Add pblock to connectTrace at the end of ConnectTip, not start
[bitcoinplatinum.git] / src / Makefile.am
blob8680546b995b983589fa58b52d6f6381c247ded0
1 # Copyright (c) 2013-2016 The Bitcoin Core developers
2 # Distributed under the MIT software license, see the accompanying
3 # file COPYING or http://www.opensource.org/licenses/mit-license.php.
5 DIST_SUBDIRS = secp256k1 univalue
7 AM_LDFLAGS = $(PTHREAD_CFLAGS) $(LIBTOOL_LDFLAGS) $(HARDENED_LDFLAGS)
8 AM_CXXFLAGS = $(HARDENED_CXXFLAGS) $(ERROR_CXXFLAGS)
9 AM_CPPFLAGS = $(HARDENED_CPPFLAGS)
10 EXTRA_LIBRARIES =
12 if EMBEDDED_UNIVALUE
13 LIBUNIVALUE = univalue/libunivalue.la
15 $(LIBUNIVALUE): $(wildcard univalue/lib/*) $(wildcard univalue/include/*)
16         $(AM_V_at)$(MAKE) $(AM_MAKEFLAGS) -C $(@D) $(@F)
17 else
18 LIBUNIVALUE = $(UNIVALUE_LIBS)
19 endif
21 BITCOIN_CONFIG_INCLUDES=-I$(builddir)/config
22 BITCOIN_INCLUDES=-I$(builddir) -I$(builddir)/obj $(BDB_CPPFLAGS) $(BOOST_CPPFLAGS) $(LEVELDB_CPPFLAGS) $(CRYPTO_CFLAGS) $(SSL_CFLAGS)
24 BITCOIN_INCLUDES += -I$(srcdir)/secp256k1/include
25 BITCOIN_INCLUDES += $(UNIVALUE_CFLAGS)
27 LIBBITCOIN_SERVER=libbitcoin_server.a
28 LIBBITCOIN_COMMON=libbitcoin_common.a
29 LIBBITCOIN_CONSENSUS=libbitcoin_consensus.a
30 LIBBITCOIN_CLI=libbitcoin_cli.a
31 LIBBITCOIN_UTIL=libbitcoin_util.a
32 LIBBITCOIN_CRYPTO=crypto/libbitcoin_crypto.a
33 LIBBITCOINQT=qt/libbitcoinqt.a
34 LIBSECP256K1=secp256k1/libsecp256k1.la
36 if ENABLE_ZMQ
37 LIBBITCOIN_ZMQ=libbitcoin_zmq.a
38 endif
39 if BUILD_BITCOIN_LIBS
40 LIBBITCOINCONSENSUS=libbitcoinconsensus.la
41 endif
42 if ENABLE_WALLET
43 LIBBITCOIN_WALLET=libbitcoin_wallet.a
44 endif
46 $(LIBSECP256K1): $(wildcard secp256k1/src/*) $(wildcard secp256k1/include/*)
47         $(AM_V_at)$(MAKE) $(AM_MAKEFLAGS) -C $(@D) $(@F)
49 # Make is not made aware of per-object dependencies to avoid limiting building parallelization
50 # But to build the less dependent modules first, we manually select their order here:
51 EXTRA_LIBRARIES += \
52   $(LIBBITCOIN_CRYPTO) \
53   $(LIBBITCOIN_UTIL) \
54   $(LIBBITCOIN_COMMON) \
55   $(LIBBITCOIN_CONSENSUS) \
56   $(LIBBITCOIN_SERVER) \
57   $(LIBBITCOIN_CLI) \
58   $(LIBBITCOIN_WALLET) \
59   $(LIBBITCOIN_ZMQ)
61 lib_LTLIBRARIES = $(LIBBITCOINCONSENSUS)
63 bin_PROGRAMS =
64 noinst_PROGRAMS =
65 TESTS =
66 BENCHMARKS =
68 if BUILD_BITCOIND
69   bin_PROGRAMS += bitcoind
70 endif
72 if BUILD_BITCOIN_UTILS
73   bin_PROGRAMS += bitcoin-cli bitcoin-tx
74 endif
76 .PHONY: FORCE check-symbols check-security
77 # bitcoin core #
78 BITCOIN_CORE_H = \
79   addrdb.h \
80   addrman.h \
81   base58.h \
82   bloom.h \
83   blockencodings.h \
84   chain.h \
85   chainparams.h \
86   chainparamsbase.h \
87   chainparamsseeds.h \
88   checkpoints.h \
89   checkqueue.h \
90   clientversion.h \
91   coins.h \
92   compat.h \
93   compat/byteswap.h \
94   compat/endian.h \
95   compat/sanity.h \
96   compressor.h \
97   consensus/consensus.h \
98   core_io.h \
99   core_memusage.h \
100   cuckoocache.h \
101   fs.h \
102   httprpc.h \
103   httpserver.h \
104   indirectmap.h \
105   init.h \
106   key.h \
107   keystore.h \
108   dbwrapper.h \
109   limitedmap.h \
110   memusage.h \
111   merkleblock.h \
112   miner.h \
113   net.h \
114   net_processing.h \
115   netaddress.h \
116   netbase.h \
117   netmessagemaker.h \
118   noui.h \
119   policy/fees.h \
120   policy/policy.h \
121   policy/rbf.h \
122   pow.h \
123   protocol.h \
124   random.h \
125   reverselock.h \
126   rpc/blockchain.h \
127   rpc/client.h \
128   rpc/protocol.h \
129   rpc/server.h \
130   rpc/register.h \
131   scheduler.h \
132   script/sigcache.h \
133   script/sign.h \
134   script/standard.h \
135   script/ismine.h \
136   streams.h \
137   support/allocators/secure.h \
138   support/allocators/zeroafterfree.h \
139   support/cleanse.h \
140   support/events.h \
141   support/lockedpool.h \
142   sync.h \
143   threadsafety.h \
144   threadinterrupt.h \
145   timedata.h \
146   torcontrol.h \
147   txdb.h \
148   txmempool.h \
149   ui_interface.h \
150   undo.h \
151   util.h \
152   utilmoneystr.h \
153   utiltime.h \
154   validation.h \
155   validationinterface.h \
156   versionbits.h \
157   wallet/coincontrol.h \
158   wallet/crypter.h \
159   wallet/db.h \
160   wallet/rpcwallet.h \
161   wallet/wallet.h \
162   wallet/walletdb.h \
163   warnings.h \
164   zmq/zmqabstractnotifier.h \
165   zmq/zmqconfig.h\
166   zmq/zmqnotificationinterface.h \
167   zmq/zmqpublishnotifier.h
170 obj/build.h: FORCE
171         @$(MKDIR_P) $(builddir)/obj
172         @$(top_srcdir)/share/genbuild.sh "$(abs_top_builddir)/src/obj/build.h" \
173           "$(abs_top_srcdir)"
174 libbitcoin_util_a-clientversion.$(OBJEXT): obj/build.h
176 # server: shared between bitcoind and bitcoin-qt
177 libbitcoin_server_a_CPPFLAGS = $(AM_CPPFLAGS) $(BITCOIN_INCLUDES) $(MINIUPNPC_CPPFLAGS) $(EVENT_CFLAGS) $(EVENT_PTHREADS_CFLAGS)
178 libbitcoin_server_a_CXXFLAGS = $(AM_CXXFLAGS) $(PIE_FLAGS)
179 libbitcoin_server_a_SOURCES = \
180   addrman.cpp \
181   addrdb.cpp \
182   bloom.cpp \
183   blockencodings.cpp \
184   chain.cpp \
185   checkpoints.cpp \
186   httprpc.cpp \
187   httpserver.cpp \
188   init.cpp \
189   dbwrapper.cpp \
190   merkleblock.cpp \
191   miner.cpp \
192   net.cpp \
193   net_processing.cpp \
194   noui.cpp \
195   policy/fees.cpp \
196   policy/policy.cpp \
197   pow.cpp \
198   rest.cpp \
199   rpc/blockchain.cpp \
200   rpc/mining.cpp \
201   rpc/misc.cpp \
202   rpc/net.cpp \
203   rpc/rawtransaction.cpp \
204   rpc/server.cpp \
205   script/sigcache.cpp \
206   script/ismine.cpp \
207   timedata.cpp \
208   torcontrol.cpp \
209   txdb.cpp \
210   txmempool.cpp \
211   ui_interface.cpp \
212   validation.cpp \
213   validationinterface.cpp \
214   versionbits.cpp \
215   $(BITCOIN_CORE_H)
217 if ENABLE_ZMQ
218 libbitcoin_zmq_a_CPPFLAGS = $(BITCOIN_INCLUDES) $(ZMQ_CFLAGS)
219 libbitcoin_zmq_a_CXXFLAGS = $(AM_CXXFLAGS) $(PIE_FLAGS)
220 libbitcoin_zmq_a_SOURCES = \
221   zmq/zmqabstractnotifier.cpp \
222   zmq/zmqnotificationinterface.cpp \
223   zmq/zmqpublishnotifier.cpp
224 endif
227 # wallet: shared between bitcoind and bitcoin-qt, but only linked
228 # when wallet enabled
229 libbitcoin_wallet_a_CPPFLAGS = $(AM_CPPFLAGS) $(BITCOIN_INCLUDES)
230 libbitcoin_wallet_a_CXXFLAGS = $(AM_CXXFLAGS) $(PIE_FLAGS)
231 libbitcoin_wallet_a_SOURCES = \
232   wallet/crypter.cpp \
233   wallet/db.cpp \
234   wallet/rpcdump.cpp \
235   wallet/rpcwallet.cpp \
236   wallet/wallet.cpp \
237   wallet/walletdb.cpp \
238   policy/rbf.cpp \
239   $(BITCOIN_CORE_H)
241 # crypto primitives library
242 crypto_libbitcoin_crypto_a_CPPFLAGS = $(AM_CPPFLAGS) $(BITCOIN_CONFIG_INCLUDES)
243 crypto_libbitcoin_crypto_a_CXXFLAGS = $(AM_CXXFLAGS) $(PIE_FLAGS)
244 crypto_libbitcoin_crypto_a_SOURCES = \
245   crypto/aes.cpp \
246   crypto/aes.h \
247   crypto/common.h \
248   crypto/hmac_sha256.cpp \
249   crypto/hmac_sha256.h \
250   crypto/hmac_sha512.cpp \
251   crypto/hmac_sha512.h \
252   crypto/ripemd160.cpp \
253   crypto/ripemd160.h \
254   crypto/sha1.cpp \
255   crypto/sha1.h \
256   crypto/sha256.cpp \
257   crypto/sha256.h \
258   crypto/sha512.cpp \
259   crypto/sha512.h
261 # consensus: shared between all executables that validate any consensus rules.
262 libbitcoin_consensus_a_CPPFLAGS = $(AM_CPPFLAGS) $(BITCOIN_INCLUDES)
263 libbitcoin_consensus_a_CXXFLAGS = $(AM_CXXFLAGS) $(PIE_FLAGS)
264 libbitcoin_consensus_a_SOURCES = \
265   amount.h \
266   arith_uint256.cpp \
267   arith_uint256.h \
268   consensus/merkle.cpp \
269   consensus/merkle.h \
270   consensus/params.h \
271   consensus/validation.h \
272   hash.cpp \
273   hash.h \
274   prevector.h \
275   primitives/block.cpp \
276   primitives/block.h \
277   primitives/transaction.cpp \
278   primitives/transaction.h \
279   pubkey.cpp \
280   pubkey.h \
281   script/bitcoinconsensus.cpp \
282   script/interpreter.cpp \
283   script/interpreter.h \
284   script/script.cpp \
285   script/script.h \
286   script/script_error.cpp \
287   script/script_error.h \
288   serialize.h \
289   tinyformat.h \
290   uint256.cpp \
291   uint256.h \
292   utilstrencodings.cpp \
293   utilstrencodings.h \
294   version.h
296 # common: shared between bitcoind, and bitcoin-qt and non-server tools
297 libbitcoin_common_a_CPPFLAGS = $(AM_CPPFLAGS) $(BITCOIN_INCLUDES)
298 libbitcoin_common_a_CXXFLAGS = $(AM_CXXFLAGS) $(PIE_FLAGS)
299 libbitcoin_common_a_SOURCES = \
300   amount.cpp \
301   base58.cpp \
302   chainparams.cpp \
303   coins.cpp \
304   compressor.cpp \
305   core_read.cpp \
306   core_write.cpp \
307   key.cpp \
308   keystore.cpp \
309   netaddress.cpp \
310   netbase.cpp \
311   protocol.cpp \
312   scheduler.cpp \
313   script/sign.cpp \
314   script/standard.cpp \
315   warnings.cpp \
316   $(BITCOIN_CORE_H)
318 # util: shared between all executables.
319 # This library *must* be included to make sure that the glibc
320 # backward-compatibility objects and their sanity checks are linked.
321 libbitcoin_util_a_CPPFLAGS = $(AM_CPPFLAGS) $(BITCOIN_INCLUDES)
322 libbitcoin_util_a_CXXFLAGS = $(AM_CXXFLAGS) $(PIE_FLAGS)
323 libbitcoin_util_a_SOURCES = \
324   support/lockedpool.cpp \
325   chainparamsbase.cpp \
326   clientversion.cpp \
327   compat/glibc_sanity.cpp \
328   compat/glibcxx_sanity.cpp \
329   compat/strnlen.cpp \
330   fs.cpp \
331   random.cpp \
332   rpc/protocol.cpp \
333   support/cleanse.cpp \
334   sync.cpp \
335   threadinterrupt.cpp \
336   util.cpp \
337   utilmoneystr.cpp \
338   utilstrencodings.cpp \
339   utiltime.cpp \
340   $(BITCOIN_CORE_H)
342 if GLIBC_BACK_COMPAT
343 libbitcoin_util_a_SOURCES += compat/glibc_compat.cpp
344 endif
346 # cli: shared between bitcoin-cli and bitcoin-qt
347 libbitcoin_cli_a_CPPFLAGS = $(AM_CPPFLAGS) $(BITCOIN_INCLUDES)
348 libbitcoin_cli_a_CXXFLAGS = $(AM_CXXFLAGS) $(PIE_FLAGS)
349 libbitcoin_cli_a_SOURCES = \
350   rpc/client.cpp \
351   $(BITCOIN_CORE_H)
353 nodist_libbitcoin_util_a_SOURCES = $(srcdir)/obj/build.h
356 # bitcoind binary #
357 bitcoind_SOURCES = bitcoind.cpp
358 bitcoind_CPPFLAGS = $(AM_CPPFLAGS) $(BITCOIN_INCLUDES)
359 bitcoind_CXXFLAGS = $(AM_CXXFLAGS) $(PIE_FLAGS)
360 bitcoind_LDFLAGS = $(RELDFLAGS) $(AM_LDFLAGS) $(LIBTOOL_APP_LDFLAGS)
362 if TARGET_WINDOWS
363 bitcoind_SOURCES += bitcoind-res.rc
364 endif
366 bitcoind_LDADD = \
367   $(LIBBITCOIN_SERVER) \
368   $(LIBBITCOIN_COMMON) \
369   $(LIBUNIVALUE) \
370   $(LIBBITCOIN_UTIL) \
371   $(LIBBITCOIN_WALLET) \
372   $(LIBBITCOIN_ZMQ) \
373   $(LIBBITCOIN_CONSENSUS) \
374   $(LIBBITCOIN_CRYPTO) \
375   $(LIBLEVELDB) \
376   $(LIBMEMENV) \
377   $(LIBSECP256K1)
379 bitcoind_LDADD += $(BOOST_LIBS) $(BDB_LIBS) $(SSL_LIBS) $(CRYPTO_LIBS) $(MINIUPNPC_LIBS) $(EVENT_PTHREADS_LIBS) $(EVENT_LIBS) $(ZMQ_LIBS)
381 # bitcoin-cli binary #
382 bitcoin_cli_SOURCES = bitcoin-cli.cpp
383 bitcoin_cli_CPPFLAGS = $(AM_CPPFLAGS) $(BITCOIN_INCLUDES) $(EVENT_CFLAGS)
384 bitcoin_cli_CXXFLAGS = $(AM_CXXFLAGS) $(PIE_FLAGS)
385 bitcoin_cli_LDFLAGS = $(RELDFLAGS) $(AM_LDFLAGS) $(LIBTOOL_APP_LDFLAGS)
387 if TARGET_WINDOWS
388 bitcoin_cli_SOURCES += bitcoin-cli-res.rc
389 endif
391 bitcoin_cli_LDADD = \
392   $(LIBBITCOIN_CLI) \
393   $(LIBUNIVALUE) \
394   $(LIBBITCOIN_UTIL) \
395   $(LIBBITCOIN_CRYPTO)
397 bitcoin_cli_LDADD += $(BOOST_LIBS) $(SSL_LIBS) $(CRYPTO_LIBS) $(EVENT_LIBS)
400 # bitcoin-tx binary #
401 bitcoin_tx_SOURCES = bitcoin-tx.cpp
402 bitcoin_tx_CPPFLAGS = $(AM_CPPFLAGS) $(BITCOIN_INCLUDES)
403 bitcoin_tx_CXXFLAGS = $(AM_CXXFLAGS) $(PIE_FLAGS)
404 bitcoin_tx_LDFLAGS = $(RELDFLAGS) $(AM_LDFLAGS) $(LIBTOOL_APP_LDFLAGS)
406 if TARGET_WINDOWS
407 bitcoin_tx_SOURCES += bitcoin-tx-res.rc
408 endif
410 bitcoin_tx_LDADD = \
411   $(LIBUNIVALUE) \
412   $(LIBBITCOIN_COMMON) \
413   $(LIBBITCOIN_UTIL) \
414   $(LIBBITCOIN_CONSENSUS) \
415   $(LIBBITCOIN_CRYPTO) \
416   $(LIBSECP256K1)
418 bitcoin_tx_LDADD += $(BOOST_LIBS) $(CRYPTO_LIBS)
421 # bitcoinconsensus library #
422 if BUILD_BITCOIN_LIBS
423 include_HEADERS = script/bitcoinconsensus.h
424 libbitcoinconsensus_la_SOURCES = $(crypto_libbitcoin_crypto_a_SOURCES) $(libbitcoin_consensus_a_SOURCES)
426 if GLIBC_BACK_COMPAT
427   libbitcoinconsensus_la_SOURCES += compat/glibc_compat.cpp
428 endif
430 libbitcoinconsensus_la_LDFLAGS = $(AM_LDFLAGS) -no-undefined $(RELDFLAGS)
431 libbitcoinconsensus_la_LIBADD = $(LIBSECP256K1)
432 libbitcoinconsensus_la_CPPFLAGS = $(AM_CPPFLAGS) -I$(builddir)/obj -I$(srcdir)/secp256k1/include -DBUILD_BITCOIN_INTERNAL
433 libbitcoinconsensus_la_CXXFLAGS = $(AM_CXXFLAGS) $(PIE_FLAGS)
435 endif
438 CTAES_DIST =  crypto/ctaes/bench.c
439 CTAES_DIST += crypto/ctaes/ctaes.c
440 CTAES_DIST += crypto/ctaes/ctaes.h
441 CTAES_DIST += crypto/ctaes/README.md
442 CTAES_DIST += crypto/ctaes/test.c
444 CLEANFILES = $(EXTRA_LIBRARIES)
446 CLEANFILES += *.gcda *.gcno
447 CLEANFILES += compat/*.gcda compat/*.gcno
448 CLEANFILES += consensus/*.gcda consensus/*.gcno
449 CLEANFILES += crypto/*.gcda crypto/*.gcno
450 CLEANFILES += policy/*.gcda policy/*.gcno
451 CLEANFILES += primitives/*.gcda primitives/*.gcno
452 CLEANFILES += script/*.gcda script/*.gcno
453 CLEANFILES += support/*.gcda support/*.gcno
454 CLEANFILES += univalue/*.gcda univalue/*.gcno
455 CLEANFILES += wallet/*.gcda wallet/*.gcno
456 CLEANFILES += wallet/test/*.gcda wallet/test/*.gcno
457 CLEANFILES += zmq/*.gcda zmq/*.gcno
459 DISTCLEANFILES = obj/build.h
461 EXTRA_DIST = $(CTAES_DIST)
463 clean-local:
464         -$(MAKE) -C secp256k1 clean
465         -$(MAKE) -C univalue clean
466         -rm -f leveldb/*/*.gcda leveldb/*/*.gcno leveldb/helpers/memenv/*.gcda leveldb/helpers/memenv/*.gcno
467         -rm -f config.h
468         -rm -rf test/__pycache__
470 .rc.o:
471         @test -f $(WINDRES)
472         ## FIXME: How to get the appropriate modulename_CPPFLAGS in here?
473         $(AM_V_GEN) $(WINDRES) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(CPPFLAGS) -DWINDRES_PREPROC -i $< -o $@
475 .mm.o:
476         $(AM_V_CXX) $(OBJCXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \
477           $(CPPFLAGS) $(AM_CXXFLAGS) $(QT_INCLUDES) $(AM_CXXFLAGS) $(PIE_FLAGS) $(CXXFLAGS) -c -o $@ $<
479 check-symbols: $(bin_PROGRAMS)
480 if GLIBC_BACK_COMPAT
481         @echo "Checking glibc back compat..."
482         $(AM_V_at) READELF=$(READELF) CPPFILT=$(CPPFILT) $(top_srcdir)/contrib/devtools/symbol-check.py < $(bin_PROGRAMS)
483 endif
485 check-security: $(bin_PROGRAMS)
486 if HARDEN
487         @echo "Checking binary security..."
488         $(AM_V_at) READELF=$(READELF) OBJDUMP=$(OBJDUMP) $(top_srcdir)/contrib/devtools/security-check.py < $(bin_PROGRAMS)
489 endif
491 %.pb.cc %.pb.h: %.proto
492         @test -f $(PROTOC)
493         $(AM_V_GEN) $(PROTOC) --cpp_out=$(@D) --proto_path=$(<D) $<
495 if EMBEDDED_LEVELDB
496 include Makefile.leveldb.include
497 endif
499 if ENABLE_TESTS
500 include Makefile.test.include
501 endif
503 if ENABLE_BENCH
504 include Makefile.bench.include
505 endif
507 if ENABLE_QT
508 include Makefile.qt.include
509 endif
511 if ENABLE_QT_TESTS
512 include Makefile.qttest.include
513 endif