Browse Source

Pass compiler flags down into leveldb make

Fixes issue#2288. Includes cleanups from Luke's pull 2243.
0.8
Gavin Andresen 12 years ago
parent
commit
fbd860287e
  1. 4
      bitcoin-qt.pro
  2. 2
      contrib/gitian-descriptors/gitian-win32.yml
  3. 15
      src/makefile.linux-mingw
  4. 15
      src/makefile.mingw
  5. 7
      src/makefile.osx
  6. 6
      src/makefile.unix

4
bitcoin-qt.pro

@ -99,14 +99,14 @@ contains(BITCOIN_NEED_QT_PLUGINS, 1) {
INCLUDEPATH += src/leveldb/include src/leveldb/helpers INCLUDEPATH += src/leveldb/include src/leveldb/helpers
LIBS += $$PWD/src/leveldb/libleveldb.a $$PWD/src/leveldb/libmemenv.a LIBS += $$PWD/src/leveldb/libleveldb.a $$PWD/src/leveldb/libmemenv.a
!win32 { !win32 {
genleveldb.commands = cd $$PWD/src/leveldb && $(MAKE) libleveldb.a libmemenv.a genleveldb.commands = cd $$PWD/src/leveldb && CC=$$QMAKE_CC CXX=$$QMAKE_CXX $(MAKE) OPT=\"$$QMAKE_CXXFLAGS\" libleveldb.a libmemenv.a
} else { } else {
# make an educated guess about what the ranlib command is called # make an educated guess about what the ranlib command is called
isEmpty(QMAKE_RANLIB) { isEmpty(QMAKE_RANLIB) {
QMAKE_RANLIB = $$replace(QMAKE_STRIP, strip, ranlib) QMAKE_RANLIB = $$replace(QMAKE_STRIP, strip, ranlib)
} }
LIBS += -lshlwapi LIBS += -lshlwapi
genleveldb.commands = cd $$PWD/src/leveldb && CC=$$QMAKE_CC CXX=$$QMAKE_CXX TARGET_OS=OS_WINDOWS_CROSSCOMPILE $(MAKE) libleveldb.a libmemenv.a && $$QMAKE_RANLIB $$PWD/src/leveldb/libleveldb.a && $$QMAKE_RANLIB $$PWD/src/leveldb/libmemenv.a genleveldb.commands = cd $$PWD/src/leveldb && CC=$$QMAKE_CC CXX=$$QMAKE_CXX TARGET_OS=OS_WINDOWS_CROSSCOMPILE $(MAKE) OPT=\"$$QMAKE_CXXFLAGS\" libleveldb.a libmemenv.a && $$QMAKE_RANLIB $$PWD/src/leveldb/libleveldb.a && $$QMAKE_RANLIB $$PWD/src/leveldb/libmemenv.a
} }
genleveldb.target = $$PWD/src/leveldb/libleveldb.a genleveldb.target = $$PWD/src/leveldb/libleveldb.a
genleveldb.depends = FORCE genleveldb.depends = FORCE

2
contrib/gitian-descriptors/gitian-win32.yml

@ -51,7 +51,7 @@ script: |
export LD_PRELOAD=/usr/lib/faketime/libfaketime.so.1 export LD_PRELOAD=/usr/lib/faketime/libfaketime.so.1
export FAKETIME=$REFERENCE_DATETIME export FAKETIME=$REFERENCE_DATETIME
export TZ=UTC export TZ=UTC
$HOME/qt/src/bin/qmake -spec unsupported/win32-g++-cross MINIUPNPC_LIB_PATH=$HOME/build/miniupnpc MINIUPNPC_INCLUDE_PATH=$HOME/build/ BDB_LIB_PATH=$HOME/build/db-4.8.30.NC/build_unix BDB_INCLUDE_PATH=$HOME/build/db-4.8.30.NC/build_unix BOOST_LIB_PATH=$HOME/build/boost_1_50_0/stage/lib BOOST_INCLUDE_PATH=$HOME/build/boost_1_50_0 BOOST_LIB_SUFFIX=-mt-s BOOST_THREAD_LIB_SUFFIX=_win32-mt-s OPENSSL_LIB_PATH=$HOME/build/openssl-1.0.1c OPENSSL_INCLUDE_PATH=$HOME/build/openssl-1.0.1c/include QRENCODE_LIB_PATH=$HOME/build/qrencode-3.2.0/.libs QRENCODE_INCLUDE_PATH=$HOME/build/qrencode-3.2.0 USE_QRCODE=1 INCLUDEPATH=$HOME/build DEFINES=BOOST_THREAD_USE_LIB BITCOIN_NEED_QT_PLUGINS=1 QMAKE_LRELEASE=lrelease QMAKE_CXXFLAGS=-frandom-seed=bitcoin QMAKE_LFLAGS=-frandom-seed=bitcoin USE_BUILD_INFO=1 $HOME/qt/src/bin/qmake -spec unsupported/win32-g++-cross MINIUPNPC_LIB_PATH=$HOME/build/miniupnpc MINIUPNPC_INCLUDE_PATH=$HOME/build/ BDB_LIB_PATH=$HOME/build/db-4.8.30.NC/build_unix BDB_INCLUDE_PATH=$HOME/build/db-4.8.30.NC/build_unix BOOST_LIB_PATH=$HOME/build/boost_1_50_0/stage/lib BOOST_INCLUDE_PATH=$HOME/build/boost_1_50_0 BOOST_LIB_SUFFIX=-mt-s BOOST_THREAD_LIB_SUFFIX=_win32-mt-s OPENSSL_LIB_PATH=$HOME/build/openssl-1.0.1c OPENSSL_INCLUDE_PATH=$HOME/build/openssl-1.0.1c/include QRENCODE_LIB_PATH=$HOME/build/qrencode-3.2.0/.libs QRENCODE_INCLUDE_PATH=$HOME/build/qrencode-3.2.0 USE_QRCODE=1 INCLUDEPATH=$HOME/build DEFINES=BOOST_THREAD_USE_LIB BITCOIN_NEED_QT_PLUGINS=1 QMAKE_LRELEASE=lrelease QMAKE_CXXFLAGS=-frandom-seed=bitcoin USE_BUILD_INFO=1
make $MAKEOPTS make $MAKEOPTS
cp release/bitcoin-qt.exe $OUTDIR/ cp release/bitcoin-qt.exe $OUTDIR/
# #

15
src/makefile.linux-mingw

@ -4,6 +4,9 @@
DEPSDIR:=/usr/i586-mingw32msvc DEPSDIR:=/usr/i586-mingw32msvc
CC ?= i586-mingw32msvc-gcc
CXX ?= i586-mingw32msvc-g++
USE_UPNP:=0 USE_UPNP:=0
USE_IPV6:=1 USE_IPV6:=1
@ -58,6 +61,7 @@ LIBS += -l mingwthrd -l kernel32 -l user32 -l gdi32 -l comdlg32 -l winspool -l w
HEADERS = $(wildcard *.h) HEADERS = $(wildcard *.h)
OBJS= \ OBJS= \
leveldb/libleveldb.a \
obj/alert.o \ obj/alert.o \
obj/version.o \ obj/version.o \
obj/checkpoints.o \ obj/checkpoints.o \
@ -95,8 +99,7 @@ all: bitcoind.exe
DEFS += -I"$(CURDIR)/leveldb/include" DEFS += -I"$(CURDIR)/leveldb/include"
DEFS += -I"$(CURDIR)/leveldb/helpers" DEFS += -I"$(CURDIR)/leveldb/helpers"
leveldb/libleveldb.a: leveldb/libleveldb.a:
@echo "Building LevelDB ..." && cd leveldb && CC=i586-mingw32msvc-gcc CXX=i586-mingw32msvc-g++ TARGET_OS=OS_WINDOWS_CROSSCOMPILE CXXFLAGS="$(INCLUDEPATHS)" LDFLAGS="$(LIBPATHS)" $(MAKE) libleveldb.a libmemenv.a && i586-mingw32msvc-ranlib libleveldb.a && i586-mingw32msvc-ranlib libmemenv.a && cd .. @echo "Building LevelDB ..." && cd leveldb && TARGET_OS=OS_WINDOWS_CROSSCOMPILE $(MAKE) CC=$(CC) CXX=$(CXX) OPT="$(CFLAGS)" libleveldb.a libmemenv.a && i586-mingw32msvc-ranlib libleveldb.a && i586-mingw32msvc-ranlib libmemenv.a && cd ..
obj/leveldb.o: leveldb/libleveldb.a
obj/build.h: FORCE obj/build.h: FORCE
/bin/sh ../share/genbuild.sh obj/build.h /bin/sh ../share/genbuild.sh obj/build.h
@ -104,18 +107,18 @@ 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 $@ $< $(CXX) -c $(CFLAGS) -o $@ $<
bitcoind.exe: $(OBJS:obj/%=obj/%) bitcoind.exe: $(OBJS:obj/%=obj/%)
i586-mingw32msvc-g++ $(CFLAGS) $(LDFLAGS) -o $@ $(LIBPATHS) $^ $(LIBS) $(CXX) $(CFLAGS) $(LDFLAGS) -o $@ $(LIBPATHS) $^ $(LIBS)
TESTOBJS := $(patsubst test/%.cpp,obj-test/%.o,$(wildcard test/*.cpp)) TESTOBJS := $(patsubst test/%.cpp,obj-test/%.o,$(wildcard test/*.cpp))
obj-test/%.o: test/%.cpp $(HEADERS) obj-test/%.o: test/%.cpp $(HEADERS)
i586-mingw32msvc-g++ -c $(TESTDEFS) $(CFLAGS) -o $@ $< $(CXX) -c $(TESTDEFS) $(CFLAGS) -o $@ $<
test_bitcoin.exe: $(TESTOBJS) $(filter-out obj/init.o,$(OBJS:obj/%=obj/%)) test_bitcoin.exe: $(TESTOBJS) $(filter-out obj/init.o,$(OBJS:obj/%=obj/%))
i586-mingw32msvc-g++ $(CFLAGS) $(LDFLAGS) -o $@ $(LIBPATHS) $^ -lboost_unit_test_framework-mt-s $(LIBS) $(CXX) $(CFLAGS) $(LDFLAGS) -o $@ $(LIBPATHS) $^ -lboost_unit_test_framework-mt-s $(LIBS)
clean: clean:

15
src/makefile.mingw

@ -15,6 +15,8 @@
# 'make clean' assumes it is running inside a MSYS shell, and uses 'rm' # 'make clean' assumes it is running inside a MSYS shell, and uses 'rm'
# to remove files. # to remove files.
CXX ?= g++
USE_UPNP:=- USE_UPNP:=-
USE_IPV6:=1 USE_IPV6:=1
@ -67,6 +69,7 @@ LIBS += -l kernel32 -l user32 -l gdi32 -l comdlg32 -l winspool -l winmm -l shell
HEADERS = $(wildcard *.h) HEADERS = $(wildcard *.h)
OBJS= \ OBJS= \
leveldb/libleveldb.a \
obj/alert.o \ obj/alert.o \
obj/version.o \ obj/version.o \
obj/checkpoints.o \ obj/checkpoints.o \
@ -112,23 +115,21 @@ DEFS += $(addprefix -I,$(CURDIR)/leveldb/include)
DEFS += $(addprefix -I,$(CURDIR)/leveldb/helpers) DEFS += $(addprefix -I,$(CURDIR)/leveldb/helpers)
leveldb/libleveldb.a: leveldb/libleveldb.a:
cd leveldb && $(MAKE) OPT="$(DEBUGFLAGS)" TARGET_OS=NATIVE_WINDOWS libleveldb.a libmemenv.a && cd .. cd leveldb && $(MAKE) CC=$(CC) CXX=$(CXX) OPT="$(CFLAGS)" TARGET_OS=NATIVE_WINDOWS libleveldb.a libmemenv.a && cd ..
obj/leveldb.o: leveldb/libleveldb.a
obj/%.o: %.cpp $(HEADERS) obj/%.o: %.cpp $(HEADERS)
g++ -c $(CFLAGS) -o $@ $< $(CXX) -c $(CFLAGS) -o $@ $<
bitcoind.exe: $(OBJS:obj/%=obj/%) bitcoind.exe: $(OBJS:obj/%=obj/%)
g++ $(CFLAGS) $(LDFLAGS) -o $@ $(LIBPATHS) $^ $(LIBS) $(CXX) $(CFLAGS) $(LDFLAGS) -o $@ $(LIBPATHS) $^ $(LIBS)
TESTOBJS := $(patsubst test/%.cpp,obj-test/%.o,$(wildcard test/*.cpp)) TESTOBJS := $(patsubst test/%.cpp,obj-test/%.o,$(wildcard test/*.cpp))
obj-test/%.o: test/%.cpp $(HEADERS) obj-test/%.o: test/%.cpp $(HEADERS)
g++ -c $(TESTDEFS) $(CFLAGS) -o $@ $< $(CXX) -c $(TESTDEFS) $(CFLAGS) -o $@ $<
test_bitcoin.exe: $(TESTOBJS) $(filter-out obj/init.o,$(OBJS:obj/%=obj/%)) test_bitcoin.exe: $(TESTOBJS) $(filter-out obj/init.o,$(OBJS:obj/%=obj/%))
g++ $(CFLAGS) $(LDFLAGS) -o $@ $(LIBPATHS) $^ -lboost_unit_test_framework$(BOOST_SUFFIX) $(LIBS) $(CXX) $(CFLAGS) $(LDFLAGS) -o $@ $(LIBPATHS) $^ -lboost_unit_test_framework$(BOOST_SUFFIX) $(LIBS)
clean: clean:
rm -f bitcoind.exe test_bitcoin.exe rm -f bitcoind.exe test_bitcoin.exe

7
src/makefile.osx vendored

@ -62,7 +62,7 @@ ifdef RELEASE
# the same way. # the same way.
CFLAGS = -mmacosx-version-min=10.5 -arch i386 -O3 CFLAGS = -mmacosx-version-min=10.5 -arch i386 -O3
else else
CFLAGS = -g DEBUGFLAGS = -g
endif endif
# ppc doesn't work because we don't support big-endian # ppc doesn't work because we don't support big-endian
@ -70,6 +70,7 @@ CFLAGS += -Wall -Wextra -Wformat -Wformat-security -Wno-unused-parameter \
$(DEBUGFLAGS) $(DEFS) $(INCLUDEPATHS) $(DEBUGFLAGS) $(DEFS) $(INCLUDEPATHS)
OBJS= \ OBJS= \
leveldb/libleveldb.a \
obj/alert.o \ obj/alert.o \
obj/version.o \ obj/version.o \
obj/checkpoints.o \ obj/checkpoints.o \
@ -130,8 +131,7 @@ LIBS += $(CURDIR)/leveldb/libleveldb.a $(CURDIR)/leveldb/libmemenv.a
DEFS += $(addprefix -I,$(CURDIR)/leveldb/include) DEFS += $(addprefix -I,$(CURDIR)/leveldb/include)
DEFS += $(addprefix -I,$(CURDIR)/leveldb/helpers) DEFS += $(addprefix -I,$(CURDIR)/leveldb/helpers)
leveldb/libleveldb.a: leveldb/libleveldb.a:
@echo "Building LevelDB ..." && cd leveldb && $(MAKE) libleveldb.a libmemenv.a && cd .. @echo "Building LevelDB ..." && cd leveldb && $(MAKE) CC=$(CC) CXX=$(CXX) OPT="$(CFLAGS)" libleveldb.a libmemenv.a && cd ..
obj/leveldb.o: leveldb/libleveldb.a
# auto-generated dependencies: # auto-generated dependencies:
-include obj/*.P -include obj/*.P
@ -171,5 +171,6 @@ clean:
-rm -f obj/*.P -rm -f obj/*.P
-rm -f obj-test/*.P -rm -f obj-test/*.P
-rm -f obj/build.h -rm -f obj/build.h
-cd leveldb && $(MAKE) clean || true
FORCE: FORCE:

6
src/makefile.unix

@ -101,6 +101,7 @@ xCXXFLAGS=-O2 -pthread -Wall -Wextra -Wformat -Wformat-security -Wno-unused-para
xLDFLAGS=$(LDHARDENING) $(LDFLAGS) xLDFLAGS=$(LDHARDENING) $(LDFLAGS)
OBJS= \ OBJS= \
leveldb/libleveldb.a \
obj/alert.o \ obj/alert.o \
obj/version.o \ obj/version.o \
obj/checkpoints.o \ obj/checkpoints.o \
@ -142,12 +143,12 @@ test check: test_bitcoin FORCE
# #
# LevelDB support # LevelDB support
# #
MAKEOVERRIDES =
LIBS += $(CURDIR)/leveldb/libleveldb.a $(CURDIR)/leveldb/libmemenv.a LIBS += $(CURDIR)/leveldb/libleveldb.a $(CURDIR)/leveldb/libmemenv.a
DEFS += $(addprefix -I,$(CURDIR)/leveldb/include) DEFS += $(addprefix -I,$(CURDIR)/leveldb/include)
DEFS += $(addprefix -I,$(CURDIR)/leveldb/helpers) DEFS += $(addprefix -I,$(CURDIR)/leveldb/helpers)
leveldb/libleveldb.a: leveldb/libleveldb.a:
@echo "Building LevelDB ..." && cd leveldb && $(MAKE) libleveldb.a libmemenv.a && cd .. @echo "Building LevelDB ..." && cd leveldb && $(MAKE) CC=$(CC) CXX=$(CXX) OPT="$(xCXXFLAGS)" libleveldb.a libmemenv.a && cd ..
obj/leveldb.o: leveldb/libleveldb.a
# auto-generated dependencies: # auto-generated dependencies:
-include obj/*.P -include obj/*.P
@ -187,5 +188,6 @@ clean:
-rm -f obj/*.P -rm -f obj/*.P
-rm -f obj-test/*.P -rm -f obj-test/*.P
-rm -f obj/build.h -rm -f obj/build.h
-cd leveldb && $(MAKE) clean || true
FORCE: FORCE:

Loading…
Cancel
Save