1 DIST_SUBDIRS = secp256k1 snark univalue
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
24 BITCOIN_INCLUDES += -I$(srcdir)/snark/build/include
25 BITCOIN_INCLUDES += -I$(srcdir)/snark/build/include/libsnark
26 BITCOIN_INCLUDES += -I$(srcdir)/univalue/include
28 LIBBITCOIN_SERVER=libbitcoin_server.a
29 LIBBITCOIN_WALLET=libbitcoin_wallet.a
30 LIBBITCOIN_COMMON=libbitcoin_common.a
31 LIBBITCOIN_CLI=libbitcoin_cli.a
32 LIBBITCOIN_UTIL=libbitcoin_util.a
33 LIBBITCOIN_CRYPTO=crypto/libbitcoin_crypto.a
34 LIBSECP256K1=secp256k1/libsecp256k1.la
35 LIBSNARK=snark/build/lib/libsnark.a
36 LIBUNIVALUE=univalue/libunivalue.la
39 # libsnark is added as a dependency here solely to ensure it is built early, so
40 # that its header files are collated for use in later build steps.
41 $(LIBSECP256K1): $(LIBSNARK) $(wildcard secp256k1/src/*) $(wildcard secp256k1/include/*)
42 $(AM_V_at)$(MAKE) $(AM_MAKEFLAGS) -C $(@D) $(@F)
44 $(LIBSNARK): $(wildcard snark/src/*)
45 CXXFLAGS="-fPIC -DBINARY_OUTPUT -DNO_PT_COMPRESSION=1" $(AM_V_at)$(MAKE) $(AM_MAKEFLAGS) -C snark/ install PREFIX=$(srcdir)/build DEPINST=$(prefix) CURVE=ALT_BN128 MULTICORE=1 NO_PROCPS=1 NO_GTEST=1 NO_DOCS=1 STATIC=1 NO_SUPERCOP=1 FEATUREFLAGS=-DMONTGOMERY_OUTPUT OPTFLAGS="-O2 -march=x86-64"
47 $(LIBUNIVALUE): $(wildcard univalue/lib/*)
48 $(AM_V_at)$(MAKE) $(AM_MAKEFLAGS) -C univalue/
50 # Make is not made aware of per-object dependencies to avoid limiting building parallelization
51 # But to build the less dependent modules first, we manually select their order here:
53 crypto/libbitcoin_crypto.a \
60 BITCOIN_INCLUDES += $(BDB_CPPFLAGS)
61 EXTRA_LIBRARIES += libbitcoin_wallet.a
64 EXTRA_LIBRARIES += libbitcoin_zmq.a
67 EXTRA_LIBRARIES += libbitcoin_proton.a
71 lib_LTLIBRARIES = libzcashconsensus.la
72 LIBZCASH_CONSENSUS=libzcashconsensus.la
82 bin_PROGRAMS += zcashd
85 if BUILD_BITCOIN_UTILS
86 bin_PROGRAMS += zcash-cli zcash-tx
90 zcash/IncrementalMerkleTree.hpp \
91 zcash/NoteEncryption.hpp \
100 .PHONY: FORCE check-symbols check-security
106 amqp/amqpabstractnotifier.h \
108 amqp/amqpnotificationinterface.h \
109 amqp/amqppublishnotifier.h \
112 asyncrpcoperation.h \
130 consensus/consensus.h \
132 consensus/validation.h \
156 primitives/transaction.h \
165 script/interpreter.h \
167 script/script_error.h \
173 support/allocators/secure.h \
174 support/allocators/zeroafterfree.h \
177 support/pagelocker.h \
193 validationinterface.h \
195 wallet/asyncrpcoperation_sendmany.h \
199 wallet/wallet_ismine.h \
201 zmq/zmqabstractnotifier.h \
203 zmq/zmqnotificationinterface.h \
204 zmq/zmqpublishnotifier.h
208 @$(MKDIR_P) $(builddir)/obj
209 @$(top_srcdir)/share/genbuild.sh $(abs_top_builddir)/src/obj/build.h \
211 libbitcoin_util_a-clientversion.$(OBJEXT): obj/build.h
214 libbitcoin_server_a_CPPFLAGS = $(BITCOIN_INCLUDES) $(EVENT_CFLAGS) $(EVENT_PTHREADS_CFLAGS)
215 libbitcoin_server_a_SOURCES = \
220 asyncrpcoperation.cpp \
243 rpcrawtransaction.cpp \
245 script/sigcache.cpp \
250 validationinterface.cpp \
255 LIBBITCOIN_ZMQ=libbitcoin_zmq.a
257 libbitcoin_zmq_a_CPPFLAGS = $(BITCOIN_INCLUDES) $(ZMQ_CFLAGS)
258 libbitcoin_zmq_a_SOURCES = \
259 zmq/zmqabstractnotifier.cpp \
260 zmq/zmqnotificationinterface.cpp \
261 zmq/zmqpublishnotifier.cpp
265 LIBBITCOIN_PROTON=libbitcoin_proton.a
267 libbitcoin_proton_a_CPPFLAGS = $(BITCOIN_INCLUDES)
268 libbitcoin_proton_a_SOURCES = \
269 amqp/amqpabstractnotifier.cpp \
270 amqp/amqpnotificationinterface.cpp \
271 amqp/amqppublishnotifier.cpp
274 # wallet: zcashd, but only linked when wallet enabled
275 libbitcoin_wallet_a_CPPFLAGS = $(BITCOIN_INCLUDES)
276 libbitcoin_wallet_a_SOURCES = \
281 wallet/asyncrpcoperation_sendmany.cpp \
285 wallet/rpcwallet.cpp \
287 wallet/wallet_ismine.cpp \
288 wallet/walletdb.cpp \
292 # crypto primitives library
293 crypto_libbitcoin_crypto_a_CPPFLAGS = $(BITCOIN_CONFIG_INCLUDES)
294 crypto_libbitcoin_crypto_a_SOURCES = \
296 crypto/equihash.cpp \
298 crypto/equihash.tcc \
299 crypto/hmac_sha256.cpp \
300 crypto/hmac_sha256.h \
301 crypto/hmac_sha512.cpp \
302 crypto/hmac_sha512.h \
303 crypto/ripemd160.cpp \
313 EQUIHASH_TROMP_SOURCES = \
314 pow/tromp/equi_miner.h \
316 pow/tromp/osx_barrier.h
318 crypto_libbitcoin_crypto_a_CPPFLAGS += \
319 -DEQUIHASH_TROMP_ATOMIC
320 crypto_libbitcoin_crypto_a_SOURCES += \
321 ${EQUIHASH_TROMP_SOURCES}
324 # common: shared between zcashd and non-server tools
325 libbitcoin_common_a_CPPFLAGS = $(BITCOIN_INCLUDES)
326 libbitcoin_common_a_SOURCES = \
339 primitives/block.cpp \
340 primitives/transaction.cpp \
344 script/interpreter.cpp \
346 script/script_error.cpp \
348 script/standard.cpp \
352 # util: shared between all executables.
353 # This library *must* be included to make sure that the glibc
354 # backward-compatibility objects and their sanity checks are linked.
355 libbitcoin_util_a_CPPFLAGS = $(BITCOIN_INCLUDES)
356 libbitcoin_util_a_SOURCES = \
357 support/pagelocker.cpp \
358 chainparamsbase.cpp \
360 compat/glibc_sanity.cpp \
361 compat/glibcxx_sanity.cpp \
365 support/cleanse.cpp \
370 utilstrencodings.cpp \
376 libbitcoin_util_a_SOURCES += compat/glibc_compat.cpp
380 libbitcoin_cli_a_CPPFLAGS = $(BITCOIN_INCLUDES)
381 libbitcoin_cli_a_SOURCES = \
386 nodist_libbitcoin_util_a_SOURCES = $(srcdir)/obj/build.h
390 zcashd_SOURCES = bitcoind.cpp
391 zcashd_CPPFLAGS = $(BITCOIN_INCLUDES)
392 zcashd_LDFLAGS = $(RELDFLAGS) $(AM_LDFLAGS) $(LIBTOOL_APP_LDFLAGS)
395 zcashd_SOURCES += bitcoind-res.rc
399 $(LIBBITCOIN_SERVER) \
400 $(LIBBITCOIN_COMMON) \
403 $(LIBBITCOIN_CRYPTO) \
411 zcashd_LDADD += $(LIBBITCOIN_ZMQ) $(ZMQ_LIBS)
415 zcashd_LDADD += libbitcoin_wallet.a
423 $(EVENT_PTHREADS_LIBS) \
425 $(LIBBITCOIN_CRYPTO) \
429 zcashd_LDADD += $(LIBBITCOIN_PROTON) $(PROTON_LIBS)
432 # bitcoin-cli binary #
433 zcash_cli_SOURCES = bitcoin-cli.cpp
434 zcash_cli_CPPFLAGS = $(BITCOIN_INCLUDES) $(EVENT_CFLAGS)
435 zcash_cli_LDFLAGS = $(RELDFLAGS) $(AM_LDFLAGS) $(LIBTOOL_APP_LDFLAGS)
438 zcash_cli_SOURCES += bitcoin-cli-res.rc
451 $(LIBBITCOIN_CRYPTO) \
456 zcash_tx_SOURCES = bitcoin-tx.cpp
457 zcash_tx_CPPFLAGS = $(BITCOIN_INCLUDES)
458 zcash_tx_LDFLAGS = $(RELDFLAGS) $(AM_LDFLAGS) $(LIBTOOL_APP_LDFLAGS)
461 zcash_tx_SOURCES += bitcoin-tx-res.rc
464 # FIXME: Is libzcash needed for zcash_tx?
467 $(LIBBITCOIN_COMMON) \
472 $(LIBBITCOIN_CRYPTO) \
475 zcash_tx_LDADD += $(BOOST_LIBS) $(CRYPTO_LIBS)
478 # zcash protocol primitives #
479 libzcash_a_SOURCES = \
480 zcash/IncrementalMerkleTree.cpp \
481 zcash/NoteEncryption.cpp \
483 zcash/JoinSplit.cpp \
488 zcash/circuit/commitment.tcc \
489 zcash/circuit/gadget.tcc \
490 zcash/circuit/merkle.tcc \
491 zcash/circuit/note.tcc \
492 zcash/circuit/prfs.tcc \
493 zcash/circuit/utils.tcc
495 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)
497 libzcash_a_CXXFLAGS = $(HARDENED_CXXFLAGS) -fwrapv -fno-strict-aliasing
499 libzcash_a_LDFLAGS = $(HARDENED_LDFLAGS)
501 libzcash_a_CPPFLAGS += -DMONTGOMERY_OUTPUT
503 # zcashconsensus library #
504 if BUILD_BITCOIN_LIBS
505 include_HEADERS = script/zcashconsensus.h
506 libzcashconsensus_la_SOURCES = \
507 crypto/equihash.cpp \
508 crypto/hmac_sha512.cpp \
509 crypto/ripemd160.cpp \
514 primitives/transaction.cpp \
516 script/zcashconsensus.cpp \
517 script/interpreter.cpp \
523 libzcashconsensus_la_SOURCES += compat/glibc_compat.cpp
526 libzcashconsensus_la_LDFLAGS = -no-undefined $(RELDFLAGS)
527 libzcashconsensus_la_LIBADD = $(LIBSECP256K1)
528 libzcashconsensus_la_CPPFLAGS = -I$(builddir)/obj -I$(srcdir)/secp256k1/include -DBUILD_BITCOIN_INTERNAL
533 CLEANFILES = leveldb/libleveldb.a leveldb/libmemenv.a *.gcda *.gcno */*.gcno wallet/*/*.gcno
535 DISTCLEANFILES = obj/build.h
540 -$(MAKE) -C leveldb clean
541 -$(MAKE) -C secp256k1 clean
542 rm -f leveldb/*/*.gcno leveldb/helpers/memenv/*.gcno
547 $(AM_V_GEN) $(WINDRES) -DWINDRES_PREPROC -i $< -o $@
550 $(AM_V_CXX) $(OBJCXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \
551 $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o $@ $<
553 check-symbols: $(bin_PROGRAMS)
555 @echo "Checking glibc back compat of [$(bin_PROGRAMS)]..."
556 $(AM_V_at) READELF=$(READELF) CPPFILT=$(CPPFILT) $(top_srcdir)/contrib/devtools/symbol-check.py < $(bin_PROGRAMS)
559 check-security: $(bin_PROGRAMS)
561 @echo "Checking binary security of [$(bin_PROGRAMS)]..."
562 $(AM_V_at) READELF=$(READELF) OBJDUMP=$(OBJDUMP) $(top_srcdir)/contrib/devtools/security-check.py < $(bin_PROGRAMS)
565 %.pb.cc %.pb.h: %.proto
567 $(AM_V_GEN) $(PROTOC) --cpp_out=$(@D) --proto_path=$(abspath $(<D) $<)
570 include Makefile.test.include
571 include Makefile.gtest.include
574 include Makefile.zcash.include