aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAlexander Sulfrian <alexander@sulfrian.net>2010-01-04 23:45:00 +0100
committerAlexander Sulfrian <alexander@sulfrian.net>2013-01-05 17:17:43 +0100
commit15648f10d8f75d81c676bb73e4f63031896e79c7 (patch)
tree959d92545276d6fdb783183453ac9742f788ecf0
parent9934c444bda05d32f6c5e03895ecbfb4f0532df1 (diff)
downloadusdx-15648f10d8f75d81c676bb73e4f63031896e79c7.tar.gz
usdx-15648f10d8f75d81c676bb73e4f63031896e79c7.tar.xz
usdx-15648f10d8f75d81c676bb73e4f63031896e79c7.zip
added dep-calculation to rebuild objectfile, if header changed
-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)