aboutsummaryrefslogtreecommitdiff
path: root/src/makefile.unix
diff options
context:
space:
mode:
authorGavin Andresen <gavinandresen@gmail.com>2011-10-05 11:28:08 -0400
committerGavin Andresen <gavinandresen@gmail.com>2011-10-05 11:28:08 -0400
commit4ffbdcc0f5a1b28092f4f45bef6ae0bbcdcefe42 (patch)
treeff4532421f42fbcf9d06d174d70414eb07f87251 /src/makefile.unix
parente9e7bb968b31cd49d1fdcb46cb1fdb6489280fe8 (diff)
Auto-build dependencies
Diffstat (limited to 'src/makefile.unix')
-rw-r--r--src/makefile.unix23
1 files changed, 18 insertions, 5 deletions
diff --git a/src/makefile.unix b/src/makefile.unix
index f9f03b3aa8..1ef7caaad7 100644
--- a/src/makefile.unix
+++ b/src/makefile.unix
@@ -101,15 +101,26 @@ OBJS= \
all: bitcoind
+# auto-generated dependencies:
+-include obj/nogui/*.P
+-include obj/test/*.P
-obj/nogui/%.o: %.cpp $(HEADERS)
- $(CXX) -c $(CXXFLAGS) -o $@ $<
+obj/nogui/%.o: %.cpp
+ $(CXX) -c $(CXXFLAGS) -MMD -o $@ $<
+ @cp $(@:%.o=%.d) $(@:%.o=%.P); \
+ sed -e 's/#.*//' -e 's/^[^:]*: *//' -e 's/ *\\$$//' \
+ -e '/^$$/ d' -e 's/$$/ :/' < $(@:%.o=%.d) >> $(@:%.o=%.P); \
+ rm -f $(@:%.o=%.d)
bitcoind: $(OBJS:obj/%=obj/nogui/%)
$(CXX) $(CXXFLAGS) -o $@ $^ $(LIBS)
-obj/test/test_bitcoin.o: $(wildcard test/*.cpp) $(HEADERS)
- $(CXX) -c $(CFLAGS) -o $@ test/test_bitcoin.cpp
+obj/test/%.o: test/%.cpp
+ $(CXX) -c $(CXXFLAGS) -MMD -o $@ $<
+ @cp $(@:%.o=%.d) $(@:%.o=%.P); \
+ sed -e 's/#.*//' -e 's/^[^:]*: *//' -e 's/ *\\$$//' \
+ -e '/^$$/ d' -e 's/$$/ :/' < $(@:%.o=%.d) >> $(@:%.o=%.P); \
+ rm -f $(@:%.o=%.d)
test_bitcoin: obj/test/test_bitcoin.o $(filter-out obj/nogui/init.o,$(OBJS:obj/%=obj/nogui/%))
$(CXX) $(CXXFLAGS) -o $@ $(LIBPATHS) $^ -Wl,-Bstatic -lboost_unit_test_framework $(LIBS)
@@ -119,4 +130,6 @@ clean:
-rm -f obj/*.o
-rm -f obj/nogui/*.o
-rm -f obj/test/*.o
- -rm -f headers.h.gch
+ -rm -f obj/*.P
+ -rm -f obj/nogui/*.P
+ -rm -f obj/test/*.P