bugmake - Bugs: bug #6091, target variable assignment do not...

 
 

bug #6091: target variable assignment do not variable flavor

Submitted by:  None
Submitted on:  Tue 21 Oct 2003 12:25:58 PM UTC  
 
Severity: 3 - NormalItem Group: Bug
Status: Not A BugPrivacy: Public
Assigned to: NoneOpen/Closed: Closed
Component Version: 3.80Operating System: POSIX-Based
Fixed Release: NoneTriage Status: None

Add a New Comment(Rich Markup)
   

You are not logged in

Please log in, so followups can be emailed to you.

 

Mon 29 Nov 2004 03:00:10 PM UTC, comment #2:

Gak. The output in my comment below has no relationship to the makefile I show :-/. The current, "right" output for the makefile below is:

FOO = foo baz
FOO = foo

The output as it would be with the change you suggest would be:

FOO = bar baz
FOO = foo

because the value of FOO for "first" would be expanded immediately and wouldn't take into account the value inherited from the parent target.

Anyway, without any followup I'm closing this. Please add notes if you think make should work differently given this information.

Paul D. Smith <psmith>
Project Administrator
Wed 07 Jan 2004 11:49:07 PM UTC, comment #1:

Hmm. This is kind of gross. Either way this works it will surprise someone. For example, if the change is made to expand simple variables immediately, then various types of prerequisite inheritence will no longer work correctly (or at least not the way the user would expect). It doesn't appear possible to make it work properly in all cases so we may just have to pick the lesser evil. As an example, something like this:

FOO := bar

last : FOO = foo
first : FOO += baz

last : first
last first : ; @echo FOO = $(FOO)

FOO := biz

Right now this does the "right" thing when you "make last":

FOO = good baz
FOO = good

because when you make "last" the value of "first"'s FOO takes precedence over the master FOO. If we made the change you suggest, the result would be:

FOO = y baz
FOO = good

because the value of FOO for the "last" target would be expanded when the makefile is parsed, and so no inheritance would have occurred at that time.

Hmm hmm.

Paul D. Smith <psmith>
Project Administrator
Tue 21 Oct 2003 12:25:58 PM UTC, original submission:

While simply expanded variables are instantiated imediately for regular dependency statements, for target variables using +=, the expansion of simply expanded variables is delayed, even when all variables involved are simply expanded. The following demonstrates:

x:
y:

FOO:=x
BAR:=

one:
@echo "1. FOO is ${BAR}"
@echo "1. FOO is $<"
two:
@echo "2. FOO is ${BAR}"
@echo "2. FOO is $<"
three:
@echo "3. FOO is ${BAR}"
@echo "3. FOO is $<"

one: ${FOO}
one: BAR:=${FOO}
two: ${FOO}
two: BAR+=${FOO}
three: ${FOO}
three: BAR:=${BAR} ${FOO}

FOO:=y

The output demonstrates that FOO is having its expansion delayed.

> gmake -f make.bug one two three

1. FOO is x
1. FOO is x
2. FOO is y
2. FOO is x
3. FOO is x
3. FOO is x

Anonymous

 

(Note: upload size limit is set to 16384 kB, after insertion of the required escape characters.)

Attach File(s):
   
   
Comment:
   

No files currently attached

 

Depends on the following items: None found

Items that depend on this one: None found

 

CC list is empty

 

Do you think this task is very important?
If so, you can click here to add your encouragement to it.
This task has 0 encouragements so far.

Only logged-in users can vote.

 

Please enter the title of George Orwell's famous dystopian book (it's a date):

 

 

Follow 4 latest changes.

Date Changed By Updated Field Previous Value => Replaced By
Mon 29 Nov 2004 03:00:10 PM UTCpsmithStatusNone=>Not A Bug
  Assigned topsmith=>None
  Open/ClosedOpen=>Closed
Wed 07 Jan 2004 11:49:07 PM UTCpsmithAssigned toNone=>psmith

Back to the top


Powered by Savane 3.1-cleanup1