diff --git a/c/tex_parser/Makefile b/c/tex_parser/Makefile index 4d1f6a5..1ef12e6 100644 --- a/c/tex_parser/Makefile +++ b/c/tex_parser/Makefile @@ -16,6 +16,7 @@ TARGET=tex_parser_test ifeq ($(mode),) mode = debug endif + ifeq ($(mode),debug) CFLAGS = -O0 -g -std=gnu99 -pedantic -Wextra -Wconversion LDFLAGS = @@ -36,7 +37,7 @@ endif CFLAGS += -Wall LDFLAGS += -Wall $(LIBRARIES) -all: $(TARGET) +all: change_build_mode $(TARGET) ifneq ($(mode),debug) ifneq ($(mode),profile) @@ -55,13 +56,21 @@ endif @echo "LDFLAGS=$(LDFLAGS)" @echo ".........................." +OLD_BUILD_MODE=$(shell cat build_mode.out 2>/dev/null) +change_build_mode: +ifneq ($(mode), $(OLD_BUILD_MODE)) + @echo CLEANING... + @make clean &>/dev/null + @echo $(mode) > build_mode.out +endif + %.o : $(CC) -c $(CFLAGS) $(INCLUDE) -o $@ $< clean: $(RM) *.o *.out callgrind.out.* *.gcno $(TARGET) -.PHONY: all clean +.PHONY: all change_build_mode clean #_________________________________ # R U L E S |