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 \
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 = \
277 consensus/merkle.cpp \
280 consensus/validation.h \
284 primitives/block.cpp \
286 primitives/transaction.cpp \
287 primitives/transaction.h \
290 script/bitcoinconsensus.cpp \
291 script/interpreter.cpp \
292 script/interpreter.h \
295 script/script_error.cpp \
296 script/script_error.h \
301 utilstrencodings.cpp \
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 = \
323 script/standard.cpp \
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 \
336 compat/glibc_sanity.cpp \
337 compat/glibcxx_sanity.cpp \
342 support/cleanse.cpp \
344 threadinterrupt.cpp \
347 utilstrencodings.cpp \
352 libbitcoin_util_a_SOURCES += compat/glibc_compat.cpp
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 = \
362 nodist_libbitcoin_util_a_SOURCES = $(srcdir)/obj/build.h
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)
372 bitcoind_SOURCES += bitcoind-res.rc
376 $(LIBBITCOIN_SERVER) \
377 $(LIBBITCOIN_COMMON) \
380 $(LIBBITCOIN_WALLET) \
382 $(LIBBITCOIN_CONSENSUS) \
383 $(LIBBITCOIN_CRYPTO) \
385 $(LIBLEVELDB_SSE42) \
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)
398 bitcoin_cli_SOURCES += bitcoin-cli-res.rc
401 bitcoin_cli_LDADD = \
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)
417 bitcoin_tx_SOURCES += bitcoin-tx-res.rc
422 $(LIBBITCOIN_COMMON) \
424 $(LIBBITCOIN_CONSENSUS) \
425 $(LIBBITCOIN_CRYPTO) \
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)
437 libbitcoinconsensus_la_SOURCES += compat/glibc_compat.cpp
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)
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
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
486 -rm -rf test/__pycache__
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 $@
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)
499 @echo "Checking glibc back compat..."
500 $(AM_V_at) READELF=$(READELF) CPPFILT=$(CPPFILT) $(top_srcdir)/contrib/devtools/symbol-check.py < $(bin_PROGRAMS)
503 check-security: $(bin_PROGRAMS)
505 @echo "Checking binary security..."
506 $(AM_V_at) READELF=$(READELF) OBJDUMP=$(OBJDUMP) $(top_srcdir)/contrib/devtools/security-check.py < $(bin_PROGRAMS)
509 %.pb.cc %.pb.h: %.proto
511 $(AM_V_GEN) $(PROTOC) --cpp_out=$(@D) --proto_path=$(<D) $<
514 include Makefile.leveldb.include
518 include Makefile.test.include
522 include Makefile.bench.include
526 include Makefile.qt.include
530 include Makefile.qttest.include