Fix build.h dependencies

For Qt builds, the build.h file is moved to build/build.h. For regular
builds, it is moved to obj/build.h. This allows the Qt build to be done
in a different directory than the source, and without interfering with
other builds.
This commit is contained in:
Pieter Wuille 2012-04-11 03:51:08 +02:00
parent 5d464a4a55
commit 4577167170
4 changed files with 19 additions and 14 deletions

View File

@ -83,9 +83,9 @@ contains(BITCOIN_NEED_QT_PLUGINS, 1) {
# regenerate src/build.h # regenerate src/build.h
!windows || contains(USE_BUILD_INFO, 1) { !windows || contains(USE_BUILD_INFO, 1) {
genbuild.depends = FORCE genbuild.depends = FORCE
genbuild.commands = share/genbuild.sh src/build.h genbuild.commands = cd $$PWD; share/genbuild.sh $$OUT_PWD/build/build.h
genbuild.target = src/build.h genbuild.target = genbuildhook
"src/version.cpp".depends += src/build.h PRE_TARGETDEPS += genbuildhook
QMAKE_EXTRA_TARGETS += genbuild QMAKE_EXTRA_TARGETS += genbuild
DEFINES += HAVE_BUILD_INFO DEFINES += HAVE_BUILD_INFO
} }

View File

@ -10,7 +10,8 @@ INCLUDEPATHS= \
-I"$(DEPSDIR)/boost_1_47_0" \ -I"$(DEPSDIR)/boost_1_47_0" \
-I"$(DEPSDIR)/db-4.8.30.NC/build_unix" \ -I"$(DEPSDIR)/db-4.8.30.NC/build_unix" \
-I"$(DEPSDIR)/openssl-1.0.0e/include" \ -I"$(DEPSDIR)/openssl-1.0.0e/include" \
-I"$(DEPSDIR)" -I"$(DEPSDIR)" \
-I"$(CURDIR)"/obj \
LIBPATHS= \ LIBPATHS= \
-L"$(DEPSDIR)/boost_1_47_0/stage/lib" \ -L"$(DEPSDIR)/boost_1_47_0/stage/lib" \
@ -65,14 +66,15 @@ OBJS= \
all: bitcoind.exe all: bitcoind.exe
build.h: FORCE obj/build.h: FORCE
@../share/genbuild.sh build.h ../share/genbuild.sh obj/build.h
version.cpp: obj/build.h
DEFS += -DHAVE_BUILD_INFO DEFS += -DHAVE_BUILD_INFO
obj/%.o: %.cpp $(HEADERS) obj/%.o: %.cpp $(HEADERS)
i586-mingw32msvc-g++ -c $(CFLAGS) -o $@ $< i586-mingw32msvc-g++ -c $(CFLAGS) -o $@ $<
bitcoind.exe: build.h $(OBJS:obj/%=obj/%) bitcoind.exe: $(OBJS:obj/%=obj/%)
i586-mingw32msvc-g++ $(CFLAGS) -o $@ $(LIBPATHS) $^ $(LIBS) i586-mingw32msvc-g++ $(CFLAGS) -o $@ $(LIBPATHS) $^ $(LIBS)

View File

@ -11,6 +11,7 @@ DEPSDIR=/opt/local
INCLUDEPATHS= \ INCLUDEPATHS= \
-I"$(CURDIR)" \ -I"$(CURDIR)" \
-I"$(CURDIR)"/obj \
-I"$(DEPSDIR)/include" \ -I"$(DEPSDIR)/include" \
-I"$(DEPSDIR)/include/db48" -I"$(DEPSDIR)/include/db48"
@ -100,8 +101,9 @@ all: bitcoind
-include obj/*.P -include obj/*.P
-include obj-test/*.P -include obj-test/*.P
build.h: FORCE obj/build.h: FORCE
@../share/genbuild.sh build.h ../share/genbuild.sh obj/build.h
version.cpp: obj/build.h
DEFS += -DHAVE_BUILD_INFO DEFS += -DHAVE_BUILD_INFO
obj/%.o: %.cpp obj/%.o: %.cpp
@ -111,7 +113,7 @@ obj/%.o: %.cpp
-e '/^$$/ d' -e 's/$$/ :/' < $(@:%.o=%.d) >> $(@:%.o=%.P); \ -e '/^$$/ d' -e 's/$$/ :/' < $(@:%.o=%.d) >> $(@:%.o=%.P); \
rm -f $(@:%.o=%.d) rm -f $(@:%.o=%.d)
bitcoind: build.h $(OBJS:obj/%=obj/%) bitcoind: $(OBJS:obj/%=obj/%)
$(CXX) $(CFLAGS) -o $@ $(LIBPATHS) $^ $(LIBS) $(CXX) $(CFLAGS) -o $@ $(LIBPATHS) $^ $(LIBS)
TESTOBJS := $(patsubst test/%.cpp,obj-test/%.o,$(wildcard test/*.cpp)) TESTOBJS := $(patsubst test/%.cpp,obj-test/%.o,$(wildcard test/*.cpp))

View File

@ -6,7 +6,7 @@ USE_UPNP:=0
DEFS=-DNOPCH DEFS=-DNOPCH
DEFS += $(addprefix -I,$(CURDIR) $(BOOST_INCLUDE_PATH) $(BDB_INCLUDE_PATH) $(OPENSSL_INCLUDE_PATH)) DEFS += $(addprefix -I,$(CURDIR) $(CURDIR)/obj $(BOOST_INCLUDE_PATH) $(BDB_INCLUDE_PATH) $(OPENSSL_INCLUDE_PATH))
LIBS = $(addprefix -L,$(BOOST_LIB_PATH) $(BDB_LIB_PATH) $(OPENSSL_LIB_PATH)) LIBS = $(addprefix -L,$(BOOST_LIB_PATH) $(BDB_LIB_PATH) $(OPENSSL_LIB_PATH))
LMODE = dynamic LMODE = dynamic
@ -112,8 +112,9 @@ all: bitcoind
-include obj/*.P -include obj/*.P
-include obj-test/*.P -include obj-test/*.P
build.h: FORCE obj/build.h: FORCE
@../share/genbuild.sh build.h ../share/genbuild.sh obj/build.h
version.cpp: obj/build.h
DEFS += -DHAVE_BUILD_INFO DEFS += -DHAVE_BUILD_INFO
obj/%.o: %.cpp obj/%.o: %.cpp
@ -123,7 +124,7 @@ obj/%.o: %.cpp
-e '/^$$/ d' -e 's/$$/ :/' < $(@:%.o=%.d) >> $(@:%.o=%.P); \ -e '/^$$/ d' -e 's/$$/ :/' < $(@:%.o=%.d) >> $(@:%.o=%.P); \
rm -f $(@:%.o=%.d) rm -f $(@:%.o=%.d)
bitcoind: build.h $(OBJS:obj/%=obj/%) bitcoind: $(OBJS:obj/%=obj/%)
$(CXX) $(xCXXFLAGS) -o $@ $^ $(LDFLAGS) $(LIBS) $(CXX) $(xCXXFLAGS) -o $@ $^ $(LDFLAGS) $(LIBS)
TESTOBJS := $(patsubst test/%.cpp,obj-test/%.o,$(wildcard test/*.cpp)) TESTOBJS := $(patsubst test/%.cpp,obj-test/%.o,$(wildcard test/*.cpp))