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)
13 LIBUNIVALUE = univalue/libunivalue.la
15 $(LIBUNIVALUE): $(wildcard univalue/lib/*) $(wildcard univalue/include/*)
16 $(AM_V_at)$(MAKE) $(AM_MAKEFLAGS) -C $(@D) $(@F)
18 LIBUNIVALUE = $(UNIVALUE_LIBS)
21 BITCOIN_INCLUDES=-I$(builddir) $(BDB_CPPFLAGS) $(BOOST_CPPFLAGS) $(LEVELDB_CPPFLAGS) $(CRYPTO_CFLAGS) $(SSL_CFLAGS)
23 BITCOIN_INCLUDES += -I$(srcdir)/secp256k1/include
24 BITCOIN_INCLUDES += $(UNIVALUE_CFLAGS)
26 LIBBITCOIN_SERVER=libbitcoin_server.a
27 LIBBITCOIN_COMMON=libbitcoin_common.a
28 LIBBITCOIN_CONSENSUS=libbitcoin_consensus.a
29 LIBBITCOIN_CLI=libbitcoin_cli.a
30 LIBBITCOIN_UTIL=libbitcoin_util.a
31 LIBBITCOIN_CRYPTO=crypto/libbitcoin_crypto.a
32 LIBBITCOINQT=qt/libbitcoinqt.a
33 LIBSECP256K1=secp256k1/libsecp256k1.la
36 LIBBITCOIN_ZMQ=libbitcoin_zmq.a
39 LIBBITCOINCONSENSUS=libbitcoinconsensus.la
42 LIBBITCOIN_WALLET=libbitcoin_wallet.a
45 $(LIBSECP256K1): $(wildcard secp256k1/src/*) $(wildcard secp256k1/include/*)
46 $(AM_V_at)$(MAKE) $(AM_MAKEFLAGS) -C $(@D) $(@F)
48 # Make is not made aware of per-object dependencies to avoid limiting building parallelization
49 # But to build the less dependent modules first, we manually select their order here:
51 $(LIBBITCOIN_CRYPTO) \
53 $(LIBBITCOIN_COMMON) \
54 $(LIBBITCOIN_CONSENSUS) \
55 $(LIBBITCOIN_SERVER) \
57 $(LIBBITCOIN_WALLET) \
60 lib_LTLIBRARIES = $(LIBBITCOINCONSENSUS)
68 bin_PROGRAMS += bitcoind
71 if BUILD_BITCOIN_UTILS
72 bin_PROGRAMS += bitcoin-cli bitcoin-tx
75 .PHONY: FORCE check-symbols check-security
97 consensus/consensus.h \
98 consensus/tx_verify.h \
142 support/allocators/secure.h \
143 support/allocators/zeroafterfree.h \
146 support/lockedpool.h \
160 validationinterface.h \
162 wallet/coincontrol.h \
171 wallet/walletutil.h \
173 zmq/zmqabstractnotifier.h \
175 zmq/zmqnotificationinterface.h \
176 zmq/zmqpublishnotifier.h
180 @$(MKDIR_P) $(builddir)/obj
181 @$(top_srcdir)/share/genbuild.sh "$(abs_top_builddir)/src/obj/build.h" \
183 libbitcoin_util_a-clientversion.$(OBJEXT): obj/build.h
185 # server: shared between bitcoind and bitcoin-qt
186 libbitcoin_server_a_CPPFLAGS = $(AM_CPPFLAGS) $(BITCOIN_INCLUDES) $(MINIUPNPC_CPPFLAGS) $(EVENT_CFLAGS) $(EVENT_PTHREADS_CFLAGS)
187 libbitcoin_server_a_CXXFLAGS = $(AM_CXXFLAGS) $(PIE_FLAGS)
188 libbitcoin_server_a_SOURCES = \
195 consensus/tx_verify.cpp \
214 rpc/rawtransaction.cpp \
217 script/sigcache.cpp \
225 validationinterface.cpp \
230 libbitcoin_zmq_a_CPPFLAGS = $(BITCOIN_INCLUDES) $(ZMQ_CFLAGS)
231 libbitcoin_zmq_a_CXXFLAGS = $(AM_CXXFLAGS) $(PIE_FLAGS)
232 libbitcoin_zmq_a_SOURCES = \
233 zmq/zmqabstractnotifier.cpp \
234 zmq/zmqnotificationinterface.cpp \
235 zmq/zmqpublishnotifier.cpp
239 # wallet: shared between bitcoind and bitcoin-qt, but only linked
240 # when wallet enabled
241 libbitcoin_wallet_a_CPPFLAGS = $(AM_CPPFLAGS) $(BITCOIN_INCLUDES)
242 libbitcoin_wallet_a_CXXFLAGS = $(AM_CXXFLAGS) $(PIE_FLAGS)
243 libbitcoin_wallet_a_SOURCES = \
246 wallet/feebumper.cpp \
250 wallet/rpcwallet.cpp \
252 wallet/walletdb.cpp \
253 wallet/walletutil.cpp \
256 # crypto primitives library
257 crypto_libbitcoin_crypto_a_CPPFLAGS = $(AM_CPPFLAGS)
258 crypto_libbitcoin_crypto_a_CXXFLAGS = $(AM_CXXFLAGS) $(PIE_FLAGS)
259 crypto_libbitcoin_crypto_a_SOURCES = \
263 crypto/chacha20.cpp \
265 crypto/hmac_sha256.cpp \
266 crypto/hmac_sha256.h \
267 crypto/hmac_sha512.cpp \
268 crypto/hmac_sha512.h \
269 crypto/ripemd160.cpp \
279 crypto_libbitcoin_crypto_a_SOURCES += crypto/sha256_sse4.cpp
282 # consensus: shared between all executables that validate any consensus rules.
283 libbitcoin_consensus_a_CPPFLAGS = $(AM_CPPFLAGS) $(BITCOIN_INCLUDES)
284 libbitcoin_consensus_a_CXXFLAGS = $(AM_CXXFLAGS) $(PIE_FLAGS)
285 libbitcoin_consensus_a_SOURCES = \
289 consensus/merkle.cpp \
292 consensus/validation.h \
296 primitives/block.cpp \
298 primitives/transaction.cpp \
299 primitives/transaction.h \
302 script/bitcoinconsensus.cpp \
303 script/interpreter.cpp \
304 script/interpreter.h \
307 script/script_error.cpp \
308 script/script_error.h \
313 utilstrencodings.cpp \
317 # common: shared between bitcoind, and bitcoin-qt and non-server tools
318 libbitcoin_common_a_CPPFLAGS = $(AM_CPPFLAGS) $(BITCOIN_INCLUDES)
319 libbitcoin_common_a_CXXFLAGS = $(AM_CXXFLAGS) $(PIE_FLAGS)
320 libbitcoin_common_a_SOURCES = \
336 script/standard.cpp \
340 # util: shared between all executables.
341 # This library *must* be included to make sure that the glibc
342 # backward-compatibility objects and their sanity checks are linked.
343 libbitcoin_util_a_CPPFLAGS = $(AM_CPPFLAGS) $(BITCOIN_INCLUDES)
344 libbitcoin_util_a_CXXFLAGS = $(AM_CXXFLAGS) $(PIE_FLAGS)
345 libbitcoin_util_a_SOURCES = \
346 support/lockedpool.cpp \
347 chainparamsbase.cpp \
349 compat/glibc_sanity.cpp \
350 compat/glibcxx_sanity.cpp \
355 support/cleanse.cpp \
357 threadinterrupt.cpp \
360 utilstrencodings.cpp \
365 libbitcoin_util_a_SOURCES += compat/glibc_compat.cpp
368 # cli: shared between bitcoin-cli and bitcoin-qt
369 libbitcoin_cli_a_CPPFLAGS = $(AM_CPPFLAGS) $(BITCOIN_INCLUDES)
370 libbitcoin_cli_a_CXXFLAGS = $(AM_CXXFLAGS) $(PIE_FLAGS)
371 libbitcoin_cli_a_SOURCES = \
375 nodist_libbitcoin_util_a_SOURCES = $(srcdir)/obj/build.h
379 bitcoind_SOURCES = bitcoind.cpp
380 bitcoind_CPPFLAGS = $(AM_CPPFLAGS) $(BITCOIN_INCLUDES)
381 bitcoind_CXXFLAGS = $(AM_CXXFLAGS) $(PIE_FLAGS)
382 bitcoind_LDFLAGS = $(RELDFLAGS) $(AM_LDFLAGS) $(LIBTOOL_APP_LDFLAGS)
385 bitcoind_SOURCES += bitcoind-res.rc
389 $(LIBBITCOIN_SERVER) \
390 $(LIBBITCOIN_COMMON) \
393 $(LIBBITCOIN_WALLET) \
395 $(LIBBITCOIN_CONSENSUS) \
396 $(LIBBITCOIN_CRYPTO) \
398 $(LIBLEVELDB_SSE42) \
402 bitcoind_LDADD += $(BOOST_LIBS) $(BDB_LIBS) $(SSL_LIBS) $(CRYPTO_LIBS) $(MINIUPNPC_LIBS) $(EVENT_PTHREADS_LIBS) $(EVENT_LIBS) $(ZMQ_LIBS)
404 # bitcoin-cli binary #
405 bitcoin_cli_SOURCES = bitcoin-cli.cpp
406 bitcoin_cli_CPPFLAGS = $(AM_CPPFLAGS) $(BITCOIN_INCLUDES) $(EVENT_CFLAGS)
407 bitcoin_cli_CXXFLAGS = $(AM_CXXFLAGS) $(PIE_FLAGS)
408 bitcoin_cli_LDFLAGS = $(RELDFLAGS) $(AM_LDFLAGS) $(LIBTOOL_APP_LDFLAGS)
411 bitcoin_cli_SOURCES += bitcoin-cli-res.rc
414 bitcoin_cli_LDADD = \
420 bitcoin_cli_LDADD += $(BOOST_LIBS) $(SSL_LIBS) $(CRYPTO_LIBS) $(EVENT_LIBS)
423 # bitcoin-tx binary #
424 bitcoin_tx_SOURCES = bitcoin-tx.cpp
425 bitcoin_tx_CPPFLAGS = $(AM_CPPFLAGS) $(BITCOIN_INCLUDES)
426 bitcoin_tx_CXXFLAGS = $(AM_CXXFLAGS) $(PIE_FLAGS)
427 bitcoin_tx_LDFLAGS = $(RELDFLAGS) $(AM_LDFLAGS) $(LIBTOOL_APP_LDFLAGS)
430 bitcoin_tx_SOURCES += bitcoin-tx-res.rc
435 $(LIBBITCOIN_COMMON) \
437 $(LIBBITCOIN_CONSENSUS) \
438 $(LIBBITCOIN_CRYPTO) \
441 bitcoin_tx_LDADD += $(BOOST_LIBS) $(CRYPTO_LIBS)
444 # bitcoinconsensus library #
445 if BUILD_BITCOIN_LIBS
446 include_HEADERS = script/bitcoinconsensus.h
447 libbitcoinconsensus_la_SOURCES = $(crypto_libbitcoin_crypto_a_SOURCES) $(libbitcoin_consensus_a_SOURCES)
450 libbitcoinconsensus_la_SOURCES += compat/glibc_compat.cpp
453 libbitcoinconsensus_la_LDFLAGS = $(AM_LDFLAGS) -no-undefined $(RELDFLAGS)
454 libbitcoinconsensus_la_LIBADD = $(LIBSECP256K1)
455 libbitcoinconsensus_la_CPPFLAGS = $(AM_CPPFLAGS) -I$(builddir)/obj -I$(srcdir)/secp256k1/include -DBUILD_BITCOIN_INTERNAL
456 libbitcoinconsensus_la_CXXFLAGS = $(AM_CXXFLAGS) $(PIE_FLAGS)
461 CTAES_DIST = crypto/ctaes/bench.c
462 CTAES_DIST += crypto/ctaes/ctaes.c
463 CTAES_DIST += crypto/ctaes/ctaes.h
464 CTAES_DIST += crypto/ctaes/README.md
465 CTAES_DIST += crypto/ctaes/test.c
467 CLEANFILES = $(EXTRA_LIBRARIES)
469 CLEANFILES += *.gcda *.gcno
470 CLEANFILES += compat/*.gcda compat/*.gcno
471 CLEANFILES += consensus/*.gcda consensus/*.gcno
472 CLEANFILES += crypto/*.gcda crypto/*.gcno
473 CLEANFILES += policy/*.gcda policy/*.gcno
474 CLEANFILES += primitives/*.gcda primitives/*.gcno
475 CLEANFILES += script/*.gcda script/*.gcno
476 CLEANFILES += support/*.gcda support/*.gcno
477 CLEANFILES += univalue/*.gcda univalue/*.gcno
478 CLEANFILES += wallet/*.gcda wallet/*.gcno
479 CLEANFILES += wallet/test/*.gcda wallet/test/*.gcno
480 CLEANFILES += zmq/*.gcda zmq/*.gcno
481 CLEANFILES += obj/build.h
483 EXTRA_DIST = $(CTAES_DIST)
486 config/bitcoin-config.h: config/stamp-h1
487 @$(MAKE) -C $(top_builddir) $(subdir)/$(@)
488 config/stamp-h1: $(top_srcdir)/$(subdir)/config/bitcoin-config.h.in $(top_builddir)/config.status
489 $(AM_V_at)$(MAKE) -C $(top_builddir) $(subdir)/$(@)
490 $(top_srcdir)/$(subdir)/config/bitcoin-config.h.in: $(am__configure_deps)
491 $(AM_V_at)$(MAKE) -C $(top_srcdir) $(subdir)/config/bitcoin-config.h.in
494 -$(MAKE) -C secp256k1 clean
495 -$(MAKE) -C univalue clean
496 -rm -f leveldb/*/*.gcda leveldb/*/*.gcno leveldb/helpers/memenv/*.gcda leveldb/helpers/memenv/*.gcno
498 -rm -rf test/__pycache__
502 ## FIXME: How to get the appropriate modulename_CPPFLAGS in here?
503 $(AM_V_GEN) $(WINDRES) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(CPPFLAGS) -DWINDRES_PREPROC -i $< -o $@
505 check-symbols: $(bin_PROGRAMS)
507 @echo "Checking glibc back compat..."
508 $(AM_V_at) READELF=$(READELF) CPPFILT=$(CPPFILT) $(top_srcdir)/contrib/devtools/symbol-check.py < $(bin_PROGRAMS)
511 check-security: $(bin_PROGRAMS)
513 @echo "Checking binary security..."
514 $(AM_V_at) READELF=$(READELF) OBJDUMP=$(OBJDUMP) $(top_srcdir)/contrib/devtools/security-check.py < $(bin_PROGRAMS)
517 %.pb.cc %.pb.h: %.proto
519 $(AM_V_GEN) $(PROTOC) --cpp_out=$(@D) --proto_path=$(<D) $<
522 include Makefile.leveldb.include
526 include Makefile.test.include
530 include Makefile.bench.include
534 include Makefile.qt.include
538 include Makefile.qttest.include