Is this expected behavior?

$ cat makefile1
override CFLAGS+=-DB

$(info makefile1: CFLAGS=$(CFLAGS))

all:
        make -f makefile2
$ cat makefile2

$(info makefile2: CFLAGS=$(CFLAGS))

override CFLAGS+=-DC

$(info makefile2: CFLAGS=$(CFLAGS))

all:
        @echo foo
$ make -f makefile1 CFLAGS=-DA
makefile1: CFLAGS=-DA -DB
make -f makefile2
makefile2: CFLAGS=-DA
makefile2: CFLAGS=-DA -DC
foo
$


So why isn't the CFLAGS that gets passed to the submake set to "-DA -DB"?

This is less than intuitive: it's not *really* overriding if it's only 
semi-persistent.

What's even more confusing is that make apparently keeps two copies...  the one 
that's in-scope for the current make, and the one that gets re-exported into 
sub-makes.

I couldn't find in the documentation where this behavior gets called out.

-Philip



_______________________________________________
Bug-make mailing list
Bug-make@gnu.org
http://lists.gnu.org/mailman/listinfo/bug-make

Reply via email to