bugmake - Bugs: bug #11913, definition of target specific...

 
 

bug #11913: definition of target specific variable doesnt use correct variable set

Submitted by:  None
Submitted on:  Thu 10 Feb 2005 12:38:05 AM UTC  
 
Severity: 3 - NormalItem Group: Bug
Status: FixedPrivacy: Public
Assigned to: Paul D. Smith <psmith>Open/Closed: Closed
Component Version: 3.80Operating System: Any
Fixed Release: 3.81Triage Status: None

Add a New Comment(Rich Markup)
   

You are not logged in

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

 

Thu 09 Jun 2005 07:20:22 PM UTC, comment #2:

OK, I committed a fix for this bug. It will be in the next release of GNU make.
Thanks!

Paul D. Smith <psmith>
Project AdministratorIn charge of this item.
Sat 21 May 2005 02:55:28 PM UTC, comment #1:

Hm. The latest CVS code gives an even more strange result:

Makefile:7: e = E1
Makefile:25: Test run of foreach: e = e2
Makefile:25: Test run of foreach: e = e3
Makefile:26: Inside function mkRuleForE: e = e2
Makefile:26: Inside function mkRuleForE: e = e3
Making target e2Target //e = E3
Making target e3Target //e = E3
Making target E1Target //e = E1

I see the problem in the code. Fixing it will be interesting. I'll try to look at it this weekend.

Paul D. Smith <psmith>
Project AdministratorIn charge of this item.
Thu 10 Feb 2005 12:38:05 AM UTC, original submission:

When processing 'target: var := varvalue', make380/381b doesnt use the "current" variable set while computing var's new value. E.g. take '$(e)target: e := $(e)', then the 1st $(e) uses the current variable set, but the 2nd $(e) may take a wrong one.
#------sample makefile-----------
.PHONY: all

all: ;

e := E1

$(warning e = $(e))
.PHONY: $(e)Target
all: $(e)Target
$(e)Target: e := $(e)
$(e)Target: ; @echo Making target $@ //"e" = "$(e)"

e := E2

define mkRuleForE
$(warning Inside function mkRuleForE: e = $(e))
.PHONY: $(e)Target
all: $(e)Target
$(e)Target: e := $(e)
$(e)Target: ; @echo Making target $@ //"e" = "$(e)"
endef

e := E3

$(foreach e,e2 e3,$(warning Test run of foreach: e = $(e)))
$(foreach e,e2 e3,$(eval $(value mkRuleForE)))

e := E4
#------sample makefile-end----------

Running make should now result in ...

Making target E1Target //e = E1
Making target e2Target //e = e2
Making target e3Target //e = e3

... but the actual result with all my 380|381beta1 is ...

Making target E1Target //e = E1
Making target e2Target //e = E3
Making target e3Target //e = E3

Workaround, e.g. inside the above makfile: make sure to use only global variables inside such definitions of target specific variable =>

define mkRuleForE
e := $x
# Assign from local var 'x' to global var 'e'.
# Now only use global var:
$(e)Target: e := $(e)
endef
....
$(foreach x,e2 e3,$(eval $(value mkRuleForE)))

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 7 latest changes.

Date Changed By Updated Field Previous Value => Replaced By
Sat 01 Apr 2006 07:13:08 AM UTCpsmithFixed Release4.0=>3.81
Thu 09 Jun 2005 07:20:22 PM UTCpsmithStatusNone=>Fixed
  Assigned toNone=>psmith
  Open/ClosedOpen=>Closed
  Component VersionNone=>3.80
  Operating SystemNone=>Any
  Fixed ReleaseNone=>4.0

Back to the top


Powered by Savane 3.1-cleanup1