forked from ElementsProject/lightning
-
Notifications
You must be signed in to change notification settings - Fork 1
/
Makefile
260 lines (212 loc) · 9.47 KB
/
Makefile
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
248
249
250
251
252
253
254
255
256
257
258
259
260
PLUGIN_PAY_SRC := plugins/pay.c
PLUGIN_PAY_HEADER :=
PLUGIN_PAY_OBJS := $(PLUGIN_PAY_SRC:.c=.o)
PLUGIN_AUTOCLEAN_SRC := plugins/autoclean.c
PLUGIN_AUTOCLEAN_OBJS := $(PLUGIN_AUTOCLEAN_SRC:.c=.o)
PLUGIN_chanbackup_SRC := plugins/chanbackup.c
PLUGIN_chanbackup_OBJS := $(PLUGIN_chanbackup_SRC:.c=.o)
PLUGIN_TOPOLOGY_SRC := plugins/topology.c
PLUGIN_TOPOLOGY_OBJS := $(PLUGIN_TOPOLOGY_SRC:.c=.o)
PLUGIN_TXPREPARE_SRC := plugins/txprepare.c
PLUGIN_TXPREPARE_OBJS := $(PLUGIN_TXPREPARE_SRC:.c=.o)
PLUGIN_BCLI_SRC := plugins/bcli.c
PLUGIN_BCLI_OBJS := $(PLUGIN_BCLI_SRC:.c=.o)
PLUGIN_COMMANDO_SRC := plugins/commando.c
PLUGIN_COMMANDO_OBJS := $(PLUGIN_COMMANDO_SRC:.c=.o)
PLUGIN_KEYSEND_SRC := plugins/keysend.c
PLUGIN_KEYSEND_OBJS := $(PLUGIN_KEYSEND_SRC:.c=.o)
PLUGIN_LIB_SRC := plugins/libplugin.c
PLUGIN_LIB_HEADER := plugins/libplugin.h
PLUGIN_LIB_OBJS := $(PLUGIN_LIB_SRC:.c=.o)
PLUGIN_PAY_LIB_SRC := plugins/libplugin-pay.c
PLUGIN_PAY_LIB_HEADER := plugins/libplugin-pay.h
PLUGIN_PAY_LIB_OBJS := $(PLUGIN_PAY_LIB_SRC:.c=.o)
PLUGIN_OFFERS_SRC := plugins/offers.c plugins/offers_offer.c plugins/offers_invreq_hook.c plugins/offers_inv_hook.c
PLUGIN_OFFERS_OBJS := $(PLUGIN_OFFERS_SRC:.c=.o)
PLUGIN_OFFERS_HEADER := $(PLUGIN_OFFERS_SRC:.c=.h)
PLUGIN_FETCHINVOICE_SRC := plugins/fetchinvoice.c
PLUGIN_FETCHINVOICE_OBJS := $(PLUGIN_FETCHINVOICE_SRC:.c=.o)
PLUGIN_FETCHINVOICE_HEADER :=
PLUGIN_SQL_SRC := plugins/sql.c
PLUGIN_SQL_HEADER :=
PLUGIN_SQL_OBJS := $(PLUGIN_SQL_SRC:.c=.o)
PLUGIN_SPENDER_SRC := \
plugins/spender/fundchannel.c \
plugins/spender/main.c \
plugins/spender/multifundchannel.c \
plugins/spender/multiwithdraw.c \
plugins/spender/openchannel.c
PLUGIN_SPENDER_HEADER := \
plugins/spender/multifundchannel.h \
plugins/spender/multiwithdraw.h \
plugins/spender/fundchannel.h \
plugins/spender/multifundchannel.h \
plugins/spender/openchannel.h
PLUGIN_SPENDER_OBJS := $(PLUGIN_SPENDER_SRC:.c=.o)
PLUGIN_FUNDER_SRC := \
plugins/funder.c \
plugins/funder_policy.c
PLUGIN_FUNDER_HEADER := \
plugins/funder_policy.h
PLUGIN_FUNDER_OBJS := $(PLUGIN_FUNDER_SRC:.c=.o)
PLUGIN_ALL_SRC := \
$(PLUGIN_AUTOCLEAN_SRC) \
$(PLUGIN_chanbackup_SRC) \
$(PLUGIN_BCLI_SRC) \
$(PLUGIN_COMMANDO_SRC) \
$(PLUGIN_FETCHINVOICE_SRC) \
$(PLUGIN_FUNDER_SRC) \
$(PLUGIN_TOPOLOGY_SRC) \
$(PLUGIN_KEYSEND_SRC) \
$(PLUGIN_TXPREPARE_SRC) \
$(PLUGIN_LIB_SRC) \
$(PLUGIN_OFFERS_SRC) \
$(PLUGIN_PAY_LIB_SRC) \
$(PLUGIN_PAY_SRC) \
$(PLUGIN_SPENDER_SRC)
PLUGIN_ALL_HEADER := \
$(PLUGIN_PAY_HEADER) \
$(PLUGIN_LIB_HEADER) \
$(PLUGIN_FUNDER_HEADER) \
$(PLUGIN_PAY_LIB_HEADER) \
$(PLUGIN_OFFERS_HEADER) \
$(PLUGIN_SPENDER_HEADER)
C_PLUGINS := \
plugins/autoclean \
plugins/chanbackup \
plugins/bcli \
plugins/commando \
plugins/fetchinvoice \
plugins/funder \
plugins/topology \
plugins/keysend \
plugins/offers \
plugins/pay \
plugins/txprepare \
plugins/cln-renepay \
plugins/spenderp
PY_PLUGINS := \
plugins/clnrest/clnrest.py
ifeq ($(HAVE_SQLITE3),1)
C_PLUGINS += plugins/sql
PLUGIN_ALL_SRC += $(PLUGIN_SQL_SRC)
PLUGIN_ALL_HEADER += $(PLUGIN_SQL_HEADER)
endif
# This is non-python plugins (PY_PLUGINS need their whole directory!)
PLUGINS := $(C_PLUGINS)
PLUGIN_ALL_OBJS := $(PLUGIN_ALL_SRC:.c=.o)
ifneq ($(RUST),0)
# Builtin plugins must be in this plugins dir to work when we're executed
# *without* make install.
plugins/cln-grpc: target/${RUST_PROFILE}/cln-grpc
@cp $< $@
PLUGINS += plugins/cln-grpc
endif
PLUGIN_COMMON_OBJS := \
bitcoin/base58.o \
bitcoin/block.o \
bitcoin/chainparams.o \
bitcoin/feerate.o \
bitcoin/preimage.o \
bitcoin/privkey.o \
bitcoin/psbt.o \
bitcoin/pubkey.o \
bitcoin/script.o \
bitcoin/shadouble.o \
bitcoin/short_channel_id.o \
bitcoin/signature.o \
bitcoin/tx.o \
bitcoin/varint.o \
common/amount.o \
common/autodata.o \
common/coin_mvt.o \
common/base32.o \
common/bech32.o \
common/bech32_util.o \
common/bigsize.o \
common/bolt11.o \
common/channel_id.o \
common/daemon.o \
common/features.o \
common/hash_u5.o \
common/json_param.o \
common/json_parse.o \
common/json_parse_simple.o \
common/json_filter.o \
common/json_stream.o \
common/lease_rates.o \
common/memleak.o \
common/node_id.o \
common/psbt_open.o \
common/pseudorand.o \
common/random_select.o \
common/scb_wiregen.o \
common/setup.o \
common/status_levels.o \
common/type_to_string.o \
common/utils.o \
common/version.o \
common/wireaddr.o \
wire/channel_type_wiregen.o \
wire/fromwire.o \
wire/onion_wiregen.o \
wire/peer_wiregen.o \
wire/tlvstream.o \
wire/towire.o
include plugins/bkpr/Makefile
include plugins/renepay/Makefile
# Make sure these depend on everything.
ALL_C_SOURCES += $(PLUGIN_ALL_SRC)
ALL_C_HEADERS += $(PLUGIN_ALL_HEADER)
ALL_PROGRAMS += $(C_PLUGINS)
# Make all plugins depend on all plugin headers, for simplicity.
$(PLUGIN_ALL_OBJS): $(PLUGIN_ALL_HEADER)
plugins/pay: $(PLUGIN_PAY_OBJS) $(PLUGIN_LIB_OBJS) $(PLUGIN_PAY_LIB_OBJS) $(PLUGIN_COMMON_OBJS) $(JSMN_OBJS) common/gossmap.o common/fp16.o common/route.o common/dijkstra.o common/bolt12.o common/bolt12_merkle.o wire/bolt12_wiregen.o bitcoin/block.o common/blindedpay.o common/blindedpath.o common/hmac.o common/blinding.o common/onion_encode.o
plugins/autoclean: $(PLUGIN_AUTOCLEAN_OBJS) $(PLUGIN_LIB_OBJS) $(PLUGIN_COMMON_OBJS) $(JSMN_OBJS)
plugins/chanbackup: $(PLUGIN_chanbackup_OBJS) $(PLUGIN_LIB_OBJS) $(PLUGIN_COMMON_OBJS) $(JSMN_OBJS)
plugins/commando: $(PLUGIN_COMMANDO_OBJS) $(PLUGIN_LIB_OBJS) $(PLUGIN_COMMON_OBJS) $(JSMN_OBJS)
# Topology wants to decode node_announcement, and peer_wiregen which
# pulls in some of bitcoin/.
plugins/topology: common/route.o common/dijkstra.o common/gossmap.o common/fp16.o wire/peer_wiregen.o wire/channel_type_wiregen.o bitcoin/block.o bitcoin/preimage.o $(PLUGIN_TOPOLOGY_OBJS) $(PLUGIN_LIB_OBJS) $(PLUGIN_COMMON_OBJS) $(JSMN_OBJS)
plugins/txprepare: $(PLUGIN_TXPREPARE_OBJS) $(PLUGIN_LIB_OBJS) $(PLUGIN_COMMON_OBJS) $(JSMN_OBJS)
plugins/bcli: $(PLUGIN_BCLI_OBJS) $(PLUGIN_LIB_OBJS) $(PLUGIN_COMMON_OBJS) $(JSMN_OBJS)
plugins/keysend: wire/tlvstream.o wire/onion_wiregen.o $(PLUGIN_KEYSEND_OBJS) $(PLUGIN_LIB_OBJS) $(PLUGIN_PAY_LIB_OBJS) $(PLUGIN_COMMON_OBJS) $(JSMN_OBJS) common/gossmap.o common/fp16.o common/route.o common/dijkstra.o common/blindedpay.o common/blindedpath.o common/hmac.o common/blinding.o common/onion_encode.o
$(PLUGIN_KEYSEND_OBJS): $(PLUGIN_PAY_LIB_HEADER)
plugins/spenderp: bitcoin/block.o bitcoin/preimage.o bitcoin/psbt.o common/psbt_open.o wire/peer${EXP}_wiregen.o $(PLUGIN_SPENDER_OBJS) $(PLUGIN_LIB_OBJS) $(PLUGIN_COMMON_OBJS) $(JSMN_OBJS)
plugins/offers: $(PLUGIN_OFFERS_OBJS) $(PLUGIN_LIB_OBJS) $(PLUGIN_COMMON_OBJS) common/bolt12.o common/bolt12_merkle.o common/bolt11_json.o common/iso4217.o $(WIRE_OBJS) $(WIRE_BOLT12_OBJS) bitcoin/block.o common/channel_id.o bitcoin/preimage.o common/blindedpath.o common/invoice_path_id.o common/blinding.o common/hmac.o $(JSMN_OBJS)
plugins/fetchinvoice: $(PLUGIN_FETCHINVOICE_OBJS) $(PLUGIN_LIB_OBJS) $(PLUGIN_COMMON_OBJS) common/bolt12.o common/bolt12_merkle.o common/iso4217.o $(WIRE_OBJS) $(WIRE_BOLT12_OBJS) bitcoin/block.o common/channel_id.o bitcoin/preimage.o $(JSMN_OBJS) common/gossmap.o common/fp16.o common/dijkstra.o common/route.o common/blindedpath.o common/hmac.o common/blinding.o
plugins/funder: bitcoin/psbt.o common/psbt_open.o $(PLUGIN_FUNDER_OBJS) $(PLUGIN_LIB_OBJS) $(PLUGIN_COMMON_OBJS) $(JSMN_OBJS)
# This covers all the low-level list RPCs which return simple arrays
SQL_LISTRPCS := listchannels listforwards listhtlcs listinvoices listnodes listoffers listpeers listpeerchannels listclosedchannels listtransactions listsendpays bkpr-listaccountevents bkpr-listincome
SQL_LISTRPCS_SCHEMAS := $(foreach l,$(SQL_LISTRPCS),doc/schemas/$l.schema.json)
# We squeeze:
# descriptions (we don't need)
# fields with no members (we don't need)
# whitespace
# We can't simply *remove* fields, since the extra comma left over can
# make invalid JSON. Grr!
# But these simple removals drop us from 100k to 29k.
plugins/sql-schema_gen.h: plugins/Makefile $(SQL_LISTRPCS_SCHEMAS)
@$(call VERBOSE,GEN $@, (SEP=""; echo '"{'; for f in $(SQL_LISTRPCS); do echo "$$SEP\\\"$$f\\\":"; sed -e s/\"description\":\ *\".\*\"/\"\":\"\"/ -e s/\".*\":\ *{}/\"\":{}/ -e s/\"/\\\\\"/g < doc/schemas/$$f.schema.json; SEP=","; done; echo '}"') | tr -d ' \n' > $@)
plugins/sql.o: plugins/sql-schema_gen.h
plugins/sql: $(PLUGIN_SQL_OBJS) $(PLUGIN_LIB_OBJS) $(PLUGIN_COMMON_OBJS) $(JSMN_OBJS) common/gossip_store.o gossipd/gossip_store_wiregen.o
# Generated from PLUGINS definition in plugins/Makefile
ALL_C_HEADERS += plugins/list_of_builtin_plugins_gen.h
PLUGIN_BASES := $(PLUGINS:plugins/%=%) $(PY_PLUGINS:plugins/%=%)
plugins/list_of_builtin_plugins_gen.h: plugins/Makefile Makefile config.vars
@$(call VERBOSE,GEN $@,echo "static const char *list_of_builtin_plugins[] = { $(PLUGIN_BASES:%=\"%\",) NULL };" > $@)
CLN_PLUGIN_EXAMPLES := \
target/${RUST_PROFILE}/examples/cln-plugin-startup \
target/${RUST_PROFILE}/examples/cln-plugin-reentrant \
target/${RUST_PROFILE}/examples/cln-rpc-getinfo
CLN_PLUGIN_SRC = $(shell find plugins/src -name "*.rs")
target/${RUST_PROFILE}/cln-grpc: ${CLN_PLUGIN_SRC}
cargo build ${CARGO_OPTS} --bin cln-grpc
ifneq ($(RUST),0)
DEFAULT_TARGETS += $(CLN_PLUGIN_EXAMPLES) plugins/cln-grpc
endif
clean: plugins-clean
plugins-clean:
$(RM) $(PLUGINS) $(CLN_PLUGIN_EXAMPLES)
$(RM) plugins/sql-schema_gen.h
include plugins/test/Makefile