help-make
[Top][All Lists]
Advanced

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

Re: Multiple expansion works in rules, but not in actions


From: Stephan Beal
Subject: Re: Multiple expansion works in rules, but not in actions
Date: Mon, 29 Oct 2007 20:09:47 +0100

On 10/29/07, Alexander Kriegisch <address@hidden> wrote:
FOO:=bla

$(FOO):
        @echo "## $(FOO) ##"

FOO:=

The target name $(FOO) is expanded to "bla", but $(FOO) is expanded to
nothing inside the action. I studied the manual of GNU make 3.81, but
found no explanation for this effect. Can you point me to the section I
should read in order to unserstand how changing values affect actions?


Hi, Alexander! This isn't a bug, but a misunderstanding. The evaluation is happing in this order:

FOO:=blah
blah:
   <blah's rules>
FOO:=

the blah target is then run AFTER the second assignment. At that point, blah's rules evaluate $(FOO) as an empty value. Target names are evaluated as early as possible (they must be, or else different targets would be dynamically created every time $(FOO) changes values). The text of target rules is evaluated at the time it is run, though.


--
----- stephan beal
http://wanderinghorse.net/home/stephan/
reply via email to

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