( , , . ):
-include CFLAGS.save
CFLAGS := -O2 -g
all: foo
CFLAGS.save:
echo 'CFLAGS_SAVE := $(CFLAGS)' > $@
ifeq ($(CFLAGS),$(CFLAGS_SAVE))
%.o: %.c CFLAGS.save
gcc $(CFLAGS_SAVE) -c -o $@ $<
else
.PHONY: CFLAGS.save
%.o: %.c CFLAGS.save
$(MAKE) $@
endif
foo: foo.o
gcc -o $@ $^
: CFLAGS CFLAGS.save. CFLAGS CFLAGS_SAVE, . , CFLAGS.save , make . , CFLAGS , , . make . .
, CFLAGS, . , $(origin) CFLAGS, , . .
makeshould be simple. Because of this, distributors have enough problems understanding abuses on the part of tool collectors (unfortunately, most of the fault is aligned on a level automake). Please just say no to Cthulhoid build systems.
It make clean all CFLAGS='-Whatever -foo'will also work just as well.
source
share