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 \
135 support/allocators/secure.h \
136 support/allocators/zeroafterfree.h \
139 support/lockedpool.h \
153 validationinterface.h \
155 wallet/coincontrol.h \
162 zmq/zmqabstractnotifier.h \
164 zmq/zmqnotificationinterface.h \
165 zmq/zmqpublishnotifier.h
169 @$(MKDIR_P) $(builddir)/obj
170 @$(top_srcdir)/share/genbuild.sh $(abs_top_builddir)/src/obj/build.h \
172 libbitcoin_util_a-clientversion.$(OBJEXT): obj/build.h
174 # server: shared between bitcoind and bitcoin-qt
175 libbitcoin_server_a_CPPFLAGS = $(AM_CPPFLAGS) $(BITCOIN_INCLUDES) $(MINIUPNPC_CPPFLAGS) $(EVENT_CFLAGS) $(EVENT_PTHREADS_CFLAGS)
176 libbitcoin_server_a_CXXFLAGS = $(AM_CXXFLAGS) $(PIE_FLAGS)
177 libbitcoin_server_a_SOURCES = \
201 rpc/rawtransaction.cpp \
203 script/sigcache.cpp \
211 validationinterface.cpp \
216 libbitcoin_zmq_a_CPPFLAGS = $(BITCOIN_INCLUDES) $(ZMQ_CFLAGS)
217 libbitcoin_zmq_a_CXXFLAGS = $(AM_CXXFLAGS) $(PIE_FLAGS)
218 libbitcoin_zmq_a_SOURCES = \
219 zmq/zmqabstractnotifier.cpp \
220 zmq/zmqnotificationinterface.cpp \
221 zmq/zmqpublishnotifier.cpp
225 # wallet: shared between bitcoind and bitcoin-qt, but only linked
226 # when wallet enabled
227 libbitcoin_wallet_a_CPPFLAGS = $(AM_CPPFLAGS) $(BITCOIN_INCLUDES)
228 libbitcoin_wallet_a_CXXFLAGS = $(AM_CXXFLAGS) $(PIE_FLAGS)
229 libbitcoin_wallet_a_SOURCES = \
233 wallet/rpcwallet.cpp \
235 wallet/walletdb.cpp \
239 # crypto primitives library
240 crypto_libbitcoin_crypto_a_CPPFLAGS = $(AM_CPPFLAGS) $(BITCOIN_CONFIG_INCLUDES)
241 crypto_libbitcoin_crypto_a_CXXFLAGS = $(AM_CXXFLAGS) $(PIE_FLAGS)
242 crypto_libbitcoin_crypto_a_SOURCES = \
246 crypto/hmac_sha256.cpp \
247 crypto/hmac_sha256.h \
248 crypto/hmac_sha512.cpp \
249 crypto/hmac_sha512.h \
250 crypto/ripemd160.cpp \
259 # consensus: shared between all executables that validate any consensus rules.
260 libbitcoin_consensus_a_CPPFLAGS = $(AM_CPPFLAGS) $(BITCOIN_INCLUDES)
261 libbitcoin_consensus_a_CXXFLAGS = $(AM_CXXFLAGS) $(PIE_FLAGS)
262 libbitcoin_consensus_a_SOURCES = \
266 consensus/merkle.cpp \
269 consensus/validation.h \
273 primitives/block.cpp \
275 primitives/transaction.cpp \
276 primitives/transaction.h \
279 script/bitcoinconsensus.cpp \
280 script/interpreter.cpp \
281 script/interpreter.h \
284 script/script_error.cpp \
285 script/script_error.h \
290 utilstrencodings.cpp \
294 # common: shared between bitcoind, and bitcoin-qt and non-server tools
295 libbitcoin_common_a_CPPFLAGS = $(AM_CPPFLAGS) $(BITCOIN_INCLUDES)
296 libbitcoin_common_a_CXXFLAGS = $(AM_CXXFLAGS) $(PIE_FLAGS)
297 libbitcoin_common_a_SOURCES = \
312 script/standard.cpp \
316 # util: shared between all executables.
317 # This library *must* be included to make sure that the glibc
318 # backward-compatibility objects and their sanity checks are linked.
319 libbitcoin_util_a_CPPFLAGS = $(AM_CPPFLAGS) $(BITCOIN_INCLUDES)
320 libbitcoin_util_a_CXXFLAGS = $(AM_CXXFLAGS) $(PIE_FLAGS)
321 libbitcoin_util_a_SOURCES = \
322 support/lockedpool.cpp \
323 chainparamsbase.cpp \
325 compat/glibc_sanity.cpp \
326 compat/glibcxx_sanity.cpp \
330 support/cleanse.cpp \
332 threadinterrupt.cpp \
335 utilstrencodings.cpp \
340 libbitcoin_util_a_SOURCES += compat/glibc_compat.cpp
343 # cli: shared between bitcoin-cli and bitcoin-qt
344 libbitcoin_cli_a_CPPFLAGS = $(AM_CPPFLAGS) $(BITCOIN_INCLUDES)
345 libbitcoin_cli_a_CXXFLAGS = $(AM_CXXFLAGS) $(PIE_FLAGS)
346 libbitcoin_cli_a_SOURCES = \
350 nodist_libbitcoin_util_a_SOURCES = $(srcdir)/obj/build.h
354 bitcoind_SOURCES = bitcoind.cpp
355 bitcoind_CPPFLAGS = $(AM_CPPFLAGS) $(BITCOIN_INCLUDES)
356 bitcoind_CXXFLAGS = $(AM_CXXFLAGS) $(PIE_FLAGS)
357 bitcoind_LDFLAGS = $(RELDFLAGS) $(AM_LDFLAGS) $(LIBTOOL_APP_LDFLAGS)
360 bitcoind_SOURCES += bitcoind-res.rc
364 $(LIBBITCOIN_SERVER) \
365 $(LIBBITCOIN_COMMON) \
368 $(LIBBITCOIN_WALLET) \
370 $(LIBBITCOIN_CONSENSUS) \
371 $(LIBBITCOIN_CRYPTO) \
376 bitcoind_LDADD += $(BOOST_LIBS) $(BDB_LIBS) $(SSL_LIBS) $(CRYPTO_LIBS) $(MINIUPNPC_LIBS) $(EVENT_PTHREADS_LIBS) $(EVENT_LIBS) $(ZMQ_LIBS)
378 # bitcoin-cli binary #
379 bitcoin_cli_SOURCES = bitcoin-cli.cpp
380 bitcoin_cli_CPPFLAGS = $(AM_CPPFLAGS) $(BITCOIN_INCLUDES) $(EVENT_CFLAGS)
381 bitcoin_cli_CXXFLAGS = $(AM_CXXFLAGS) $(PIE_FLAGS)
382 bitcoin_cli_LDFLAGS = $(RELDFLAGS) $(AM_LDFLAGS) $(LIBTOOL_APP_LDFLAGS)
385 bitcoin_cli_SOURCES += bitcoin-cli-res.rc
388 bitcoin_cli_LDADD = \
394 bitcoin_cli_LDADD += $(BOOST_LIBS) $(SSL_LIBS) $(CRYPTO_LIBS) $(EVENT_LIBS)
397 # bitcoin-tx binary #
398 bitcoin_tx_SOURCES = bitcoin-tx.cpp
399 bitcoin_tx_CPPFLAGS = $(AM_CPPFLAGS) $(BITCOIN_INCLUDES)
400 bitcoin_tx_CXXFLAGS = $(AM_CXXFLAGS) $(PIE_FLAGS)
401 bitcoin_tx_LDFLAGS = $(RELDFLAGS) $(AM_LDFLAGS) $(LIBTOOL_APP_LDFLAGS)
404 bitcoin_tx_SOURCES += bitcoin-tx-res.rc
409 $(LIBBITCOIN_COMMON) \
411 $(LIBBITCOIN_CONSENSUS) \
412 $(LIBBITCOIN_CRYPTO) \
415 bitcoin_tx_LDADD += $(BOOST_LIBS) $(CRYPTO_LIBS)
418 # bitcoinconsensus library #
419 if BUILD_BITCOIN_LIBS
420 include_HEADERS = script/bitcoinconsensus.h
421 libbitcoinconsensus_la_SOURCES = $(crypto_libbitcoin_crypto_a_SOURCES) $(libbitcoin_consensus_a_SOURCES)
424 libbitcoinconsensus_la_SOURCES += compat/glibc_compat.cpp
427 libbitcoinconsensus_la_LDFLAGS = $(AM_LDFLAGS) -no-undefined $(RELDFLAGS)
428 libbitcoinconsensus_la_LIBADD = $(LIBSECP256K1)
429 libbitcoinconsensus_la_CPPFLAGS = $(AM_CPPFLAGS) -I$(builddir)/obj -I$(srcdir)/secp256k1/include -DBUILD_BITCOIN_INTERNAL
430 libbitcoinconsensus_la_CXXFLAGS = $(AM_CXXFLAGS) $(PIE_FLAGS)
435 CTAES_DIST = crypto/ctaes/bench.c
436 CTAES_DIST += crypto/ctaes/ctaes.c
437 CTAES_DIST += crypto/ctaes/ctaes.h
438 CTAES_DIST += crypto/ctaes/README.md
439 CTAES_DIST += crypto/ctaes/test.c
441 CLEANFILES = $(EXTRA_LIBRARIES)
443 CLEANFILES += *.gcda *.gcno
444 CLEANFILES += compat/*.gcda compat/*.gcno
445 CLEANFILES += consensus/*.gcda consensus/*.gcno
446 CLEANFILES += crypto/*.gcda crypto/*.gcno
447 CLEANFILES += policy/*.gcda policy/*.gcno
448 CLEANFILES += primitives/*.gcda primitives/*.gcno
449 CLEANFILES += script/*.gcda script/*.gcno
450 CLEANFILES += support/*.gcda support/*.gcno
451 CLEANFILES += univalue/*.gcda univalue/*.gcno
452 CLEANFILES += wallet/*.gcda wallet/*.gcno
453 CLEANFILES += wallet/test/*.gcda wallet/test/*.gcno
454 CLEANFILES += zmq/*.gcda zmq/*.gcno
456 DISTCLEANFILES = obj/build.h
458 EXTRA_DIST = $(CTAES_DIST)
461 -$(MAKE) -C secp256k1 clean
462 -$(MAKE) -C univalue clean
463 -rm -f leveldb/*/*.gcda leveldb/*/*.gcno leveldb/helpers/memenv/*.gcda leveldb/helpers/memenv/*.gcno
465 -rm -rf test/__pycache__
469 ## FIXME: How to get the appropriate modulename_CPPFLAGS in here?
470 $(AM_V_GEN) $(WINDRES) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(CPPFLAGS) -DWINDRES_PREPROC -i $< -o $@
473 $(AM_V_CXX) $(OBJCXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \
474 $(CPPFLAGS) $(AM_CXXFLAGS) $(QT_INCLUDES) $(AM_CXXFLAGS) $(PIE_FLAGS) $(CXXFLAGS) -c -o $@ $<
476 check-symbols: $(bin_PROGRAMS)
478 @echo "Checking glibc back compat..."
479 $(AM_V_at) READELF=$(READELF) CPPFILT=$(CPPFILT) $(top_srcdir)/contrib/devtools/symbol-check.py < $(bin_PROGRAMS)
482 check-security: $(bin_PROGRAMS)
484 @echo "Checking binary security..."
485 $(AM_V_at) READELF=$(READELF) OBJDUMP=$(OBJDUMP) $(top_srcdir)/contrib/devtools/security-check.py < $(bin_PROGRAMS)
488 %.pb.cc %.pb.h: %.proto
490 $(AM_V_GEN) $(PROTOC) --cpp_out=$(@D) --proto_path=$(<D) $<
493 include Makefile.leveldb.include
497 include Makefile.test.include
501 include Makefile.bench.include
505 include Makefile.qt.include
509 include Makefile.qttest.include