Add instructions for multi-processor gitian builds
[bitcoinplatinum.git] / Makefile.am
blob8216b7d60811bc01573622eaa5f12a856d6e53e8
1 # Copyright (c) 2013-2016 The Bitcoin Core developers
2 # Distributed under the MIT software license, see the accompanying
3 # file COPYING or http://www.opensource.org/licenses/mit-license.php.
5 ACLOCAL_AMFLAGS = -I build-aux/m4
6 SUBDIRS = src
7 if ENABLE_MAN
8 SUBDIRS += doc/man
9 endif
10 .PHONY: deploy FORCE
12 GZIP_ENV="-9n"
13 export PYTHONPATH
15 if BUILD_BITCOIN_LIBS
16 pkgconfigdir = $(libdir)/pkgconfig
17 pkgconfig_DATA = libbitcoinconsensus.pc
18 endif
20 BITCOIND_BIN=$(top_builddir)/src/$(BITCOIN_DAEMON_NAME)$(EXEEXT)
21 BITCOIN_QT_BIN=$(top_builddir)/src/qt/$(BITCOIN_GUI_NAME)$(EXEEXT)
22 BITCOIN_CLI_BIN=$(top_builddir)/src/$(BITCOIN_CLI_NAME)$(EXEEXT)
23 BITCOIN_WIN_INSTALLER=$(PACKAGE)-$(PACKAGE_VERSION)-win$(WINDOWS_BITS)-setup$(EXEEXT)
25 empty :=
26 space := $(empty) $(empty)
28 OSX_APP=Bitcoin-Qt.app
29 OSX_VOLNAME = $(subst $(space),-,$(PACKAGE_NAME))
30 OSX_DMG = $(OSX_VOLNAME).dmg
31 OSX_BACKGROUND_SVG=background.svg
32 OSX_BACKGROUND_IMAGE=background.tiff
33 OSX_BACKGROUND_IMAGE_DPIS=36 72
34 OSX_DSSTORE_GEN=$(top_srcdir)/contrib/macdeploy/custom_dsstore.py
35 OSX_DEPLOY_SCRIPT=$(top_srcdir)/contrib/macdeploy/macdeployqtplus
36 OSX_FANCY_PLIST=$(top_srcdir)/contrib/macdeploy/fancy.plist
37 OSX_INSTALLER_ICONS=$(top_srcdir)/src/qt/res/icons/bitcoin.icns
38 OSX_PLIST=$(top_builddir)/share/qt/Info.plist #not installed
39 OSX_QT_TRANSLATIONS = da,de,es,hu,ru,uk,zh_CN,zh_TW
41 DIST_DOCS = $(wildcard doc/*.md) $(wildcard doc/release-notes/*.md)
42 DIST_CONTRIB = $(top_srcdir)/contrib/bitcoin-cli.bash-completion \
43                $(top_srcdir)/contrib/bitcoin-tx.bash-completion \
44                $(top_srcdir)/contrib/bitcoind.bash-completion \
45                $(top_srcdir)/contrib/init \
46                $(top_srcdir)/contrib/rpm
48 BIN_CHECKS=$(top_srcdir)/contrib/devtools/symbol-check.py \
49            $(top_srcdir)/contrib/devtools/security-check.py
51 WINDOWS_PACKAGING = $(top_srcdir)/share/pixmaps/bitcoin.ico \
52   $(top_srcdir)/share/pixmaps/nsis-header.bmp \
53   $(top_srcdir)/share/pixmaps/nsis-wizard.bmp \
54   $(top_srcdir)/doc/README_windows.txt
56 OSX_PACKAGING = $(OSX_DEPLOY_SCRIPT) $(OSX_FANCY_PLIST) $(OSX_INSTALLER_ICONS) \
57   $(top_srcdir)/contrib/macdeploy/$(OSX_BACKGROUND_SVG) \
58   $(OSX_DSSTORE_GEN) \
59   $(top_srcdir)/contrib/macdeploy/detached-sig-apply.sh \
60   $(top_srcdir)/contrib/macdeploy/detached-sig-create.sh
62 COVERAGE_INFO = baseline.info \
63   test_bitcoin_filtered.info total_coverage.info \
64   baseline_filtered.info functional_test.info functional_test_filtered.info \
65   test_bitcoin_coverage.info test_bitcoin.info
67 dist-hook:
68         -$(GIT) archive --format=tar HEAD -- src/clientversion.cpp | $(AMTAR) -C $(top_distdir) -xf -
70 $(BITCOIN_WIN_INSTALLER): all-recursive
71         $(MKDIR_P) $(top_builddir)/release
72         STRIPPROG="$(STRIP)" $(INSTALL_STRIP_PROGRAM) $(BITCOIND_BIN) $(top_builddir)/release
73         STRIPPROG="$(STRIP)" $(INSTALL_STRIP_PROGRAM) $(BITCOIN_QT_BIN) $(top_builddir)/release
74         STRIPPROG="$(STRIP)" $(INSTALL_STRIP_PROGRAM) $(BITCOIN_CLI_BIN) $(top_builddir)/release
75         @test -f $(MAKENSIS) && $(MAKENSIS) -V2 $(top_builddir)/share/setup.nsi || \
76           echo error: could not build $@
77         @echo built $@
79 $(OSX_APP)/Contents/PkgInfo:
80         $(MKDIR_P) $(@D)
81         @echo "APPL????" > $@
83 $(OSX_APP)/Contents/Resources/empty.lproj:
84         $(MKDIR_P) $(@D)
85         @touch $@ 
87 $(OSX_APP)/Contents/Info.plist: $(OSX_PLIST)
88         $(MKDIR_P) $(@D)
89         $(INSTALL_DATA) $< $@
91 $(OSX_APP)/Contents/Resources/bitcoin.icns: $(OSX_INSTALLER_ICONS)
92         $(MKDIR_P) $(@D)
93         $(INSTALL_DATA) $< $@
95 $(OSX_APP)/Contents/MacOS/Bitcoin-Qt: $(BITCOIN_QT_BIN)
96         $(MKDIR_P) $(@D)
97         STRIPPROG="$(STRIP)" $(INSTALL_STRIP_PROGRAM)  $< $@
99 $(OSX_APP)/Contents/Resources/Base.lproj/InfoPlist.strings:
100         $(MKDIR_P) $(@D)
101         echo '{ CFBundleDisplayName = "$(PACKAGE_NAME)"; CFBundleName = "$(PACKAGE_NAME)"; }' > $@
103 OSX_APP_BUILT=$(OSX_APP)/Contents/PkgInfo $(OSX_APP)/Contents/Resources/empty.lproj \
104   $(OSX_APP)/Contents/Resources/bitcoin.icns $(OSX_APP)/Contents/Info.plist \
105   $(OSX_APP)/Contents/MacOS/Bitcoin-Qt $(OSX_APP)/Contents/Resources/Base.lproj/InfoPlist.strings
107 osx_volname:
108         echo $(OSX_VOLNAME) >$@
110 if BUILD_DARWIN
111 $(OSX_DMG): $(OSX_APP_BUILT) $(OSX_PACKAGING) $(OSX_BACKGROUND_IMAGE)
112         $(PYTHON) $(OSX_DEPLOY_SCRIPT) $(OSX_APP) -add-qt-tr $(OSX_QT_TRANSLATIONS) -translations-dir=$(QT_TRANSLATION_DIR) -dmg -fancy $(OSX_FANCY_PLIST) -verbose 2 -volname $(OSX_VOLNAME)
114 $(OSX_BACKGROUND_IMAGE).png: contrib/macdeploy/$(OSX_BACKGROUND_SVG)
115         sed 's/PACKAGE_NAME/$(PACKAGE_NAME)/' < "$<" | $(RSVG_CONVERT) -f png -d 36 -p 36 -o $@
116 $(OSX_BACKGROUND_IMAGE)@2x.png: contrib/macdeploy/$(OSX_BACKGROUND_SVG)
117         sed 's/PACKAGE_NAME/$(PACKAGE_NAME)/' < "$<" | $(RSVG_CONVERT) -f png -d 72 -p 72 -o $@
118 $(OSX_BACKGROUND_IMAGE): $(OSX_BACKGROUND_IMAGE).png $(OSX_BACKGROUND_IMAGE)@2x.png
119         tiffutil -cathidpicheck $^ -out $@
121 deploydir: $(OSX_DMG)
122 else
123 APP_DIST_DIR=$(top_builddir)/dist
124 APP_DIST_EXTRAS=$(APP_DIST_DIR)/.background/$(OSX_BACKGROUND_IMAGE) $(APP_DIST_DIR)/.DS_Store $(APP_DIST_DIR)/Applications
126 $(APP_DIST_DIR)/Applications:
127         @rm -f $@
128         @cd $(@D); $(LN_S) /Applications $(@F)
130 $(APP_DIST_EXTRAS): $(APP_DIST_DIR)/$(OSX_APP)/Contents/MacOS/Bitcoin-Qt
132 $(OSX_DMG): $(APP_DIST_EXTRAS)
133         $(GENISOIMAGE) -no-cache-inodes -D -l -probe -V "$(OSX_VOLNAME)" -no-pad -r -dir-mode 0755 -apple -o $@ dist
135 dpi%.$(OSX_BACKGROUND_IMAGE): contrib/macdeploy/$(OSX_BACKGROUND_SVG)
136         sed 's/PACKAGE_NAME/$(PACKAGE_NAME)/' < "$<" | $(RSVG_CONVERT) -f png -d $* -p $* | $(IMAGEMAGICK_CONVERT) - $@
137 OSX_BACKGROUND_IMAGE_DPIFILES := $(foreach dpi,$(OSX_BACKGROUND_IMAGE_DPIS),dpi$(dpi).$(OSX_BACKGROUND_IMAGE))
138 $(APP_DIST_DIR)/.background/$(OSX_BACKGROUND_IMAGE): $(OSX_BACKGROUND_IMAGE_DPIFILES)
139         $(MKDIR_P) $(@D)
140         $(TIFFCP) -c none $(OSX_BACKGROUND_IMAGE_DPIFILES) $@
142 $(APP_DIST_DIR)/.DS_Store: $(OSX_DSSTORE_GEN)
143         $(PYTHON) $< "$@" "$(OSX_VOLNAME)"
145 $(APP_DIST_DIR)/$(OSX_APP)/Contents/MacOS/Bitcoin-Qt: $(OSX_APP_BUILT) $(OSX_PACKAGING)
146         INSTALLNAMETOOL=$(INSTALLNAMETOOL)  OTOOL=$(OTOOL) STRIP=$(STRIP) $(PYTHON) $(OSX_DEPLOY_SCRIPT) $(OSX_APP) -translations-dir=$(QT_TRANSLATION_DIR) -add-qt-tr $(OSX_QT_TRANSLATIONS) -verbose 2
148 deploydir: $(APP_DIST_EXTRAS)
149 endif
151 if TARGET_DARWIN
152 appbundle: $(OSX_APP_BUILT)
153 deploy: $(OSX_DMG)
154 endif
155 if TARGET_WINDOWS
156 deploy: $(BITCOIN_WIN_INSTALLER)
157 endif
159 $(BITCOIN_QT_BIN): FORCE
160         $(MAKE) -C src qt/$(@F)
162 $(BITCOIND_BIN): FORCE
163         $(MAKE) -C src $(@F)
165 $(BITCOIN_CLI_BIN): FORCE
166         $(MAKE) -C src $(@F)
168 if USE_LCOV
169 LCOV_FILTER_PATTERN=-p "/usr/include/" -p "src/leveldb/" -p "src/bench/" -p "src/univalue" -p "src/crypto/ctaes" -p "src/secp256k1"
171 baseline.info:
172         $(LCOV) -c -i -d $(abs_builddir)/src -o $@
174 baseline_filtered.info: baseline.info
175         $(abs_builddir)/contrib/filter-lcov.py $(LCOV_FILTER_PATTERN) $< $@
176         $(LCOV) -a $@ $(LCOV_OPTS) -o $@
178 test_bitcoin.info: baseline_filtered.info
179         $(MAKE) -C src/ check
180         $(LCOV) -c $(LCOV_OPTS) -d $(abs_builddir)/src -t test_bitcoin -o $@
181         $(LCOV) -z $(LCOV_OPTS) -d $(abs_builddir)/src
183 test_bitcoin_filtered.info: test_bitcoin.info
184         $(abs_builddir)/contrib/filter-lcov.py $(LCOV_FILTER_PATTERN) $< $@
185         $(LCOV) -a $@ $(LCOV_OPTS) -o $@
187 functional_test.info: test_bitcoin_filtered.info
188         -@TIMEOUT=15 test/functional/test_runner.py $(EXTENDED_FUNCTIONAL_TESTS)
189         $(LCOV) -c $(LCOV_OPTS) -d $(abs_builddir)/src --t functional-tests -o $@
190         $(LCOV) -z $(LCOV_OPTS) -d $(abs_builddir)/src
192 functional_test_filtered.info: functional_test.info
193         $(abs_builddir)/contrib/filter-lcov.py $(LCOV_FILTER_PATTERN) $< $@
194         $(LCOV) -a $@ $(LCOV_OPTS) -o $@
196 test_bitcoin_coverage.info: baseline_filtered.info test_bitcoin_filtered.info
197         $(LCOV) -a $(LCOV_OPTS) baseline_filtered.info -a test_bitcoin_filtered.info -o $@
199 total_coverage.info: test_bitcoin_filtered.info functional_test_filtered.info
200         $(LCOV) -a $(LCOV_OPTS) baseline_filtered.info -a test_bitcoin_filtered.info -a functional_test_filtered.info -o $@ | $(GREP) "\%" | $(AWK) '{ print substr($$3,2,50) "/" $$5 }' > coverage_percent.txt
202 test_bitcoin.coverage/.dirstamp:  test_bitcoin_coverage.info
203         $(GENHTML) -s $(LCOV_OPTS) $< -o $(@D)
204         @touch $@
206 total.coverage/.dirstamp: total_coverage.info
207         $(GENHTML) -s $(LCOV_OPTS) $< -o $(@D)
208         @touch $@
210 cov: test_bitcoin.coverage/.dirstamp total.coverage/.dirstamp
212 endif
214 dist_noinst_SCRIPTS = autogen.sh
216 EXTRA_DIST = $(top_srcdir)/share/genbuild.sh test/functional/test_runner.py test/functional $(DIST_CONTRIB) $(DIST_DOCS) $(WINDOWS_PACKAGING) $(OSX_PACKAGING) $(BIN_CHECKS)
218 EXTRA_DIST += \
219     test/util/bitcoin-util-test.py \
220     test/util/data/bitcoin-util-test.json \
221     test/util/data/blanktxv1.hex \
222     test/util/data/blanktxv1.json \
223     test/util/data/blanktxv2.hex \
224     test/util/data/blanktxv2.json \
225     test/util/data/tt-delin1-out.hex \
226     test/util/data/tt-delin1-out.json \
227     test/util/data/tt-delout1-out.hex \
228     test/util/data/tt-delout1-out.json \
229     test/util/data/tt-locktime317000-out.hex \
230     test/util/data/tt-locktime317000-out.json \
231     test/util/data/tx394b54bb.hex \
232     test/util/data/txcreate1.hex \
233     test/util/data/txcreate1.json \
234     test/util/data/txcreate2.hex \
235     test/util/data/txcreate2.json \
236     test/util/data/txcreatedata1.hex \
237     test/util/data/txcreatedata1.json \
238     test/util/data/txcreatedata2.hex \
239     test/util/data/txcreatedata2.json \
240     test/util/data/txcreatedata_seq0.hex \
241     test/util/data/txcreatedata_seq0.json \
242     test/util/data/txcreatedata_seq1.hex \
243     test/util/data/txcreatedata_seq1.json \
244     test/util/data/txcreatemultisig1.hex \
245     test/util/data/txcreatemultisig1.json \
246     test/util/data/txcreatemultisig2.hex \
247     test/util/data/txcreatemultisig2.json \
248     test/util/data/txcreatemultisig3.hex \
249     test/util/data/txcreatemultisig3.json \
250     test/util/data/txcreatemultisig4.hex \
251     test/util/data/txcreatemultisig4.json \
252     test/util/data/txcreateoutpubkey1.hex \
253     test/util/data/txcreateoutpubkey1.json \
254     test/util/data/txcreateoutpubkey2.hex \
255     test/util/data/txcreateoutpubkey2.json \
256     test/util/data/txcreateoutpubkey3.hex \
257     test/util/data/txcreateoutpubkey3.json \
258     test/util/data/txcreatescript1.hex \
259     test/util/data/txcreatescript1.json \
260     test/util/data/txcreatescript2.hex \
261     test/util/data/txcreatescript2.json \
262     test/util/data/txcreatescript3.hex \
263     test/util/data/txcreatescript3.json \
264     test/util/data/txcreatescript4.hex \
265     test/util/data/txcreatescript4.json \
266     test/util/data/txcreatesignv1.hex \
267     test/util/data/txcreatesignv1.json \
268     test/util/data/txcreatesignv2.hex
270 CLEANFILES = $(OSX_DMG) $(BITCOIN_WIN_INSTALLER)
272 .INTERMEDIATE: $(COVERAGE_INFO)
274 DISTCHECK_CONFIGURE_FLAGS = --enable-man
276 clean-local:
277         rm -rf coverage_percent.txt test_bitcoin.coverage/ total.coverage/ test/tmp/ cache/ $(OSX_APP)
278         rm -rf test/functional/__pycache__