[Top][All Lists]

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

Re: variable expansion (immediate vs deferred)

From: Paul Smith
Subject: Re: variable expansion (immediate vs deferred)
Date: Thu, 24 Jan 2008 12:39:58 -0500

On Sat, 2008-03-15 at 10:36 +0530, chandan wrote:
> In the above makefile $(LIST) appears in the prerequiste list of both
> "all" and ".PHONY" which happen to be expanded in an immediate
> context. The output shows that $(LIST) (within commands section) is
> expanded in the second phase i.e target-update phase (even though
> $(LIST) appears later in an immediate context).

Each reference to a variable is expanded separately, depending on its

When a reference to the LIST variable, $(LIST), appears in an immediate
context it's expanded immediately.

When a reference to the LIST variable appears in a deferred context,
it's not expanded at that time.

When a variable is expanded the value of the variable itself is not
changed.  Instead, the expanded value is substituted into the text, then
make parses it.

The only way the value of a variable is ever changed is by assignment.

 Paul D. Smith <address@hidden>       
 "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]