bugmake - Bugs: bug #850, Sub-make doesn't expand exported...

 
 

bug #850: Sub-make doesn't expand exported variable correctly

Submitted by:  None
Submitted on:  Mon 15 Jul 2002 08:52:14 AM UTC  
 
Severity: 3 - NormalItem Group: None
Status: Not A BugPrivacy: Public
Assigned to: Paul D. Smith <psmith>Open/Closed: Closed
Component Version: 3.79.1Operating System: None
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.

 

Tue 30 Jul 2002 04:01:46 PM UTC, comment #3:

> It seems that Make forgets to expand the variable in
> sub-make.


No.

When make puts variables into the environment to export to subcommands, of course it will expand the values of those variables before placing them into the environment! It wouldn't make sense for it to not expand them; otherwise you'd get this behavior:

FOO = foo
BAR = $(FOO)
export FOO BAR
all: ; @echo $$BAR

$ make
$(FOO)

instead of the expected output "foo".

From your example it's not clear what you're really trying to do, but maybe you could use dynamic variable names, like this:

$ cat Makefile
a = 1
b = a
export a b
all: ; $(MAKE) -C 1

$ cat 1/Makefile
a = 2
all: ; @echo $($(b))

Paul D. Smith <psmith>
Project AdministratorIn charge of this item.
Tue 30 Jul 2002 04:00:56 PM UTC, comment #2:

> It seems that Make forgets to expand the variable in
> sub-make.


No.

When make puts variables into the environment to export to subcommands, of course it will expand the values of those variables before placing them into the environment! It wouldn't make sense for it to not expand them; otherwise you'd get this behavior:

FOO = foo
BAR = $(FOO)
export FOO BAR
all: ; @echo $$BAR

$ make
$(FOO)

instead of the expected output "foo".

From your example it's not clear what you're really trying to do, but maybe you could use dynamic variable names, like this:

$ cat Makefile
a = 1
b = a
export a b
all: ; $(MAKE) -C 1

$ cat 1/Makefile
a = 2
all: ; @echo $($(b))

Paul D. Smith <psmith>
Project AdministratorIn charge of this item.
Mon 29 Jul 2002 02:59:02 PM UTC, comment #1:

> It seems that Make forgets to expand the variable in
> sub-make.


No.

When make puts variables into the environment to export to subcommands, of course it will expand the values of those variables before placing them into the environment! It wouldn't make sense for it to not expand them; otherwise you'd get this behavior:

FOO = foo
BAR = $(FOO)
export FOO BAR
all: ; @echo $$BAR

$ make
$(FOO)

instead of the expected output "foo".

From your example it's not clear what you're really trying to do, but maybe you could use dynamic variable names, like this:

$ cat Makefile
a = 1
b = a
export a b
all: ; $(MAKE) -C 1

$ cat 1/Makefile
a = 2
all: ; @echo $($(b))

Paul D. Smith <psmith>
Project AdministratorIn charge of this item.
Mon 15 Jul 2002 08:52:14 AM UTC, original submission:

Assume there are 2 Makefiles ./Makefile and ./1/Makefile
in ./Makefile
=================================
a = 1
b = $(a)
export a b
all:
$(MAKE) -C 1
==================================
in ./1/Makefile
==================================
a = 2
all:
echo $(b)
===================================
Here $(b) should equal to 2 rather than 1.
It seems that Make forgets to expand the variable in sub-make.

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

Date Changed By Updated Field Previous Value => Replaced By
Tue 30 Jul 2002 04:01:46 PM UTCpsmithClosed onTue 30 Jul 2002 04:00:56 PM UTC=>-
Tue 30 Jul 2002 04:00:56 PM UTCpsmithClosed onMon 29 Jul 2002 02:59:02 PM UTC=>-
Mon 29 Jul 2002 02:59:02 PM UTCpsmithStatusNone=>(Error - Not Found)
  Assigned toNone=>NA
  Open/ClosedOpen=>(Error - Not Found)
  Closed on-=>-

Back to the top


Powered by Savane 3.1-cleanup1