From 147cb7f0e67d1f3c3274effa5476607e24664182 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Karel=20Ko=C4=8D=C3=AD?= Date: Mon, 21 Mar 2016 17:21:57 +0100 Subject: Small updates in makefile depedencies --- Makefile | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) (limited to 'Makefile') diff --git a/Makefile b/Makefile index 4f8da62..c17404b 100644 --- a/Makefile +++ b/Makefile @@ -46,6 +46,7 @@ CFLAGS = $(shell echo $(CONFCFLAGS)) $(shell echo -DF_CPU=$(F_CPU)000L) \ -mmcu=$(MMCU) -Iinclude -imacros $(O)/build/config.h GCC = $(GNUTOOLCHAIN_PREFIX)gcc AR = $(GNUTOOLCHAIN_PREFIX)ar +CPP = $(GNUTOOLCHAIN_PREFIX)cpp $(O)/libioe.a: $(OBJ) @echo " AR $@" @@ -56,17 +57,15 @@ $(OBJ): $(O)/build/%.o: src/%.c @echo " CC $@" $(Q)$(GCC) $(CFLAGS) -c -o $@ $< -$(DEP): $(O)/build/%.d: src/%.c +$(DEP): $(O)/build/%.d: src/%.c $(O)/build/config.h $(Q)mkdir -p "$(@D)" @echo " DEP $@" - $(Q)$(GCC) -MM -MG -MT '$*.o $@' $(CFLAGS) -c -o $@ $< + $(Q)$(CPP) -MM -MG -MT '$(O)/build/$*.o $@' $(CFLAGS) -o $@ $< $(O)/build/config.h: $(CONFIG) $(Q)mkdir -p "$(@D)" @echo " GEN $@" - $(Q)grep -v "^#" $(CONFIG) | grep "CONFIG_" | sed 's/="\(.*\)"/=\1/;s/=/ /;s/^/#define /' > $@ -# This is not optimal because configuration change results to complete project -# rebuild instead of only rebuilding required files. + $(Q)grep -v "^#" $(CONFIG) | grep "CONFIG_" | sed -e 's/="\(.*\)"/=\1/;s/=/ /;s/^/#define /' > $@ else $(O)/libioe.a: -- cgit v1.2.3