Makefile.am 12.6 KB
Newer Older
Luke Dashjr's avatar
Luke Dashjr committed
1
2
3
4
# Copyright (c) 2013-2016 The Bitcoin Core developers
# Distributed under the MIT software license, see the accompanying
# file COPYING or http://www.opensource.org/licenses/mit-license.php.

5
DIST_SUBDIRS = secp256k1 univalue
6

7
8
9
AM_LDFLAGS = $(PTHREAD_CFLAGS) $(LIBTOOL_LDFLAGS) $(HARDENED_LDFLAGS)
AM_CXXFLAGS = $(HARDENED_CXXFLAGS)
AM_CPPFLAGS = $(HARDENED_CPPFLAGS)
10
EXTRA_LIBRARIES =
11

12
13
14
15
16
17
18
19
20
if EMBEDDED_UNIVALUE
LIBUNIVALUE = univalue/libunivalue.la

$(LIBUNIVALUE): $(wildcard univalue/lib/*) $(wildcard univalue/include/*)
	$(AM_V_at)$(MAKE) $(AM_MAKEFLAGS) -C $(@D) $(@F)
else
LIBUNIVALUE = $(UNIVALUE_LIBS)
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)
Cory Fields's avatar
Cory Fields committed
23

24
BITCOIN_INCLUDES += -I$(srcdir)/secp256k1/include
25
BITCOIN_INCLUDES += $(UNIVALUE_CFLAGS)
26

27
28
LIBBITCOIN_SERVER=libbitcoin_server.a
LIBBITCOIN_COMMON=libbitcoin_common.a
29
LIBBITCOIN_CONSENSUS=libbitcoin_consensus.a
30
31
32
33
LIBBITCOIN_CLI=libbitcoin_cli.a
LIBBITCOIN_UTIL=libbitcoin_util.a
LIBBITCOIN_CRYPTO=crypto/libbitcoin_crypto.a
LIBBITCOINQT=qt/libbitcoinqt.a
34
35
LIBSECP256K1=secp256k1/libsecp256k1.la

36
37
38
39
40
41
42
43
44
45
if ENABLE_ZMQ
LIBBITCOIN_ZMQ=libbitcoin_zmq.a
endif
if BUILD_BITCOIN_LIBS
LIBBITCOINCONSENSUS=libbitcoinconsensus.la
endif
if ENABLE_WALLET
LIBBITCOIN_WALLET=libbitcoin_wallet.a
endif

46
$(LIBSECP256K1): $(wildcard secp256k1/src/*) $(wildcard secp256k1/include/*)
47
	$(AM_V_at)$(MAKE) $(AM_MAKEFLAGS) -C $(@D) $(@F)
48

49
50
# Make is not made aware of per-object dependencies to avoid limiting building parallelization
# But to build the less dependent modules first, we manually select their order here:
51
EXTRA_LIBRARIES += \
52
53
54
55
56
57
58
59
  $(LIBBITCOIN_CRYPTO) \
  $(LIBBITCOIN_UTIL) \
  $(LIBBITCOIN_COMMON) \
  $(LIBBITCOIN_CONSENSUS) \
  $(LIBBITCOIN_SERVER) \
  $(LIBBITCOIN_CLI) \
  $(LIBBITCOIN_WALLET) \
  $(LIBBITCOIN_ZMQ)
60

61
lib_LTLIBRARIES = $(LIBBITCOINCONSENSUS)
62

63
bin_PROGRAMS =
64
TESTS =
65
BENCHMARKS =
66
67
68
69
70

if BUILD_BITCOIND
  bin_PROGRAMS += bitcoind
endif

71
72
if BUILD_BITCOIN_UTILS
  bin_PROGRAMS += bitcoin-cli bitcoin-tx
73
endif
74

75
.PHONY: FORCE check-symbols check-security
76
# bitcoin core #
77
BITCOIN_CORE_H = \
78
  addrdb.h \
79
  addrman.h \
Pieter Wuille's avatar
Pieter Wuille committed
80
  base58.h \
81
  bloom.h \
82
  blockencodings.h \
83
  chain.h \
84
  chainparams.h \
Jorge Timón's avatar
Jorge Timón committed
85
  chainparamsbase.h \
86
  chainparamsseeds.h \
87
88
89
90
91
  checkpoints.h \
  checkqueue.h \
  clientversion.h \
  coins.h \
  compat.h \
Jorge Timón's avatar
Jorge Timón committed
92
93
94
  compat/byteswap.h \
  compat/endian.h \
  compat/sanity.h \
95
  compressor.h \
96
  consensus/consensus.h \
97
  core_io.h \
98
  core_memusage.h \
99
100
  httprpc.h \
  httpserver.h \
101
  indirectmap.h \
102
103
104
  init.h \
  key.h \
  keystore.h \
105
  dbwrapper.h \
106
107
  limitedmap.h \
  main.h \
Pieter Wuille's avatar
Pieter Wuille committed
108
  memusage.h \
109
  merkleblock.h \
110
111
  miner.h \
  net.h \
112
  netaddress.h \
Cory Fields's avatar
Cory Fields committed
113
  netbase.h \
114
  netmessagemaker.h \
115
  noui.h \
116
  policy/fees.h \
117
  policy/policy.h \
118
  policy/rbf.h \
119
  pow.h \
120
  protocol.h \
121
  random.h \
122
  reverselock.h \
Daniel Cousens's avatar
Daniel Cousens committed
123
124
125
  rpc/client.h \
  rpc/protocol.h \
  rpc/server.h \
126
  rpc/register.h \
127
  scheduler.h \
Pieter Wuille's avatar
Pieter Wuille committed
128
  script/sigcache.h \
jtimon's avatar
jtimon committed
129
  script/sign.h \
jtimon's avatar
jtimon committed
130
  script/standard.h \
131
  script/ismine.h \
132
  streams.h \
133
134
  support/allocators/secure.h \
  support/allocators/zeroafterfree.h \
135
  support/cleanse.h \
136
  support/lockedpool.h \
137
138
  sync.h \
  threadsafety.h \
139
  timedata.h \
140
  torcontrol.h \
141
142
143
  txdb.h \
  txmempool.h \
  ui_interface.h \
144
  undo.h \
145
  util.h \
Wladimir J. van der Laan's avatar
Wladimir J. van der Laan committed
146
147
  utilmoneystr.h \
  utiltime.h \
148
  validationinterface.h \
Pieter Wuille's avatar
Pieter Wuille committed
149
  versionbits.h \
150
  wallet/coincontrol.h \
Cory Fields's avatar
Cory Fields committed
151
  wallet/crypter.h \
Jorge Timón's avatar
Jorge Timón committed
152
  wallet/db.h \
153
  wallet/rpcwallet.h \
154
  wallet/wallet.h \
155
156
157
158
159
160
  wallet/walletdb.h \
  zmq/zmqabstractnotifier.h \
  zmq/zmqconfig.h\
  zmq/zmqnotificationinterface.h \
  zmq/zmqpublishnotifier.h

161

162
obj/build.h: FORCE
163
	@$(MKDIR_P) $(builddir)/obj
164
165
	@$(top_srcdir)/share/genbuild.sh $(abs_top_builddir)/src/obj/build.h \
	  $(abs_top_srcdir)
166
libbitcoin_util_a-clientversion.$(OBJEXT): obj/build.h
167

168
# server: shared between bitcoind and bitcoin-qt
169
170
libbitcoin_server_a_CPPFLAGS = $(AM_CPPFLAGS) $(BITCOIN_INCLUDES) $(MINIUPNPC_CPPFLAGS) $(EVENT_CFLAGS) $(EVENT_PTHREADS_CFLAGS)
libbitcoin_server_a_CXXFLAGS = $(AM_CXXFLAGS) $(PIE_FLAGS)
171
172
libbitcoin_server_a_SOURCES = \
  addrman.cpp \
173
  addrdb.cpp \
174
  bloom.cpp \
175
  blockencodings.cpp \
176
  chain.cpp \
177
  checkpoints.cpp \
178
179
  httprpc.cpp \
  httpserver.cpp \
180
  init.cpp \
181
  dbwrapper.cpp \
182
  main.cpp \
183
  merkleblock.cpp \
184
  miner.cpp \
185
186
  net.cpp \
  noui.cpp \
187
  policy/fees.cpp \
188
  policy/policy.cpp \
189
  pow.cpp \
190
  rest.cpp \
Daniel Cousens's avatar
Daniel Cousens committed
191
192
193
194
195
196
  rpc/blockchain.cpp \
  rpc/mining.cpp \
  rpc/misc.cpp \
  rpc/net.cpp \
  rpc/rawtransaction.cpp \
  rpc/server.cpp \
Pieter Wuille's avatar
Pieter Wuille committed
197
  script/sigcache.cpp \
198
  script/ismine.cpp \
199
  timedata.cpp \
200
  torcontrol.cpp \
201
202
  txdb.cpp \
  txmempool.cpp \
203
  ui_interface.cpp \
204
  validationinterface.cpp \
Pieter Wuille's avatar
Pieter Wuille committed
205
  versionbits.cpp \
206
207
  $(BITCOIN_CORE_H)

208
if ENABLE_ZMQ
Cory Fields's avatar
Cory Fields committed
209
libbitcoin_zmq_a_CPPFLAGS = $(BITCOIN_INCLUDES) $(ZMQ_CFLAGS)
210
libbitcoin_zmq_a_CXXFLAGS = $(AM_CXXFLAGS) $(PIE_FLAGS)
211
212
213
214
215
216
217
libbitcoin_zmq_a_SOURCES = \
  zmq/zmqabstractnotifier.cpp \
  zmq/zmqnotificationinterface.cpp \
  zmq/zmqpublishnotifier.cpp
endif


218
219
# wallet: shared between bitcoind and bitcoin-qt, but only linked
# when wallet enabled
220
221
libbitcoin_wallet_a_CPPFLAGS = $(AM_CPPFLAGS) $(BITCOIN_INCLUDES)
libbitcoin_wallet_a_CXXFLAGS = $(AM_CXXFLAGS) $(PIE_FLAGS)
222
libbitcoin_wallet_a_SOURCES = \
Cory Fields's avatar
Cory Fields committed
223
  wallet/crypter.cpp \
224
225
226
227
228
  wallet/db.cpp \
  wallet/rpcdump.cpp \
  wallet/rpcwallet.cpp \
  wallet/wallet.cpp \
  wallet/walletdb.cpp \
229
  policy/rbf.cpp \
230
231
  $(BITCOIN_CORE_H)

232
# crypto primitives library
233
234
crypto_libbitcoin_crypto_a_CPPFLAGS = $(AM_CPPFLAGS) $(BITCOIN_CONFIG_INCLUDES)
crypto_libbitcoin_crypto_a_CXXFLAGS = $(AM_CXXFLAGS) $(PIE_FLAGS)
235
crypto_libbitcoin_crypto_a_SOURCES = \
236
237
  crypto/aes.cpp \
  crypto/aes.h \
238
  crypto/common.h \
Jorge Timón's avatar
Jorge Timón committed
239
  crypto/hmac_sha256.cpp \
Pieter Wuille's avatar
Pieter Wuille committed
240
  crypto/hmac_sha256.h \
Jorge Timón's avatar
Jorge Timón committed
241
  crypto/hmac_sha512.cpp \
Pieter Wuille's avatar
Pieter Wuille committed
242
  crypto/hmac_sha512.h \
Jorge Timón's avatar
Jorge Timón committed
243
244
245
  crypto/ripemd160.cpp \
  crypto/ripemd160.h \
  crypto/sha1.cpp \
246
  crypto/sha1.h \
Jorge Timón's avatar
Jorge Timón committed
247
248
249
250
  crypto/sha256.cpp \
  crypto/sha256.h \
  crypto/sha512.cpp \
  crypto/sha512.h
251

252
253
254
255
256
# consensus: shared between all executables that validate any consensus rules.
libbitcoin_consensus_a_CPPFLAGS = $(AM_CPPFLAGS) $(BITCOIN_INCLUDES)
libbitcoin_consensus_a_CXXFLAGS = $(AM_CXXFLAGS) $(PIE_FLAGS)
libbitcoin_consensus_a_SOURCES = \
  amount.h \
257
258
259
260
261
262
  arith_uint256.cpp \
  arith_uint256.h \
  consensus/merkle.cpp \
  consensus/merkle.h \
  consensus/params.h \
  consensus/validation.h \
263
264
265
  hash.cpp \
  hash.h \
  prevector.h \
266
267
  primitives/block.cpp \
  primitives/block.h \
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
  primitives/transaction.cpp \
  primitives/transaction.h \
  pubkey.cpp \
  pubkey.h \
  script/bitcoinconsensus.cpp \
  script/interpreter.cpp \
  script/interpreter.h \
  script/script.cpp \
  script/script.h \
  script/script_error.cpp \
  script/script_error.h \
  serialize.h \
  tinyformat.h \
  uint256.cpp \
  uint256.h \
  utilstrencodings.cpp \
  utilstrencodings.h \
  version.h

287
# common: shared between bitcoind, and bitcoin-qt and non-server tools
288
289
libbitcoin_common_a_CPPFLAGS = $(AM_CPPFLAGS) $(BITCOIN_INCLUDES)
libbitcoin_common_a_CXXFLAGS = $(AM_CXXFLAGS) $(PIE_FLAGS)
290
libbitcoin_common_a_SOURCES = \
291
  amount.cpp \
292
  base58.cpp \
293
  chainparams.cpp \
294
  coins.cpp \
295
  compressor.cpp \
296
297
  core_read.cpp \
  core_write.cpp \
298
  key.cpp \
299
  keystore.cpp \
300
  netaddress.cpp \
301
302
  netbase.cpp \
  protocol.cpp \
303
  scheduler.cpp \
jtimon's avatar
jtimon committed
304
  script/sign.cpp \
jtimon's avatar
jtimon committed
305
  script/standard.cpp \
306
307
308
309
310
  $(BITCOIN_CORE_H)

# util: shared between all executables.
# This library *must* be included to make sure that the glibc
# backward-compatibility objects and their sanity checks are linked.
311
312
libbitcoin_util_a_CPPFLAGS = $(AM_CPPFLAGS) $(BITCOIN_INCLUDES)
libbitcoin_util_a_CXXFLAGS = $(AM_CXXFLAGS) $(PIE_FLAGS)
313
libbitcoin_util_a_SOURCES = \
314
  support/lockedpool.cpp \
315
  chainparamsbase.cpp \
316
  clientversion.cpp \
317
318
319
  compat/glibc_sanity.cpp \
  compat/glibcxx_sanity.cpp \
  compat/strnlen.cpp \
320
  random.cpp \
Daniel Cousens's avatar
Daniel Cousens committed
321
  rpc/protocol.cpp \
322
  support/cleanse.cpp \
323
324
  sync.cpp \
  util.cpp \
Wladimir J. van der Laan's avatar
Wladimir J. van der Laan committed
325
  utilmoneystr.cpp \
326
  utilstrencodings.cpp \
Wladimir J. van der Laan's avatar
Wladimir J. van der Laan committed
327
  utiltime.cpp \
328
329
  $(BITCOIN_CORE_H)

330
if GLIBC_BACK_COMPAT
331
libbitcoin_util_a_SOURCES += compat/glibc_compat.cpp
332
333
endif

334
# cli: shared between bitcoin-cli and bitcoin-qt
335
336
libbitcoin_cli_a_CPPFLAGS = $(AM_CPPFLAGS) $(BITCOIN_INCLUDES)
libbitcoin_cli_a_CXXFLAGS = $(AM_CXXFLAGS) $(PIE_FLAGS)
337
libbitcoin_cli_a_SOURCES = \
Daniel Cousens's avatar
Daniel Cousens committed
338
  rpc/client.cpp \
339
340
  $(BITCOIN_CORE_H)

341
nodist_libbitcoin_util_a_SOURCES = $(srcdir)/obj/build.h
342
343
344
#

# bitcoind binary #
345
bitcoind_SOURCES = bitcoind.cpp
346
347
bitcoind_CPPFLAGS = $(AM_CPPFLAGS) $(BITCOIN_INCLUDES)
bitcoind_CXXFLAGS = $(AM_CXXFLAGS) $(PIE_FLAGS)
348
349
350
351
352
353
bitcoind_LDFLAGS = $(RELDFLAGS) $(AM_LDFLAGS) $(LIBTOOL_APP_LDFLAGS)

if TARGET_WINDOWS
bitcoind_SOURCES += bitcoind-res.rc
endif

354
bitcoind_LDADD = \
355
356
  $(LIBBITCOIN_SERVER) \
  $(LIBBITCOIN_COMMON) \
357
  $(LIBUNIVALUE) \
358
  $(LIBBITCOIN_UTIL) \
359
360
  $(LIBBITCOIN_WALLET) \
  $(LIBBITCOIN_ZMQ) \
361
  $(LIBBITCOIN_CONSENSUS) \
362
  $(LIBBITCOIN_CRYPTO) \
363
  $(LIBLEVELDB) \
364
365
  $(LIBMEMENV) \
  $(LIBSECP256K1)
366

367
bitcoind_LDADD += $(BOOST_LIBS) $(BDB_LIBS) $(SSL_LIBS) $(CRYPTO_LIBS) $(MINIUPNPC_LIBS) $(EVENT_PTHREADS_LIBS) $(EVENT_LIBS) $(ZMQ_LIBS)
368

369
370
# bitcoin-cli binary #
bitcoin_cli_SOURCES = bitcoin-cli.cpp
371
372
bitcoin_cli_CPPFLAGS = $(AM_CPPFLAGS) $(BITCOIN_INCLUDES) $(EVENT_CFLAGS)
bitcoin_cli_CXXFLAGS = $(AM_CXXFLAGS) $(PIE_FLAGS)
373
374
bitcoin_cli_LDFLAGS = $(RELDFLAGS) $(AM_LDFLAGS) $(LIBTOOL_APP_LDFLAGS)

375
if TARGET_WINDOWS
376
bitcoin_cli_SOURCES += bitcoin-cli-res.rc
377
378
endif

379
bitcoin_cli_LDADD = \
380
  $(LIBBITCOIN_CLI) \
381
  $(LIBUNIVALUE) \
382
383
  $(LIBBITCOIN_UTIL) \
  $(LIBBITCOIN_CRYPTO)
384

385
bitcoin_cli_LDADD += $(BOOST_LIBS) $(SSL_LIBS) $(CRYPTO_LIBS) $(EVENT_LIBS)
386
387
#

388
# bitcoin-tx binary #
389
bitcoin_tx_SOURCES = bitcoin-tx.cpp
390
391
bitcoin_tx_CPPFLAGS = $(AM_CPPFLAGS) $(BITCOIN_INCLUDES)
bitcoin_tx_CXXFLAGS = $(AM_CXXFLAGS) $(PIE_FLAGS)
392
393
bitcoin_tx_LDFLAGS = $(RELDFLAGS) $(AM_LDFLAGS) $(LIBTOOL_APP_LDFLAGS)

394
395
396
397
if TARGET_WINDOWS
bitcoin_tx_SOURCES += bitcoin-tx-res.rc
endif

398
bitcoin_tx_LDADD = \
399
  $(LIBUNIVALUE) \
400
401
  $(LIBBITCOIN_COMMON) \
  $(LIBBITCOIN_UTIL) \
402
  $(LIBBITCOIN_CONSENSUS) \
403
  $(LIBBITCOIN_CRYPTO) \
404
  $(LIBSECP256K1)
405

406
bitcoin_tx_LDADD += $(BOOST_LIBS) $(CRYPTO_LIBS)
407
#
408

409
# bitcoinconsensus library #
410
411
if BUILD_BITCOIN_LIBS
include_HEADERS = script/bitcoinconsensus.h
412
libbitcoinconsensus_la_SOURCES = $(crypto_libbitcoin_crypto_a_SOURCES) $(libbitcoin_consensus_a_SOURCES)
413
414
415
416
417

if GLIBC_BACK_COMPAT
  libbitcoinconsensus_la_SOURCES += compat/glibc_compat.cpp
endif

418
libbitcoinconsensus_la_LDFLAGS = $(AM_LDFLAGS) -no-undefined $(RELDFLAGS)
419
420
libbitcoinconsensus_la_LIBADD = $(LIBSECP256K1)
libbitcoinconsensus_la_CPPFLAGS = $(AM_CPPFLAGS) -I$(builddir)/obj -I$(srcdir)/secp256k1/include -DBUILD_BITCOIN_INTERNAL
421
libbitcoinconsensus_la_CXXFLAGS = $(AM_CXXFLAGS) $(PIE_FLAGS)
422

423
endif
424
#
425

426
427
428
429
430
431
CTAES_DIST =  crypto/ctaes/bench.c
CTAES_DIST += crypto/ctaes/ctaes.c
CTAES_DIST += crypto/ctaes/ctaes.h
CTAES_DIST += crypto/ctaes/README.md
CTAES_DIST += crypto/ctaes/test.c

Cory Fields's avatar
Cory Fields committed
432
433
CLEANFILES = $(EXTRA_LIBRARIES)

434
435
436
437
438
439
440
441
442
443
444
445
CLEANFILES += *.gcda *.gcno
CLEANFILES += compat/*.gcda compat/*.gcno
CLEANFILES += consensus/*.gcda consensus/*.gcno
CLEANFILES += crypto/*.gcda crypto/*.gcno
CLEANFILES += policy/*.gcda policy/*.gcno
CLEANFILES += primitives/*.gcda primitives/*.gcno
CLEANFILES += script/*.gcda script/*.gcno
CLEANFILES += support/*.gcda support/*.gcno
CLEANFILES += univalue/*.gcda univalue/*.gcno
CLEANFILES += wallet/*.gcda wallet/*.gcno
CLEANFILES += wallet/test/*.gcda wallet/test/*.gcno
CLEANFILES += zmq/*.gcda zmq/*.gcno
446
447
448

DISTCLEANFILES = obj/build.h

Cory Fields's avatar
Cory Fields committed
449
EXTRA_DIST = $(CTAES_DIST)
450
451

clean-local:
452
	-$(MAKE) -C secp256k1 clean
453
	-$(MAKE) -C univalue clean
454
	-rm -f leveldb/*/*.gcda leveldb/*/*.gcno leveldb/helpers/memenv/*.gcda leveldb/helpers/memenv/*.gcno
455
	-rm -f config.h
Cory Fields's avatar
Cory Fields committed
456
	-rm -rf test/__pycache__
457

458
.rc.o:
459
	@test -f $(WINDRES)
460
461
	## FIXME: How to get the appropriate modulename_CPPFLAGS in here?
	$(AM_V_GEN) $(WINDRES) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(CPPFLAGS) -DWINDRES_PREPROC -i $< -o $@
462
463

.mm.o:
464
	$(AM_V_CXX) $(OBJCXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \
465
	  $(CPPFLAGS) $(AM_CXXFLAGS) $(QT_INCLUDES) $(AM_CXXFLAGS) $(PIE_FLAGS) $(CXXFLAGS) -c -o $@ $<
466

467
468
469
470
471
472
473
474
475
476
477
478
check-symbols: $(bin_PROGRAMS)
if GLIBC_BACK_COMPAT
	@echo "Checking glibc back compat..."
	$(AM_V_at) READELF=$(READELF) CPPFILT=$(CPPFILT) $(top_srcdir)/contrib/devtools/symbol-check.py < $(bin_PROGRAMS)
endif

check-security: $(bin_PROGRAMS)
if HARDEN
	@echo "Checking binary security..."
	$(AM_V_at) READELF=$(READELF) OBJDUMP=$(OBJDUMP) $(top_srcdir)/contrib/devtools/security-check.py < $(bin_PROGRAMS)
endif

479
%.pb.cc %.pb.h: %.proto
480
	@test -f $(PROTOC)
481
	$(AM_V_GEN) $(PROTOC) --cpp_out=$(@D) --proto_path=$(<D) $<
482

483
484
485
486
if EMBEDDED_LEVELDB
include Makefile.leveldb.include
endif

487
488
489
490
if ENABLE_TESTS
include Makefile.test.include
endif

491
492
493
494
if ENABLE_BENCH
include Makefile.bench.include
endif

495
496
497
498
499
500
501
if ENABLE_QT
include Makefile.qt.include
endif

if ENABLE_QT_TESTS
include Makefile.qttest.include
endif