Merge #9980: Fix mem access violation merkleblock
[bitcoinplatinum.git] / src / Makefile.am
blob06b09404a767fe0bf591e6b07d26b657a881bae7
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 # consensus: shared between all executables that validate any consensus rules.
271 libbitcoin_consensus_a_CPPFLAGS = $(AM_CPPFLAGS) $(BITCOIN_INCLUDES)
272 libbitcoin_consensus_a_CXXFLAGS = $(AM_CXXFLAGS) $(PIE_FLAGS)
273 libbitcoin_consensus_a_SOURCES = \
274   amount.h \
275   arith_uint256.cpp \
276   arith_uint256.h \
277   consensus/merkle.cpp \
278   consensus/merkle.h \
279   consensus/params.h \
280   consensus/validation.h \
281   hash.cpp \
282   hash.h \
283   prevector.h \
284   primitives/block.cpp \
285   primitives/block.h \
286   primitives/transaction.cpp \
287   primitives/transaction.h \
288   pubkey.cpp \
289   pubkey.h \
290   script/bitcoinconsensus.cpp \
291   script/interpreter.cpp \
292   script/interpreter.h \
293   script/script.cpp \
294   script/script.h \
295   script/script_error.cpp \
296   script/script_error.h \
297   serialize.h \
298   tinyformat.h \
299   uint256.cpp \
300   uint256.h \
301   utilstrencodings.cpp \
302   utilstrencodings.h \
303   version.h
305 # common: shared between bitcoind, and bitcoin-qt and non-server tools
306 libbitcoin_common_a_CPPFLAGS = $(AM_CPPFLAGS) $(BITCOIN_INCLUDES)
307 libbitcoin_common_a_CXXFLAGS = $(AM_CXXFLAGS) $(PIE_FLAGS)
308 libbitcoin_common_a_SOURCES = \
309   base58.cpp \
310   chainparams.cpp \
311   coins.cpp \
312   compressor.cpp \
313   core_read.cpp \
314   core_write.cpp \
315   key.cpp \
316   keystore.cpp \
317   netaddress.cpp \
318   netbase.cpp \
319   policy/feerate.cpp \
320   protocol.cpp \
321   scheduler.cpp \
322   script/sign.cpp \
323   script/standard.cpp \
324   warnings.cpp \
325   $(BITCOIN_CORE_H)
327 # util: shared between all executables.
328 # This library *must* be included to make sure that the glibc
329 # backward-compatibility objects and their sanity checks are linked.
330 libbitcoin_util_a_CPPFLAGS = $(AM_CPPFLAGS) $(BITCOIN_INCLUDES)
331 libbitcoin_util_a_CXXFLAGS = $(AM_CXXFLAGS) $(PIE_FLAGS)
332 libbitcoin_util_a_SOURCES = \
333   support/lockedpool.cpp \
334   chainparamsbase.cpp \
335   clientversion.cpp \
336   compat/glibc_sanity.cpp \
337   compat/glibcxx_sanity.cpp \
338   compat/strnlen.cpp \
339   fs.cpp \
340   random.cpp \
341   rpc/protocol.cpp \
342   support/cleanse.cpp \
343   sync.cpp \
344   threadinterrupt.cpp \
345   util.cpp \
346   utilmoneystr.cpp \
347   utilstrencodings.cpp \
348   utiltime.cpp \
349   $(BITCOIN_CORE_H)
351 if GLIBC_BACK_COMPAT
352 libbitcoin_util_a_SOURCES += compat/glibc_compat.cpp
353 endif
355 # cli: shared between bitcoin-cli and bitcoin-qt
356 libbitcoin_cli_a_CPPFLAGS = $(AM_CPPFLAGS) $(BITCOIN_INCLUDES)
357 libbitcoin_cli_a_CXXFLAGS = $(AM_CXXFLAGS) $(PIE_FLAGS)
358 libbitcoin_cli_a_SOURCES = \
359   rpc/client.cpp \
360   $(BITCOIN_CORE_H)
362 nodist_libbitcoin_util_a_SOURCES = $(srcdir)/obj/build.h
365 # bitcoind binary #
366 bitcoind_SOURCES = bitcoind.cpp
367 bitcoind_CPPFLAGS = $(AM_CPPFLAGS) $(BITCOIN_INCLUDES)
368 bitcoind_CXXFLAGS = $(AM_CXXFLAGS) $(PIE_FLAGS)
369 bitcoind_LDFLAGS = $(RELDFLAGS) $(AM_LDFLAGS) $(LIBTOOL_APP_LDFLAGS)
371 if TARGET_WINDOWS
372 bitcoind_SOURCES += bitcoind-res.rc
373 endif
375 bitcoind_LDADD = \
376   $(LIBBITCOIN_SERVER) \
377   $(LIBBITCOIN_COMMON) \
378   $(LIBUNIVALUE) \
379   $(LIBBITCOIN_UTIL) \
380   $(LIBBITCOIN_WALLET) \
381   $(LIBBITCOIN_ZMQ) \
382   $(LIBBITCOIN_CONSENSUS) \
383   $(LIBBITCOIN_CRYPTO) \
384   $(LIBLEVELDB) \
385   $(LIBLEVELDB_SSE42) \
386   $(LIBMEMENV) \
387   $(LIBSECP256K1)
389 bitcoind_LDADD += $(BOOST_LIBS) $(BDB_LIBS) $(SSL_LIBS) $(CRYPTO_LIBS) $(MINIUPNPC_LIBS) $(EVENT_PTHREADS_LIBS) $(EVENT_LIBS) $(ZMQ_LIBS)
391 # bitcoin-cli binary #
392 bitcoin_cli_SOURCES = bitcoin-cli.cpp
393 bitcoin_cli_CPPFLAGS = $(AM_CPPFLAGS) $(BITCOIN_INCLUDES) $(EVENT_CFLAGS)
394 bitcoin_cli_CXXFLAGS = $(AM_CXXFLAGS) $(PIE_FLAGS)
395 bitcoin_cli_LDFLAGS = $(RELDFLAGS) $(AM_LDFLAGS) $(LIBTOOL_APP_LDFLAGS)
397 if TARGET_WINDOWS
398 bitcoin_cli_SOURCES += bitcoin-cli-res.rc
399 endif
401 bitcoin_cli_LDADD = \
402   $(LIBBITCOIN_CLI) \
403   $(LIBUNIVALUE) \
404   $(LIBBITCOIN_UTIL) \
405   $(LIBBITCOIN_CRYPTO)
407 bitcoin_cli_LDADD += $(BOOST_LIBS) $(SSL_LIBS) $(CRYPTO_LIBS) $(EVENT_LIBS)
410 # bitcoin-tx binary #
411 bitcoin_tx_SOURCES = bitcoin-tx.cpp
412 bitcoin_tx_CPPFLAGS = $(AM_CPPFLAGS) $(BITCOIN_INCLUDES)
413 bitcoin_tx_CXXFLAGS = $(AM_CXXFLAGS) $(PIE_FLAGS)
414 bitcoin_tx_LDFLAGS = $(RELDFLAGS) $(AM_LDFLAGS) $(LIBTOOL_APP_LDFLAGS)
416 if TARGET_WINDOWS
417 bitcoin_tx_SOURCES += bitcoin-tx-res.rc
418 endif
420 bitcoin_tx_LDADD = \
421   $(LIBUNIVALUE) \
422   $(LIBBITCOIN_COMMON) \
423   $(LIBBITCOIN_UTIL) \
424   $(LIBBITCOIN_CONSENSUS) \
425   $(LIBBITCOIN_CRYPTO) \
426   $(LIBSECP256K1)
428 bitcoin_tx_LDADD += $(BOOST_LIBS) $(CRYPTO_LIBS)
431 # bitcoinconsensus library #
432 if BUILD_BITCOIN_LIBS
433 include_HEADERS = script/bitcoinconsensus.h
434 libbitcoinconsensus_la_SOURCES = $(crypto_libbitcoin_crypto_a_SOURCES) $(libbitcoin_consensus_a_SOURCES)
436 if GLIBC_BACK_COMPAT
437   libbitcoinconsensus_la_SOURCES += compat/glibc_compat.cpp
438 endif
440 libbitcoinconsensus_la_LDFLAGS = $(AM_LDFLAGS) -no-undefined $(RELDFLAGS)
441 libbitcoinconsensus_la_LIBADD = $(LIBSECP256K1)
442 libbitcoinconsensus_la_CPPFLAGS = $(AM_CPPFLAGS) -I$(builddir)/obj -I$(srcdir)/secp256k1/include -DBUILD_BITCOIN_INTERNAL
443 libbitcoinconsensus_la_CXXFLAGS = $(AM_CXXFLAGS) $(PIE_FLAGS)
445 endif
448 CTAES_DIST =  crypto/ctaes/bench.c
449 CTAES_DIST += crypto/ctaes/ctaes.c
450 CTAES_DIST += crypto/ctaes/ctaes.h
451 CTAES_DIST += crypto/ctaes/README.md
452 CTAES_DIST += crypto/ctaes/test.c
454 CLEANFILES = $(EXTRA_LIBRARIES)
456 CLEANFILES += *.gcda *.gcno
457 CLEANFILES += compat/*.gcda compat/*.gcno
458 CLEANFILES += consensus/*.gcda consensus/*.gcno
459 CLEANFILES += crypto/*.gcda crypto/*.gcno
460 CLEANFILES += policy/*.gcda policy/*.gcno
461 CLEANFILES += primitives/*.gcda primitives/*.gcno
462 CLEANFILES += script/*.gcda script/*.gcno
463 CLEANFILES += support/*.gcda support/*.gcno
464 CLEANFILES += univalue/*.gcda univalue/*.gcno
465 CLEANFILES += wallet/*.gcda wallet/*.gcno
466 CLEANFILES += wallet/test/*.gcda wallet/test/*.gcno
467 CLEANFILES += zmq/*.gcda zmq/*.gcno
469 DISTCLEANFILES = obj/build.h
471 EXTRA_DIST = $(CTAES_DIST)
474 config/bitcoin-config.h: config/stamp-h1
475         @$(MAKE) -C $(top_builddir) $(subdir)/$(@)
476 config/stamp-h1: $(top_srcdir)/$(subdir)/config/bitcoin-config.h.in $(top_builddir)/config.status
477         $(AM_V_at)$(MAKE) -C $(top_builddir) $(subdir)/$(@)
478 $(top_srcdir)/$(subdir)/config/bitcoin-config.h.in:  $(am__configure_deps)
479         $(AM_V_at)$(MAKE) -C $(top_srcdir) $(subdir)/config/bitcoin-config.h.in
481 clean-local:
482         -$(MAKE) -C secp256k1 clean
483         -$(MAKE) -C univalue clean
484         -rm -f leveldb/*/*.gcda leveldb/*/*.gcno leveldb/helpers/memenv/*.gcda leveldb/helpers/memenv/*.gcno
485         -rm -f config.h
486         -rm -rf test/__pycache__
488 .rc.o:
489         @test -f $(WINDRES)
490         ## FIXME: How to get the appropriate modulename_CPPFLAGS in here?
491         $(AM_V_GEN) $(WINDRES) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(CPPFLAGS) -DWINDRES_PREPROC -i $< -o $@
493 .mm.o:
494         $(AM_V_CXX) $(OBJCXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \
495           $(CPPFLAGS) $(AM_CXXFLAGS) $(QT_INCLUDES) $(AM_CXXFLAGS) $(PIE_FLAGS) $(CXXFLAGS) -c -o $@ $<
497 check-symbols: $(bin_PROGRAMS)
498 if GLIBC_BACK_COMPAT
499         @echo "Checking glibc back compat..."
500         $(AM_V_at) READELF=$(READELF) CPPFILT=$(CPPFILT) $(top_srcdir)/contrib/devtools/symbol-check.py < $(bin_PROGRAMS)
501 endif
503 check-security: $(bin_PROGRAMS)
504 if HARDEN
505         @echo "Checking binary security..."
506         $(AM_V_at) READELF=$(READELF) OBJDUMP=$(OBJDUMP) $(top_srcdir)/contrib/devtools/security-check.py < $(bin_PROGRAMS)
507 endif
509 %.pb.cc %.pb.h: %.proto
510         @test -f $(PROTOC)
511         $(AM_V_GEN) $(PROTOC) --cpp_out=$(@D) --proto_path=$(<D) $<
513 if EMBEDDED_LEVELDB
514 include Makefile.leveldb.include
515 endif
517 if ENABLE_TESTS
518 include Makefile.test.include
519 endif
521 if ENABLE_BENCH
522 include Makefile.bench.include
523 endif
525 if ENABLE_QT
526 include Makefile.qt.include
527 endif
529 if ENABLE_QT_TESTS
530 include Makefile.qttest.include
531 endif