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 12KB

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