List Info

Thread: target-specific variable behavior




target-specific variable behavior
user name
2006-11-30 20:53:08
could someone please explain as to why this is the behavior
of
target-specific variable?
the output that I'm expecting is

[expected output]
target1, bar1 bar2
target2, bar1

but this is what i got instead

[real output]
target1, bar1 bar2
target2,


[makefile]
foo := bar1

all : target1 target2

target1 : foo += bar2
target1 :
	echo target1, $(foo)

target2 : foo += 
target2 :
	echo target2, $(foo)

_______________________________________________
help-gnu-utils mailing list
help-gnu-utilsgnu.org

http://lists.gnu.org/mailman/listinfo/help-gnu-utils
target-specific variable behavior
user name
2006-11-30 22:11:21
I guess I'm talking to myself here...

I discovered that by modifying the line
        target2 : foo +=
to
        target2 : foo += ''
I get the right results.  I guess it's a side-effect of how
make parses
a variable when it's part of a rule.

_______________________________________________
help-gnu-utils mailing list
help-gnu-utilsgnu.org

http://lists.gnu.org/mailman/listinfo/help-gnu-utils
[1-2]

about | contact  Other archives ( Real Estate discussion Medical topics )