aboutsummaryrefslogtreecommitdiff
path: root/src/makefile.unix
diff options
context:
space:
mode:
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