Merge #8807: [univalue] Pull subtree from upstream
[bitcoinplatinum.git] / Makefile.am
blob2e061c377358050eb9c416837f764e5543c36912
1 ACLOCAL_AMFLAGS = -I build-aux/m4
2 SUBDIRS = src
3 if ENABLE_MAN
4 SUBDIRS += doc/man
5 endif
6 .PHONY: deploy FORCE
8 GZIP_ENV="-9n"
9 export PYTHONPATH
11 if BUILD_BITCOIN_LIBS
12 pkgconfigdir = $(libdir)/pkgconfig
13 pkgconfig_DATA = libbitcoinconsensus.pc
14 endif
16 BITCOIND_BIN=$(top_builddir)/src/$(BITCOIN_DAEMON_NAME)$(EXEEXT)
17 BITCOIN_QT_BIN=$(top_builddir)/src/qt/$(BITCOIN_GUI_NAME)$(EXEEXT)
18 BITCOIN_CLI_BIN=$(top_builddir)/src/$(BITCOIN_CLI_NAME)$(EXEEXT)
19 BITCOIN_WIN_INSTALLER=$(PACKAGE)-$(PACKAGE_VERSION)-win$(WINDOWS_BITS)-setup$(EXEEXT)
21 empty :=
22 space := $(empty) $(empty)
24 OSX_APP=Bitcoin-Qt.app
25 OSX_VOLNAME = $(subst $(space),-,$(PACKAGE_NAME))
26 OSX_DMG = $(OSX_VOLNAME).dmg
27 OSX_BACKGROUND_SVG=background.svg
28 OSX_BACKGROUND_IMAGE=background.tiff
29 OSX_BACKGROUND_IMAGE_DPIS=36 72
30 OSX_DSSTORE_GEN=$(top_srcdir)/contrib/macdeploy/custom_dsstore.py
31 OSX_DEPLOY_SCRIPT=$(top_srcdir)/contrib/macdeploy/macdeployqtplus
32 OSX_FANCY_PLIST=$(top_srcdir)/contrib/macdeploy/fancy.plist
33 OSX_INSTALLER_ICONS=$(top_srcdir)/src/qt/res/icons/bitcoin.icns
34 OSX_PLIST=$(top_builddir)/share/qt/Info.plist #not installed
35 OSX_QT_TRANSLATIONS = da,de,es,hu,ru,uk,zh_CN,zh_TW
37 DIST_DOCS = $(wildcard doc/*.md) $(wildcard doc/release-notes/*.md)
39 BIN_CHECKS=$(top_srcdir)/contrib/devtools/symbol-check.py \
40            $(top_srcdir)/contrib/devtools/security-check.py
42 WINDOWS_PACKAGING = $(top_srcdir)/share/pixmaps/bitcoin.ico \
43   $(top_srcdir)/share/pixmaps/nsis-header.bmp \
44   $(top_srcdir)/share/pixmaps/nsis-wizard.bmp \
45   $(top_srcdir)/doc/README_windows.txt
47 OSX_PACKAGING = $(OSX_DEPLOY_SCRIPT) $(OSX_FANCY_PLIST) $(OSX_INSTALLER_ICONS) \
48   $(top_srcdir)/contrib/macdeploy/$(OSX_BACKGROUND_SVG) \
49   $(OSX_DSSTORE_GEN) \
50   $(top_srcdir)/contrib/macdeploy/detached-sig-apply.sh \
51   $(top_srcdir)/contrib/macdeploy/detached-sig-create.sh
53 COVERAGE_INFO = baseline_filtered_combined.info baseline.info \
54   leveldb_baseline.info test_bitcoin_filtered.info total_coverage.info \
55   baseline_filtered.info rpc_test.info rpc_test_filtered.info \
56   leveldb_baseline_filtered.info test_bitcoin_coverage.info test_bitcoin.info
58 dist-hook:
59         -$(GIT) archive --format=tar HEAD -- src/clientversion.cpp | $(AMTAR) -C $(top_distdir) -xf -
61 $(BITCOIN_WIN_INSTALLER): all-recursive
62         $(MKDIR_P) $(top_builddir)/release
63         STRIPPROG="$(STRIP)" $(INSTALL_STRIP_PROGRAM) $(BITCOIND_BIN) $(top_builddir)/release
64         STRIPPROG="$(STRIP)" $(INSTALL_STRIP_PROGRAM) $(BITCOIN_QT_BIN) $(top_builddir)/release
65         STRIPPROG="$(STRIP)" $(INSTALL_STRIP_PROGRAM) $(BITCOIN_CLI_BIN) $(top_builddir)/release
66         @test -f $(MAKENSIS) && $(MAKENSIS) -V2 $(top_builddir)/share/setup.nsi || \
67           echo error: could not build $@
68         @echo built $@
70 $(if $(findstring src/,$(MAKECMDGOALS)),$(MAKECMDGOALS), none): FORCE
71         $(MAKE) -C src $(patsubst src/%,%,$@)
73 $(OSX_APP)/Contents/PkgInfo:
74         $(MKDIR_P) $(@D)
75         @echo "APPL????" > $@
77 $(OSX_APP)/Contents/Resources/empty.lproj:
78         $(MKDIR_P) $(@D)
79         @touch $@ 
81 $(OSX_APP)/Contents/Info.plist: $(OSX_PLIST)
82         $(MKDIR_P) $(@D)
83         $(INSTALL_DATA) $< $@
85 $(OSX_APP)/Contents/Resources/bitcoin.icns: $(OSX_INSTALLER_ICONS)
86         $(MKDIR_P) $(@D)
87         $(INSTALL_DATA) $< $@
89 $(OSX_APP)/Contents/MacOS/Bitcoin-Qt: $(BITCOIN_QT_BIN)
90         $(MKDIR_P) $(@D)
91         STRIPPROG="$(STRIP)" $(INSTALL_STRIP_PROGRAM)  $< $@
93 $(OSX_APP)/Contents/Resources/Base.lproj/InfoPlist.strings:
94         $(MKDIR_P) $(@D)
95         echo '{ CFBundleDisplayName = "$(PACKAGE_NAME)"; CFBundleName = "$(PACKAGE_NAME)"; }' > $@
97 OSX_APP_BUILT=$(OSX_APP)/Contents/PkgInfo $(OSX_APP)/Contents/Resources/empty.lproj \
98   $(OSX_APP)/Contents/Resources/bitcoin.icns $(OSX_APP)/Contents/Info.plist \
99   $(OSX_APP)/Contents/MacOS/Bitcoin-Qt $(OSX_APP)/Contents/Resources/Base.lproj/InfoPlist.strings
101 osx_volname:
102         echo $(OSX_VOLNAME) >$@
104 if BUILD_DARWIN
105 $(OSX_DMG): $(OSX_APP_BUILT) $(OSX_PACKAGING)
106         $(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)
108 deploydir: $(OSX_DMG)
109 else
110 APP_DIST_DIR=$(top_builddir)/dist
111 APP_DIST_EXTRAS=$(APP_DIST_DIR)/.background/$(OSX_BACKGROUND_IMAGE) $(APP_DIST_DIR)/.DS_Store $(APP_DIST_DIR)/Applications
113 $(APP_DIST_DIR)/Applications:
114         @rm -f $@
115         @cd $(@D); $(LN_S) /Applications $(@F)
117 $(APP_DIST_EXTRAS): $(APP_DIST_DIR)/$(OSX_APP)/Contents/MacOS/Bitcoin-Qt
119 $(OSX_DMG): $(APP_DIST_EXTRAS)
120         $(GENISOIMAGE) -no-cache-inodes -D -l -probe -V "$(OSX_VOLNAME)" -no-pad -r -dir-mode 0755 -apple -o $@ dist
122 dpi%.$(OSX_BACKGROUND_IMAGE): contrib/macdeploy/$(OSX_BACKGROUND_SVG)
123         sed 's/PACKAGE_NAME/$(PACKAGE_NAME)/' < "$<" | $(RSVG_CONVERT) -f png -d $* -p $* | $(IMAGEMAGICK_CONVERT) - $@
124 OSX_BACKGROUND_IMAGE_DPIFILES := $(foreach dpi,$(OSX_BACKGROUND_IMAGE_DPIS),dpi$(dpi).$(OSX_BACKGROUND_IMAGE))
125 $(APP_DIST_DIR)/.background/$(OSX_BACKGROUND_IMAGE): $(OSX_BACKGROUND_IMAGE_DPIFILES)
126         $(MKDIR_P) $(@D)
127         $(TIFFCP) -c none $(OSX_BACKGROUND_IMAGE_DPIFILES) $@
129 $(APP_DIST_DIR)/.DS_Store: $(OSX_DSSTORE_GEN)
130         $(PYTHON) $< "$@" "$(OSX_VOLNAME)"
132 $(APP_DIST_DIR)/$(OSX_APP)/Contents/MacOS/Bitcoin-Qt: $(OSX_APP_BUILT) $(OSX_PACKAGING)
133         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
135 deploydir: $(APP_DIST_EXTRAS)
136 endif
138 if TARGET_DARWIN
139 appbundle: $(OSX_APP_BUILT)
140 deploy: $(OSX_DMG)
141 endif
142 if TARGET_WINDOWS
143 deploy: $(BITCOIN_WIN_INSTALLER)
144 endif
146 $(BITCOIN_QT_BIN): FORCE
147         $(MAKE) -C src qt/$(@F)
149 $(BITCOIND_BIN): FORCE
150         $(MAKE) -C src $(@F)
152 $(BITCOIN_CLI_BIN): FORCE
153         $(MAKE) -C src $(@F)
155 if USE_LCOV
157 baseline.info:
158         $(LCOV) -c -i -d $(abs_builddir)/src -o $@
160 baseline_filtered.info: baseline.info
161         $(LCOV) -r $< "/usr/include/*" -o $@
163 leveldb_baseline.info: baseline_filtered.info
164         $(LCOV) -c -i -d $(abs_builddir)/src/leveldb -b $(abs_builddir)/src/leveldb -o $@
166 leveldb_baseline_filtered.info: leveldb_baseline.info
167         $(LCOV) -r $< "/usr/include/*" -o $@
169 baseline_filtered_combined.info: leveldb_baseline_filtered.info baseline_filtered.info
170         $(LCOV) -a leveldb_baseline_filtered.info -a baseline_filtered.info -o $@
172 test_bitcoin.info: baseline_filtered_combined.info
173         $(MAKE) -C src/ check
174         $(LCOV) -c -d $(abs_builddir)/src -t test_bitcoin -o $@
175         $(LCOV) -z -d $(abs_builddir)/src
176         $(LCOV) -z -d $(abs_builddir)/src/leveldb
178 test_bitcoin_filtered.info: test_bitcoin.info
179         $(LCOV) -r $< "/usr/include/*" -o $@
181 rpc_test.info: test_bitcoin_filtered.info
182         -@TIMEOUT=15 python qa/pull-tester/rpc-tests.py $(EXTENDED_RPC_TESTS)
183         $(LCOV) -c -d $(abs_builddir)/src --t rpc-tests -o $@
184         $(LCOV) -z -d $(abs_builddir)/src
185         $(LCOV) -z -d $(abs_builddir)/src/leveldb
187 rpc_test_filtered.info: rpc_test.info
188         $(LCOV) -r $< "/usr/include/*" -o $@
190 test_bitcoin_coverage.info: baseline_filtered_combined.info test_bitcoin_filtered.info
191         $(LCOV) -a baseline_filtered.info -a leveldb_baseline_filtered.info -a test_bitcoin_filtered.info -o $@
193 total_coverage.info: baseline_filtered_combined.info test_bitcoin_filtered.info rpc_test_filtered.info
194         $(LCOV) -a baseline_filtered.info -a leveldb_baseline_filtered.info -a test_bitcoin_filtered.info -a rpc_test_filtered.info -o $@ | $(GREP) "\%" | $(AWK) '{ print substr($$3,2,50) "/" $$5 }' > coverage_percent.txt
196 test_bitcoin.coverage/.dirstamp:  test_bitcoin_coverage.info
197         $(GENHTML) -s $< -o $(@D)
198         @touch $@
200 total.coverage/.dirstamp: total_coverage.info
201         $(GENHTML) -s $< -o $(@D)
202         @touch $@
204 cov: test_bitcoin.coverage/.dirstamp total.coverage/.dirstamp
206 endif
208 dist_noinst_SCRIPTS = autogen.sh
210 EXTRA_DIST = $(top_srcdir)/share/genbuild.sh qa/pull-tester/rpc-tests.py qa/rpc-tests $(DIST_DOCS) $(WINDOWS_PACKAGING) $(OSX_PACKAGING) $(BIN_CHECKS)
212 CLEANFILES = $(OSX_DMG) $(BITCOIN_WIN_INSTALLER)
214 # This file is problematic for out-of-tree builds if it exists.
215 DISTCLEANFILES = qa/pull-tester/tests_config.pyc
217 .INTERMEDIATE: $(COVERAGE_INFO)
219 DISTCHECK_CONFIGURE_FLAGS = --enable-man
221 clean-local:
222         rm -rf coverage_percent.txt test_bitcoin.coverage/ total.coverage/ qa/tmp/ cache/ $(OSX_APP)
223         rm -rf qa/pull-tester/__pycache__