Use GCC to generate dependency files.
Signed-off-by: Blue Swirl blauwirbel@gmail.com --- Makefile.target | 9 ++++++++- config/xml/rules.xml | 8 ++++---- 2 files changed, 12 insertions(+), 5 deletions(-)
diff --git a/Makefile.target b/Makefile.target index fd46e09..9ae8120 100644 --- a/Makefile.target +++ b/Makefile.target @@ -14,6 +14,8 @@ HOSTCFLAGS+= -Wall -Wredundant-decls -Wshadow -Wpointer-arith HOSTCFLAGS+= -Wstrict-prototypes -Wmissing-declarations -Wundef -Wendif-labels HOSTCFLAGS+= -Wstrict-aliasing -Wwrite-strings -Wmissing-prototypes -Wnested-externs HOSTCFLAGS+= -W +# Flags for dependency generation +HOSTCFLAGS+= -MMD -MP -MT $@ -MF '$(*D)/$(*F).d' HOSTINCLUDES := -I$(SRCDIR)/include -I$(SRCDIR)/kernel -I$(SRCDIR)/kernel/include -I$(ODIR)/target/include
CC := $(TARGET)gcc @@ -29,6 +31,8 @@ CFLAGS+= -Wall -Wredundant-decls -Wshadow -Wpointer-arith CFLAGS+= -Wstrict-prototypes -Wmissing-declarations -Wundef -Wendif-labels CFLAGS+= -Wstrict-aliasing -Wwrite-strings -Wmissing-prototypes -Wnested-externs CFLAGS+= -Werror +# Flags for dependency generation +CFLAGS+= -MMD -MP -MT $@ -MF '$(*D)/$(*F).d' INCLUDES := -I$(SRCDIR)/include -I$(SRCDIR)/kernel/include -I$(ODIR)/target/include AS_FLAGS+= -g
@@ -63,7 +67,7 @@ clean: @printf "Cleaning up for $(ARCH)..." @rm -rf forth.dict.core forthstrap *.dict openbios-* @rm -f $(ODIR)/target/include/openbios-version.h $(ODIR)/forth/version.fs - @find . -type f ( -name "*~" -o -name '*.o' -o -name '*.a' ) -exec rm {} ; + @find . -type f ( -name "*~" -o -name '*.o' -o -name '*.d' -o -name '*.a' ) -exec rm {} ; @echo " ok"
build-verbose: info build @@ -71,3 +75,6 @@ build-verbose: info build build: all
include rules.mak + +# Include automatically generated dependency files +-include $(wildcard $(ODIR)/host/kernel/*.d $(ODIR)/target/*/*.d $(ODIR)/target/*/*/*.d $(ODIR)/target/*/*/*/*.d) diff --git a/config/xml/rules.xml b/config/xml/rules.xml index 9764298..86a3b6b 100644 --- a/config/xml/rules.xml +++ b/config/xml/rules.xml @@ -4,11 +4,11 @@ $(call quiet-command,$(HOSTCC) $(HOSTCFLAGS) -o $@ $^," HOSTCC $(TARGET_DIR)$@") </rule> <rule target="host" entity="object"> - $(call quiet-command,$(HOSTCC) $(HOSTCFLAGS) $(HOSTINCLUDES) -c -o $@ $^," HOSTCC $(TARGET_DIR)$@") + $(call quiet-command,$(HOSTCC) $(HOSTCFLAGS) $(HOSTINCLUDES) -c -o $@ $<," HOSTCC $(TARGET_DIR)$@") </rule> <rule target="host" entity="object" extracflags="1"> $(call quiet-command,$(HOSTCC) $(HOSTCFLAGS) $(HOSTINCLUDES)</rule> -<rule target="host" entity="object" extracflags="2"> -c -o $@ $^," HOSTCC $(TARGET_DIR)$@") +<rule target="host" entity="object" extracflags="2"> -c -o $@ $<," HOSTCC $(TARGET_DIR)$@") </rule> <rule target="host" entity="library"> $(call quiet--command,$(AR) cru $@ $^; $(RANLIB) $@," HOSTAR $(TARGET_DIR)$@") @@ -19,11 +19,11 @@ $(call quiet-command,$(CC) $(CFLAGS) -o $@ $^," CC $(TARGET_DIR)$@") </rule> <rule target="target" entity="object"> - $(call quiet-command,$(CC) $$EXTRACFLAGS $(CFLAGS) $(INCLUDES) -c -o $@ $^," CC $(TARGET_DIR)$@") + $(call quiet-command,$(CC) $$EXTRACFLAGS $(CFLAGS) $(INCLUDES) -c -o $@ $<," CC $(TARGET_DIR)$@") </rule> <rule target="target" entity="object" extracflags="1"> $(call quiet-command,$(CC) $$EXTRACFLAGS $(CFLAGS) $(INCLUDES)</rule> -<rule target="target" entity="object" extracflags="2"> -c -o $@ $^," CC $(TARGET_DIR)$@") +<rule target="target" entity="object" extracflags="2"> -c -o $@ $<," CC $(TARGET_DIR)$@") </rule> <rule target="target" entity="library"> $(call quiet-command,$(AR) cru $@ $^; $(RANLIB) $@," AR $(TARGET_DIR)$@")
Am 13.11.2010 um 16:05 schrieb Blue Swirl:
Use GCC to generate dependency files.
Signed-off-by: Blue Swirl blauwirbel@gmail.com
These patches arrived utterly broken - linewrapped, and I guess the < should a less-than. I tried manually fixing this one without luck so far (applies now but doesn't work). Could you push this somewhere for testing please?
Thanks, Andreas
Am 13.11.2010 um 22:42 schrieb Andreas Färber:
Am 13.11.2010 um 16:05 schrieb Blue Swirl:
Use GCC to generate dependency files.
Signed-off-by: Blue Swirl blauwirbel@gmail.com
These patches arrived utterly broken - linewrapped, and I guess the < should a less-than.
Scratch my comment on the < - it's confusing that it's not a Makefile but an XML file generating the Makefile.
I tried manually fixing this one without luck so far (applies now but doesn't work). Could you push this somewhere for testing please?
I didn't catch the trailing linewrapped include in Makefile.target. Builds okay now!
Tested-by: Andreas Färber andreas.faerber@web.de
Andreas