]> git.itanic.dy.fi Git - sdl-planets/blobdiff - Makefile
Makefile: More advanced dependency tracking
[sdl-planets] / Makefile
index a27a3e34871eb7c61805b2da7a90c934807552c8..01bcb604e540b4286bf4248ddb5d6f297ae7f16d 100644 (file)
--- 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"