summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--Makefile9
1 files changed, 7 insertions, 2 deletions
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)