Makefile.am 11.9 KB
Newer Older
1
DIST_SUBDIRS = secp256k1 univalue
2

3
4
5
AM_LDFLAGS = $(PTHREAD_CFLAGS) $(LIBTOOL_LDFLAGS) $(HARDENED_LDFLAGS)
AM_CXXFLAGS = $(HARDENED_CXXFLAGS)
AM_CPPFLAGS = $(HARDENED_CPPFLAGS)
6

7
if EMBEDDED_LEVELDB
8
9
10
11
LEVELDB_CPPFLAGS += -I$(srcdir)/leveldb/include
LEVELDB_CPPFLAGS += -I$(srcdir)/leveldb/helpers/memenv
LIBLEVELDB += $(builddir)/leveldb/libleveldb.a
LIBMEMENV  += $(builddir)/leveldb/libmemenv.a
12
13
14
15
16
17
18

# 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
$(LIBLEVELDB): $(LIBMEMENV)

$(LIBLEVELDB) $(LIBMEMENV):
	@echo "Building LevelDB ..." && $(MAKE) -C $(@D) $(@F) CXX="$(CXX)" \
	  CC="$(CC)" PLATFORM=$(TARGET_OS) AR="$(AR)" $(LEVELDB_TARGET_FLAGS) \
19
          OPT="$(AM_CXXFLAGS) $(PIE_FLAGS) $(CXXFLAGS) $(AM_CPPFLAGS) $(CPPFLAGS) -D__STDC_LIMIT_MACROS"
20
21
endif

22
BITCOIN_CONFIG_INCLUDES=-I$(builddir)/config
23
BITCOIN_INCLUDES=-I$(builddir) -I$(builddir)/obj $(BOOST_CPPFLAGS) $(LEVELDB_CPPFLAGS) $(CRYPTO_CFLAGS) $(SSL_CFLAGS)
Cory Fields's avatar
Cory Fields committed
24

25
BITCOIN_INCLUDES += -I$(srcdir)/secp256k1/include
26
BITCOIN_INCLUDES += -I$(srcdir)/univalue/include
27

28
29
30
31
32
33
34
LIBBITCOIN_SERVER=libbitcoin_server.a
LIBBITCOIN_WALLET=libbitcoin_wallet.a
LIBBITCOIN_COMMON=libbitcoin_common.a
LIBBITCOIN_CLI=libbitcoin_cli.a
LIBBITCOIN_UTIL=libbitcoin_util.a
LIBBITCOIN_CRYPTO=crypto/libbitcoin_crypto.a
LIBBITCOINQT=qt/libbitcoinqt.a
35
LIBSECP256K1=secp256k1/libsecp256k1.la
36
LIBUNIVALUE=univalue/libunivalue.la
37
38

