On Sat, 2012-01-14 at 16:20 +0100, Michael Ludwig wrote:
> Now that's useful! Will keep this snippet handy from now on:
> 
>       @echo ==   $$@ $@
>       @echo ==   $$%% $%
>       @echo ==   $$^< $<
>       @echo ==   $$? $?
>       @echo ==   $$^^ $^
>       @echo ==   $$+ $+
>       @echo ==   $$^| $|
>       @echo ==   $$* $*
> 
> Can I define it as a function? To invoke it like: $(echoautovars)

Sure, but you really should quote these to protect them from the shell:

        define echoautovars
        echo ==   '$$@ $@'
        echo ==   '$$%% $%'
        echo ==   '$$^< $<'
        echo ==   '$$? $?'
        echo ==   '$$^^ $^'
        echo ==   '$$+ $+'
        echo ==   '$$^| $|'
        echo ==   '$$* $*'
        endef
        
        foo:
                @$(echoautovars)

-- 
-------------------------------------------------------------------------------
 Paul D. Smith <psm...@gnu.org>          Find some GNU make tips at:
 http://www.gnu.org                      http://make.mad-scientist.net
 "Please remain calm...I may be mad, but I am a professional." --Mad Scientist


_______________________________________________
Help-make mailing list
Help-make@gnu.org
https://lists.gnu.org/mailman/listinfo/help-make

Reply via email to