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
110 bin_PROGRAMS += wallet-utility
115 zcash/IncrementalMerkleTree.hpp \
116 zcash/NoteEncryption.hpp \
118 zcash/JoinSplit.hpp \
125 .PHONY: FORCE collate-libsnark check-symbols check-security
133 amqp/amqpabstractnotifier.h \
135 amqp/amqpnotificationinterface.h \
136 amqp/amqppublishnotifier.h \
139 asyncrpcoperation.h \
158 consensus/consensus.h \
160 consensus/upgrades.h \
161 consensus/validation.h \
182 paymentdisclosure.h \
183 paymentdisclosuredb.h \
187 primitives/transaction.h \
196 script/interpreter.h \
198 script/script_error.h \
199 script/serverchecker.h \
204 support/allocators/secure.h \
205 support/allocators/zeroafterfree.h \
208 support/pagelocker.h \
224 validationinterface.h \
226 wallet/asyncrpcoperation_mergetoaddress.h \
227 wallet/asyncrpcoperation_sendmany.h \
228 wallet/asyncrpcoperation_shieldcoinbase.h \
232 wallet/wallet_ismine.h \
234 zmq/zmqabstractnotifier.h \
236 zmq/zmqnotificationinterface.h \
237 zmq/zmqpublishnotifier.h
241 @$(MKDIR_P) $(builddir)/obj
242 @$(top_srcdir)/share/genbuild.sh $(abs_top_builddir)/src/obj/build.h \
244 libbitcoin_util_a-clientversion.$(OBJEXT): obj/build.h
247 libbitcoin_server_a_CPPFLAGS = $(AM_CPPFLAGS) $(BITCOIN_INCLUDES) $(EVENT_CFLAGS) $(EVENT_PTHREADS_CFLAGS)
248 libbitcoin_server_a_CXXFLAGS = $(AM_CXXFLAGS) $(PIE_FLAGS)
249 libbitcoin_server_a_SOURCES = \
254 asyncrpcoperation.cpp \
258 cc/importpayout.cpp \
259 cc/disputepayout.cpp \
274 paymentdisclosure.cpp \
275 paymentdisclosuredb.cpp \
283 rpcrawtransaction.cpp \
285 script/serverchecker.cpp \
290 validationinterface.cpp \
295 LIBBITCOIN_ZMQ=libbitcoin_zmq.a
297 libbitcoin_zmq_a_CPPFLAGS = $(BITCOIN_INCLUDES) $(ZMQ_CFLAGS)
298 libbitcoin_zmq_a_CXXFLAGS = $(AM_CXXFLAGS) $(PIE_FLAGS)
299 libbitcoin_zmq_a_SOURCES = \
300 zmq/zmqabstractnotifier.cpp \
301 zmq/zmqnotificationinterface.cpp \
302 zmq/zmqpublishnotifier.cpp
306 LIBBITCOIN_PROTON=libbitcoin_proton.a
308 libbitcoin_proton_a_CPPFLAGS = $(BITCOIN_INCLUDES)
309 libbitcoin_proton_a_CXXFLAGS = $(AM_CXXFLAGS) $(PIE_FLAGS)
310 libbitcoin_proton_a_SOURCES = \
311 amqp/amqpabstractnotifier.cpp \
312 amqp/amqpnotificationinterface.cpp \
313 amqp/amqppublishnotifier.cpp
316 # wallet: zcashd, but only linked when wallet enabled
317 libbitcoin_wallet_a_CPPFLAGS = $(AM_CPPFLAGS) $(BITCOIN_INCLUDES)
318 libbitcoin_wallet_a_CXXFLAGS = $(AM_CXXFLAGS) $(PIE_FLAGS)
319 libbitcoin_wallet_a_SOURCES = \
324 wallet/asyncrpcoperation_mergetoaddress.cpp \
325 wallet/asyncrpcoperation_sendmany.cpp \
326 wallet/asyncrpcoperation_shieldcoinbase.cpp \
329 paymentdisclosure.cpp \
330 paymentdisclosuredb.cpp \
331 wallet/rpcdisclosure.cpp \
333 wallet/rpcwallet.cpp \
335 wallet/wallet_ismine.cpp \
336 wallet/walletdb.cpp \
340 # crypto primitives library
341 crypto_libbitcoin_crypto_a_CPPFLAGS = $(AM_CPPFLAGS) $(BITCOIN_CONFIG_INCLUDES)
342 crypto_libbitcoin_crypto_a_CXXFLAGS = $(AM_CXXFLAGS) $(PIE_FLAGS)
343 crypto_libbitcoin_crypto_a_SOURCES = \
345 crypto/equihash.cpp \
347 crypto/equihash.tcc \
348 crypto/hmac_sha256.cpp \
349 crypto/hmac_sha256.h \
350 crypto/hmac_sha512.cpp \
351 crypto/hmac_sha512.h \
352 crypto/ripemd160.cpp \
362 EQUIHASH_TROMP_SOURCES = \
363 pow/tromp/equi_miner.h \
365 pow/tromp/osx_barrier.h
367 crypto_libbitcoin_crypto_a_CPPFLAGS += \
368 -DEQUIHASH_TROMP_ATOMIC
369 crypto_libbitcoin_crypto_a_SOURCES += \
370 ${EQUIHASH_TROMP_SOURCES}
373 # common: shared between zcashd and non-server tools
374 libbitcoin_common_a_CPPFLAGS = $(AM_CPPFLAGS) $(BITCOIN_INCLUDES)
375 libbitcoin_common_a_CXXFLAGS = $(AM_CXXFLAGS) $(PIE_FLAGS)
376 libbitcoin_common_a_SOURCES = \
383 consensus/upgrades.cpp \
390 primitives/block.cpp \
391 primitives/transaction.cpp \
396 script/interpreter.cpp \
398 script/script_error.cpp \
400 script/standard.cpp \
404 # util: shared between all executables.
405 # This library *must* be included to make sure that the glibc
406 # backward-compatibility objects and their sanity checks are linked.
407 libbitcoin_util_a_CPPFLAGS = $(AM_CPPFLAGS) $(BITCOIN_INCLUDES)
408 libbitcoin_util_a_CXXFLAGS = $(AM_CXXFLAGS) $(PIE_FLAGS)
409 libbitcoin_util_a_SOURCES = \
410 support/pagelocker.cpp \
411 chainparamsbase.cpp \
413 compat/glibc_sanity.cpp \
414 compat/glibcxx_sanity.cpp \
418 support/cleanse.cpp \
423 utilstrencodings.cpp \
429 libbitcoin_util_a_SOURCES += compat/glibc_compat.cpp
433 libbitcoin_cli_a_CPPFLAGS = $(AM_CPPFLAGS) $(BITCOIN_INCLUDES)
434 libbitcoin_cli_a_CXXFLAGS = $(AM_CXXFLAGS) $(PIE_FLAGS)
435 libbitcoin_cli_a_SOURCES = \
440 nodist_libbitcoin_util_a_SOURCES = $(srcdir)/obj/build.h
444 komodod_SOURCES = bitcoind.cpp
445 komodod_CPPFLAGS = $(AM_CPPFLAGS) $(BITCOIN_INCLUDES)
446 komodod_CXXFLAGS = $(AM_CXXFLAGS) $(PIE_FLAGS)
447 komodod_LDFLAGS = $(RELDFLAGS) $(AM_LDFLAGS) $(LIBTOOL_APP_LDFLAGS)
450 komodod_SOURCES += bitcoind-res.rc
454 $(LIBBITCOIN_SERVER) \
455 $(LIBBITCOIN_COMMON) \
458 $(LIBBITCOIN_CRYPTO) \
464 $(LIBCRYPTOCONDITIONS)
467 komodod_LDADD += $(LIBBITCOIN_ZMQ) $(ZMQ_LIBS)
471 komodod_LDADD += libbitcoin_wallet.a
479 $(EVENT_PTHREADS_LIBS) \
481 $(LIBBITCOIN_CRYPTO) \
485 komodod_LDADD += $(LIBBITCOIN_PROTON) $(PROTON_LIBS)
488 # bitcoin-cli binary #
489 komodo_cli_SOURCES = bitcoin-cli.cpp
490 komodo_cli_CPPFLAGS = $(AM_CPPFLAGS) $(BITCOIN_INCLUDES) $(EVENT_CFLAGS)
491 komodo_cli_CXXFLAGS = $(AM_CXXFLAGS) $(PIE_FLAGS)
492 komodo_cli_LDFLAGS = $(RELDFLAGS) $(AM_LDFLAGS) $(LIBTOOL_APP_LDFLAGS)
494 # wallet-utility binary #
496 wallet_utility_SOURCES = wallet-utility.cpp
497 wallet_utility_CPPFLAGS = $(AM_CPPFLAGS) $(BITCOIN_INCLUDES)
498 wallet_utility_CXXFLAGS = $(AM_CXXFLAGS) $(PIE_FLAGS)
499 wallet_utility_LDFLAGS = $(RELDFLAGS) $(AM_LDFLAGS) $(LIBTOOL_APP_LDFLAGS)
503 komodo_cli_SOURCES += bitcoin-cli-res.rc
515 $(LIBBITCOIN_CRYPTO) \
519 wallet_utility_LDADD = \
520 libbitcoin_wallet.a \
521 $(LIBBITCOIN_COMMON) \
522 $(LIBBITCOIN_CRYPTO) \
534 komodo_tx_SOURCES = komodo-tx.cpp
535 komodo_tx_CPPFLAGS = $(AM_CPPFLAGS) $(BITCOIN_INCLUDES)
536 komodo_tx_CXXFLAGS = $(AM_CXXFLAGS) $(PIE_FLAGS)
537 komodo_tx_LDFLAGS = $(RELDFLAGS) $(AM_LDFLAGS) $(LIBTOOL_APP_LDFLAGS)
540 komodo_tx_SOURCES += bitcoin-tx-res.rc
543 # FIXME: Is libzcash needed for zcash_tx?
546 $(LIBBITCOIN_COMMON) \
551 $(LIBBITCOIN_CRYPTO) \
553 $(LIBCRYPTOCONDITIONS)
555 komodo_tx_LDADD += $(BOOST_LIBS) $(CRYPTO_LIBS)
558 # zcash protocol primitives #
559 libzcash_a_SOURCES = \
560 zcash/IncrementalMerkleTree.cpp \
561 zcash/NoteEncryption.cpp \
563 zcash/JoinSplit.cpp \
568 zcash/circuit/commitment.tcc \
569 zcash/circuit/gadget.tcc \
570 zcash/circuit/merkle.tcc \
571 zcash/circuit/note.tcc \
572 zcash/circuit/prfs.tcc \
573 zcash/circuit/utils.tcc
575 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)
577 libzcash_a_CXXFLAGS = $(SAN_CXXFLAGS) $(HARDENED_CXXFLAGS) -fwrapv -fno-strict-aliasing
578 libzcash_a_LDFLAGS = $(SAN_LDFLAGS) $(HARDENED_LDFLAGS)
579 libzcash_a_CPPFLAGS += -DMONTGOMERY_OUTPUT
581 # zcashconsensus library #
582 if BUILD_BITCOIN_LIBS
583 include_HEADERS = script/zcashconsensus.h
584 libzcashconsensus_la_SOURCES = \
585 crypto/equihash.cpp \
586 crypto/hmac_sha512.cpp \
587 crypto/ripemd160.cpp \
592 primitives/transaction.cpp \
594 script/zcashconsensus.cpp \
595 script/interpreter.cpp \
601 libzcashconsensus_la_SOURCES += compat/glibc_compat.cpp
604 libzcashconsensus_la_LDFLAGS = $(AM_LDFLAGS) -no-undefined $(RELDFLAGS)
605 libzcashconsensus_la_LIBADD = $(LIBSECP256K1)
606 libzcashconsensus_la_CPPFLAGS = $(AM_CPPFLAGS) -I$(builddir)/obj -I$(srcdir)/secp256k1/include -DBUILD_BITCOIN_INTERNAL
607 libzcashconsensus_la_CXXFLAGS = $(AM_CXXFLAGS) $(PIE_FLAGS)
612 CLEANFILES = leveldb/libleveldb.a leveldb/libmemenv.a *.gcda *.gcno */*.gcno wallet/*/*.gcno
614 DISTCLEANFILES = obj/build.h
616 EXTRA_DIST = leveldb snark
619 -$(MAKE) -C leveldb clean
620 -$(MAKE) -C secp256k1 clean
621 -$(MAKE) -C snark clean
622 rm -f leveldb/*/*.gcno leveldb/helpers/memenv/*.gcno
627 $(AM_V_GEN) $(WINDRES) -DWINDRES_PREPROC -i $< -o $@
630 $(AM_V_CXX) $(OBJCXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \
631 $(CPPFLAGS) $(AM_CXXFLAGS) $(AM_CXXFLAGS) $(PIE_FLAGS) $(CXXFLAGS) -c -o $@ $<
633 check-symbols: $(bin_PROGRAMS)
635 @echo "Checking glibc back compat of [$(bin_PROGRAMS)]..."
636 $(AM_V_at) READELF=$(READELF) CPPFILT=$(CPPFILT) $(top_srcdir)/contrib/devtools/symbol-check.py $(bin_PROGRAMS)
639 check-security: $(bin_PROGRAMS)
641 @echo "Checking binary security of [$(bin_PROGRAMS)]..."
642 $(AM_V_at) READELF=$(READELF) OBJDUMP=$(OBJDUMP) $(top_srcdir)/contrib/devtools/security-check.py $(bin_PROGRAMS)
645 %.pb.cc %.pb.h: %.proto
647 $(AM_V_GEN) $(PROTOC) --cpp_out=$(@D) --proto_path=$(abspath $(<D) $<)
650 include Makefile.ktest.include
651 #include Makefile.test.include
652 #include Makefile.gtest.include
655 include Makefile.zcash.include