You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

Makefile.am 13KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499
  1. DIST_SUBDIRS = secp256k1 univalue
  2. AM_LDFLAGS = $(PTHREAD_CFLAGS) $(LIBTOOL_LDFLAGS) $(HARDENED_LDFLAGS)
  3. AM_CXXFLAGS = $(HARDENED_CXXFLAGS)
  4. AM_CPPFLAGS = $(HARDENED_CPPFLAGS)
  5. if EMBEDDED_UNIVALUE
  6. LIBUNIVALUE = univalue/libunivalue.la
  7. $(LIBUNIVALUE): $(wildcard univalue/lib/*) $(wildcard univalue/include/*)
  8. $(AM_V_at)$(MAKE) $(AM_MAKEFLAGS) -C $(@D) $(@F)
  9. else
  10. LIBUNIVALUE = $(UNIVALUE_LIBS)
  11. endif
  12. if EMBEDDED_LEVELDB
  13. LEVELDB_CPPFLAGS += -I$(srcdir)/leveldb/include
  14. LEVELDB_CPPFLAGS += -I$(srcdir)/leveldb/helpers/memenv
  15. LIBLEVELDB += $(builddir)/leveldb/libleveldb.a
  16. LIBMEMENV += $(builddir)/leveldb/libmemenv.a
  17. # 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
  18. $(LIBLEVELDB): $(LIBMEMENV)
  19. $(LIBLEVELDB) $(LIBMEMENV):
  20. @echo "Building LevelDB ..." && $(MAKE) -C $(@D) $(@F) CXX="$(CXX)" \
  21. CC="$(CC)" PLATFORM=$(TARGET_OS) AR="$(AR)" $(LEVELDB_TARGET_FLAGS) \
  22. OPT="$(AM_CXXFLAGS) $(PIE_FLAGS) $(CXXFLAGS) $(AM_CPPFLAGS) $(CPPFLAGS) -D__STDC_LIMIT_MACROS"
  23. endif
  24. BITCOIN_CONFIG_INCLUDES=-I$(builddir)/config
  25. BITCOIN_INCLUDES=-I$(builddir) -I$(builddir)/obj $(BOOST_CPPFLAGS) $(LEVELDB_CPPFLAGS) $(CRYPTO_CFLAGS) $(SSL_CFLAGS)
  26. BITCOIN_INCLUDES += -I$(srcdir)/secp256k1/include
  27. BITCOIN_INCLUDES += $(UNIVALUE_CFLAGS)
  28. LIBBITCOIN_SERVER=libbitcoin_server.a
  29. LIBBITCOIN_WALLET=libbitcoin_wallet.a
  30. LIBBITCOIN_COMMON=libbitcoin_common.a
  31. LIBBITCOIN_CONSENSUS=libbitcoin_consensus.a
  32. LIBBITCOIN_CLI=libbitcoin_cli.a
  33. LIBBITCOIN_UTIL=libbitcoin_util.a
  34. LIBBITCOIN_CRYPTO=crypto/libbitcoin_crypto.a
  35. LIBBITCOINQT=qt/libbitcoinqt.a
  36. LIBSECP256K1=secp256k1/libsecp256k1.la
  37. $(LIBSECP256K1): $(wildcard secp256k1/src/*) $(wildcard secp256k1/include/*)
  38. $(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:
  41. EXTRA_LIBRARIES = \
  42. crypto/libbitcoin_crypto.a \
  43. libbitcoin_util.a \
  44. libbitcoin_common.a \
  45. libbitcoin_consensus.a \
  46. libbitcoin_server.a \
  47. libbitcoin_cli.a
  48. if ENABLE_WALLET
  49. BITCOIN_INCLUDES += $(BDB_CPPFLAGS)
  50. EXTRA_LIBRARIES += libbitcoin_wallet.a
  51. endif
  52. if ENABLE_ZMQ
  53. EXTRA_LIBRARIES += libbitcoin_zmq.a
  54. endif
  55. if BUILD_BITCOIN_LIBS
  56. lib_LTLIBRARIES = libbitcoinconsensus.la
  57. LIBBITCOINCONSENSUS=libbitcoinconsensus.la
  58. else
  59. LIBBITCOINCONSENSUS=
  60. endif
  61. bin_PROGRAMS =
  62. TESTS =
  63. BENCHMARKS =
  64. if BUILD_BITCOIND
  65. bin_PROGRAMS += bitcoind
  66. endif
  67. if BUILD_BITCOIN_UTILS
  68. bin_PROGRAMS += bitcoin-cli bitcoin-tx
  69. endif
  70. .PHONY: FORCE check-symbols check-security
  71. # bitcoin core #
  72. BITCOIN_CORE_H = \
  73. addrman.h \
  74. alert.h \
  75. base58.h \
  76. bloom.h \
  77. chain.h \
  78. chainparams.h \
  79. chainparamsbase.h \
  80. chainparamsseeds.h \
  81. checkpoints.h \
  82. checkqueue.h \
  83. clientversion.h \
  84. coincontrol.h \
  85. coins.h \
  86. compat.h \
  87. compat/byteswap.h \
  88. compat/endian.h \
  89. compat/sanity.h \
  90. compressor.h \
  91. consensus/consensus.h \
  92. core_io.h \
  93. core_memusage.h \
  94. httprpc.h \
  95. httpserver.h \
  96. init.h \
  97. key.h \
  98. keystore.h \
  99. dbwrapper.h \
  100. limitedmap.h \
  101. main.h \
  102. memusage.h \
  103. merkleblock.h \
  104. miner.h \
  105. net.h \
  106. netbase.h \
  107. noui.h \
  108. policy/fees.h \
  109. policy/policy.h \
  110. policy/rbf.h \
  111. pow.h \
  112. protocol.h \
  113. random.h \
  114. reverselock.h \
  115. rpc/client.h \
  116. rpc/protocol.h \
  117. rpc/server.h \
  118. scheduler.h \
  119. script/sigcache.h \
  120. script/sign.h \
  121. script/standard.h \
  122. streams.h \
  123. support/allocators/secure.h \
  124. support/allocators/zeroafterfree.h \
  125. support/cleanse.h \
  126. support/pagelocker.h \
  127. sync.h \
  128. threadsafety.h \
  129. timedata.h \
  130. torcontrol.h \
  131. txdb.h \
  132. txmempool.h \
  133. ui_interface.h \
  134. undo.h \
  135. util.h \
  136. utilmoneystr.h \
  137. utiltime.h \
  138. validationinterface.h \
  139. versionbits.h \
  140. wallet/crypter.h \
  141. wallet/db.h \
  142. wallet/rpcwallet.h \
  143. wallet/wallet.h \
  144. wallet/wallet_ismine.h \
  145. wallet/walletdb.h \
  146. zmq/zmqabstractnotifier.h \
  147. zmq/zmqconfig.h\
  148. zmq/zmqnotificationinterface.h \
  149. zmq/zmqpublishnotifier.h
  150. obj/build.h: FORCE
  151. @$(MKDIR_P) $(builddir)/obj
  152. @$(top_srcdir)/share/genbuild.sh $(abs_top_builddir)/src/obj/build.h \
  153. $(abs_top_srcdir)
  154. libbitcoin_util_a-clientversion.$(OBJEXT): obj/build.h
  155. # server: shared between bitcoind and bitcoin-qt
  156. libbitcoin_server_a_CPPFLAGS = $(AM_CPPFLAGS) $(BITCOIN_INCLUDES) $(MINIUPNPC_CPPFLAGS) $(EVENT_CFLAGS) $(EVENT_PTHREADS_CFLAGS)
  157. libbitcoin_server_a_CXXFLAGS = $(AM_CXXFLAGS) $(PIE_FLAGS)
  158. libbitcoin_server_a_SOURCES = \
  159. addrman.cpp \
  160. alert.cpp \
  161. bloom.cpp \
  162. chain.cpp \
  163. checkpoints.cpp \
  164. httprpc.cpp \
  165. httpserver.cpp \
  166. init.cpp \
  167. dbwrapper.cpp \
  168. main.cpp \
  169. merkleblock.cpp \
  170. miner.cpp \
  171. net.cpp \
  172. noui.cpp \
  173. policy/fees.cpp \
  174. policy/policy.cpp \
  175. pow.cpp \
  176. rest.cpp \
  177. rpc/blockchain.cpp \
  178. rpc/mining.cpp \
  179. rpc/misc.cpp \
  180. rpc/net.cpp \
  181. rpc/rawtransaction.cpp \
  182. rpc/server.cpp \
  183. script/sigcache.cpp \
  184. timedata.cpp \
  185. torcontrol.cpp \
  186. txdb.cpp \
  187. txmempool.cpp \
  188. validationinterface.cpp \
  189. versionbits.cpp \
  190. $(BITCOIN_CORE_H)
  191. if ENABLE_ZMQ
  192. LIBBITCOIN_ZMQ=libbitcoin_zmq.a
  193. libbitcoin_zmq_a_CPPFLAGS = $(BITCOIN_INCLUDES) $(ZMQ_CFLAGS)
  194. libbitcoin_zmq_a_CXXFLAGS = $(AM_CXXFLAGS) $(PIE_FLAGS)
  195. libbitcoin_zmq_a_SOURCES = \
  196. zmq/zmqabstractnotifier.cpp \
  197. zmq/zmqnotificationinterface.cpp \
  198. zmq/zmqpublishnotifier.cpp
  199. endif
  200. # wallet: shared between bitcoind and bitcoin-qt, but only linked
  201. # when wallet enabled
  202. libbitcoin_wallet_a_CPPFLAGS = $(AM_CPPFLAGS) $(BITCOIN_INCLUDES)
  203. libbitcoin_wallet_a_CXXFLAGS = $(AM_CXXFLAGS) $(PIE_FLAGS)
  204. libbitcoin_wallet_a_SOURCES = \
  205. wallet/crypter.cpp \
  206. wallet/db.cpp \
  207. wallet/rpcdump.cpp \
  208. wallet/rpcwallet.cpp \
  209. wallet/wallet.cpp \
  210. wallet/wallet_ismine.cpp \
  211. wallet/walletdb.cpp \
  212. policy/rbf.cpp \
  213. $(BITCOIN_CORE_H)
  214. # crypto primitives library
  215. crypto_libbitcoin_crypto_a_CPPFLAGS = $(AM_CPPFLAGS) $(BITCOIN_CONFIG_INCLUDES)
  216. crypto_libbitcoin_crypto_a_CXXFLAGS = $(AM_CXXFLAGS) $(PIE_FLAGS)
  217. crypto_libbitcoin_crypto_a_SOURCES = \
  218. crypto/common.h \
  219. crypto/hmac_sha256.cpp \
  220. crypto/hmac_sha256.h \
  221. crypto/hmac_sha512.cpp \
  222. crypto/hmac_sha512.h \
  223. crypto/ripemd160.cpp \
  224. crypto/ripemd160.h \
  225. crypto/sha1.cpp \
  226. crypto/sha1.h \
  227. crypto/sha256.cpp \
  228. crypto/sha256.h \
  229. crypto/sha512.cpp \
  230. crypto/sha512.h
  231. # consensus: shared between all executables that validate any consensus rules.
  232. libbitcoin_consensus_a_CPPFLAGS = $(AM_CPPFLAGS) $(BITCOIN_INCLUDES)
  233. libbitcoin_consensus_a_CXXFLAGS = $(AM_CXXFLAGS) $(PIE_FLAGS)
  234. libbitcoin_consensus_a_SOURCES = \
  235. amount.h \
  236. arith_uint256.cpp \
  237. arith_uint256.h \
  238. consensus/merkle.cpp \
  239. consensus/merkle.h \
  240. consensus/params.h \
  241. consensus/validation.h \
  242. hash.cpp \
  243. hash.h \
  244. prevector.h \
  245. primitives/block.cpp \
  246. primitives/block.h \
  247. primitives/transaction.cpp \
  248. primitives/transaction.h \
  249. pubkey.cpp \
  250. pubkey.h \
  251. script/bitcoinconsensus.cpp \
  252. script/interpreter.cpp \
  253. script/interpreter.h \
  254. script/script.cpp \
  255. script/script.h \
  256. script/script_error.cpp \
  257. script/script_error.h \
  258. serialize.h \
  259. tinyformat.h \
  260. uint256.cpp \
  261. uint256.h \
  262. utilstrencodings.cpp \
  263. utilstrencodings.h \
  264. version.h
  265. # common: shared between bitcoind, and bitcoin-qt and non-server tools
  266. libbitcoin_common_a_CPPFLAGS = $(AM_CPPFLAGS) $(BITCOIN_INCLUDES)
  267. libbitcoin_common_a_CXXFLAGS = $(AM_CXXFLAGS) $(PIE_FLAGS)
  268. libbitcoin_common_a_SOURCES = \
  269. amount.cpp \
  270. base58.cpp \
  271. chainparams.cpp \
  272. coins.cpp \
  273. compressor.cpp \
  274. core_read.cpp \
  275. core_write.cpp \
  276. key.cpp \
  277. keystore.cpp \
  278. netbase.cpp \
  279. protocol.cpp \
  280. scheduler.cpp \
  281. script/sign.cpp \
  282. script/standard.cpp \
  283. $(BITCOIN_CORE_H)
  284. # util: shared between all executables.
  285. # This library *must* be included to make sure that the glibc
  286. # backward-compatibility objects and their sanity checks are linked.
  287. libbitcoin_util_a_CPPFLAGS = $(AM_CPPFLAGS) $(BITCOIN_INCLUDES)
  288. libbitcoin_util_a_CXXFLAGS = $(AM_CXXFLAGS) $(PIE_FLAGS)
  289. libbitcoin_util_a_SOURCES = \
  290. support/pagelocker.cpp \
  291. chainparamsbase.cpp \
  292. clientversion.cpp \
  293. compat/glibc_sanity.cpp \
  294. compat/glibcxx_sanity.cpp \
  295. compat/strnlen.cpp \
  296. random.cpp \
  297. rpc/protocol.cpp \
  298. support/cleanse.cpp \
  299. sync.cpp \
  300. util.cpp \
  301. utilmoneystr.cpp \
  302. utilstrencodings.cpp \
  303. utiltime.cpp \
  304. $(BITCOIN_CORE_H)
  305. if GLIBC_BACK_COMPAT
  306. libbitcoin_util_a_SOURCES += compat/glibc_compat.cpp
  307. endif
  308. # cli: shared between bitcoin-cli and bitcoin-qt
  309. libbitcoin_cli_a_CPPFLAGS = $(AM_CPPFLAGS) $(BITCOIN_INCLUDES)
  310. libbitcoin_cli_a_CXXFLAGS = $(AM_CXXFLAGS) $(PIE_FLAGS)
  311. libbitcoin_cli_a_SOURCES = \
  312. rpc/client.cpp \
  313. $(BITCOIN_CORE_H)
  314. nodist_libbitcoin_util_a_SOURCES = $(srcdir)/obj/build.h
  315. #
  316. # bitcoind binary #
  317. bitcoind_SOURCES = bitcoind.cpp
  318. bitcoind_CPPFLAGS = $(AM_CPPFLAGS) $(BITCOIN_INCLUDES)
  319. bitcoind_CXXFLAGS = $(AM_CXXFLAGS) $(PIE_FLAGS)
  320. bitcoind_LDFLAGS = $(RELDFLAGS) $(AM_LDFLAGS) $(LIBTOOL_APP_LDFLAGS)
  321. if TARGET_WINDOWS
  322. bitcoind_SOURCES += bitcoind-res.rc
  323. endif
  324. bitcoind_LDADD = \
  325. $(LIBBITCOIN_SERVER) \
  326. $(LIBBITCOIN_COMMON) \
  327. $(LIBUNIVALUE) \
  328. $(LIBBITCOIN_UTIL) \
  329. $(LIBBITCOIN_CONSENSUS) \
  330. $(LIBBITCOIN_CRYPTO) \
  331. $(LIBLEVELDB) \
  332. $(LIBMEMENV) \
  333. $(LIBSECP256K1)
  334. if ENABLE_ZMQ
  335. bitcoind_LDADD += $(LIBBITCOIN_ZMQ) $(ZMQ_LIBS)
  336. endif
  337. if ENABLE_WALLET
  338. bitcoind_LDADD += libbitcoin_wallet.a
  339. endif
  340. bitcoind_LDADD += $(BOOST_LIBS) $(BDB_LIBS) $(SSL_LIBS) $(CRYPTO_LIBS) $(MINIUPNPC_LIBS) $(EVENT_PTHREADS_LIBS) $(EVENT_LIBS)
  341. # bitcoin-cli binary #
  342. bitcoin_cli_SOURCES = bitcoin-cli.cpp
  343. bitcoin_cli_CPPFLAGS = $(AM_CPPFLAGS) $(BITCOIN_INCLUDES) $(EVENT_CFLAGS)
  344. bitcoin_cli_CXXFLAGS = $(AM_CXXFLAGS) $(PIE_FLAGS)
  345. bitcoin_cli_LDFLAGS = $(RELDFLAGS) $(AM_LDFLAGS) $(LIBTOOL_APP_LDFLAGS)
  346. if TARGET_WINDOWS
  347. bitcoin_cli_SOURCES += bitcoin-cli-res.rc
  348. endif
  349. bitcoin_cli_LDADD = \
  350. $(LIBBITCOIN_CLI) \
  351. $(LIBUNIVALUE) \
  352. $(LIBBITCOIN_UTIL)
  353. bitcoin_cli_LDADD += $(BOOST_LIBS) $(SSL_LIBS) $(CRYPTO_LIBS) $(EVENT_LIBS)
  354. #
  355. # bitcoin-tx binary #
  356. bitcoin_tx_SOURCES = bitcoin-tx.cpp
  357. bitcoin_tx_CPPFLAGS = $(AM_CPPFLAGS) $(BITCOIN_INCLUDES)
  358. bitcoin_tx_CXXFLAGS = $(AM_CXXFLAGS) $(PIE_FLAGS)
  359. bitcoin_tx_LDFLAGS = $(RELDFLAGS) $(AM_LDFLAGS) $(LIBTOOL_APP_LDFLAGS)
  360. if TARGET_WINDOWS
  361. bitcoin_tx_SOURCES += bitcoin-tx-res.rc
  362. endif
  363. bitcoin_tx_LDADD = \
  364. $(LIBUNIVALUE) \
  365. $(LIBBITCOIN_COMMON) \
  366. $(LIBBITCOIN_UTIL) \
  367. $(LIBBITCOIN_CONSENSUS) \
  368. $(LIBBITCOIN_CRYPTO) \
  369. $(LIBSECP256K1)
  370. bitcoin_tx_LDADD += $(BOOST_LIBS) $(CRYPTO_LIBS)
  371. #
  372. # bitcoinconsensus library #
  373. if BUILD_BITCOIN_LIBS
  374. include_HEADERS = script/bitcoinconsensus.h
  375. libbitcoinconsensus_la_SOURCES = $(crypto_libbitcoin_crypto_a_SOURCES) $(libbitcoin_consensus_a_SOURCES)
  376. if GLIBC_BACK_COMPAT
  377. libbitcoinconsensus_la_SOURCES += compat/glibc_compat.cpp
  378. endif
  379. libbitcoinconsensus_la_LDFLAGS = $(AM_LDFLAGS) -no-undefined $(RELDFLAGS)
  380. libbitcoinconsensus_la_LIBADD = $(LIBSECP256K1)
  381. libbitcoinconsensus_la_CPPFLAGS = $(AM_CPPFLAGS) -I$(builddir)/obj -I$(srcdir)/secp256k1/include -DBUILD_BITCOIN_INTERNAL
  382. libbitcoinconsensus_la_CXXFLAGS = $(AM_CXXFLAGS) $(PIE_FLAGS)
  383. endif
  384. #
  385. CLEANFILES = leveldb/libleveldb.a leveldb/libmemenv.a
  386. CLEANFILES += $(EXTRA_LIBRARIES)
  387. CLEANFILES += *.gcda *.gcno
  388. CLEANFILES += compat/*.gcda compat/*.gcno
  389. CLEANFILES += consensus/*.gcda consensus/*.gcno
  390. CLEANFILES += crypto/*.gcda crypto/*.gcno
  391. CLEANFILES += policy/*.gcda policy/*.gcno
  392. CLEANFILES += primitives/*.gcda primitives/*.gcno
  393. CLEANFILES += script/*.gcda script/*.gcno
  394. CLEANFILES += support/*.gcda support/*.gcno
  395. CLEANFILES += univalue/*.gcda univalue/*.gcno
  396. CLEANFILES += wallet/*.gcda wallet/*.gcno
  397. CLEANFILES += wallet/test/*.gcda wallet/test/*.gcno
  398. CLEANFILES += zmq/*.gcda zmq/*.gcno
  399. DISTCLEANFILES = obj/build.h
  400. EXTRA_DIST = leveldb
  401. clean-local:
  402. -$(MAKE) -C leveldb clean
  403. -$(MAKE) -C secp256k1 clean
  404. -$(MAKE) -C univalue clean
  405. -rm -f leveldb/*/*.gcda leveldb/*/*.gcno leveldb/helpers/memenv/*.gcda leveldb/helpers/memenv/*.gcno
  406. -rm -f config.h
  407. .rc.o:
  408. @test -f $(WINDRES)
  409. ## FIXME: How to get the appropriate modulename_CPPFLAGS in here?
  410. $(AM_V_GEN) $(WINDRES) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(CPPFLAGS) -DWINDRES_PREPROC -i $< -o $@
  411. .mm.o:
  412. $(AM_V_CXX) $(OBJCXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \
  413. $(CPPFLAGS) $(AM_CXXFLAGS) $(QT_INCLUDES) $(AM_CXXFLAGS) $(PIE_FLAGS) $(CXXFLAGS) -c -o $@ $<
  414. check-symbols: $(bin_PROGRAMS)
  415. if GLIBC_BACK_COMPAT
  416. @echo "Checking glibc back compat..."
  417. $(AM_V_at) READELF=$(READELF) CPPFILT=$(CPPFILT) $(top_srcdir)/contrib/devtools/symbol-check.py < $(bin_PROGRAMS)
  418. endif
  419. check-security: $(bin_PROGRAMS)
  420. if HARDEN
  421. @echo "Checking binary security..."
  422. $(AM_V_at) READELF=$(READELF) OBJDUMP=$(OBJDUMP) $(top_srcdir)/contrib/devtools/security-check.py < $(bin_PROGRAMS)
  423. endif
  424. %.pb.cc %.pb.h: %.proto
  425. @test -f $(PROTOC)
  426. $(AM_V_GEN) $(PROTOC) --cpp_out=$(@D) --proto_path=$(abspath $(<D) $<)
  427. if ENABLE_TESTS
  428. include Makefile.test.include
  429. endif
  430. if ENABLE_BENCH
  431. include Makefile.bench.include
  432. endif
  433. if ENABLE_QT
  434. include Makefile.qt.include
  435. endif
  436. if ENABLE_QT_TESTS
  437. include Makefile.qttest.include
  438. endif