help-make
[Top][All Lists]
Advanced

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

Re: Assigning $@ to target-specific variable


From: John Graham-Cumming
Subject: Re: Assigning $@ to target-specific variable
Date: Thu, 23 Feb 2006 13:10:33 +0100
User-agent: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.6) Gecko/20040208 Thunderbird/0.5 Mnenhy/0.6.0.104

Ryan Berdeen wrote:
I've just started using GNU make (3.80), and I'm confused why the following doesn't work:

$(TARGETS): target := $@

The target variable remains empty.

That's happening because you used := which means that the variable 'target' is getting fully evaluated when it is defined. At that moment $@ is not defined and hence 'target' is empty.

If you changed the line to:

    $(TARGETS) : target = $@

then it would work.

Here's a simple example:

    all: i_am = $@
    all: ; @echo I am $(i_am)

which will output:

    I am all

John.
--
John Graham-Cumming
address@hidden

Home: http://www.jgc.org/
Blog: http://www.jgc.org/blog/

POPFile: http://getpopfile.org/
GNU Make Standard Library: http://gmsl.sf.net/
GNU Make Debugger: http://gmd.sf.net/
Fast, Parallel Builds: http://www.electric-cloud.com/

Sign up for my Spam and Anti-spam Newsletter
at http://www.jgc.org/




reply via email to

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