LinuxQuestions.org
Help answer threads with 0 replies.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Non-*NIX Forums > Programming
User Name
Password
Programming This forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.

Notices


Reply
  Search this Thread
Old 04-24-2006, 08:04 AM   #1
George2
Member
 
Registered: Oct 2003
Posts: 354

Rep: Reputation: 30
about immediate and deferred variable assignment in GNU make


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
 
Old 07-22-2011, 05:55 PM   #2
ccabanne
LQ Newbie
 
Registered: Jul 2011
Posts: 1

Rep: Reputation: Disabled
make immediate vs deferred variable assignment

I came here with the same question. An example or pointer to how to get a feel for how make assignment works, would be very helpful.

This was the most useful thread that I could find: http://stackoverflow.com/questions/4...ble-assignment

It seems that evaluating the value right hand side can be done at parse time, or at execution time.

Last edited by ccabanne; 07-22-2011 at 05:59 PM.
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
Which GNU Make???? munichtexan Linux - Newbie 22 11-20-2005 09:37 AM
Need help installing gnu make 3.80.0 AljoshaNL Linux - Software 0 08-19-2005 04:16 AM
Shell commands in GNU make MadCactus Programming 2 02-19-2004 04:36 AM
How to do a make? GNU Krell steve65 Linux - Software 6 10-22-2002 10:42 AM
GNU make problems MacDaddy Linux - General 9 08-26-2001 02:09 PM

LinuxQuestions.org > Forums > Non-*NIX Forums > Programming

All times are GMT -5. The time now is 12:48 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration