Makefile.am 7.2 KB
Newer Older
Cory Fields's avatar
Cory Fields committed
1
AM_CPPFLAGS =  $(INCLUDES)
2
AM_LDFLAGS = $(PTHREAD_CFLAGS) $(LIBTOOL_LDFLAGS)
3

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

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

# 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

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

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

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

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

52
bin_PROGRAMS =
53
TESTS =
54
55
56
57
58
59
60
61

if BUILD_BITCOIND
  bin_PROGRAMS += bitcoind
endif

if BUILD_BITCOIN_CLI
  bin_PROGRAMS += bitcoin-cli
endif
62

63
64
bin_PROGRAMS += bitcoin-tx

65
66
.PHONY: FORCE
# bitcoin core #
67
68
69
70
BITCOIN_CORE_H = \
  addrman.h \
  alert.h \
  allocators.h \
Pieter Wuille's avatar
Pieter Wuille committed
71
  base58.h \
72
73
  bloom.h \
  chainparams.h \
74
  chainparamsbase.h \
75
76
77
78
79
80
81
  checkpoints.h \
  checkqueue.h \
  clientversion.h \
  coincontrol.h \
  coins.h \
  compat.h \
  core.h \
82
  core_io.h \
83
84
85
86
87
88
89
90
91
92
93
94
95
96
  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 \
97
  pow.h \
98
  protocol.h \
99
  random.h \
100
101
102
  rpcclient.h \
  rpcprotocol.h \
  rpcserver.h \
103
104
105
106
  script.h \
  serialize.h \
  sync.h \
  threadsafety.h \
107
  timedata.h \
108
  tinyformat.h \
109
110
111
112
113
114
115
  txdb.h \
  txmempool.h \
  ui_interface.h \
  uint256.h \
  util.h \
  version.h \
  walletdb.h \
116
117
  wallet.h \
  compat/sanity.h
118
119
120
121
122
123
124
125
126
127

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 \
128
129
130
  json/json_spirit_writer_template.h

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

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

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

174
# crypto primitives library
175
176
177
178
179
180
181
182
183
184
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

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

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

226
if GLIBC_BACK_COMPAT
227
228
libbitcoin_util_a_SOURCES += compat/glibc_compat.cpp
libbitcoin_util_a_SOURCES += compat/glibcxx_compat.cpp
229
230
endif

231
# cli: shared between bitcoin-cli and bitcoin-qt
232
233
234
235
libbitcoin_cli_a_SOURCES = \
  rpcclient.cpp \
  $(BITCOIN_CORE_H)

236
nodist_libbitcoin_util_a_SOURCES = $(srcdir)/obj/build.h
237
238
239
#

# bitcoind binary #
240
bitcoind_LDADD = \
241
242
  $(LIBBITCOIN_SERVER) \
  $(LIBBITCOIN_COMMON) \
243
  $(LIBBITCOIN_UNIVALUE) \
244
245
  $(LIBBITCOIN_UTIL) \
  $(LIBBITCOIN_CRYPTO) \
246
247
  $(LIBLEVELDB) \
  $(LIBMEMENV)
248
249
250
251
252

if USE_LIBSECP256K1
  bitcoind_LDADD += secp256k1/libsecp256k1.la
endif

253
254
255
if ENABLE_WALLET
bitcoind_LDADD += libbitcoin_wallet.a
endif
256
257
258
bitcoind_SOURCES = bitcoind.cpp
#

259
if TARGET_WINDOWS
260
bitcoind_SOURCES += bitcoind-res.rc
261
262
endif

263
bitcoind_LDADD += $(BOOST_LIBS) $(BDB_LIBS)
Cory Fields's avatar
Cory Fields committed
264
bitcoind_CPPFLAGS = $(BITCOIN_INCLUDES)
265

266
# bitcoin-cli binary #
267
bitcoin_cli_LDADD = \
268
269
270
271
  $(LIBBITCOIN_CLI) \
  $(LIBBITCOIN_COMMON) \
  $(LIBBITCOIN_UTIL) \
  $(LIBBITCOIN_CRYPTO) \
272
  $(BOOST_LIBS)
273
274
bitcoin_cli_SOURCES = \
  bitcoin-cli.cpp
275
276
277
278

if USE_LIBSECP256K1
  bitcoin_cli_LDADD += secp256k1/libsecp256k1.la
endif
Cory Fields's avatar
Cory Fields committed
279
bitcoin_cli_CPPFLAGS = $(BITCOIN_INCLUDES)
280
281
#

282
283
284
285
286
287
288
289
290
291
292
# bitcoin-tx binary #
bitcoin_tx_LDADD = \
  $(LIBBITCOIN_UNIVALUE) \
  $(LIBBITCOIN_COMMON) \
  $(LIBBITCOIN_UTIL) \
  $(LIBBITCOIN_CRYPTO) \
  $(BOOST_LIBS)
bitcoin_tx_SOURCES = bitcoin-tx.cpp
bitcoin_tx_CPPFLAGS = $(BITCOIN_INCLUDES)
#

293
294
295
296
if TARGET_WINDOWS
bitcoin_cli_SOURCES += bitcoin-cli-res.rc
endif

297
298
299
300
CLEANFILES = leveldb/libleveldb.a leveldb/libmemenv.a *.gcda *.gcno

DISTCLEANFILES = obj/build.h

301
EXTRA_DIST = leveldb secp256k1
302
303
304

clean-local:
	-$(MAKE) -C leveldb clean
305
	-$(MAKE) -C secp256k1 clean 2>/dev/null
306
	rm -f leveldb/*/*.gcno leveldb/helpers/memenv/*.gcno
307
	-rm -f config.h
308

309
.rc.o:
310
311
	@test -f $(WINDRES)
	$(AM_V_GEN) $(WINDRES) -i $< -o $@
312
313

.mm.o:
314
	$(AM_V_CXX) $(OBJCXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \
315
316
317
	  $(CPPFLAGS) $(AM_CXXFLAGS) $(QT_INCLUDES) $(CXXFLAGS)  -c -o $@ $<

%.pb.cc %.pb.h: %.proto
318
319
	@test -f $(PROTOC)
	$(AM_V_GEN) $(PROTOC) --cpp_out=$(@D) --proto_path=$(abspath $(<D) $<)
320

321
322
323
324
325
326
327
328
329
330
331
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