help-make
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: VPATH/vpath and Pattern Rules


From: Paul Smith
Subject: Re: VPATH/vpath and Pattern Rules
Date: Sat, 14 Jan 2012 11:30:48 -0500

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 <address@hidden>          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




reply via email to

[Prev in Thread] Current Thread [Next in Thread]