Теперь учитываются CFLAGS и LDFLAGS при определении необходимости автоматического выполнения make clean

This commit is contained in:
Kolan Sh 2011-07-09 21:07:06 +04:00
parent 9369a6ab1a
commit ab7bf723c1
1 changed files with 10 additions and 6 deletions

View File

@ -24,7 +24,7 @@ endif
CFLAGS += -Wall CFLAGS += -Wall
LDFLAGS += -Wall $(LIBRARIES) LDFLAGS += -Wall $(LIBRARIES)
all: change_build_mode $(TARGET) all: change_make_options $(TARGET)
ifneq ($(mode),debug) ifneq ($(mode),debug)
ifneq ($(mode),profile) ifneq ($(mode),profile)
@ -43,12 +43,16 @@ endif
@echo "LDFLAGS=$(LDFLAGS)" @echo "LDFLAGS=$(LDFLAGS)"
@echo ".........................." @echo ".........................."
OLD_BUILD_MODE=$(shell cat build_mode.out 2>/dev/null) OLD_BUILD_MODE=$(shell grep ^MODE make_options.out 2>/dev/null | sed 's~^MODE=~~')
change_build_mode: OLD_BUILD_CFLAGS=$(shell grep ^CFLAGS make_options.out 2>/dev/null | sed 's~^CFLAGS=~~')
ifneq ($(mode), $(OLD_BUILD_MODE)) OLD_BUILD_LDFLAGS=$(shell grep ^LDFLAGS make_options.out 2>/dev/null | sed 's~^LDFLAGS=~~')
change_make_options:
ifneq ($(mode)|$(CFLAGS)|$(LDFLAGS), $(OLD_BUILD_MODE)|$(OLD_BUILD_CFLAGS)|$(OLD_BUILD_LDFLAGS))
@echo CLEANING... @echo CLEANING...
@make clean &>/dev/null @make clean &>/dev/null
@echo $(mode) > build_mode.out @echo MODE=$(mode) > make_options.out
@echo CFLAGS=$(CFLAGS) >> make_options.out
@echo LDFLAGS=$(LDFLAGS) >> make_options.out
endif endif
%.o : %.o :
@ -57,4 +61,4 @@ endif
clean: clean:
$(RM) *.o *.out callgrind.out.* *.gcno $(TARGET) $(RM) *.o *.out callgrind.out.* *.gcno $(TARGET)
.PHONY: all change_build_mode clean .PHONY: all change_make_options clean