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 \
137 support/allocators/secure.h \
138 support/allocators/zeroafterfree.h \
141 support/lockedpool.h \
155 validationinterface.h \
157 wallet/coincontrol.h \
164 zmq/zmqabstractnotifier.h \
166 zmq/zmqnotificationinterface.h \
167 zmq/zmqpublishnotifier.h
171 @$(MKDIR_P) $(builddir)/obj
172 @$(top_srcdir)/share/genbuild.sh "$(abs_top_builddir)/src/obj/build.h" \
174 libbitcoin_util_a-clientversion.$(OBJEXT): obj/build.h
176 # server: shared between bitcoind and bitcoin-qt
177 libbitcoin_server_a_CPPFLAGS = $(AM_CPPFLAGS) $(BITCOIN_INCLUDES) $(MINIUPNPC_CPPFLAGS) $(EVENT_CFLAGS) $(EVENT_PTHREADS_CFLAGS)
178 libbitcoin_server_a_CXXFLAGS = $(AM_CXXFLAGS) $(PIE_FLAGS)
179 libbitcoin_server_a_SOURCES = \
203 rpc/rawtransaction.cpp \
205 script/sigcache.cpp \
213 validationinterface.cpp \
218 libbitcoin_zmq_a_CPPFLAGS = $(BITCOIN_INCLUDES) $(ZMQ_CFLAGS)
219 libbitcoin_zmq_a_CXXFLAGS = $(AM_CXXFLAGS) $(PIE_FLAGS)
220 libbitcoin_zmq_a_SOURCES = \
221 zmq/zmqabstractnotifier.cpp \
222 zmq/zmqnotificationinterface.cpp \
223 zmq/zmqpublishnotifier.cpp
227 # wallet: shared between bitcoind and bitcoin-qt, but only linked
228 # when wallet enabled
229 libbitcoin_wallet_a_CPPFLAGS = $(AM_CPPFLAGS) $(BITCOIN_INCLUDES)
230 libbitcoin_wallet_a_CXXFLAGS = $(AM_CXXFLAGS) $(PIE_FLAGS)
231 libbitcoin_wallet_a_SOURCES = \
235 wallet/rpcwallet.cpp \
237 wallet/walletdb.cpp \
241 # crypto primitives library
242 crypto_libbitcoin_crypto_a_CPPFLAGS = $(AM_CPPFLAGS) $(BITCOIN_CONFIG_INCLUDES)
243 crypto_libbitcoin_crypto_a_CXXFLAGS = $(AM_CXXFLAGS) $(PIE_FLAGS)
244 crypto_libbitcoin_crypto_a_SOURCES = \
248 crypto/hmac_sha256.cpp \
249 crypto/hmac_sha256.h \
250 crypto/hmac_sha512.cpp \
251 crypto/hmac_sha512.h \
252 crypto/ripemd160.cpp \
261 # consensus: shared between all executables that validate any consensus rules.
262 libbitcoin_consensus_a_CPPFLAGS = $(AM_CPPFLAGS) $(BITCOIN_INCLUDES)
263 libbitcoin_consensus_a_CXXFLAGS = $(AM_CXXFLAGS) $(PIE_FLAGS)
264 libbitcoin_consensus_a_SOURCES = \
268 consensus/merkle.cpp \
271 consensus/validation.h \
275 primitives/block.cpp \
277 primitives/transaction.cpp \
278 primitives/transaction.h \
281 script/bitcoinconsensus.cpp \
282 script/interpreter.cpp \
283 script/interpreter.h \
286 script/script_error.cpp \
287 script/script_error.h \
292 utilstrencodings.cpp \
296 # common: shared between bitcoind, and bitcoin-qt and non-server tools
297 libbitcoin_common_a_CPPFLAGS = $(AM_CPPFLAGS) $(BITCOIN_INCLUDES)
298 libbitcoin_common_a_CXXFLAGS = $(AM_CXXFLAGS) $(PIE_FLAGS)
299 libbitcoin_common_a_SOURCES = \
314 script/standard.cpp \
318 # util: shared between all executables.
319 # This library *must* be included to make sure that the glibc
320 # backward-compatibility objects and their sanity checks are linked.
321 libbitcoin_util_a_CPPFLAGS = $(AM_CPPFLAGS) $(BITCOIN_INCLUDES)
322 libbitcoin_util_a_CXXFLAGS = $(AM_CXXFLAGS) $(PIE_FLAGS)
323 libbitcoin_util_a_SOURCES = \
324 support/lockedpool.cpp \
325 chainparamsbase.cpp \
327 compat/glibc_sanity.cpp \
328 compat/glibcxx_sanity.cpp \
333 support/cleanse.cpp \
335 threadinterrupt.cpp \
338 utilstrencodings.cpp \
343 libbitcoin_util_a_SOURCES += compat/glibc_compat.cpp
346 # cli: shared between bitcoin-cli and bitcoin-qt
347 libbitcoin_cli_a_CPPFLAGS = $(AM_CPPFLAGS) $(BITCOIN_INCLUDES)
348 libbitcoin_cli_a_CXXFLAGS = $(AM_CXXFLAGS) $(PIE_FLAGS)
349 libbitcoin_cli_a_SOURCES = \
353 nodist_libbitcoin_util_a_SOURCES = $(srcdir)/obj/build.h
357 bitcoind_SOURCES = bitcoind.cpp
358 bitcoind_CPPFLAGS = $(AM_CPPFLAGS) $(BITCOIN_INCLUDES)
359 bitcoind_CXXFLAGS = $(AM_CXXFLAGS) $(PIE_FLAGS)
360 bitcoind_LDFLAGS = $(RELDFLAGS) $(AM_LDFLAGS) $(LIBTOOL_APP_LDFLAGS)
363 bitcoind_SOURCES += bitcoind-res.rc
367 $(LIBBITCOIN_SERVER) \
368 $(LIBBITCOIN_COMMON) \
371 $(LIBBITCOIN_WALLET) \
373 $(LIBBITCOIN_CONSENSUS) \
374 $(LIBBITCOIN_CRYPTO) \
379 bitcoind_LDADD += $(BOOST_LIBS) $(BDB_LIBS) $(SSL_LIBS) $(CRYPTO_LIBS) $(MINIUPNPC_LIBS) $(EVENT_PTHREADS_LIBS) $(EVENT_LIBS) $(ZMQ_LIBS)
381 # bitcoin-cli binary #
382 bitcoin_cli_SOURCES = bitcoin-cli.cpp
383 bitcoin_cli_CPPFLAGS = $(AM_CPPFLAGS) $(BITCOIN_INCLUDES) $(EVENT_CFLAGS)
384 bitcoin_cli_CXXFLAGS = $(AM_CXXFLAGS) $(PIE_FLAGS)
385 bitcoin_cli_LDFLAGS = $(RELDFLAGS) $(AM_LDFLAGS) $(LIBTOOL_APP_LDFLAGS)
388 bitcoin_cli_SOURCES += bitcoin-cli-res.rc
391 bitcoin_cli_LDADD = \
397 bitcoin_cli_LDADD += $(BOOST_LIBS) $(SSL_LIBS) $(CRYPTO_LIBS) $(EVENT_LIBS)
400 # bitcoin-tx binary #
401 bitcoin_tx_SOURCES = bitcoin-tx.cpp
402 bitcoin_tx_CPPFLAGS = $(AM_CPPFLAGS) $(BITCOIN_INCLUDES)
403 bitcoin_tx_CXXFLAGS = $(AM_CXXFLAGS) $(PIE_FLAGS)
404 bitcoin_tx_LDFLAGS = $(RELDFLAGS) $(AM_LDFLAGS) $(LIBTOOL_APP_LDFLAGS)
407 bitcoin_tx_SOURCES += bitcoin-tx-res.rc
412 $(LIBBITCOIN_COMMON) \
414 $(LIBBITCOIN_CONSENSUS) \
415 $(LIBBITCOIN_CRYPTO) \
418 bitcoin_tx_LDADD += $(BOOST_LIBS) $(CRYPTO_LIBS)
421 # bitcoinconsensus library #
422 if BUILD_BITCOIN_LIBS
423 include_HEADERS = script/bitcoinconsensus.h
424 libbitcoinconsensus_la_SOURCES = $(crypto_libbitcoin_crypto_a_SOURCES) $(libbitcoin_consensus_a_SOURCES)
427 libbitcoinconsensus_la_SOURCES += compat/glibc_compat.cpp
430 libbitcoinconsensus_la_LDFLAGS = $(AM_LDFLAGS) -no-undefined $(RELDFLAGS)
431 libbitcoinconsensus_la_LIBADD = $(LIBSECP256K1)
432 libbitcoinconsensus_la_CPPFLAGS = $(AM_CPPFLAGS) -I$(builddir)/obj -I$(srcdir)/secp256k1/include -DBUILD_BITCOIN_INTERNAL
433 libbitcoinconsensus_la_CXXFLAGS = $(AM_CXXFLAGS) $(PIE_FLAGS)
438 CTAES_DIST = crypto/ctaes/bench.c
439 CTAES_DIST += crypto/ctaes/ctaes.c
440 CTAES_DIST += crypto/ctaes/ctaes.h
441 CTAES_DIST += crypto/ctaes/README.md
442 CTAES_DIST += crypto/ctaes/test.c
444 CLEANFILES = $(EXTRA_LIBRARIES)
446 CLEANFILES += *.gcda *.gcno
447 CLEANFILES += compat/*.gcda compat/*.gcno
448 CLEANFILES += consensus/*.gcda consensus/*.gcno
449 CLEANFILES += crypto/*.gcda crypto/*.gcno
450 CLEANFILES += policy/*.gcda policy/*.gcno
451 CLEANFILES += primitives/*.gcda primitives/*.gcno
452 CLEANFILES += script/*.gcda script/*.gcno
453 CLEANFILES += support/*.gcda support/*.gcno
454 CLEANFILES += univalue/*.gcda univalue/*.gcno
455 CLEANFILES += wallet/*.gcda wallet/*.gcno
456 CLEANFILES += wallet/test/*.gcda wallet/test/*.gcno
457 CLEANFILES += zmq/*.gcda zmq/*.gcno
459 DISTCLEANFILES = obj/build.h
461 EXTRA_DIST = $(CTAES_DIST)
464 -$(MAKE) -C secp256k1 clean
465 -$(MAKE) -C univalue clean
466 -rm -f leveldb/*/*.gcda leveldb/*/*.gcno leveldb/helpers/memenv/*.gcda leveldb/helpers/memenv/*.gcno
468 -rm -rf test/__pycache__
472 ## FIXME: How to get the appropriate modulename_CPPFLAGS in here?
473 $(AM_V_GEN) $(WINDRES) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(CPPFLAGS) -DWINDRES_PREPROC -i $< -o $@
476 $(AM_V_CXX) $(OBJCXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \
477 $(CPPFLAGS) $(AM_CXXFLAGS) $(QT_INCLUDES) $(AM_CXXFLAGS) $(PIE_FLAGS) $(CXXFLAGS) -c -o $@ $<
479 check-symbols: $(bin_PROGRAMS)
481 @echo "Checking glibc back compat..."
482 $(AM_V_at) READELF=$(READELF) CPPFILT=$(CPPFILT) $(top_srcdir)/contrib/devtools/symbol-check.py < $(bin_PROGRAMS)
485 check-security: $(bin_PROGRAMS)
487 @echo "Checking binary security..."
488 $(AM_V_at) READELF=$(READELF) OBJDUMP=$(OBJDUMP) $(top_srcdir)/contrib/devtools/security-check.py < $(bin_PROGRAMS)
491 %.pb.cc %.pb.h: %.proto
493 $(AM_V_GEN) $(PROTOC) --cpp_out=$(@D) --proto_path=$(<D) $<
496 include Makefile.leveldb.include
500 include Makefile.test.include
504 include Makefile.bench.include
508 include Makefile.qt.include
512 include Makefile.qttest.include