Auto-build dependencies

This commit is contained in:
Gavin Andresen 2011-10-05 11:28:08 -04:00
parent e9e7bb968b
commit 4ffbdcc0f5
1 changed files with 18 additions and 5 deletions

View File

@ -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