Merge #11023: [tests] Add option to attach a python debugger if functional test fails
[bitcoinplatinum.git] / src / Makefile.am
blobf7abab482e9e6ef338bee3bc710de3fe5e65a588
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 DIST_SUBDIRS = secp256k1 univalue
7 AM_LDFLAGS = $(PTHREAD_CFLAGS) $(LIBTOOL_LDFLAGS) $(HARDENED_LDFLAGS)
8 AM_CXXFLAGS = $(HARDENED_CXXFLAGS) $(ERROR_CXXFLAGS)
9 AM_CPPFLAGS = $(HARDENED_CPPFLAGS)
10 EXTRA_LIBRARIES =
12 if EMBEDDED_UNIVALUE
13 LIBUNIVALUE = univalue/libunivalue.la
15 $(LIBUNIVALUE): $(wildcard univalue/lib/*) $(wildcard univalue/include/*)
16         $(AM_V_at)$(MAKE) $(AM_MAKEFLAGS) -C $(@D) $(@F)
17 else
18 LIBUNIVALUE = $(UNIVALUE_LIBS)
19 endif
21 BITCOIN_CONFIG_INCLUDES=-I$(builddir)/config
22 BITCOIN_INCLUDES=-I$(builddir) -I$(builddir)/obj $(BDB_CPPFLAGS) $(BOOST_CPPFLAGS) $(LEVELDB_CPPFLAGS) $(CRYPTO_CFLAGS) $(SSL_CFLAGS)
24 BITCOIN_INCLUDES += -I$(srcdir)/secp256k1/include
25 BITCOIN_INCLUDES += $(UNIVALUE_CFLAGS)
27 LIBBITCOIN_SERVER=libbitcoin_server.a
28 LIBBITCOIN_COMMON=libbitcoin_common.a
29 LIBBITCOIN_CONSENSUS=libbitcoin_consensus.a
30 LIBBITCOIN_CLI=libbitcoin_cli.a
31 LIBBITCOIN_UTIL=libbitcoin_util.a
32 LIBBITCOIN_CRYPTO=crypto/libbitcoin_crypto.a
33 LIBBITCOINQT=qt/libbitcoinqt.a
34 LIBSECP256K1=secp256k1/libsecp256k1.la
36 if ENABLE_ZMQ
37 LIBBITCOIN_ZMQ=libbitcoin_zmq.a
38 endif
39 if BUILD_BITCOIN_LIBS
40 LIBBITCOINCONSENSUS=libbitcoinconsensus.la
41 endif
42 if ENABLE_WALLET
43 LIBBITCOIN_WALLET=libbitcoin_wallet.a
44 endif
46 $(LIBSECP256K1): $(wildcard secp256k1/src/*) $(wildcard secp256k1/include/*)
47         $(AM_V_at)$(MAKE) $(AM_MAKEFLAGS) -C $(@D) $(@F)
49 # Make is not made aware of per-object dependencies to avoid limiting building parallelization
50 # But to build the less dependent modules first, we manually select their order here:
51 EXTRA_LIBRARIES += \
52   $(LIBBITCOIN_CRYPTO) \
53   $(LIBBITCOIN_UTIL) \
54   $(LIBBITCOIN_COMMON) \
55   $(LIBBITCOIN_CONSENSUS) \
56   $(LIBBITCOIN_SERVER) \
57   $(LIBBITCOIN_CLI) \
58   $(LIBBITCOIN_WALLET) \
59   $(LIBBITCOIN_ZMQ)
61 lib_LTLIBRARIES = $(LIBBITCOINCONSENSUS)
63 bin_PROGRAMS =
64 noinst_PROGRAMS =
65 TESTS =
66 BENCHMARKS =
68 if BUILD_BITCOIND
69   bin_PROGRAMS += bitcoind
70 endif
72 if BUILD_BITCOIN_UTILS
73   bin_PROGRAMS += bitcoin-cli bitcoin-tx
74 endif
76 .PHONY: FORCE check-symbols check-security
77 # bitcoin core #
78 BITCOIN_CORE_H = \
79   addrdb.h \
80   addrman.h \
81   base58.h \
82   bloom.h \
83   blockencodings.h \
84   chain.h \
85   chainparams.h \
86   chainparamsbase.h \
87   chainparamsseeds.h \
88   checkpoints.h \
89   checkqueue.h \
90   clientversion.h \
91   coins.h \
92   compat.h \
93   compat/byteswap.h \
94   compat/endian.h \
95   compat/sanity.h \
96   compressor.h \
97   consensus/consensus.h \
98   consensus/tx_verify.h \
99   core_io.h \
100   core_memusage.h \
101   cuckoocache.h \
102   fs.h \
103   httprpc.h \
104   httpserver.h \
105   indirectmap.h \
106   init.h \
107   key.h \
108   keystore.h \
109   dbwrapper.h \
110   limitedmap.h \
111   memusage.h \
112   merkleblock.h \
113   miner.h \
114   net.h \
115   net_processing.h \
116   netaddress.h \
117   netbase.h \
118   netmessagemaker.h \
119   noui.h \
120   policy/feerate.h \
121   policy/fees.h \
122   policy/policy.h \
123   policy/rbf.h \
124   pow.h \
125   protocol.h \
126   random.h \
127   reverse_iterator.h \
128   reverselock.h \
129   rpc/blockchain.h \
130   rpc/client.h \
131   rpc/mining.h \
132   rpc/protocol.h \
133   rpc/server.h \
134   rpc/register.h \
135   scheduler.h \
136   script/sigcache.h \
137   script/sign.h \
138   script/standard.h \
139   script/ismine.h \
140   streams.h \
141   support/allocators/secure.h \
142   support/allocators/zeroafterfree.h \
143   support/cleanse.h \
144   support/events.h \
145   support/lockedpool.h \
146   sync.h \
147   threadsafety.h \
148   threadinterrupt.h \
149   timedata.h \
150   torcontrol.h \
151   txdb.h \
152   txmempool.h \
153   ui_interface.h \
154   undo.h \
155   util.h \
156   utilmoneystr.h \
157   utiltime.h \
158   validation.h \
159   validationinterface.h \
160   versionbits.h \
161   wallet/coincontrol.h \
162   wallet/crypter.h \
163   wallet/db.h \
164   wallet/feebumper.h \
165   wallet/rpcwallet.h \
166   wallet/wallet.h \
167   wallet/walletdb.h \
168   warnings.h \
169   zmq/zmqabstractnotifier.h \
170   zmq/zmqconfig.h\
171   zmq/zmqnotificationinterface.h \
172   zmq/zmqpublishnotifier.h
175 obj/build.h: FORCE
176         @$(MKDIR_P) $(builddir)/obj
177         @$(top_srcdir)/share/genbuild.sh "$(abs_top_builddir)/src/obj/build.h" \
178           "$(abs_top_srcdir)"
179 libbitcoin_util_a-clientversion.$(OBJEXT): obj/build.h
181 # server: shared between bitcoind and bitcoin-qt
182 libbitcoin_server_a_CPPFLAGS = $(AM_CPPFLAGS) $(BITCOIN_INCLUDES) $(MINIUPNPC_CPPFLAGS) $(EVENT_CFLAGS) $(EVENT_PTHREADS_CFLAGS)
183 libbitcoin_server_a_CXXFLAGS = $(AM_CXXFLAGS) $(PIE_FLAGS)
184 libbitcoin_server_a_SOURCES = \
185   addrdb.cpp \
186   addrman.cpp \
187   bloom.cpp \
188   blockencodings.cpp \
189   chain.cpp \
190   checkpoints.cpp \
191   consensus/tx_verify.cpp \
192   httprpc.cpp \
193   httpserver.cpp \
194   init.cpp \
195   dbwrapper.cpp \
196   merkleblock.cpp \
197   miner.cpp \
198   net.cpp \
199   net_processing.cpp \
200   noui.cpp \
201   policy/fees.cpp \
202   policy/policy.cpp \
203   policy/rbf.cpp \
204   pow.cpp \
205   rest.cpp \
206   rpc/blockchain.cpp \
207   rpc/mining.cpp \
208   rpc/misc.cpp \
209   rpc/net.cpp \
210   rpc/rawtransaction.cpp \
211   rpc/server.cpp \
212   script/sigcache.cpp \
213   script/ismine.cpp \
214   timedata.cpp \
215   torcontrol.cpp \
216   txdb.cpp \
217   txmempool.cpp \
218   ui_interface.cpp \
219   validation.cpp \
220   validationinterface.cpp \
221   versionbits.cpp \
222   $(BITCOIN_CORE_H)
224 if ENABLE_ZMQ
225 libbitcoin_zmq_a_CPPFLAGS = $(BITCOIN_INCLUDES) $(ZMQ_CFLAGS)
226 libbitcoin_zmq_a_CXXFLAGS = $(AM_CXXFLAGS) $(PIE_FLAGS)
227 libbitcoin_zmq_a_SOURCES = \
228   zmq/zmqabstractnotifier.cpp \
229   zmq/zmqnotificationinterface.cpp \
230   zmq/zmqpublishnotifier.cpp
231 endif
234 # wallet: shared between bitcoind and bitcoin-qt, but only linked
235 # when wallet enabled
236 libbitcoin_wallet_a_CPPFLAGS = $(AM_CPPFLAGS) $(BITCOIN_INCLUDES)
237 libbitcoin_wallet_a_CXXFLAGS = $(AM_CXXFLAGS) $(PIE_FLAGS)
238 libbitcoin_wallet_a_SOURCES = \
239   wallet/crypter.cpp \
240   wallet/db.cpp \
241   wallet/feebumper.cpp \
242   wallet/rpcdump.cpp \
243   wallet/rpcwallet.cpp \
244   wallet/wallet.cpp \
245   wallet/walletdb.cpp \
246   $(BITCOIN_CORE_H)
248 # crypto primitives library
249 crypto_libbitcoin_crypto_a_CPPFLAGS = $(AM_CPPFLAGS) $(BITCOIN_CONFIG_INCLUDES)
250 crypto_libbitcoin_crypto_a_CXXFLAGS = $(AM_CXXFLAGS) $(PIE_FLAGS)
251 crypto_libbitcoin_crypto_a_SOURCES = \
252   crypto/aes.cpp \
253   crypto/aes.h \
254   crypto/chacha20.h \
255   crypto/chacha20.cpp \
256   crypto/common.h \
257   crypto/hmac_sha256.cpp \
258   crypto/hmac_sha256.h \
259   crypto/hmac_sha512.cpp \
260   crypto/hmac_sha512.h \
261   crypto/ripemd160.cpp \
262   crypto/ripemd160.h \
263   crypto/sha1.cpp \
264   crypto/sha1.h \
265   crypto/sha256.cpp \
266   crypto/sha256.h \
267   crypto/sha512.cpp \
268   crypto/sha512.h
270 if EXPERIMENTAL_ASM
271 crypto_libbitcoin_crypto_a_SOURCES += crypto/sha256_sse4.cpp
272 endif
274 # consensus: shared between all executables that validate any consensus rules.
275 libbitcoin_consensus_a_CPPFLAGS = $(AM_CPPFLAGS) $(BITCOIN_INCLUDES)
276 libbitcoin_consensus_a_CXXFLAGS = $(AM_CXXFLAGS) $(PIE_FLAGS)
277 libbitcoin_consensus_a_SOURCES = \
278   amount.h \
279   arith_uint256.cpp \
280   arith_uint256.h \
281   consensus/merkle.cpp \
282   consensus/merkle.h \
283   consensus/params.h \
284   consensus/validation.h \
285   hash.cpp \
286   hash.h \
287   prevector.h \
288   primitives/block.cpp \
289   primitives/block.h \
290   primitives/transaction.cpp \
291   primitives/transaction.h \
292   pubkey.cpp \
293   pubkey.h \
294   script/bitcoinconsensus.cpp \
295   script/interpreter.cpp \
296   script/interpreter.h \
297   script/script.cpp \
298   script/script.h \
299   script/script_error.cpp \
300   script/script_error.h \
301   serialize.h \
302   tinyformat.h \
303   uint256.cpp \
304   uint256.h \
305   utilstrencodings.cpp \
306   utilstrencodings.h \
307   version.h
309 # common: shared between bitcoind, and bitcoin-qt and non-server tools
310 libbitcoin_common_a_CPPFLAGS = $(AM_CPPFLAGS) $(BITCOIN_INCLUDES)
311 libbitcoin_common_a_CXXFLAGS = $(AM_CXXFLAGS) $(PIE_FLAGS)
312 libbitcoin_common_a_SOURCES = \
313   base58.cpp \
314   chainparams.cpp \
315   coins.cpp \
316   compressor.cpp \
317   core_read.cpp \
318   core_write.cpp \
319   key.cpp \
320   keystore.cpp \
321   netaddress.cpp \
322   netbase.cpp \
323   policy/feerate.cpp \
324   protocol.cpp \
325   scheduler.cpp \
326   script/sign.cpp \
327   script/standard.cpp \
328   warnings.cpp \
329   $(BITCOIN_CORE_H)
331 # util: shared between all executables.
332 # This library *must* be included to make sure that the glibc
333 # backward-compatibility objects and their sanity checks are linked.
334 libbitcoin_util_a_CPPFLAGS = $(AM_CPPFLAGS) $(BITCOIN_INCLUDES)
335 libbitcoin_util_a_CXXFLAGS = $(AM_CXXFLAGS) $(PIE_FLAGS)
336 libbitcoin_util_a_SOURCES = \
337   support/lockedpool.cpp \
338   chainparamsbase.cpp \
339   clientversion.cpp \
340   compat/glibc_sanity.cpp \
341   compat/glibcxx_sanity.cpp \
342   compat/strnlen.cpp \
343   fs.cpp \
344   random.cpp \
345   rpc/protocol.cpp \
346   support/cleanse.cpp \
347   sync.cpp \
348   threadinterrupt.cpp \
349   util.cpp \
350   utilmoneystr.cpp \
351   utilstrencodings.cpp \
352   utiltime.cpp \
353   $(BITCOIN_CORE_H)
355 if GLIBC_BACK_COMPAT
356 libbitcoin_util_a_SOURCES += compat/glibc_compat.cpp
357 endif
359 # cli: shared between bitcoin-cli and bitcoin-qt
360 libbitcoin_cli_a_CPPFLAGS = $(AM_CPPFLAGS) $(BITCOIN_INCLUDES)
361 libbitcoin_cli_a_CXXFLAGS = $(AM_CXXFLAGS) $(PIE_FLAGS)
362 libbitcoin_cli_a_SOURCES = \
363   rpc/client.cpp \
364   $(BITCOIN_CORE_H)
366 nodist_libbitcoin_util_a_SOURCES = $(srcdir)/obj/build.h
369 # bitcoind binary #
370 bitcoind_SOURCES = bitcoind.cpp
371 bitcoind_CPPFLAGS = $(AM_CPPFLAGS) $(BITCOIN_INCLUDES)
372 bitcoind_CXXFLAGS = $(AM_CXXFLAGS) $(PIE_FLAGS)
373 bitcoind_LDFLAGS = $(RELDFLAGS) $(AM_LDFLAGS) $(LIBTOOL_APP_LDFLAGS)
375 if TARGET_WINDOWS
376 bitcoind_SOURCES += bitcoind-res.rc
377 endif
379 bitcoind_LDADD = \
380   $(LIBBITCOIN_SERVER) \
381   $(LIBBITCOIN_COMMON) \
382   $(LIBUNIVALUE) \
383   $(LIBBITCOIN_UTIL) \
384   $(LIBBITCOIN_WALLET) \
385   $(LIBBITCOIN_ZMQ) \
386   $(LIBBITCOIN_CONSENSUS) \
387   $(LIBBITCOIN_CRYPTO) \
388   $(LIBLEVELDB) \
389   $(LIBLEVELDB_SSE42) \
390   $(LIBMEMENV) \
391   $(LIBSECP256K1)
393 bitcoind_LDADD += $(BOOST_LIBS) $(BDB_LIBS) $(SSL_LIBS) $(CRYPTO_LIBS) $(MINIUPNPC_LIBS) $(EVENT_PTHREADS_LIBS) $(EVENT_LIBS) $(ZMQ_LIBS)
395 # bitcoin-cli binary #
396 bitcoin_cli_SOURCES = bitcoin-cli.cpp
397 bitcoin_cli_CPPFLAGS = $(AM_CPPFLAGS) $(BITCOIN_INCLUDES) $(EVENT_CFLAGS)
398 bitcoin_cli_CXXFLAGS = $(AM_CXXFLAGS) $(PIE_FLAGS)
399 bitcoin_cli_LDFLAGS = $(RELDFLAGS) $(AM_LDFLAGS) $(LIBTOOL_APP_LDFLAGS)
401 if TARGET_WINDOWS
402 bitcoin_cli_SOURCES += bitcoin-cli-res.rc
403 endif
405 bitcoin_cli_LDADD = \
406   $(LIBBITCOIN_CLI) \
407   $(LIBUNIVALUE) \
408   $(LIBBITCOIN_UTIL) \
409   $(LIBBITCOIN_CRYPTO)
411 bitcoin_cli_LDADD += $(BOOST_LIBS) $(SSL_LIBS) $(CRYPTO_LIBS) $(EVENT_LIBS)
414 # bitcoin-tx binary #
415 bitcoin_tx_SOURCES = bitcoin-tx.cpp
416 bitcoin_tx_CPPFLAGS = $(AM_CPPFLAGS) $(BITCOIN_INCLUDES)
417 bitcoin_tx_CXXFLAGS = $(AM_CXXFLAGS) $(PIE_FLAGS)
418 bitcoin_tx_LDFLAGS = $(RELDFLAGS) $(AM_LDFLAGS) $(LIBTOOL_APP_LDFLAGS)
420 if TARGET_WINDOWS
421 bitcoin_tx_SOURCES += bitcoin-tx-res.rc
422 endif
424 bitcoin_tx_LDADD = \
425   $(LIBUNIVALUE) \
426   $(LIBBITCOIN_COMMON) \
427   $(LIBBITCOIN_UTIL) \
428   $(LIBBITCOIN_CONSENSUS) \
429   $(LIBBITCOIN_CRYPTO) \
430   $(LIBSECP256K1)
432 bitcoin_tx_LDADD += $(BOOST_LIBS) $(CRYPTO_LIBS)
435 # bitcoinconsensus library #
436 if BUILD_BITCOIN_LIBS
437 include_HEADERS = script/bitcoinconsensus.h
438 libbitcoinconsensus_la_SOURCES = $(crypto_libbitcoin_crypto_a_SOURCES) $(libbitcoin_consensus_a_SOURCES)
440 if GLIBC_BACK_COMPAT
441   libbitcoinconsensus_la_SOURCES += compat/glibc_compat.cpp
442 endif
444 libbitcoinconsensus_la_LDFLAGS = $(AM_LDFLAGS) -no-undefined $(RELDFLAGS)
445 libbitcoinconsensus_la_LIBADD = $(LIBSECP256K1)
446 libbitcoinconsensus_la_CPPFLAGS = $(AM_CPPFLAGS) -I$(builddir)/obj -I$(srcdir)/secp256k1/include -DBUILD_BITCOIN_INTERNAL
447 libbitcoinconsensus_la_CXXFLAGS = $(AM_CXXFLAGS) $(PIE_FLAGS)
449 endif
452 CTAES_DIST =  crypto/ctaes/bench.c
453 CTAES_DIST += crypto/ctaes/ctaes.c
454 CTAES_DIST += crypto/ctaes/ctaes.h
455 CTAES_DIST += crypto/ctaes/README.md
456 CTAES_DIST += crypto/ctaes/test.c
458 CLEANFILES = $(EXTRA_LIBRARIES)
460 CLEANFILES += *.gcda *.gcno
461 CLEANFILES += compat/*.gcda compat/*.gcno
462 CLEANFILES += consensus/*.gcda consensus/*.gcno
463 CLEANFILES += crypto/*.gcda crypto/*.gcno
464 CLEANFILES += policy/*.gcda policy/*.gcno
465 CLEANFILES += primitives/*.gcda primitives/*.gcno
466 CLEANFILES += script/*.gcda script/*.gcno
467 CLEANFILES += support/*.gcda support/*.gcno
468 CLEANFILES += univalue/*.gcda univalue/*.gcno
469 CLEANFILES += wallet/*.gcda wallet/*.gcno
470 CLEANFILES += wallet/test/*.gcda wallet/test/*.gcno
471 CLEANFILES += zmq/*.gcda zmq/*.gcno
473 DISTCLEANFILES = obj/build.h
475 EXTRA_DIST = $(CTAES_DIST)
478 config/bitcoin-config.h: config/stamp-h1
479         @$(MAKE) -C $(top_builddir) $(subdir)/$(@)
480 config/stamp-h1: $(top_srcdir)/$(subdir)/config/bitcoin-config.h.in $(top_builddir)/config.status
481         $(AM_V_at)$(MAKE) -C $(top_builddir) $(subdir)/$(@)
482 $(top_srcdir)/$(subdir)/config/bitcoin-config.h.in:  $(am__configure_deps)
483         $(AM_V_at)$(MAKE) -C $(top_srcdir) $(subdir)/config/bitcoin-config.h.in
485 clean-local:
486         -$(MAKE) -C secp256k1 clean
487         -$(MAKE) -C univalue clean
488         -rm -f leveldb/*/*.gcda leveldb/*/*.gcno leveldb/helpers/memenv/*.gcda leveldb/helpers/memenv/*.gcno
489         -rm -f config.h
490         -rm -rf test/__pycache__
492 .rc.o:
493         @test -f $(WINDRES)
494         ## FIXME: How to get the appropriate modulename_CPPFLAGS in here?
495         $(AM_V_GEN) $(WINDRES) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(CPPFLAGS) -DWINDRES_PREPROC -i $< -o $@
497 .mm.o:
498         $(AM_V_CXX) $(OBJCXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \
499           $(CPPFLAGS) $(AM_CXXFLAGS) $(QT_INCLUDES) $(AM_CXXFLAGS) $(PIE_FLAGS) $(CXXFLAGS) -c -o $@ $<
501 check-symbols: $(bin_PROGRAMS)
502 if GLIBC_BACK_COMPAT
503         @echo "Checking glibc back compat..."
504         $(AM_V_at) READELF=$(READELF) CPPFILT=$(CPPFILT) $(top_srcdir)/contrib/devtools/symbol-check.py < $(bin_PROGRAMS)
505 endif
507 check-security: $(bin_PROGRAMS)
508 if HARDEN
509         @echo "Checking binary security..."
510         $(AM_V_at) READELF=$(READELF) OBJDUMP=$(OBJDUMP) $(top_srcdir)/contrib/devtools/security-check.py < $(bin_PROGRAMS)
511 endif
513 %.pb.cc %.pb.h: %.proto
514         @test -f $(PROTOC)
515         $(AM_V_GEN) $(PROTOC) --cpp_out=$(@D) --proto_path=$(<D) $<
517 if EMBEDDED_LEVELDB
518 include Makefile.leveldb.include
519 endif
521 if ENABLE_TESTS
522 include Makefile.test.include
523 endif
525 if ENABLE_BENCH
526 include Makefile.bench.include
527 endif
529 if ENABLE_QT
530 include Makefile.qt.include
531 endif
533 if ENABLE_QT_TESTS
534 include Makefile.qttest.include
535 endif