From c374c855d461d1828059837e1ad5998aa5252257 Mon Sep 17 00:00:00 2001 From: Timo Kokkonen Date: Thu, 3 Feb 2011 22:10:15 +0200 Subject: [PATCH] Makefile: More advanced dependency tracking Inspired by: http://mad-scientist.net/make/autodep.html#norule Ensure that dependency tracking does not get confused even if some dependencies (header files for example) are renamed or deleted. Signed-off-by: Timo Kokkonen --- Makefile | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/Makefile b/Makefile index a27a3e3..01bcb60 100644 --- a/Makefile +++ b/Makefile @@ -22,6 +22,11 @@ debug-planet: $(PLANET_DEBUG_OBJS) .c.o: @echo -e "\tCC\t" $@ @$(CC) -MMD -MF .$@.d $(CFLAGS) -c $< -o $@ + @cp .$@.d .$@.P; \ + sed -e 's/#.*//' -e 's/^[^:]*: *//' -e 's/ *\\$$//' \ + -e '/^$$/ d' -e 's/$$/ :/' < .$@.d >> .$@.P; \ + mv .$@.P .$@.d + ifeq ($(C),1) sparse $(CFLAGS) $< endif @@ -32,6 +37,10 @@ endif %-debug.o: %.c @echo -e "\tCC\t" $@ @$(CC) -MMD -MF .$@.d $(CFLAGS) -DDEBUG -O0 -c $< -o $@ + @cp .$@.d .$@.P; \ + sed -e 's/#.*//' -e 's/^[^:]*: *//' -e 's/ *\\$$//' \ + -e '/^$$/ d' -e 's/$$/ :/' < .$@.d >> .$@.P; \ + mv .$@.P .$@.d TAGS: @echo -e "\tTAGS\t" -- 2.44.0