help-make
[Top][All Lists]
Advanced

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

about immediate and deferred variable assignment in GNU make


From: Lin George
Subject: about immediate and deferred variable assignment in GNU make
Date: Wed, 26 Apr 2006 07:01:28 -0700 (PDT)

Hello everyone,


I have a question about immediate and deferred variable assignment in GNU make. In GNU make manual, it is said,

http://www.gnu.org/software/make/manual/make.html

--------------------
It's important to understand this two-phase approach because it has a direct impact on how variable and function expansion happens; this is often a source of some confusion when writing makefiles. Here we will present a summary of the phases in which expansion happens for different constructs within the makefile. We say that expansion is immediate if it happens during the first phase: in this case make will expand any variables or functions in that section of a construct as the makefile is parsed. We say that expansion is deferred if expansion is not performed immediately. Expansion of deferred construct is not performed until either the construct appears later in an immediate context, or until the second phase.

You may not be familiar with some of these constructs yet. You can reference this section as you become familiar with them, in later chapters.

Variable Assignment
Variable definitions are parsed as follows:

immediate = deferred
immediate ?= deferred
immediate := immediate
immediate += deferred or immediate

define immediate
deferred
endef
--------------------

After reading the above statement several times, I am still confused about what mean immediate assignment and what means deferred assignment. Could anyone show me an example please?

What are the advantages (dis-advantages) of immediate (deferred) assignment?


thanks in advance,
George


Yahoo! Messenger with Voice. PC-to-Phone calls for ridiculously low rates.
reply via email to

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