aboutsummaryrefslogtreecommitdiffstats
path: root/test
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--test/Makefile15
1 files changed, 12 insertions, 3 deletions
diff --git a/test/Makefile b/test/Makefile
index 6dfcee98..2b8eef7b 100644
--- a/test/Makefile
+++ b/test/Makefile
@@ -8,19 +8,28 @@ zip:=$(PROJECT).rar
headers:=$(wildcard *.hpp) $(wildcard */*.hpp) $(wildcard ../src/*/*.hpp) $(wildcard ../src/*.hpp)
sources:=$(wildcard *.cpp) $(wildcard */*.cpp) $(wildcard ../src/*/*.cpp) $(wildcard ../src/*.cpp)
objects:=$(sources:.cpp=.o)
+deps:=$(sources:.cpp=.d)
-all: $(TARGET)
+all: $(deps) $(TARGET)
+
+ifneq ($(MAKECMDGOALS),clean)
+-include $(deps)
+endif
.PHONY: all clean run zip
-$(TARGET): $(objects)
+$(TARGET): $(objects) $(deps)
$(CXX) $(CXXFLAGS) $(LDFLAGS) -o $(TARGET) $(objects)
%.o: %.cpp
$(CXX) $(CXXFLAGS) -MMD -c $< -o $@
+%.d: %.cpp
+ $(CXX) $(CXXFLAGS) -MMD -E -c $< -o $(@:.d=.tmp)
+ rm $(@:.d=.tmp)
+
clean:
- -$(RM) $(TARGET) $(objects)
+ -$(RM) $(TARGET) $(objects) $(deps)
run: $(TARGET)
./$(TARGET)