$(LIBSECP256K1): $(wildcard secp256k1/src/*) $(wildcard secp256k1/include/*)
39
	$(AM_V_at)$(MAKE) $(AM_MAKEFLAGS) -C $(@D) $(@F)
40
  
41
42
$(LIBUNIVALUE): $(wildcard univalue/lib/*) $(wildcard univalue/include/*)
	$(AM_V_at)$(MAKE) $(AM_MAKEFLAGS) -C $(@D) $(@F)
43

44
45
# 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:
46
EXTRA_LIBRARIES = \
47
  crypto/libbitcoin_crypto.a \
48
  libbitcoin_util.a \
49
50
51
  libbitcoin_common.a \
  libbitcoin_server.a \
  libbitcoin_cli.a
52
if ENABLE_WALLET
Cory Fields's avatar
Cory Fields committed
53
BITCOIN_INCLUDES += $(BDB_CPPFLAGS)
54
EXTRA_LIBRARIES += libbitcoin_wallet.a
55
endif
56
57
58
if ENABLE_ZMQ
EXTRA_LIBRARIES += libbitcoin_zmq.a
endif
59

60
if BUILD_BITCOIN_LIBS
61
lib_LTLIBRARIES = libbitcoinconsensus.la
62
63
64
65
LIBBITCOIN_CONSENSUS=libbitcoinconsensus.la
else
LIBBITCOIN_CONSENSUS=
endif
66

67
bin_PROGRAMS =
68
TESTS =
69
BENCHMARKS =
70
71
72
73
74

if BUILD_BITCOIND
  bin_PROGRAMS += bitcoind
endif

75
76
if BUILD_BITCOIN_UTILS
  bin_PROGRAMS += bitcoin-cli bitcoin-tx
77
endif
78
79
80

.PHONY: FORCE
# bitcoin core #
81
82
83
BITCOIN_CORE_H = \
  addrman.h \
  alert.h \
84
  amount.h \
85
  arith_uint256.h \
Pieter Wuille's avatar
Pieter Wuille committed
86
  base58.h \
87
  bloom.h \
88
  chain.h \
89
  chainparams.h \
Jorge Timón's avatar
Jorge Timón committed
90
  chainparamsbase.h \
91
  chainparamsseeds.h \
92
93
94
95
96
97
  checkpoints.h \
  checkqueue.h \
  clientversion.h \
  coincontrol.h \
  coins.h \
  compat.h \
Jorge Timón's avatar
Jorge Timón committed
98
99
100
  compat/byteswap.h \
  compat/endian.h \
  compat/sanity.h \
101
  compressor.h \
102
  consensus/consensus.h \
103
  consensus/merkle.h \
104
  consensus/params.h \
105
  consensus/validation.h \
106
  core_io.h \
107
  core_memusage.h \
108
  hash.h \
109
110
  httprpc.h \
  httpserver.h \
111
112
113
  init.h \
  key.h \
  keystore.h \
114
  dbwrapper.h \
115
116
  limitedmap.h \
  main.h \
Pieter Wuille's avatar
Pieter Wuille committed
117
  memusage.h \
118
  merkleblock.h \
119
120
121
  miner.h \
  mruset.h \
  net.h \
Jorge Timón's avatar
Jorge Timón committed
122
  netbase.h \
123
  noui.h \
124
  policy/fees.h \
125
  policy/policy.h \
126
  pow.h \
Pieter Wuille's avatar
Pieter Wuille committed
127
  prevector.h \
128
129
  primitives/block.h \
  primitives/transaction.h \
130
  protocol.h \
131
  pubkey.h \
132
  random.h \
133
  reverselock.h \
134
135
136
  rpcclient.h \
  rpcprotocol.h \
  rpcserver.h \
137
  scheduler.h \
Philip Kaufmann's avatar
Philip Kaufmann committed
138
  script/interpreter.h \
139
  script/script.h \
Jorge Timón's avatar
Jorge Timón committed
140
  script/script_error.h \
Pieter Wuille's avatar
Pieter Wuille committed
141
  script/sigcache.h \
jtimon's avatar
jtimon committed
142
  script/sign.h \
jtimon's avatar
jtimon committed
143
  script/standard.h \
144
  serialize.h \
145
  streams.h \
146
147
  support/allocators/secure.h \
  support/allocators/zeroafterfree.h \
148
  support/cleanse.h \
149
  support/pagelocker.h \
150
151
  sync.h \
  threadsafety.h \
152
  timedata.h \
153
  tinyformat.h \
154
  torcontrol.h \
155
156
157
158
  txdb.h \
  txmempool.h \
  ui_interface.h \
  uint256.h \
159
  undo.h \
160
  util.h \
Wladimir J. van der Laan's avatar
Wladimir J. van der Laan committed
161
  utilmoneystr.h \
162
  utilstrencodings.h \
Wladimir J. van der Laan's avatar
Wladimir J. van der Laan committed
163
  utiltime.h \
164
  validationinterface.h \
165
  version.h \
Cory Fields's avatar
Cory Fields committed
166
  wallet/crypter.h \
Jorge Timón's avatar
Jorge Timón committed
167
  wallet/db.h \
168
169
  wallet/wallet.h \
  wallet/wallet_ismine.h \
170
171
172
173
174
175
  wallet/walletdb.h \
  zmq/zmqabstractnotifier.h \
  zmq/zmqconfig.h\
  zmq/zmqnotificationinterface.h \
  zmq/zmqpublishnotifier.h

176

177
obj/build.h: FORCE
178
	@$(MKDIR_P) $(builddir)/obj
179
180
	@$(top_srcdir)/share/genbuild.sh $(abs_top_builddir)/src/obj/build.h \
	  $(abs_top_srcdir)
181
libbitcoin_util_a-clientversion.$(OBJEXT): obj/build.h
182

183
# server: shared between bitcoind and bitcoin-qt
184
185
libbitcoin_server_a_CPPFLAGS = $(AM_CPPFLAGS) $(BITCOIN_INCLUDES) $(MINIUPNPC_CPPFLAGS) $(EVENT_CFLAGS) $(EVENT_PTHREADS_CFLAGS)
libbitcoin_server_a_CXXFLAGS = $(AM_CXXFLAGS) $(PIE_FLAGS)
186
187
188
libbitcoin_server_a_SOURCES = \
  addrman.cpp \
  alert.cpp \
189
  bloom.cpp \
190
  chain.cpp \
191
  checkpoints.cpp \
192
193
  httprpc.cpp \
  httpserver.cpp \
194
  init.cpp \
195
  dbwrapper.cpp \
196
  main.cpp \
197
  merkleblock.cpp \
198
  miner.cpp \
199
200
  net.cpp \
  noui.cpp \
201
  policy/fees.cpp \
202
  policy/policy.cpp \
203
  pow.cpp \
204
  rest.cpp \
205
  rpcblockchain.cpp \
206
  rpcmining.cpp \
207
  rpcmisc.cpp \
208
209
  rpcnet.cpp \
  rpcrawtransaction.cpp \
210
  rpcserver.cpp \
Pieter Wuille's avatar
Pieter Wuille committed
211
  script/sigcache.cpp \
212
  timedata.cpp \
213
  torcontrol.cpp \
214
215
  txdb.cpp \
  txmempool.cpp \
216
  validationinterface.cpp \
217
218
  $(BITCOIN_CORE_H)

219
220
221
if ENABLE_ZMQ
LIBBITCOIN_ZMQ=libbitcoin_zmq.a

Cory Fields's avatar
Cory Fields committed
222
libbitcoin_zmq_a_CPPFLAGS = $(BITCOIN_INCLUDES) $(ZMQ_CFLAGS)
223
libbitcoin_zmq_a_CXXFLAGS = $(AM_CXXFLAGS) $(PIE_FLAGS)
224
225
226
227
228
229
230
libbitcoin_zmq_a_SOURCES = \
  zmq/zmqabstractnotifier.cpp \
  zmq/zmqnotificationinterface.cpp \
  zmq/zmqpublishnotifier.cpp
endif


231
232
# wallet: shared between bitcoind and bitcoin-qt, but only linked
# when wallet enabled
233
234
libbitcoin_wallet_a_CPPFLAGS = $(AM_CPPFLAGS) $(BITCOIN_INCLUDES)
libbitcoin_wallet_a_CXXFLAGS = $(AM_CXXFLAGS) $(PIE_FLAGS)
235
libbitcoin_wallet_a_SOURCES = \
Cory Fields's avatar
Cory Fields committed
236
  wallet/crypter.cpp \
237
238
239
240
241
242
  wallet/db.cpp \
  wallet/rpcdump.cpp \
  wallet/rpcwallet.cpp \
  wallet/wallet.cpp \
  wallet/wallet_ismine.cpp \
  wallet/walletdb.cpp \
243
244
  $(BITCOIN_CORE_H)

245
# crypto primitives library
246
247
crypto_libbitcoin_crypto_a_CPPFLAGS = $(AM_CPPFLAGS) $(BITCOIN_CONFIG_INCLUDES)
crypto_libbitcoin_crypto_a_CXXFLAGS = $(AM_CXXFLAGS) $(PIE_FLAGS)
248
249
crypto_libbitcoin_crypto_a_SOURCES = \
  crypto/common.h \
Jorge Timón's avatar
Jorge Timón committed
250
  crypto/hmac_sha256.cpp \
Pieter Wuille's avatar
Pieter Wuille committed
251
  crypto/hmac_sha256.h \
Jorge Timón's avatar
Jorge Timón committed
252
  crypto/hmac_sha512.cpp \
Pieter Wuille's avatar
Pieter Wuille committed
253
  crypto/hmac_sha512.h \
Jorge Timón's avatar
Jorge Timón committed
254
255
256
  crypto/ripemd160.cpp \
  crypto/ripemd160.h \
  crypto/sha1.cpp \
257
  crypto/sha1.h \
Jorge Timón's avatar
Jorge Timón committed
258
259
260
261
  crypto/sha256.cpp \
  crypto/sha256.h \
  crypto/sha512.cpp \
  crypto/sha512.h
262

263
# common: shared between bitcoind, and bitcoin-qt and non-server tools
264
265
libbitcoin_common_a_CPPFLAGS = $(AM_CPPFLAGS) $(BITCOIN_INCLUDES)
libbitcoin_common_a_CXXFLAGS = $(AM_CXXFLAGS) $(PIE_FLAGS)
266
libbitcoin_common_a_SOURCES = \
267
  amount.cpp \
Jorge Timón's avatar
Jorge Timón committed
268
  arith_uint256.cpp \
269
  base58.cpp \
270
  chainparams.cpp \
271
  coins.cpp \
272
  compressor.cpp \
273
  consensus/merkle.cpp \
274
275
  core_read.cpp \
  core_write.cpp \
276
277
  hash.cpp \
  key.cpp \
278
  keystore.cpp \
279
  netbase.cpp \
Jorge Timón's avatar
Jorge Timón committed
280
281
  primitives/block.cpp \
  primitives/transaction.cpp \
282
  protocol.cpp \
283
  pubkey.cpp \
284
  scheduler.cpp \
Philip Kaufmann's avatar
Philip Kaufmann committed
285
  script/interpreter.cpp \
286
  script/script.cpp \
Jorge Timón's avatar
Jorge Timón committed
287
  script/script_error.cpp \
jtimon's avatar
jtimon committed
288
  script/sign.cpp \
jtimon's avatar
jtimon committed
289
  script/standard.cpp \
290
291
292
293
294
  $(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.
295
296
libbitcoin_util_a_CPPFLAGS = $(AM_CPPFLAGS) $(BITCOIN_INCLUDES)
libbitcoin_util_a_CXXFLAGS = $(AM_CXXFLAGS) $(PIE_FLAGS)
297
libbitcoin_util_a_SOURCES = \
298
  support/pagelocker.cpp \
299
  chainparamsbase.cpp \
300
  clientversion.cpp \
301
302
303
  compat/glibc_sanity.cpp \
  compat/glibcxx_sanity.cpp \
  compat/strnlen.cpp \
304
  random.cpp \
305
  rpcprotocol.cpp \
306
  support/cleanse.cpp \
307
  sync.cpp \
308
  uint256.cpp \
309
  util.cpp \
Wladimir J. van der Laan's avatar
Wladimir J. van der Laan committed
310
  utilmoneystr.cpp \
311
  utilstrencodings.cpp \
Wladimir J. van der Laan's avatar
Wladimir J. van der Laan committed
312
  utiltime.cpp \
313
314
  $(BITCOIN_CORE_H)

315
if GLIBC_BACK_COMPAT
316
libbitcoin_util_a_SOURCES += compat/glibc_compat.cpp
317
318
endif

319
# cli: shared between bitcoin-cli and bitcoin-qt
320
321
libbitcoin_cli_a_CPPFLAGS = $(AM_CPPFLAGS) $(BITCOIN_INCLUDES)
libbitcoin_cli_a_CXXFLAGS = $(AM_CXXFLAGS) $(PIE_FLAGS)
322
323
324
325
libbitcoin_cli_a_SOURCES = \
  rpcclient.cpp \
  $(BITCOIN_CORE_H)

326
nodist_libbitcoin_util_a_SOURCES = $(srcdir)/obj/build.h
327
328
329
#

# bitcoind binary #
330
bitcoind_SOURCES = bitcoind.cpp
331
332
bitcoind_CPPFLAGS = $(AM_CPPFLAGS) $(BITCOIN_INCLUDES)
bitcoind_CXXFLAGS = $(AM_CXXFLAGS) $(PIE_FLAGS)
333
334
335
336
337
338
bitcoind_LDFLAGS = $(RELDFLAGS) $(AM_LDFLAGS) $(LIBTOOL_APP_LDFLAGS)

if TARGET_WINDOWS
bitcoind_SOURCES += bitcoind-res.rc
endif

339
bitcoind_LDADD = \
340
341
  $(LIBBITCOIN_SERVER) \
  $(LIBBITCOIN_COMMON) \
342
  $(LIBUNIVALUE) \
343
344
  $(LIBBITCOIN_UTIL) \
  $(LIBBITCOIN_CRYPTO) \
345
  $(LIBLEVELDB) \
346
347
  $(LIBMEMENV) \
  $(LIBSECP256K1)
348

349
350
351
352
if ENABLE_ZMQ
bitcoind_LDADD += $(LIBBITCOIN_ZMQ) $(ZMQ_LIBS)
endif

353
354
355
if ENABLE_WALLET
bitcoind_LDADD += libbitcoin_wallet.a
endif
356

357
bitcoind_LDADD += $(BOOST_LIBS) $(BDB_LIBS) $(SSL_LIBS) $(CRYPTO_LIBS) $(MINIUPNPC_LIBS) $(EVENT_PTHREADS_LIBS) $(EVENT_LIBS)
358

359
360
# bitcoin-cli binary #
bitcoin_cli_SOURCES = bitcoin-cli.cpp
361
362
bitcoin_cli_CPPFLAGS = $(AM_CPPFLAGS) $(BITCOIN_INCLUDES) $(EVENT_CFLAGS)
bitcoin_cli_CXXFLAGS = $(AM_CXXFLAGS) $(PIE_FLAGS)
363
364
bitcoin_cli_LDFLAGS = $(RELDFLAGS) $(AM_LDFLAGS) $(LIBTOOL_APP_LDFLAGS)

365
if TARGET_WINDOWS
366
bitcoin_cli_SOURCES += bitcoin-cli-res.rc
367
368
endif

369
bitcoin_cli_LDADD = \
370
  $(LIBBITCOIN_CLI) \
371
  $(LIBUNIVALUE) \
372
  $(LIBBITCOIN_UTIL)
373

374
bitcoin_cli_LDADD += $(BOOST_LIBS) $(SSL_LIBS) $(CRYPTO_LIBS) $(EVENT_LIBS)
375
376
#

377
# bitcoin-tx binary #
378
bitcoin_tx_SOURCES = bitcoin-tx.cpp
379
380
bitcoin_tx_CPPFLAGS = $(AM_CPPFLAGS) $(BITCOIN_INCLUDES)
bitcoin_tx_CXXFLAGS = $(AM_CXXFLAGS) $(PIE_FLAGS)
381
382
bitcoin_tx_LDFLAGS = $(RELDFLAGS) $(AM_LDFLAGS) $(LIBTOOL_APP_LDFLAGS)

383
384
385
386
if TARGET_WINDOWS
bitcoin_tx_SOURCES += bitcoin-tx-res.rc
endif

387
bitcoin_tx_LDADD = \
388
  $(LIBUNIVALUE) \
389
390
  $(LIBBITCOIN_COMMON) \
  $(LIBBITCOIN_UTIL) \
391
  $(LIBBITCOIN_CRYPTO) \
392
  $(LIBSECP256K1)
393

394
bitcoin_tx_LDADD += $(BOOST_LIBS) $(CRYPTO_LIBS)
395
#
396

397
# bitcoinconsensus library #
398
399
400
if BUILD_BITCOIN_LIBS
include_HEADERS = script/bitcoinconsensus.h
libbitcoinconsensus_la_SOURCES = \
Pieter Wuille's avatar
Pieter Wuille committed
401
  crypto/hmac_sha512.cpp \
402
  crypto/ripemd160.cpp \
403
  crypto/sha1.cpp \
Pieter Wuille's avatar
Pieter Wuille committed
404
405
  crypto/sha256.cpp \
  crypto/sha512.cpp \
406
  hash.cpp \
407
  primitives/transaction.cpp \
408
409
  pubkey.cpp \
  script/bitcoinconsensus.cpp \
410
411
  script/interpreter.cpp \
  script/script.cpp \
412
413
414
415
416
417
418
  uint256.cpp \
  utilstrencodings.cpp

if GLIBC_BACK_COMPAT
  libbitcoinconsensus_la_SOURCES += compat/glibc_compat.cpp
endif

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

424
endif
425
#
426

427
428
429
430
431
432
433
434
435
436
437
438
439
CLEANFILES = leveldb/libleveldb.a leveldb/libmemenv.a
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
440
441
442

DISTCLEANFILES = obj/build.h

443
EXTRA_DIST = leveldb
444
445
446

clean-local:
	-$(MAKE) -C leveldb clean
447
	-$(MAKE) -C secp256k1 clean
448
	-$(MAKE) -C univalue clean
449
	-rm -f leveldb/*/*.gcda leveldb/*/*.gcno leveldb/helpers/memenv/*.gcda leveldb/helpers/memenv/*.gcno
450
	-rm -f config.h
451

452
.rc.o:
453
	@test -f $(WINDRES)
454
	$(AM_V_GEN) $(WINDRES) -DWINDRES_PREPROC -i $< -o $@
455
456

.mm.o:
457
	$(AM_V_CXX) $(OBJCXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \
458
	  $(CPPFLAGS) $(AM_CXXFLAGS) $(QT_INCLUDES) $(AM_CXXFLAGS) $(PIE_FLAGS) $(CXXFLAGS) -c -o $@ $<
459
460

%.pb.cc %.pb.h: %.proto
461
462
	@test -f $(PROTOC)
	$(AM_V_GEN) $(PROTOC) --cpp_out=$(@D) --proto_path=$(abspath $(<D) $<)
463

464
465
466
467
if ENABLE_TESTS
include Makefile.test.include
endif

468
469
470
471
if ENABLE_BENCH
include Makefile.bench.include
endif

472
473
474
475
476
477
478
if ENABLE_QT
include Makefile.qt.include
endif

if ENABLE_QT_TESTS
include Makefile.qttest.include
endif