aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAlexis Lockwood2021-06-27 14:53:41 -0400
committerAlexis Lockwood2021-06-27 14:53:41 -0400
commitdb769f30cb388aaeec2cd3187290618f4f2666a4 (patch)
tree9b00afe240eedce05e27f9b8426d8ec8f99e0d23
parentbffd6240c10736aa44e8f553b5ff65876748b7fc (diff)
Build .d files
-rw-r--r--.gitignore1
-rw-r--r--Makefile6
2 files changed, 7 insertions, 0 deletions
diff --git a/.gitignore b/.gitignore
index dc4d1c2..ef3516e 100644
--- a/.gitignore
+++ b/.gitignore
@@ -1,4 +1,5 @@
*.o
*.a
+*.d
*.test
ls_run
diff --git a/Makefile b/Makefile
index d7665b5..fd930af 100644
--- a/Makefile
+++ b/Makefile
@@ -19,6 +19,8 @@ CFLAGS += \
all: ls_run
+include ${LS_SOURCES:.c=.d}
+
munit/munit.o: CFLAGS := $(filter-out -Wconversion -Wshadow, ${CFLAGS})
ls_run: ls_run.c src/libls.a
@@ -46,6 +48,10 @@ src/libls.a: ${LS_SOURCES:.c=.o}
clean:
${RM} -f ${LS_SOURCES:.c=.o}
+ ${RM} -f ${LS_SOURCES:.c=.d}
${RM} -f src/libls.a
${RM} -f munit/libmunit.a munit/munit.o
${RM} -f ${TESTS}
+
+%.d: %.c
+ @$(CC) -MM $(CFLAGS) $< > $@ && sed -e '/^\S/ s,^,$@ src/,' -i $@