1 DIST_SUBDIRS = secp256k1
2 AM_LDFLAGS = $(PTHREAD_CFLAGS) $(LIBTOOL_LDFLAGS)
6 LEVELDB_CPPFLAGS += -I$(srcdir)/leveldb/include
7 LEVELDB_CPPFLAGS += -I$(srcdir)/leveldb/helpers/memenv
8 LIBLEVELDB += $(builddir)/leveldb/libleveldb.a
9 LIBMEMENV += $(builddir)/leveldb/libmemenv.a
11 # NOTE: This dependency is not strictly necessary, but without it make may try to build both in parallel, which breaks the LevelDB build system in a race
12 $(LIBLEVELDB): $(LIBMEMENV)
14 $(LIBLEVELDB) $(LIBMEMENV):
15 @echo "Building LevelDB ..." && $(MAKE) -C $(@D) $(@F) CXX="$(CXX)" \
16 CC="$(CC)" PLATFORM=$(TARGET_OS) AR="$(AR)" $(LEVELDB_TARGET_FLAGS) \
17 OPT="$(CXXFLAGS) $(CPPFLAGS) -D__STDC_LIMIT_MACROS"
20 BITCOIN_CONFIG_INCLUDES=-I$(builddir)/config
21 BITCOIN_INCLUDES=-I$(builddir) -I$(builddir)/obj $(BOOST_CPPFLAGS) $(LEVELDB_CPPFLAGS) $(CRYPTO_CFLAGS) $(SSL_CFLAGS)
23 BITCOIN_INCLUDES += -I$(srcdir)/secp256k1/include
25 LIBBITCOIN_SERVER=libbitcoin_server.a
26 LIBBITCOIN_WALLET=libbitcoin_wallet.a
27 LIBBITCOIN_COMMON=libbitcoin_common.a
28 LIBBITCOIN_CLI=libbitcoin_cli.a
29 LIBBITCOIN_UTIL=libbitcoin_util.a
30 LIBBITCOIN_CRYPTO=crypto/libbitcoin_crypto.a
31 LIBBITCOIN_UNIVALUE=univalue/libbitcoin_univalue.a
32 LIBBITCOINQT=qt/libbitcoinqt.a
33 LIBSECP256K1=secp256k1/libsecp256k1.la
34 LIBZCASH=libzcash.a -lcurl
36 $(LIBSECP256K1): $(wildcard secp256k1/src/*) $(wildcard secp256k1/include/*)
37 $(AM_V_at)$(MAKE) $(AM_MAKEFLAGS) -C $(@D) $(@F)
39 # Make is not made aware of per-object dependencies to avoid limiting building parallelization
40 # But to build the less dependent modules first, we manually select their order here:
42 crypto/libbitcoin_crypto.a \
45 univalue/libbitcoin_univalue.a \
50 BITCOIN_INCLUDES += $(BDB_CPPFLAGS)
51 EXTRA_LIBRARIES += libbitcoin_wallet.a
55 lib_LTLIBRARIES = libbitcoinconsensus.la
56 LIBBITCOIN_CONSENSUS=libbitcoinconsensus.la
65 bin_PROGRAMS += komodod
68 if BUILD_BITCOIN_UTILS
69 bin_PROGRAMS += komodo-cli bitcoin-tx
73 zcash/IncrementalMerkleTree.hpp \
74 zcash/NoteEncryption.hpp \
83 .PHONY: FORCE check-symbols check-security
108 consensus/consensus.h \
110 consensus/validation.h \
131 primitives/transaction.h \
140 script/interpreter.h \
142 script/script_error.h \
148 support/allocators/secure.h \
149 support/allocators/zeroafterfree.h \
151 support/pagelocker.h \
166 validationinterface.h \
168 wallet/asyncrpcoperation_sendmany.h \
172 wallet/wallet_ismine.h \
177 json/json_spirit_error_position.h \
178 json/json_spirit_reader.h \
179 json/json_spirit_reader_template.h \
180 json/json_spirit_stream_reader.h \
181 json/json_spirit_utils.h \
182 json/json_spirit_value.h \
183 json/json_spirit_writer.h \
184 json/json_spirit_writer_template.h
187 @$(MKDIR_P) $(builddir)/obj
188 @$(top_srcdir)/share/genbuild.sh $(abs_top_builddir)/src/obj/build.h \
190 libbitcoin_util_a-clientversion.$(OBJEXT): obj/build.h
192 # server: shared between bitcoind and bitcoin-qt
193 libbitcoin_server_a_CPPFLAGS = $(BITCOIN_INCLUDES) $(MINIUPNPC_CPPFLAGS)
194 libbitcoin_server_a_SOURCES = \
199 asyncrpcoperation.cpp \
218 rpcrawtransaction.cpp \
220 script/sigcache.cpp \
224 validationinterface.cpp \
229 # wallet: shared between bitcoind and bitcoin-qt, but only linked
230 # when wallet enabled
231 libbitcoin_wallet_a_CPPFLAGS = $(BITCOIN_INCLUDES)
232 libbitcoin_wallet_a_SOURCES = \
235 wallet/asyncrpcoperation_sendmany.cpp \
239 wallet/rpcwallet.cpp \
241 wallet/wallet_ismine.cpp \
242 wallet/walletdb.cpp \
246 # crypto primitives library
247 crypto_libbitcoin_crypto_a_CPPFLAGS = $(BITCOIN_CONFIG_INCLUDES)
248 crypto_libbitcoin_crypto_a_SOURCES = \
250 crypto/equihash.cpp \
252 crypto/equihash.tcc \
253 crypto/hmac_sha256.cpp \
254 crypto/hmac_sha256.h \
255 crypto/hmac_sha512.cpp \
256 crypto/hmac_sha512.h \
257 crypto/ripemd160.cpp \
266 # univalue JSON library
267 univalue_libbitcoin_univalue_a_SOURCES = \
268 univalue/univalue.cpp \
269 univalue/univalue.h \
270 univalue/univalue_escapes.h \
271 univalue/univalue_read.cpp \
272 univalue/univalue_write.cpp
274 # common: shared between bitcoind, and bitcoin-qt and non-server tools
275 libbitcoin_common_a_CPPFLAGS = $(BITCOIN_INCLUDES)
276 libbitcoin_common_a_SOURCES = \
291 primitives/block.cpp \
292 primitives/transaction.cpp \
296 script/interpreter.cpp \
298 script/script_error.cpp \
300 script/standard.cpp \
304 # util: shared between all executables.
305 # This library *must* be included to make sure that the glibc
306 # backward-compatibility objects and their sanity checks are linked.
307 libbitcoin_util_a_CPPFLAGS = $(BITCOIN_INCLUDES)
308 libbitcoin_util_a_SOURCES = \
309 support/pagelocker.cpp \
310 chainparamsbase.cpp \
312 compat/glibc_sanity.cpp \
313 compat/glibcxx_sanity.cpp \
317 support/cleanse.cpp \
322 utilstrencodings.cpp \
328 libbitcoin_util_a_SOURCES += compat/glibc_compat.cpp
331 # cli: shared between bitcoin-cli and bitcoin-qt
332 libbitcoin_cli_a_CPPFLAGS = $(BITCOIN_INCLUDES)
333 libbitcoin_cli_a_SOURCES = \
338 nodist_libbitcoin_util_a_SOURCES = $(srcdir)/obj/build.h
342 komodod_SOURCES = bitcoind.cpp
343 komodod_CPPFLAGS = $(BITCOIN_INCLUDES)
344 komodod_LDFLAGS = $(RELDFLAGS) $(AM_LDFLAGS) $(LIBTOOL_APP_LDFLAGS)
347 komodod_SOURCES += bitcoind-res.rc
351 $(LIBBITCOIN_SERVER) \
352 $(LIBBITCOIN_COMMON) \
353 $(LIBBITCOIN_UNIVALUE) \
355 $(LIBBITCOIN_CRYPTO) \
362 komodod_LDADD += libbitcoin_wallet.a
372 $(LIBBITCOIN_CRYPTO) \
376 # bitcoin-cli binary #
377 komodo_cli_SOURCES = bitcoin-cli.cpp
378 komodo_cli_CPPFLAGS = $(BITCOIN_INCLUDES)
379 komodo_cli_LDFLAGS = $(RELDFLAGS) $(AM_LDFLAGS) $(LIBTOOL_APP_LDFLAGS)
382 komodo_cli_SOURCES += bitcoin-cli-res.rc
392 $(LIBBITCOIN_CRYPTO) \
396 # bitcoin-tx binary #
397 bitcoin_tx_SOURCES = bitcoin-tx.cpp
398 bitcoin_tx_CPPFLAGS = $(BITCOIN_INCLUDES)
399 bitcoin_tx_LDFLAGS = $(RELDFLAGS) $(AM_LDFLAGS) $(LIBTOOL_APP_LDFLAGS)
402 bitcoin_tx_SOURCES += bitcoin-tx-res.rc
405 # FIXME: Is libzcash needed for bitcoin_tx?
407 $(LIBBITCOIN_UNIVALUE) \
408 $(LIBBITCOIN_COMMON) \
412 $(LIBBITCOIN_CRYPTO) \
415 bitcoin_tx_LDADD += $(BOOST_LIBS) $(CRYPTO_LIBS)
418 # zcash protocol primitives #
419 libzcash_a_SOURCES = \
420 zcash/IncrementalMerkleTree.cpp \
421 zcash/NoteEncryption.cpp \
423 zcash/JoinSplit.cpp \
428 zcash/circuit/commitment.tcc \
429 zcash/circuit/gadget.tcc \
430 zcash/circuit/merkle.tcc \
431 zcash/circuit/note.tcc \
432 zcash/circuit/prfs.tcc \
433 zcash/circuit/utils.tcc
435 libzcash_a_CPPFLAGS = -DMULTICORE -fopenmp -fPIC -DBINARY_OUTPUT -DCURVE_ALT_BN128 -DBOOST_SPIRIT_THREADSAFE -DHAVE_BUILD_INFO -D__STDC_FORMAT_MACROS $(HARDENED_CPPFLAGS) -pipe -O1 -g -Wstack-protector -fstack-protector-all -fPIE -fvisibility=hidden -DSTATIC $(BITCOIN_INCLUDES)
437 libzcash_a_CXXFLAGS = $(HARDENED_CXXFLAGS) -fwrapv -fno-strict-aliasing
439 libzcash_a_LDFLAGS = $(HARDENED_LDFLAGS)
441 libzcash_a_CPPFLAGS += -DMONTGOMERY_OUTPUT
443 # bitcoinconsensus library #
444 if BUILD_BITCOIN_LIBS
445 include_HEADERS = script/bitcoinconsensus.h
446 libbitcoinconsensus_la_SOURCES = \
447 crypto/equihash.cpp \
448 crypto/hmac_sha512.cpp \
449 crypto/ripemd160.cpp \
456 primitives/transaction.cpp \
458 script/bitcoinconsensus.cpp \
459 script/interpreter.cpp \
465 libbitcoinconsensus_la_SOURCES += compat/glibc_compat.cpp
468 libbitcoinconsensus_la_LDFLAGS = -no-undefined $(RELDFLAGS)
469 libbitcoinconsensus_la_LIBADD = $(CRYPTO_LIBS)
470 libbitcoinconsensus_la_CPPFLAGS = $(CRYPTO_CFLAGS) -I$(builddir)/obj -DBUILD_BITCOIN_INTERNAL
475 CLEANFILES = leveldb/libleveldb.a leveldb/libmemenv.a *.gcda *.gcno
477 DISTCLEANFILES = obj/build.h
482 -$(MAKE) -C leveldb clean
483 -$(MAKE) -C secp256k1 clean
484 rm -f leveldb/*/*.gcno leveldb/helpers/memenv/*.gcno
489 $(AM_V_GEN) $(WINDRES) -DWINDRES_PREPROC -i $< -o $@
492 $(AM_V_CXX) $(OBJCXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \
493 $(CPPFLAGS) $(AM_CXXFLAGS) $(QT_INCLUDES) $(CXXFLAGS) -c -o $@ $<
495 check-symbols: $(bin_PROGRAMS)
497 @echo "Checking glibc back compat of [$(bin_PROGRAMS)]..."
498 $(AM_V_at) READELF=$(READELF) CPPFILT=$(CPPFILT) $(top_srcdir)/contrib/devtools/symbol-check.py < $(bin_PROGRAMS)
501 check-security: $(bin_PROGRAMS)
503 @echo "Checking binary security of [$(bin_PROGRAMS)]..."
504 $(AM_V_at) READELF=$(READELF) OBJDUMP=$(OBJDUMP) $(top_srcdir)/contrib/devtools/security-check.py < $(bin_PROGRAMS)
507 %.pb.cc %.pb.h: %.proto
509 $(AM_V_GEN) $(PROTOC) --cpp_out=$(@D) --proto_path=$(abspath $(<D) $<)
512 include Makefile.test.include
513 include Makefile.gtest.include
517 include Makefile.qt.include
521 include Makefile.qttest.include
524 include Makefile.zcash.include