Merge pull request #6553
[bitcoinplatinum.git] / Makefile.am
blobab68d8fa6d96269d630f4771bb7757060b558c9f
1 ACLOCAL_AMFLAGS = -I build-aux/m4
2 SUBDIRS = src
3 .PHONY: deploy FORCE
5 GZIP_ENV="-9n"
7 if BUILD_BITCOIN_LIBS
8 pkgconfigdir = $(libdir)/pkgconfig
9 pkgconfig_DATA = libbitcoinconsensus.pc
10 endif
12 BITCOIND_BIN=$(top_builddir)/src/bitcoind$(EXEEXT)
13 BITCOIN_QT_BIN=$(top_builddir)/src/qt/bitcoin-qt$(EXEEXT)
14 BITCOIN_CLI_BIN=$(top_builddir)/src/bitcoin-cli$(EXEEXT)
15 BITCOIN_WIN_INSTALLER=$(PACKAGE)-$(PACKAGE_VERSION)-win$(WINDOWS_BITS)-setup$(EXEEXT)
17 OSX_APP=Bitcoin-Qt.app
18 OSX_DMG=Bitcoin-Core.dmg
19 OSX_BACKGROUND_IMAGE=background.tiff
20 OSX_DEPLOY_SCRIPT=$(top_srcdir)/contrib/macdeploy/macdeployqtplus
21 OSX_FANCY_PLIST=$(top_srcdir)/contrib/macdeploy/fancy.plist
22 OSX_BASE_LPROJ_DIR=$(top_srcdir)/contrib/macdeploy/Base.lproj/InfoPlist.strings
23 OSX_INSTALLER_ICONS=$(top_srcdir)/src/qt/res/icons/bitcoin.icns
24 OSX_PLIST=$(top_srcdir)/share/qt/Info.plist #not installed
25 OSX_QT_TRANSLATIONS = da,de,es,hu,ru,uk,zh_CN,zh_TW
27 DIST_DOCS = $(wildcard doc/*.md) $(wildcard doc/release-notes/*.md)
29 WINDOWS_PACKAGING = $(top_srcdir)/share/pixmaps/bitcoin.ico \
30   $(top_srcdir)/share/pixmaps/nsis-header.bmp \
31   $(top_srcdir)/share/pixmaps/nsis-wizard.bmp \
32   $(top_srcdir)/doc/README_windows.txt
34 OSX_PACKAGING = $(OSX_DEPLOY_SCRIPT) $(OSX_FANCY_PLIST) $(OSX_INSTALLER_ICONS) $(OSX_BASE_LPROJ_DIR) \
35   $(top_srcdir)/contrib/macdeploy/$(OSX_BACKGROUND_IMAGE) \
36   $(top_srcdir)/contrib/macdeploy/DS_Store \
37   $(top_srcdir)/contrib/macdeploy/detached-sig-apply.sh \
38   $(top_srcdir)/contrib/macdeploy/detached-sig-create.sh
40 COVERAGE_INFO = baseline_filtered_combined.info baseline.info block_test.info \
41   leveldb_baseline.info test_bitcoin_filtered.info total_coverage.info \
42   baseline_filtered.info block_test_filtered.info \
43   leveldb_baseline_filtered.info test_bitcoin_coverage.info test_bitcoin.info
45 dist-hook:
46         -$(MAKE) -C $(top_distdir)/src/leveldb clean
47         -$(MAKE) -C $(top_distdir)/src/secp256k1 distclean
48         -$(GIT) archive --format=tar HEAD -- src/clientversion.cpp | $(AMTAR) -C $(top_distdir) -xf -
50 distcheck-hook:
51         $(MKDIR_P) $(top_distdir)/_build/src/leveldb
52         cp -rf $(top_srcdir)/src/leveldb/* $(top_distdir)/_build/src/leveldb/
53         -$(MAKE) -C $(top_distdir)/_build/src/leveldb clean
55 distcleancheck:
56         @:
58 $(BITCOIN_WIN_INSTALLER): all-recursive
59         $(MKDIR_P) $(top_builddir)/release
60         STRIPPROG="$(STRIP)" $(INSTALL_STRIP_PROGRAM) $(BITCOIND_BIN) $(top_builddir)/release
61         STRIPPROG="$(STRIP)" $(INSTALL_STRIP_PROGRAM) $(BITCOIN_QT_BIN) $(top_builddir)/release
62         STRIPPROG="$(STRIP)" $(INSTALL_STRIP_PROGRAM) $(BITCOIN_CLI_BIN) $(top_builddir)/release
63         @test -f $(MAKENSIS) && $(MAKENSIS) -V2 $(top_builddir)/share/setup.nsi || \
64           echo error: could not build $@
65         @echo built $@
67 $(if $(findstring src/,$(MAKECMDGOALS)),$(MAKECMDGOALS), none): FORCE
68         $(MAKE) -C src $(patsubst src/%,%,$@)
70 $(OSX_APP)/Contents/PkgInfo:
71         $(MKDIR_P) $(@D)
72         @echo "APPL????" > $@
74 $(OSX_APP)/Contents/Resources/empty.lproj:
75         $(MKDIR_P) $(@D)
76         @touch $@ 
78 $(OSX_APP)/Contents/Info.plist: $(OSX_PLIST)
79         $(MKDIR_P) $(@D)
80         $(INSTALL_DATA) $< $@
82 $(OSX_APP)/Contents/Resources/bitcoin.icns: $(OSX_INSTALLER_ICONS)
83         $(MKDIR_P) $(@D)
84         $(INSTALL_DATA) $< $@
86 $(OSX_APP)/Contents/MacOS/Bitcoin-Qt: $(BITCOIN_QT_BIN)
87         $(MKDIR_P) $(@D)
88         STRIPPROG="$(STRIP)" $(INSTALL_STRIP_PROGRAM)  $< $@
90 $(OSX_APP)/Contents/Resources/Base.lproj/InfoPlist.strings: $(OSX_BASE_LPROJ_DIR)
91         $(MKDIR_P) $(@D)
92         $(INSTALL_DATA) $< $@
94 OSX_APP_BUILT=$(OSX_APP)/Contents/PkgInfo $(OSX_APP)/Contents/Resources/empty.lproj \
95   $(OSX_APP)/Contents/Resources/bitcoin.icns $(OSX_APP)/Contents/Info.plist \
96   $(OSX_APP)/Contents/MacOS/Bitcoin-Qt $(OSX_APP)/Contents/Resources/Base.lproj/InfoPlist.strings
98 if BUILD_DARWIN
99 $(OSX_DMG): $(OSX_APP_BUILT) $(OSX_PACKAGING)
100         $(OSX_DEPLOY_SCRIPT) $(OSX_APP) -add-qt-tr $(OSX_QT_TRANSLATIONS) -translations-dir=$(QT_TRANSLATION_DIR) -dmg -fancy $(OSX_FANCY_PLIST) -verbose 2
102 deploydir: $(OSX_DMG)
103 else
104 APP_DIST_DIR=$(top_builddir)/dist
105 APP_DIST_EXTRAS=$(APP_DIST_DIR)/.background/$(OSX_BACKGROUND_IMAGE) $(APP_DIST_DIR)/.DS_Store $(APP_DIST_DIR)/Applications
107 $(APP_DIST_DIR)/Applications:
108         @rm -f $@
109         @cd $(@D); $(LN_S) /Applications $(@F)
111 $(APP_DIST_EXTRAS): $(APP_DIST_DIR)/$(OSX_APP)/Contents/MacOS/Bitcoin-Qt
113 $(OSX_DMG): $(APP_DIST_EXTRAS)
114         $(GENISOIMAGE) -no-cache-inodes -D -l -probe -V "Bitcoin-Core" -no-pad -r -apple -o $@ dist
116 $(APP_DIST_DIR)/.background/$(OSX_BACKGROUND_IMAGE): contrib/macdeploy/$(OSX_BACKGROUND_IMAGE)
117         $(MKDIR_P) $(@D)
118         $(INSTALL) $< $@
119 $(APP_DIST_DIR)/.DS_Store: contrib/macdeploy/DS_Store
120         $(INSTALL) $< $@
122 $(APP_DIST_DIR)/$(OSX_APP)/Contents/MacOS/Bitcoin-Qt: $(OSX_APP_BUILT) $(OSX_PACKAGING)
123         INSTALLNAMETOOL=$(INSTALLNAMETOOL)  OTOOL=$(OTOOL) STRIP=$(STRIP) $(OSX_DEPLOY_SCRIPT) $(OSX_APP) -translations-dir=$(QT_TRANSLATION_DIR) -add-qt-tr $(OSX_QT_TRANSLATIONS) -verbose 2
125 deploydir: $(APP_DIST_EXTRAS)
126 endif
128 if TARGET_DARWIN
129 appbundle: $(OSX_APP_BUILT)
130 deploy: $(OSX_DMG)
131 endif
132 if TARGET_WINDOWS
133 deploy: $(BITCOIN_WIN_INSTALLER)
134 endif
136 $(BITCOIN_QT_BIN): FORCE
137         $(MAKE) -C src qt/$(@F)
139 $(BITCOIND_BIN): FORCE
140         $(MAKE) -C src $(@F)
142 $(BITCOIN_CLI_BIN): FORCE
143         $(MAKE) -C src $(@F)
145 if USE_LCOV
147 baseline.info:
148         $(LCOV) -c -i -d $(abs_builddir)/src -o $@
150 baseline_filtered.info: baseline.info
151         $(LCOV) -r $< "/usr/include/*" -o $@
153 leveldb_baseline.info: baseline_filtered.info
154         $(LCOV) -c -i -d $(abs_builddir)/src/leveldb -b $(abs_builddir)/src/leveldb -o $@
156 leveldb_baseline_filtered.info: leveldb_baseline.info
157         $(LCOV) -r $< "/usr/include/*" -o $@
159 baseline_filtered_combined.info: leveldb_baseline_filtered.info baseline_filtered.info
160         $(LCOV) -a leveldb_baseline_filtered.info -a baseline_filtered.info -o $@
162 test_bitcoin.info: baseline_filtered_combined.info
163         $(MAKE) -C src/ check
164         $(LCOV) -c -d $(abs_builddir)/src -t test_bitcoin -o $@
165         $(LCOV) -z -d $(abs_builddir)/src
166         $(LCOV) -z -d $(abs_builddir)/src/leveldb
168 test_bitcoin_filtered.info: test_bitcoin.info
169         $(LCOV) -r $< "/usr/include/*" -o $@
171 block_test.info: test_bitcoin_filtered.info
172         $(MKDIR_P) qa/tmp
173         -@TIMEOUT=15 qa/pull-tester/run-bitcoind-for-test.sh $(JAVA) -jar $(JAVA_COMPARISON_TOOL) qa/tmp/compTool 0
174         $(LCOV) -c -d $(abs_builddir)/src --t BitcoinJBlockTest -o $@
175         $(LCOV) -z -d $(abs_builddir)/src
176         $(LCOV) -z -d $(abs_builddir)/src/leveldb
178 block_test_filtered.info: block_test.info
179         $(LCOV) -r $< "/usr/include/*" -o $@
181 test_bitcoin_coverage.info: baseline_filtered_combined.info test_bitcoin_filtered.info
182         $(LCOV) -a baseline_filtered.info -a leveldb_baseline_filtered.info -a test_bitcoin_filtered.info -o $@
184 total_coverage.info:  baseline_filtered_combined.info test_bitcoin_filtered.info block_test_filtered.info
185         $(LCOV) -a baseline_filtered.info -a leveldb_baseline_filtered.info -a test_bitcoin_filtered.info -a block_test_filtered.info -o $@ | $(GREP) "\%" | $(AWK) '{ print substr($$3,2,50) "/" $$5 }' > coverage_percent.txt
187 test_bitcoin.coverage/.dirstamp:  test_bitcoin_coverage.info
188         $(GENHTML) -s $< -o $(@D)
189         @touch $@
191 total.coverage/.dirstamp: total_coverage.info
192         $(GENHTML) -s $< -o $(@D)
193         @touch $@
195 cov: test_bitcoin.coverage/.dirstamp total.coverage/.dirstamp
197 endif
199 if USE_COMPARISON_TOOL
200 check-local:
201         $(MKDIR_P) qa/tmp
202         @qa/pull-tester/run-bitcoind-for-test.sh $(JAVA) -jar $(JAVA_COMPARISON_TOOL) qa/tmp/compTool $(COMPARISON_TOOL_REORG_TESTS) 2>&1
203 endif
205 dist_noinst_SCRIPTS = autogen.sh
207 EXTRA_DIST = $(top_srcdir)/share/genbuild.sh qa/pull-tester/rpc-tests.sh qa/pull-tester/run-bitcoin-cli qa/rpc-tests $(DIST_DOCS) $(WINDOWS_PACKAGING) $(OSX_PACKAGING)
209 CLEANFILES = $(OSX_DMG) $(BITCOIN_WIN_INSTALLER)
211 .INTERMEDIATE: $(COVERAGE_INFO)
213 clean-local:
214         rm -rf test_bitcoin.coverage/ total.coverage/ $(OSX_APP)