Теперь учитываются 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
LDFLAGS += -Wall $(LIBRARIES)
all: change_build_mode $(TARGET)
all: change_make_options $(TARGET)
ifneq ($(mode),debug)
ifneq ($(mode),profile)
@ -43,12 +43,16 @@ endif
@echo "LDFLAGS=$(LDFLAGS)"
@echo ".........................."
OLD_BUILD_MODE=$(shell cat build_mode.out 2>/dev/null)
change_build_mode:
ifneq ($(mode), $(OLD_BUILD_MODE))
OLD_BUILD_MODE=$(shell grep ^MODE make_options.out 2>/dev/null | sed 's~^MODE=~~')
OLD_BUILD_CFLAGS=$(shell grep ^CFLAGS make_options.out 2>/dev/null | sed 's~^CFLAGS=~~')
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...
@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
%.o :
@ -57,4 +61,4 @@ endif
clean:
$(RM) *.o *.out callgrind.out.* *.gcno $(TARGET)
.PHONY: all change_build_mode clean
.PHONY: all change_make_options clean