From 4ffbdcc0f5a1b28092f4f45bef6ae0bbcdcefe42 Mon Sep 17 00:00:00 2001 From: Gavin Andresen Date: Wed, 5 Oct 2011 11:28:08 -0400 Subject: Auto-build dependencies --- src/makefile.unix | 23 ++++++++++++++++++----- 1 file 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 -- cgit v1.2.3