Just notice how confused I am - let it be a testmake file:
$(eval $(info A: CFLAGS here is $(CFLAGS))) override CFLAGS += -B $(eval $(info B: CFLAGS here is $(CFLAGS))) CFLAGS += -C $(eval $(info C: CFLAGS here is $(CFLAGS))) override CFLAGS += -D $(eval $(info D: CFLAGS here is $(CFLAGS))) CFLAGS += -E $(eval $(info E: CFLAGS here is $(CFLAGS)))
Then:
$ make -f testmake A: CFLAGS here is B: CFLAGS here is -B C: CFLAGS here is -B D: CFLAGS here is -B -D E: CFLAGS here is -B -D make: *** No targets. Stop. $ make -f testmake CFLAGS+=-g A: CFLAGS here is -g B: CFLAGS here is -g -B C: CFLAGS here is -g -B D: CFLAGS here is -g -B -D E: CFLAGS here is -g -B -D make: *** No targets. Stop.
With override directives removed from the testmake file:
$ make -f testmake A: CFLAGS here is B: CFLAGS here is -B C: CFLAGS here is -B -C D: CFLAGS here is -B -C -D E: CFLAGS here is -B -C -D -E make: *** No targets. Stop. $ make -f testmake CFLAGS+=-g A: CFLAGS here is -g B: CFLAGS here is -g C: CFLAGS here is -g D: CFLAGS here is -g E: CFLAGS here is -g make: *** No targets. Stop.
So,
- If a variable is used by
override once, it can only be added using another statement using override (normal assignments will be ignored); - when there was no
override ; trying to add (as in += ) from the command line, overwrites each instance of this variable.
sdaau Apr 17 '13 at 4:06 on 2013-04-17 04:06
source share