Makefile.am 7.76 KB
Newer Older
1
AM_LDFLAGS = $(PTHREAD_CFLAGS) $(LIBTOOL_LDFLAGS)
2

3
4
5
6
if USE_LIBSECP256K1
secp256k1/libsecp256k1.la: $(wildcard secp256k1/src/*) $(wildcard secp256k1/include/*)
	@$(MAKE) $(AM_MAKEFLAGS) -C $(@D) $(@F)
endif
7

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

# 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) \
          OPT="$(CXXFLAGS) $(CPPFLAGS)"
endif

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

26
27
28
29
if USE_LIBSECP256K1
BITCOIN_INCLUDES += -I$(srcdir)/secp256k1/include
endif

30
31
32
33
34
35
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
36
LIBBITCOIN_UNIVALUE=univalue/libbitcoin_univalue.a
37
38
LIBBITCOINQT=qt/libbitcoinqt.a

39
40
41
noinst_LIBRARIES = \
  libbitcoin_server.a \
  libbitcoin_common.a \
42
  libbitcoin_cli.a \
43
  libbitcoin_util.a \
44
  univalue/libbitcoin_univalue.a \
45
  crypto/libbitcoin_crypto.a
46
if ENABLE_WALLET
Cory Fields's avatar
Cory Fields committed
47
BITCOIN_INCLUDES += $(BDB_CPPFLAGS)
48
49
noinst_LIBRARIES += libbitcoin_wallet.a
endif
50

51
bin_PROGRAMS =
52
TESTS =
53
54
55
56
57

if BUILD_BITCOIND
  bin_PROGRAMS += bitcoind
endif

58
59
if BUILD_BITCOIN_UTILS
  bin_PROGRAMS += bitcoin-cli bitcoin-tx
60
endif
61
62
63

.PHONY: FORCE
# bitcoin core #
64
65
66
67
BITCOIN_CORE_H = \
  addrman.h \
  alert.h \
  allocators.h \
Pieter Wuille's avatar
Pieter Wuille committed
68
  base58.h \
69
70
  bloom.h \
  chainparams.h \
71
  chainparamsbase.h \
72
  chainparamsseeds.h \
73
74
75
76
77
78
79
  checkpoints.h \
  checkqueue.h \
  clientversion.h \
  coincontrol.h \
  coins.h \
  compat.h \
  core.h \
80
  core_io.h \
81
82
83
84
85
86
87
88
89
90
91
92
93
94
  crypter.h \
  db.h \
  hash.h \
  init.h \
  key.h \
  keystore.h \
  leveldbwrapper.h \
  limitedmap.h \
  main.h \
  miner.h \
  mruset.h \
  netbase.h \
  net.h \
  noui.h \
95
  pow.h \
96
  protocol.h \
97
  random.h \
98
99
100
  rpcclient.h \
  rpcprotocol.h \
  rpcserver.h \
101
  scriptutils.h \
102
103
104
  serialize.h \
  sync.h \
  threadsafety.h \
105
  timedata.h \
106
  tinyformat.h \
107
108
109
110
111
  txdb.h \
  txmempool.h \
  ui_interface.h \
  uint256.h \
  util.h \
Wladimir J. van der Laan's avatar
Wladimir J. van der Laan committed
112
113
114
  utilstrencodings.h \
  utilmoneystr.h \
  utiltime.h \
115
116
  version.h \
  walletdb.h \
117
118
  wallet.h \
  compat/sanity.h
119
120
121
122
123
124
125
126
127
128

JSON_H = \
  json/json_spirit.h \
  json/json_spirit_error_position.h \
  json/json_spirit_reader.h \
  json/json_spirit_reader_template.h \
  json/json_spirit_stream_reader.h \
  json/json_spirit_utils.h \
  json/json_spirit_value.h \
  json/json_spirit_writer.h \
129
130
131
  json/json_spirit_writer_template.h

obj/build.h: FORCE
132
	@$(MKDIR_P) $(builddir)/obj
133
134
	@$(top_srcdir)/share/genbuild.sh $(abs_top_builddir)/src/obj/build.h \
	  $(abs_top_srcdir)
135
libbitcoin_util_a-version.$(OBJEXT): obj/build.h
136

137
# server: shared between bitcoind and bitcoin-qt
138
libbitcoin_server_a_CPPFLAGS = $(BITCOIN_INCLUDES) $(MINIUPNPC_CPPFLAGS)
139
140
141
libbitcoin_server_a_SOURCES = \
  addrman.cpp \
  alert.cpp \
142
  bloom.cpp \
143
144
145
146
  checkpoints.cpp \
  init.cpp \
  leveldbwrapper.cpp \
  main.cpp \
147
  miner.cpp \
148
149
  net.cpp \
  noui.cpp \
150
  pow.cpp \
151
  rpcblockchain.cpp \
152
  rpcmining.cpp \
153
  rpcmisc.cpp \
154
155
  rpcnet.cpp \
  rpcrawtransaction.cpp \
156
  rpcserver.cpp \
157
  timedata.cpp \
158
159
160
161
162
  txdb.cpp \
  txmempool.cpp \
  $(JSON_H) \
  $(BITCOIN_CORE_H)

163
164
# wallet: shared between bitcoind and bitcoin-qt, but only linked
# when wallet enabled
Cory Fields's avatar
Cory Fields committed
165
libbitcoin_wallet_a_CPPFLAGS = $(BITCOIN_INCLUDES)
166
167
libbitcoin_wallet_a_SOURCES = \
  db.cpp \
168
  crypter.cpp \
169
170
171
172
  rpcdump.cpp \
  rpcwallet.cpp \
  wallet.cpp \
  walletdb.cpp \
173
174
  $(BITCOIN_CORE_H)

175
# crypto primitives library
176
177
178
179
180
181
182
183
184
185
crypto_libbitcoin_crypto_a_CPPFLAGS = $(BITCOIN_CONFIG_INCLUDES)
crypto_libbitcoin_crypto_a_SOURCES = \
  crypto/sha1.cpp \
  crypto/sha2.cpp \
  crypto/ripemd160.cpp \
  crypto/common.h \
  crypto/sha2.h \
  crypto/sha1.h \
  crypto/ripemd160.h

186
187
188
189
190
# univalue JSON library
univalue_libbitcoin_univalue_a_SOURCES = \
  univalue/univalue.cpp \
  univalue/univalue_read.cpp \
  univalue/univalue_write.cpp \
191
  univalue/univalue_escapes.h \
192
193
  univalue/univalue.h

194
# common: shared between bitcoind, and bitcoin-qt and non-server tools
Cory Fields's avatar
Cory Fields committed
195
libbitcoin_common_a_CPPFLAGS = $(BITCOIN_INCLUDES)
196
197
libbitcoin_common_a_SOURCES = \
  allocators.cpp \
198
  base58.cpp \
199
  chainparams.cpp \
200
  coins.cpp \
201
  core.cpp \
202
203
  core_read.cpp \
  core_write.cpp \
204
205
  hash.cpp \
  key.cpp \
206
  keystore.cpp \
207
208
  netbase.cpp \
  protocol.cpp \
209
  scriptutils.cpp \
210
211
212
213
214
215
216
  $(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.
libbitcoin_util_a_CPPFLAGS = $(BITCOIN_INCLUDES)
libbitcoin_util_a_SOURCES = \
217
218
  compat/glibc_sanity.cpp \
  compat/glibcxx_sanity.cpp \
219
  chainparamsbase.cpp \
220
  random.cpp \
221
  rpcprotocol.cpp \
222
  sync.cpp \
223
  uint256.cpp \
224
  util.cpp \
Wladimir J. van der Laan's avatar
Wladimir J. van der Laan committed
225
226
227
  utilstrencodings.cpp \
  utilmoneystr.cpp \
  utiltime.cpp \
228
  version.cpp \
229
230
  $(BITCOIN_CORE_H)

231
if GLIBC_BACK_COMPAT
232
233
libbitcoin_util_a_SOURCES += compat/glibc_compat.cpp
libbitcoin_util_a_SOURCES += compat/glibcxx_compat.cpp
234
235
endif

236
# cli: shared between bitcoin-cli and bitcoin-qt
237
libbitcoin_cli_a_CPPFLAGS = $(BITCOIN_INCLUDES)
238
239
240
241
libbitcoin_cli_a_SOURCES = \
  rpcclient.cpp \
  $(BITCOIN_CORE_H)

242
nodist_libbitcoin_util_a_SOURCES = $(srcdir)/obj/build.h
243
244
245
#

# bitcoind binary #
246
bitcoind_LDADD = \
247
248
  $(LIBBITCOIN_SERVER) \
  $(LIBBITCOIN_COMMON) \
249
  $(LIBBITCOIN_UNIVALUE) \
250
251
  $(LIBBITCOIN_UTIL) \
  $(LIBBITCOIN_CRYPTO) \
252
253
  $(LIBLEVELDB) \
  $(LIBMEMENV)
254
255
256
257
258

if USE_LIBSECP256K1
  bitcoind_LDADD += secp256k1/libsecp256k1.la
endif

259
260
261
if ENABLE_WALLET
bitcoind_LDADD += libbitcoin_wallet.a
endif
262
263
264
bitcoind_SOURCES = bitcoind.cpp
#

265
if TARGET_WINDOWS
266
bitcoind_SOURCES += bitcoind-res.rc
267
268
endif

269
bitcoind_LDADD += $(BOOST_LIBS) $(BDB_LIBS) $(SSL_LIBS) $(CRYPTO_LIBS)
Cory Fields's avatar
Cory Fields committed
270
bitcoind_CPPFLAGS = $(BITCOIN_INCLUDES)
271
bitcoind_LDFLAGS = $(RELDFLAGS) $(AM_LDFLAGS)
272

273
# bitcoin-cli binary #
274
bitcoin_cli_LDADD = \
275
276
277
278
  $(LIBBITCOIN_CLI) \
  $(LIBBITCOIN_COMMON) \
  $(LIBBITCOIN_UTIL) \
  $(LIBBITCOIN_CRYPTO) \
279
280
281
282
  $(BOOST_LIBS) \
  $(SSL_LIBS) \
  $(CRYPTO_LIBS)

283
284
bitcoin_cli_SOURCES = \
  bitcoin-cli.cpp
285
286
287
288

if USE_LIBSECP256K1
  bitcoin_cli_LDADD += secp256k1/libsecp256k1.la
endif
Cory Fields's avatar
Cory Fields committed
289
bitcoin_cli_CPPFLAGS = $(BITCOIN_INCLUDES)
290
291
#

292
293
294
295
296
# bitcoin-tx binary #
bitcoin_tx_LDADD = \
  $(LIBBITCOIN_UNIVALUE) \
  $(LIBBITCOIN_COMMON) \
  $(LIBBITCOIN_UTIL) \
297
298
299
300
301
302
303
304
305
  $(LIBBITCOIN_CRYPTO)

if USE_LIBSECP256K1
  bitcoin_tx_LDADD += secp256k1/libsecp256k1.la
endif

  bitcoin_tx_LDADD += $(BOOST_LIBS) \
  $(SSL_LIBS) \
  $(CRYPTO_LIBS)
306
307
308
bitcoin_tx_SOURCES = bitcoin-tx.cpp
bitcoin_tx_CPPFLAGS = $(BITCOIN_INCLUDES)
#
309
bitcoin_tx_LDFLAGS = $(RELDFLAGS) $(AM_LDFLAGS)
310

311
312
313
if TARGET_WINDOWS
bitcoin_cli_SOURCES += bitcoin-cli-res.rc
endif
314
bitcoin_cli_LDFLAGS = $(RELDFLAGS) $(AM_LDFLAGS)
315

316
317
318
319
CLEANFILES = leveldb/libleveldb.a leveldb/libmemenv.a *.gcda *.gcno

DISTCLEANFILES = obj/build.h

320
EXTRA_DIST = leveldb secp256k1
321
322
323

clean-local:
	-$(MAKE) -C leveldb clean
324
	-$(MAKE) -C secp256k1 clean 2>/dev/null
325
	rm -f leveldb/*/*.gcno leveldb/helpers/memenv/*.gcno
326
	-rm -f config.h
327

328
.rc.o:
329
330
	@test -f $(WINDRES)
	$(AM_V_GEN) $(WINDRES) -i $< -o $@
331
332

.mm.o:
333
	$(AM_V_CXX) $(OBJCXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \
334
335
336
	  $(CPPFLAGS) $(AM_CXXFLAGS) $(QT_INCLUDES) $(CXXFLAGS)  -c -o $@ $<

%.pb.cc %.pb.h: %.proto
337
338
	@test -f $(PROTOC)
	$(AM_V_GEN) $(PROTOC) --cpp_out=$(@D) --proto_path=$(abspath $(<D) $<)
339

340
341
342
343
344
345
346
347
348
349
350
if ENABLE_TESTS
include Makefile.test.include
endif

if ENABLE_QT
include Makefile.qt.include
endif

if ENABLE_QT_TESTS
include Makefile.qttest.include
endif