commit d43aa7b4720f8309080ff194bf6760844b20f730
parent ad7f692f01592e2ba1b054d032c94a6a3e7da0df
Author: Kyle Milz <krwmilz@gmail.com>
Date: Tue, 14 Sep 2021 17:57:02 +0000
use -MD for dependency generation
Instead of generating one large 'depend' file on make depend, use -MD
to always keep the dependency files up to date.
Tested working on BSD and GNU make.
Diffstat:
1 file changed, 6 insertions(+), 6 deletions(-)
diff --git a/Makefile b/Makefile
@@ -18,7 +18,7 @@ PKGS = freetype2 openssl xaw7
PKGS_CFLAGS != pkg-config --cflags ${PKGS}
PKGS_LDFLAGS != pkg-config --libs ${PKGS}
-CPPFLAGS += ${PKGS_CFLAGS}
+CPPFLAGS += -MD ${PKGS_CFLAGS}
CFLAGS += -Wall -g # -Wunused-parameter -Wshadow
LDFLAGS += -Xlinker --allow-multiple-definition -lm
@@ -29,14 +29,11 @@ default.h: wdvi.1
roff2dvi wdvi.1 > default.dvi
xxd -i default.dvi $@
-depend: ${SRCS}
- cpp ${CPPFLAGS} -M ${SRCS} > depend
-
install:
@echo "Not yet."
clean:
- rm -f ${PROG} ${PROG}.core *.o *.o.tmp
+ rm -f ${PROG} ${PROG}.core *.o *.o.tmp *.d
tags: ${SRCS}
ctags -d *.c *.h
@@ -45,4 +42,7 @@ analysis:
make clean
scan-build make
--include depend
+# BSD make does not like variable substitution in the -include
+DEPENDS = ${SRCS:.c=.d}
+
+-include ${DEPENDS}