1 DIST_SUBDIRS = secp256k1 univalue cryptoconditions
3 AM_LDFLAGS = $(PTHREAD_CFLAGS) $(LIBTOOL_LDFLAGS) $(SAN_LDFLAGS) $(HARDENED_LDFLAGS)
4 AM_CXXFLAGS = $(SAN_CXXFLAGS) $(HARDENED_CXXFLAGS) $(ERROR_CXXFLAGS)
5 AM_CPPFLAGS = $(HARDENED_CPPFLAGS)
8 LEVELDB_CPPFLAGS += -I$(srcdir)/leveldb/include
9 LEVELDB_CPPFLAGS += -I$(srcdir)/leveldb/helpers/memenv
10 LIBLEVELDB += $(builddir)/leveldb/libleveldb.a
11 LIBMEMENV += $(builddir)/leveldb/libmemenv.a
13 # 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
14 $(LIBLEVELDB): $(LIBMEMENV)
16 $(LIBLEVELDB) $(LIBMEMENV):
17 @echo "Building LevelDB ..." && $(MAKE) -C $(@D) $(@F) CXX="$(CXX)" \
18 CC="$(CC)" PLATFORM=$(TARGET_OS) AR="$(AR)" $(LEVELDB_TARGET_FLAGS) \
19 OPT="$(AM_CXXFLAGS) $(PIE_FLAGS) $(CXXFLAGS) $(AM_CPPFLAGS) $(CPPFLAGS) -D__STDC_LIMIT_MACROS"
22 BITCOIN_CONFIG_INCLUDES=-I$(builddir)/config
23 BITCOIN_INCLUDES=-I$(builddir) -I$(builddir)/obj $(BOOST_CPPFLAGS) $(LEVELDB_CPPFLAGS) $(CRYPTO_CFLAGS) $(SSL_CFLAGS)
25 BITCOIN_INCLUDES += -I$(srcdir)/secp256k1/include
26 BITCOIN_INCLUDES += -I$(srcdir)/cryptoconditions/include
27 BITCOIN_INCLUDES += -I$(srcdir)/snark
28 BITCOIN_INCLUDES += -I$(srcdir)/snark/libsnark
29 BITCOIN_INCLUDES += -I$(srcdir)/univalue/include
32 LIBBITCOIN_SERVER=libbitcoin_server.a -lcurl
35 LIBBITCOIN_SERVER=libbitcoin_server.a -lcurl
37 LIBBITCOIN_SERVER=libbitcoin_server.a
40 LIBBITCOIN_WALLET=libbitcoin_wallet.a
41 LIBBITCOIN_COMMON=libbitcoin_common.a
42 LIBBITCOIN_CLI=libbitcoin_cli.a
43 LIBBITCOIN_UTIL=libbitcoin_util.a
44 LIBBITCOIN_CRYPTO=crypto/libbitcoin_crypto.a
45 LIBSECP256K1=secp256k1/libsecp256k1.la
46 LIBCRYPTOCONDITIONS=cryptoconditions/libcryptoconditions_core.la
47 LIBSNARK=snark/libsnark.a
48 LIBUNIVALUE=univalue/libunivalue.la
49 LIBZCASH=libzcash.a -lcurl
51 $(LIBSECP256K1): $(wildcard secp256k1/src/*) $(wildcard secp256k1/include/*)
52 $(AM_V_at)$(MAKE) $(AM_MAKEFLAGS) -C $(@D) $(@F)
54 LIBSNARK_CXXFLAGS = -fPIC -DBINARY_OUTPUT -DNO_PT_COMPRESSION=1 -fstack-protector-all
55 LIBSNARK_CONFIG_FLAGS = CURVE=ALT_BN128 NO_PROCPS=1 NO_DOCS=1 STATIC=1 NO_SUPERCOP=1 FEATUREFLAGS=-DMONTGOMERY_OUTPUT NO_COPY_DEPINST=1 NO_COMPILE_LIBGTEST=1
57 LIBSNARK_CONFIG_FLAGS += MULTICORE=1
60 $(LIBSNARK): $(wildcard snark/src/*)
61 $(AM_V_at) CXXFLAGS="$(LIBSNARK_CXXFLAGS)" $(MAKE) $(AM_MAKEFLAGS) -C snark/ DEPINST="$(LIBSNARK_DEPINST)" $(LIBSNARK_CONFIG_FLAGS) OPTFLAGS="-O2 -march=x86-64"
63 libsnark-tests: $(wildcard snark/src/*)
64 $(AM_V_at) CXXFLAGS="$(LIBSNARK_CXXFLAGS)" $(MAKE) $(AM_MAKEFLAGS) -C snark/ check DEPINST="$(LIBSNARK_DEPINST)" $(LIBSNARK_CONFIG_FLAGS) OPTFLAGS="-O2 -march=x86-64"
66 $(LIBUNIVALUE): $(wildcard univalue/lib/*)
67 $(AM_V_at)$(MAKE) $(AM_MAKEFLAGS) -C univalue/
69 $(LIBCRYPTOCONDITIONS): $(wildcard cryptoconditions/src/*) $(wildcard cryptoconditions/include/*)
70 $(AM_V_at)$(MAKE) $(AM_MAKEFLAGS) -C $(@D) $(@F)
72 # Make is not made aware of per-object dependencies to avoid limiting building parallelization
73 # But to build the less dependent modules first, we manually select their order here:
75 crypto/libbitcoin_crypto.a \
82 BITCOIN_INCLUDES += $(BDB_CPPFLAGS)
83 EXTRA_LIBRARIES += libbitcoin_wallet.a
86 EXTRA_LIBRARIES += libbitcoin_zmq.a
89 EXTRA_LIBRARIES += libbitcoin_proton.a
93 lib_LTLIBRARIES = libzcashconsensus.la
94 LIBZCASH_CONSENSUS=libzcashconsensus.la
104 bin_PROGRAMS += komodod
107 if BUILD_BITCOIN_UTILS
108 bin_PROGRAMS += komodo-cli komodo-tx
111 bin_PROGRAMS += wallet-utility
116 zcash/IncrementalMerkleTree.hpp \
117 zcash/NoteEncryption.hpp \
119 zcash/JoinSplit.hpp \
126 .PHONY: FORCE collate-libsnark check-symbols check-security
134 amqp/amqpabstractnotifier.h \
136 amqp/amqpnotificationinterface.h \
137 amqp/amqppublishnotifier.h \
140 asyncrpcoperation.h \
159 consensus/consensus.h \
161 consensus/upgrades.h \
162 consensus/validation.h \
183 paymentdisclosure.h \
184 paymentdisclosuredb.h \
188 primitives/transaction.h \
197 script/interpreter.h \
199 script/script_error.h \
200 script/serverchecker.h \
205 support/allocators/secure.h \
206 support/allocators/zeroafterfree.h \
209 support/pagelocker.h \
225 validationinterface.h \
227 wallet/asyncrpcoperation_mergetoaddress.h \
228 wallet/asyncrpcoperation_sendmany.h \
229 wallet/asyncrpcoperation_shieldcoinbase.h \
233 wallet/wallet_ismine.h \
235 zmq/zmqabstractnotifier.h \
237 zmq/zmqnotificationinterface.h \
238 zmq/zmqpublishnotifier.h
242 @$(MKDIR_P) $(builddir)/obj
243 @$(top_srcdir)/share/genbuild.sh $(abs_top_builddir)/src/obj/build.h \
245 libbitcoin_util_a-clientversion.$(OBJEXT): obj/build.h
248 libbitcoin_server_a_CPPFLAGS = $(AM_CPPFLAGS) $(BITCOIN_INCLUDES) $(EVENT_CFLAGS) $(EVENT_PTHREADS_CFLAGS)
249 libbitcoin_server_a_CXXFLAGS = $(AM_CXXFLAGS) $(PIE_FLAGS)
250 libbitcoin_server_a_SOURCES = \
255 asyncrpcoperation.cpp \
276 paymentdisclosure.cpp \
277 paymentdisclosuredb.cpp \
285 rpcrawtransaction.cpp \
287 script/serverchecker.cpp \
292 validationinterface.cpp \
297 LIBBITCOIN_ZMQ=libbitcoin_zmq.a
299 libbitcoin_zmq_a_CPPFLAGS = $(BITCOIN_INCLUDES) $(ZMQ_CFLAGS)
300 libbitcoin_zmq_a_CXXFLAGS = $(AM_CXXFLAGS) $(PIE_FLAGS)
301 libbitcoin_zmq_a_SOURCES = \
302 zmq/zmqabstractnotifier.cpp \
303 zmq/zmqnotificationinterface.cpp \
304 zmq/zmqpublishnotifier.cpp
308 LIBBITCOIN_PROTON=libbitcoin_proton.a
310 libbitcoin_proton_a_CPPFLAGS = $(BITCOIN_INCLUDES)
311 libbitcoin_proton_a_CXXFLAGS = $(AM_CXXFLAGS) $(PIE_FLAGS)
312 libbitcoin_proton_a_SOURCES = \
313 amqp/amqpabstractnotifier.cpp \
314 amqp/amqpnotificationinterface.cpp \
315 amqp/amqppublishnotifier.cpp
318 # wallet: zcashd, but only linked when wallet enabled
319 libbitcoin_wallet_a_CPPFLAGS = $(AM_CPPFLAGS) $(BITCOIN_INCLUDES)
320 libbitcoin_wallet_a_CXXFLAGS = $(AM_CXXFLAGS) $(PIE_FLAGS)
321 libbitcoin_wallet_a_SOURCES = \
326 wallet/asyncrpcoperation_mergetoaddress.cpp \
327 wallet/asyncrpcoperation_sendmany.cpp \
328 wallet/asyncrpcoperation_shieldcoinbase.cpp \
331 paymentdisclosure.cpp \
332 paymentdisclosuredb.cpp \
333 wallet/rpcdisclosure.cpp \
335 wallet/rpcwallet.cpp \
337 wallet/wallet_ismine.cpp \
338 wallet/walletdb.cpp \
342 # crypto primitives library
343 crypto_libbitcoin_crypto_a_CPPFLAGS = $(AM_CPPFLAGS) $(BITCOIN_CONFIG_INCLUDES)
344 crypto_libbitcoin_crypto_a_CXXFLAGS = $(AM_CXXFLAGS) $(PIE_FLAGS)
345 crypto_libbitcoin_crypto_a_SOURCES = \
347 crypto/equihash.cpp \
349 crypto/equihash.tcc \
350 crypto/hmac_sha256.cpp \
351 crypto/hmac_sha256.h \
352 crypto/hmac_sha512.cpp \
353 crypto/hmac_sha512.h \
354 crypto/ripemd160.cpp \
364 EQUIHASH_TROMP_SOURCES = \
365 pow/tromp/equi_miner.h \
367 pow/tromp/osx_barrier.h
369 crypto_libbitcoin_crypto_a_CPPFLAGS += \
370 -DEQUIHASH_TROMP_ATOMIC
371 crypto_libbitcoin_crypto_a_SOURCES += \
372 ${EQUIHASH_TROMP_SOURCES}
375 # common: shared between zcashd and non-server tools
376 libbitcoin_common_a_CPPFLAGS = $(AM_CPPFLAGS) $(BITCOIN_INCLUDES)
377 libbitcoin_common_a_CXXFLAGS = $(AM_CXXFLAGS) $(PIE_FLAGS)
378 libbitcoin_common_a_SOURCES = \
385 consensus/upgrades.cpp \
393 primitives/block.cpp \
394 primitives/transaction.cpp \
399 script/interpreter.cpp \
401 script/script_error.cpp \
403 script/standard.cpp \
407 # util: shared between all executables.
408 # This library *must* be included to make sure that the glibc
409 # backward-compatibility objects and their sanity checks are linked.
410 libbitcoin_util_a_CPPFLAGS = $(AM_CPPFLAGS) $(BITCOIN_INCLUDES)
411 libbitcoin_util_a_CXXFLAGS = $(AM_CXXFLAGS) $(PIE_FLAGS)
412 libbitcoin_util_a_SOURCES = \
413 support/pagelocker.cpp \
414 chainparamsbase.cpp \
416 compat/glibc_sanity.cpp \
417 compat/glibcxx_sanity.cpp \
421 support/cleanse.cpp \
426 utilstrencodings.cpp \
432 libbitcoin_util_a_SOURCES += compat/glibc_compat.cpp
436 libbitcoin_cli_a_CPPFLAGS = $(AM_CPPFLAGS) $(BITCOIN_INCLUDES)
437 libbitcoin_cli_a_CXXFLAGS = $(AM_CXXFLAGS) $(PIE_FLAGS)
438 libbitcoin_cli_a_SOURCES = \
443 nodist_libbitcoin_util_a_SOURCES = $(srcdir)/obj/build.h
447 komodod_SOURCES = bitcoind.cpp
448 komodod_CPPFLAGS = $(AM_CPPFLAGS) $(BITCOIN_INCLUDES)
449 komodod_CXXFLAGS = $(AM_CXXFLAGS) $(PIE_FLAGS)
450 komodod_LDFLAGS = $(RELDFLAGS) $(AM_LDFLAGS) $(LIBTOOL_APP_LDFLAGS)
453 komodod_SOURCES += bitcoind-res.rc
457 $(LIBBITCOIN_SERVER) \
458 $(LIBBITCOIN_COMMON) \
461 $(LIBBITCOIN_CRYPTO) \
467 $(LIBCRYPTOCONDITIONS)
470 komodod_LDADD += $(LIBBITCOIN_ZMQ) $(ZMQ_LIBS)
474 komodod_LDADD += libbitcoin_wallet.a
482 $(EVENT_PTHREADS_LIBS) \
484 $(LIBBITCOIN_CRYPTO) \
488 komodod_LDADD += $(LIBBITCOIN_PROTON) $(PROTON_LIBS)
491 # bitcoin-cli binary #
492 komodo_cli_SOURCES = bitcoin-cli.cpp
493 komodo_cli_CPPFLAGS = $(AM_CPPFLAGS) $(BITCOIN_INCLUDES) $(EVENT_CFLAGS)
494 komodo_cli_CXXFLAGS = $(AM_CXXFLAGS) $(PIE_FLAGS)
495 komodo_cli_LDFLAGS = $(RELDFLAGS) $(AM_LDFLAGS) $(LIBTOOL_APP_LDFLAGS)
497 # wallet-utility binary #
499 wallet_utility_SOURCES = wallet-utility.cpp
500 wallet_utility_CPPFLAGS = $(AM_CPPFLAGS) $(BITCOIN_INCLUDES)
501 wallet_utility_CXXFLAGS = $(AM_CXXFLAGS) $(PIE_FLAGS)
502 wallet_utility_LDFLAGS = $(RELDFLAGS) $(AM_LDFLAGS) $(LIBTOOL_APP_LDFLAGS)
506 komodo_cli_SOURCES += bitcoin-cli-res.rc
518 $(LIBBITCOIN_CRYPTO) \
522 wallet_utility_LDADD = \
523 libbitcoin_wallet.a \
524 $(LIBBITCOIN_COMMON) \
525 $(LIBBITCOIN_CRYPTO) \
534 $(LIBCRYPTOCONDITIONS)
538 komodo_tx_SOURCES = komodo-tx.cpp
539 komodo_tx_CPPFLAGS = $(AM_CPPFLAGS) $(BITCOIN_INCLUDES)
540 komodo_tx_CXXFLAGS = $(AM_CXXFLAGS) $(PIE_FLAGS)
541 komodo_tx_LDFLAGS = $(RELDFLAGS) $(AM_LDFLAGS) $(LIBTOOL_APP_LDFLAGS)
544 komodo_tx_SOURCES += bitcoin-tx-res.rc
547 # FIXME: Is libzcash needed for zcash_tx?
550 $(LIBBITCOIN_COMMON) \
555 $(LIBBITCOIN_CRYPTO) \
557 $(LIBCRYPTOCONDITIONS)
559 komodo_tx_LDADD += $(BOOST_LIBS) $(CRYPTO_LIBS)
562 # zcash protocol primitives #
563 libzcash_a_SOURCES = \
564 zcash/IncrementalMerkleTree.cpp \
565 zcash/NoteEncryption.cpp \
567 zcash/JoinSplit.cpp \
572 zcash/circuit/commitment.tcc \
573 zcash/circuit/gadget.tcc \
574 zcash/circuit/merkle.tcc \
575 zcash/circuit/note.tcc \
576 zcash/circuit/prfs.tcc \
577 zcash/circuit/utils.tcc
579 libzcash_a_CPPFLAGS = -DMULTICORE -fopenmp -fPIC -DBINARY_OUTPUT -DCURVE_ALT_BN128 -DBOOST_SPIRIT_THREADSAFE -DHAVE_BUILD_INFO -D__STDC_FORMAT_MACROS $(HARDENED_CPPFLAGS) $(HARDENED_CXXFLAGS) $(HARDENED_LDFLAGS) -pipe $(SAN_LDFLAGS) -O1 -g -Wstack-protector $(SAN_CXXFLAGS) -fstack-protector-all -fPIE -fvisibility=hidden -DSTATIC $(BITCOIN_INCLUDES)
581 libzcash_a_CXXFLAGS = $(SAN_CXXFLAGS) $(HARDENED_CXXFLAGS) -fwrapv -fno-strict-aliasing
582 libzcash_a_LDFLAGS = $(SAN_LDFLAGS) $(HARDENED_LDFLAGS)
583 libzcash_a_CPPFLAGS += -DMONTGOMERY_OUTPUT
585 # zcashconsensus library #
586 if BUILD_BITCOIN_LIBS
587 include_HEADERS = script/zcashconsensus.h
588 libzcashconsensus_la_SOURCES = \
589 crypto/equihash.cpp \
590 crypto/hmac_sha512.cpp \
591 crypto/ripemd160.cpp \
596 primitives/transaction.cpp \
598 script/zcashconsensus.cpp \
599 script/interpreter.cpp \
605 libzcashconsensus_la_SOURCES += compat/glibc_compat.cpp
608 libzcashconsensus_la_LDFLAGS = $(AM_LDFLAGS) -no-undefined $(RELDFLAGS)
609 libzcashconsensus_la_LIBADD = $(LIBSECP256K1)
610 libzcashconsensus_la_CPPFLAGS = $(AM_CPPFLAGS) -I$(builddir)/obj -I$(srcdir)/secp256k1/include -I$(srcdir)/cryptoconditions/include -DBUILD_BITCOIN_INTERNAL
611 libzcashconsensus_la_CXXFLAGS = $(AM_CXXFLAGS) $(PIE_FLAGS)
616 CLEANFILES = leveldb/libleveldb.a leveldb/libmemenv.a *.gcda *.gcno */*.gcno wallet/*/*.gcno
618 DISTCLEANFILES = obj/build.h
620 EXTRA_DIST = leveldb snark
623 -$(MAKE) -C leveldb clean
624 -$(MAKE) -C secp256k1 clean
625 -$(MAKE) -C snark clean
626 rm -f leveldb/*/*.gcno leveldb/helpers/memenv/*.gcno
631 $(AM_V_GEN) $(WINDRES) -DWINDRES_PREPROC -i $< -o $@
634 $(AM_V_CXX) $(OBJCXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \
635 $(CPPFLAGS) $(AM_CXXFLAGS) $(AM_CXXFLAGS) $(PIE_FLAGS) $(CXXFLAGS) -c -o $@ $<
637 check-symbols: $(bin_PROGRAMS)
639 @echo "Checking glibc back compat of [$(bin_PROGRAMS)]..."
640 $(AM_V_at) READELF=$(READELF) CPPFILT=$(CPPFILT) $(top_srcdir)/contrib/devtools/symbol-check.py $(bin_PROGRAMS)
643 check-security: $(bin_PROGRAMS)
645 @echo "Checking binary security of [$(bin_PROGRAMS)]..."
646 $(AM_V_at) READELF=$(READELF) OBJDUMP=$(OBJDUMP) $(top_srcdir)/contrib/devtools/security-check.py $(bin_PROGRAMS)
649 %.pb.cc %.pb.h: %.proto
651 $(AM_V_GEN) $(PROTOC) --cpp_out=$(@D) --proto_path=$(abspath $(<D) $<)
654 include Makefile.ktest.include
655 #include Makefile.test.include
656 #include Makefile.gtest.include
659 include Makefile.zcash.include