help-make
[Top][All Lists]
Advanced

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

Re: about immediate and deferred variable assignment in GNU make


From: Lin George
Subject: Re: about immediate and deferred variable assignment in GNU make
Date: Wed, 26 Apr 2006 19:24:04 -0700 (PDT)

Thanks Paul,
 
 
> info is a GNU make function (introduced in GNU make 3.81).
> You can look it up in the GNU make manual.
 
I have got it from GNU make manual. I have also written a simple sample to verify this function. But it is not working. Could you have a look please?
 
a=abc
all:
        $(info $(a))
        # when replace above line to @echo $(a), it is ok. It seems that it is caused by
        # info function?
 
when I use make in Linux, the output is,
 
make: 'all' is up to date.
 
How to print the expected output "abc"?
 
> If you look up the section on "The Two Flavors of Variables" in the GNU
> make manual you'll see the definition of these phrases. These are the
> proper terms for the two types of variables.
 
I have found them. Thank you!

 
regards,
George

"Paul D. Smith" <address@hidden> wrote:
%% Lin George writes:

>> $(info B is $(B))

lg> What do you mean "info B is $(B)"?

info is a GNU make function (introduced in GNU make 3.81).
You can look it up in the GNU make manual.

>> A recursive variable (expansion is deferred) will have to be
>> expanded every time the variable is referenced. Any variables in
>> the value expand to their CURRENT values, not what they were when
>> the simple variable was assigned.

lg> I am just curious why you call a variable "recursive variable" and
lg> "simple variable".

If you look up the section on "The Two Flavors of Variables" in the GNU
make manual you'll see the definition of these phrases. These are the
proper terms for the two types of variables.

lg> I think in your context, "recursive variable" means the variables
lg> which is assigned value many times and "simple variable" means
lg> variable which is assigned value only once.

lg> Also, "referenced" mean assign a value to a variable. :-)

No. You're using "assignment" in an incorrect way.

Assignment means setting a variable to a value; these are both assigment:

FOO = foo
BAR := bar

After this assignment, FOO is a recursive variable and BAR is a simple
variable.

A reference is when a variable appears somewhere to be expanded; these
are references to variables FOO and BAR respectively:

$(FOO)
${BAR}

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


Blab-away for as little as 1ยข/min. Make PC-to-Phone Calls using Yahoo! Messenger with Voice.
reply via email to

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