forked from libbtc/libbtc
-
Notifications
You must be signed in to change notification settings - Fork 19
/
Makefile.am
247 lines (216 loc) · 6.39 KB
/
Makefile.am
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
ACLOCAL_AMFLAGS = -I build-aux/m4
.PHONY: gen
.INTERMEDIATE: $(GENBIN)
DIST_SUBDIRS = src/secp256k1
if TARGET_WINDOWS
WS2_32_LIBS = -Wl,-lws2_32
FPIC_FLAGS =
else
WS2_32_LIBS =
FPIC_FLAGS = -fPIC
endif
if ANDROID_SO
ANDROID_LIBS_CFLAGS = -Wl,-landroid
ANDROID_MATH_CFLAGS = -Wl,-lm
ANDROID_MATH_LIB = -lm
ANDROID_LOG = -llog
else
ANDROID_LIBS_CFLAGS =
ANDROID_MATH_CFLAG =
ANDROID_MATH_LIB =
ANDROID_LOG =
endif
LIBSECP256K1=src/secp256k1/libsecp256k1.la
LIBCRYPTOCONDITIONS=src/tools/cryptoconditions/libcryptoconditions.la
$(LIBSECP256K1): $(wildcard src/secp256k1/src/*) $(wildcard src/secp256k1/include/*)
$(AM_V_at)$(MAKE) $(AM_MAKEFLAGS) -C $(@D) $(@F)
$(LIBCRYPTOCONDITIONS):
@echo "Building Libcryptoconditions ..." && $(MAKE) -C "$(@D)" "$(@F)"
noinst_LTLIBRARIES = libbtc.la
include_HEADERS = \
include/btc/aes256_cbc.h \
include/btc/base58.h \
include/btc/bip32.h \
include/btc/block.h \
include/btc/block_kmd.h \
include/btc/btc.h \
include/btc/buffer.h \
include/btc/chainparams.h \
include/btc/cstr.h \
include/btc/ctaes.h \
include/btc/ecc_key.h \
include/btc/ecc.h \
include/btc/hash.h \
include/btc/portable_endian.h \
include/btc/random.h \
include/btc/ripemd160.h \
include/btc/script.h \
include/btc/segwit_addr.h \
include/btc/serialize.h \
include/btc/sha2.h \
include/btc/tool.h \
include/btc/tx.h \
include/btc/utils.h \
include/btc/merkle_c.h \
include/btc/vector.h
pkgconfigdir = $(libdir)/pkgconfig
pkgconfig_DATA = libbtc.pc
libbtc_la_SOURCES = \
src/aes256_cbc.c \
src/base58.c \
src/bip32.c \
src/block.c \
src/block_kmd.c \
src/buffer.c \
src/chainparams.c \
src/commontools.c \
src/cstr.c \
src/ctaes.c \
src/ecc_key.c \
src/ecc_libsecp256k1.c \
src/memory.c \
src/memory.h \
src/random.c \
src/ripemd160.c \
src/script.c \
src/segwit_addr.c \
src/serialize.c \
src/sha2.c \
src/tx.c \
src/utils.c \
src/merkle_c.c \
src/vector.c
libbtc_la_CPPFLAGS = -DLIBNSPV_BUILD
libbtc_la_CFLAGS = -I$(top_srcdir)/include -I$(top_srcdir)/src/logdb/include -O2 $(FPIC_FLAGS)
# -DLIBBTC_BUILD
libbtc_la_LIBADD = $(LIBSECP256K1) $(ANDROID_LOG)
if USE_TESTS
noinst_PROGRAMS = tests
tests_LDADD = libbtc.la
tests_SOURCES = \
test/aes_tests.c \
test/base58check_tests.c \
test/bip32_tests.c \
test/block_tests.c \
test/buffer_tests.c \
test/cstr_tests.c \
test/ecc_tests.c \
test/eckey_tests.c \
test/hash_tests.c \
test/memory_tests.c \
test/random_tests.c \
test/serialize_tests.c \
test/sha2_tests.c \
test/utest.h \
test/unittester.c \
test/tx_tests.c \
test/utils_tests.c \
test/vector_tests.c
tests_CFLAGS = $(libbtc_la_CFLAGS) -O2
tests_CPPFLAGS = -I$(top_srcdir)/src
tests_LDFLAGS = -static
TESTS = tests
endif
if WITH_WALLET
libbtc_la_SOURCES += \
src/logdb/logdb_core.c \
src/logdb/logdb_memdb_llist.c \
src/logdb/logdb_memdb_rbtree.c \
src/logdb/logdb_rec.c \
src/logdb/red_black_tree.c
include_HEADERS += \
src/logdb/include/logdb/logdb_base.h \
src/logdb/include/logdb/logdb_core.h \
src/logdb/include/logdb/logdb_memdb_llist.h \
src/logdb/include/logdb/logdb_memdb_rbtree.h \
src/logdb/include/logdb/logdb_rec.h \
src/logdb/include/logdb/logdb.h \
src/logdb/include/logdb/red_black_tree.h
include_HEADERS += \
include/btc/wallet.h
libbtc_la_SOURCES += \
src/wallet.c
if USE_TESTS
tests_SOURCES += \
test/wallet_tests.c \
src/logdb/test/logdb_tests.c \
src/logdb/test/tests_red_black_tree.c
endif
endif
if WITH_NET
include_HEADERS += \
include/btc/headersdb.h \
include/btc/headersdb_file.h \
include/btc/protocol.h \
include/btc/net.h \
include/btc/netspv.h
libbtc_la_SOURCES += \
src/headersdb_file.c \
src/net.c \
src/netspv.c \
src/protocol.c
libbtc_la_LIBADD += $(EVENT_PTHREADS_LIBS) $(EVENT_LIBS)
libbtc_la_CFLAGS += $(EVENT_CFLAGS) $(EVENT_PTHREADS_CFLAGS) -O2
libbtc_la_LDFLAGS = -static
if USE_TESTS
tests_SOURCES += \
test/net_tests.c \
test/netspv_tests.c \
test/protocol_tests.c
tests_LDADD += $(EVENT_PTHREADS_LIBS) $(EVENT_LIBS)
tests_LDFLAGS += -levent
endif
endif
if WITH_TOOLS
if USE_TESTS
tests_SOURCES += \
test/tool_tests.c
endif
instdir=$(prefix)/bin
inst_PROGRAMS = bitcointool
bitcointool_LDADD = libbtc.la
bitcointool_SOURCES = \
src/tools/bitcointool.c
bitcointool_CFLAGS = $(libbtc_la_CFLAGS) -O2
bitcointool_CPPFLAGS = -I$(top_srcdir)/src
bitcointool_LDFLAGS = -static
if WITH_NET
inst_PROGRAMS += bitcoin-send-tx
bitcoin_send_tx_LDADD = libbtc.la $(EVENT_PTHREADS_LIBS) $(EVENT_LIBS)
bitcoin_send_tx_SOURCES = \
src/tools/bitcoin-send-tx.c
bitcoin_send_tx_CFLAGS = $(libbtc_la_CFLAGS) $(EVENT_CFLAGS) $(EVENT_PTHREADS_CFLAGS) -O2
bitcoin_send_tx_CPPFLAGS = -I$(top_srcdir)/src
bitcoin_send_tx_LDFLAGS = -static
inst_PROGRAMS += bitcoin-spv
bitcoin_spv_LDADD = libbtc.la $(EVENT_PTHREADS_LIBS) $(EVENT_LIBS) $(ANDROID_LIBS)
bitcoin_spv_SOURCES = \
src/tools/bitcoin-spv.c
bitcoin_spv_CFLAGS = $(libbtc_la_CFLAGS) -O2
bitcoin_spv_CPPFLAGS = -I$(top_srcdir)/src
bitcoin_spv_LDFLAGS = -static
endif
# building nspv executable
inst_PROGRAMS += nspv
#inst_PROGRAMS = nspv
nspv_LDADD = libbtc.la $(LIBCRYPTOCONDITIONS) -lpthread -lsodium $(ANDROID_MATH_LIB)
nspv_SOURCES = \
src/tools/nspv.c
nspv_CFLAGS = $(libbtc_la_CFLAGS) $(EVENT_CFLAGS) $(EVENT_PTHREADS_CFLAGS) -O2 -Wno-unused-parameter
nspv_CPPFLAGS = -I$(top_srcdir)/src
nspv_LDFLAGS = -static
# building libnspv.so (dll):
lib_LTLIBRARIES = libnspv.la
libnspv_la_SOURCES = \
src/tools/nspv.c
libnspv_la_CPPFLAGS = -I$(top_srcdir)/src -DLIBNSPV_BUILD
## libsec & cc will be linked as so:
# libnspv_la_LIBADD = libbtc.la $(LIBSECP256K1) $(LIBCRYPTOCONDITIONS) # and other .la do not work for MINGW
# link as shared:
# using '-Wl,-lcryptoconditions' instead of '$(LIBCRYPTOCONDITIONS)' for MINGW build:
libnspv_la_CFLAGS = $(libbtc_la_CFLAGS) -O2 -Wno-unused-command-line-argument -Xlinker -L$(top_srcdir)/src/secp256k1/.libs -L$(top_srcdir)/src/tools/cryptoconditions/.libs -levent -lcryptoconditions -lsecp256k1 $(WS2_32_LIBS) -lsodium -lpthread $(FPIC_FLAGS) $(ANDROID_LIBS_CFLAGS) $(ANDROID_MATH_CFLAGS)
libnspv_la_LDFLAGS = -no-undefined
libnspv_la_LIBADD = libbtc.la # $(LIBCRYPTOCONDITIONS) and other .la do not work for MINGW
endif
clean-local:
-$(MAKE) -C src/secp256k1 clean