From e43c5e6f856ad583579384e1f9509f66e3e0537e Mon Sep 17 00:00:00 2001 From: Bent Bisballe Nyeng Date: Sun, 20 Jun 2021 14:24:39 +0200 Subject: Add build deps to Makefile. --- Makefile | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) (limited to 'Makefile') diff --git a/Makefile b/Makefile index 9b7e035..4b43083 100644 --- a/Makefile +++ b/Makefile @@ -11,10 +11,15 @@ SRC = \ OBJ = $(patsubst %.cc,%.o,$(SRC)) +DEPFILES := $(patsubst %.cc,%.d,$(SRC)) +$(DEPFILES): + +include $(wildcard $(DEPFILES)) + CXXFLAGS = -g -O3 -std=c++17 -I. %.o: %.cc - g++ $(CXXFLAGS) -c $< -o $@ + g++ -MMD $(CXXFLAGS) -c $< -o $@ libcppbuild.a: $(OBJ) ar rcs $@ $(OBJ) @@ -23,4 +28,4 @@ cppbuild: cppbuild.cc subdir/cppbuild.cc libcppbuild.a g++ $(CXXFLAGS) -pthread cppbuild.cc subdir/cppbuild.cc libcppbuild.a -o $@ clean: - rm -f libcppbuild.a $(OBJ) cppbuild + rm -f libcppbuild.a $(OBJ) cppbuild $(DEPFILES) -- cgit v1.2.3