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_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
37 LIBBITCOIN_ZMQ=libbitcoin_zmq.a
40 LIBBITCOINCONSENSUS=libbitcoinconsensus.la
43 LIBBITCOIN_WALLET=libbitcoin_wallet.a
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:
52 $(LIBBITCOIN_CRYPTO) \
54 $(LIBBITCOIN_COMMON) \
55 $(LIBBITCOIN_CONSENSUS) \
56 $(LIBBITCOIN_SERVER) \
58 $(LIBBITCOIN_WALLET) \
61 lib_LTLIBRARIES = $(LIBBITCOINCONSENSUS)
69 bin_PROGRAMS += bitcoind
72 if BUILD_BITCOIN_UTILS
73 bin_PROGRAMS += bitcoin-cli bitcoin-tx
76 .PHONY: FORCE check-symbols check-security
97 consensus/consensus.h \
98 consensus/tx_verify.h \
141 support/allocators/secure.h \
142 support/allocators/zeroafterfree.h \
145 support/lockedpool.h \
159 validationinterface.h \
161 wallet/coincontrol.h \
169 zmq/zmqabstractnotifier.h \
171 zmq/zmqnotificationinterface.h \
172 zmq/zmqpublishnotifier.h
176 @$(MKDIR_P) $(builddir)/obj
177 @$(top_srcdir)/share/genbuild.sh "$(abs_top_builddir)/src/obj/build.h" \
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 = \
191 consensus/tx_verify.cpp \
210 rpc/rawtransaction.cpp \
212 script/sigcache.cpp \
220 validationinterface.cpp \
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
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 = \
241 wallet/feebumper.cpp \
243 wallet/rpcwallet.cpp \
245 wallet/walletdb.cpp \
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 = \
255 crypto/chacha20.cpp \
257 crypto/hmac_sha256.cpp \
258 crypto/hmac_sha256.h \
259 crypto/hmac_sha512.cpp \
260 crypto/hmac_sha512.h \
261 crypto/ripemd160.cpp \
271 crypto_libbitcoin_crypto_a_SOURCES += crypto/sha256_sse4.cpp
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 = \
281 consensus/merkle.cpp \
284 consensus/validation.h \
288 primitives/block.cpp \
290 primitives/transaction.cpp \
291 primitives/transaction.h \
294 script/bitcoinconsensus.cpp \
295 script/interpreter.cpp \
296 script/interpreter.h \
299 script/script_error.cpp \
300 script/script_error.h \
305 utilstrencodings.cpp \
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 = \
327 script/standard.cpp \
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 \
340 compat/glibc_sanity.cpp \
341 compat/glibcxx_sanity.cpp \
346 support/cleanse.cpp \
348 threadinterrupt.cpp \
351 utilstrencodings.cpp \
356 libbitcoin_util_a_SOURCES += compat/glibc_compat.cpp
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 = \
366 nodist_libbitcoin_util_a_SOURCES = $(srcdir)/obj/build.h
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)
376 bitcoind_SOURCES += bitcoind-res.rc
380 $(LIBBITCOIN_SERVER) \
381 $(LIBBITCOIN_COMMON) \
384 $(LIBBITCOIN_WALLET) \
386 $(LIBBITCOIN_CONSENSUS) \
387 $(LIBBITCOIN_CRYPTO) \
389 $(LIBLEVELDB_SSE42) \
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)
402 bitcoin_cli_SOURCES += bitcoin-cli-res.rc
405 bitcoin_cli_LDADD = \
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)
421 bitcoin_tx_SOURCES += bitcoin-tx-res.rc
426 $(LIBBITCOIN_COMMON) \
428 $(LIBBITCOIN_CONSENSUS) \
429 $(LIBBITCOIN_CRYPTO) \
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)
441 libbitcoinconsensus_la_SOURCES += compat/glibc_compat.cpp
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)
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
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
490 -rm -rf test/__pycache__
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 $@
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)
503 @echo "Checking glibc back compat..."
504 $(AM_V_at) READELF=$(READELF) CPPFILT=$(CPPFILT) $(top_srcdir)/contrib/devtools/symbol-check.py < $(bin_PROGRAMS)
507 check-security: $(bin_PROGRAMS)
509 @echo "Checking binary security..."
510 $(AM_V_at) READELF=$(READELF) OBJDUMP=$(OBJDUMP) $(top_srcdir)/contrib/devtools/security-check.py < $(bin_PROGRAMS)
513 %.pb.cc %.pb.h: %.proto
515 $(AM_V_GEN) $(PROTOC) --cpp_out=$(@D) --proto_path=$(<D) $<
518 include Makefile.leveldb.include
522 include Makefile.test.include
526 include Makefile.bench.include
530 include Makefile.qt.include
534 include Makefile.qttest.include