2016-11-30 06:21:50 +10:30
|
|
|
#! /usr/bin/make
|
|
|
|
|
2020-08-31 10:43:25 +09:30
|
|
|
WIRE_HEADERS := wire/onion_defs.h \
|
2018-09-14 08:13:12 +09:30
|
|
|
wire/peer_wire.h \
|
2020-08-31 10:43:25 +09:30
|
|
|
wire/tlvstream.h \
|
2017-04-01 20:55:59 +10:30
|
|
|
wire/wire.h \
|
2017-01-10 15:22:20 +10:30
|
|
|
wire/wire_sync.h \
|
2020-08-31 10:43:25 +09:30
|
|
|
wire/wire_io.h \
|
|
|
|
wire/peer_wiregen.h \
|
2020-08-31 10:43:25 +09:30
|
|
|
wire/onion_wiregen.h \
|
|
|
|
wire/common_wiregen.h \
|
|
|
|
wire/peer_printgen.h \
|
|
|
|
wire/onion_printgen.h
|
|
|
|
|
2020-08-31 10:43:25 +09:30
|
|
|
# We don't include peer_printgen/onion_printgen here since most don't need it.
|
2017-01-10 15:21:20 +10:30
|
|
|
WIRE_SRC := wire/wire_sync.c \
|
2017-01-10 15:22:20 +10:30
|
|
|
wire/wire_io.c \
|
2017-01-10 15:21:20 +10:30
|
|
|
wire/fromwire.c \
|
2017-04-01 20:55:59 +10:30
|
|
|
wire/peer_wire.c \
|
2020-05-15 19:59:34 +09:30
|
|
|
wire/tlvstream.c \
|
2020-08-31 10:43:25 +09:30
|
|
|
wire/towire.c \
|
|
|
|
wire/common_wiregen.c \
|
|
|
|
wire/peer_wiregen.c \
|
|
|
|
wire/onion_wiregen.c
|
|
|
|
|
|
|
|
WIRE_PRINT_SRC := \
|
|
|
|
wire/onion_printgen.c \
|
|
|
|
wire/peer_printgen.c
|
2017-01-04 14:09:20 +10:30
|
|
|
|
2020-08-31 10:43:25 +09:30
|
|
|
WIRE_OBJS := $(WIRE_SRC:.c=.o)
|
|
|
|
WIRE_PRINT_OBJS := $(WIRE_PRINT_SRC:.c=.o)
|
|
|
|
$(WIRE_OBJS) $(WIRE_PRINT_OBJS): $(WIRE_HEADERS)
|
2017-08-29 01:43:01 +09:30
|
|
|
|
2020-08-31 10:43:25 +09:30
|
|
|
# Make sure these depend on everything.
|
|
|
|
ALL_C_SOURCES += $(WIRE_SRC) $(WIRE_PRINT_SRC)
|
|
|
|
ALL_C_HEADERS += $(WIRE_HEADERS)
|
2016-11-30 06:21:50 +10:30
|
|
|
|
|
|
|
# They may not have the bolts.
|
2018-09-14 08:29:22 +09:30
|
|
|
BOLT_EXTRACT=$(LOCAL_BOLTDIR)/tools/extract-formats.py
|
2017-01-06 13:40:35 +10:30
|
|
|
|
2019-07-15 18:20:37 -05:00
|
|
|
WIRE_BOLT_DEPS := $(BOLT_DEPS) tools/gen/impl_template tools/gen/header_template
|
|
|
|
|
2019-04-18 15:57:30 +09:30
|
|
|
# Explicit command to re-extract CSV from BOLTs.
|
|
|
|
extract-bolt-csv: bolt-precheck
|
2019-07-15 18:20:37 -05:00
|
|
|
@$(BOLT_EXTRACT) $(LOCAL_BOLTDIR)/0[127]*.md > wire/extracted_peer_wire_csv
|
2019-04-18 15:57:30 +09:30
|
|
|
@echo '#include <wire/onion_defs.h>' > wire/extracted_onion_wire_csv
|
2019-07-15 18:20:37 -05:00
|
|
|
@$(BOLT_EXTRACT) $(LOCAL_BOLTDIR)/04*.md >> wire/extracted_onion_wire_csv
|
2018-09-14 08:29:22 +09:30
|
|
|
|
2019-09-09 18:57:04 -05:00
|
|
|
# Explicit command to add patchfile for BOLT CSV's
|
2019-07-24 14:11:29 +09:30
|
|
|
extract-experimental-bolt-csv: bolt-precheck
|
2019-09-09 18:57:04 -05:00
|
|
|
@$(BOLT_EXTRACT) $(LOCAL_BOLTDIR)/0[127]*.md | diff -u wire/extracted_peer_wire_csv - >wire/extracted_peer_experimental_$(BOLTVERSION) | if [ $$? -lt 0 ];then exit 1;fi
|
|
|
|
@{ echo '#include <wire/onion_defs.h>'; $(BOLT_EXTRACT) $(LOCAL_BOLTDIR)/04*.md; } | diff -u wire/extracted_onion_wire_csv - > wire/extracted_onion_experimental_$(BOLTVERSION) | if [ $$? -lt 0 ];then exit 1;fi
|
2019-04-16 12:36:19 -07:00
|
|
|
|
|
|
|
wire/extracted_peer_experimental_csv:
|
|
|
|
@touch $@
|
|
|
|
|
|
|
|
wire/extracted_onion_experimental_csv:
|
|
|
|
@touch $@
|
|
|
|
|
|
|
|
ifeq ($(EXPERIMENTAL_FEATURES),1)
|
2020-07-13 11:49:38 +09:30
|
|
|
EXPERIMENTAL_PEER_PATCHES := $(sort $(wildcard wire/extracted_peer_experimental_*))
|
|
|
|
EXPERIMENTAL_ONION_PATCHES := $(sort $(wildcard wire/extracted_onion_experimental_*))
|
2019-04-16 12:36:19 -07:00
|
|
|
|
2020-08-31 10:43:25 +09:30
|
|
|
wire/peer_wire.csv: wire/extracted_peer_wire_csv $(EXPERIMENTAL_PEER_PATCHES)
|
2020-05-01 18:24:39 -05:00
|
|
|
@set -e; trap "rm -f $@.$$$$" 0; cp $< $@.$$$$; for exp in $(EXPERIMENTAL_PEER_PATCHES); do patch $@.$$$$ $$exp >/dev/null ; done; mv $@.$$$$ $@
|
2019-09-09 18:57:04 -05:00
|
|
|
|
2020-08-31 10:43:25 +09:30
|
|
|
wire/onion_wire.csv: wire/extracted_onion_wire_csv $(EXPERIMENTAL_ONION_PATCHES)
|
2020-05-01 18:24:39 -05:00
|
|
|
@set -e; trap "rm -f $@.$$$$" 0; cp $< $@.$$$$; for exp in $(EXPERIMENTAL_ONION_PATCHES); do patch $@.$$$$ $$exp; done >/dev/null ; mv $@.$$$$ $@
|
2019-04-16 12:36:19 -07:00
|
|
|
|
|
|
|
else # /* EXPERIMENTAL_FEATURES */
|
2020-08-31 10:43:25 +09:30
|
|
|
wire/peer_wire.csv: wire/extracted_peer_wire_csv
|
2019-04-16 12:32:30 -07:00
|
|
|
@cp $< $@
|
2016-11-30 06:21:50 +10:30
|
|
|
|
2020-08-31 10:43:25 +09:30
|
|
|
wire/onion_wire.csv: wire/extracted_onion_wire_csv
|
2019-04-16 12:32:30 -07:00
|
|
|
@cp $< $@
|
2019-04-16 12:36:19 -07:00
|
|
|
endif
|
2016-11-30 06:21:50 +10:30
|
|
|
|
2019-07-24 14:10:29 +09:30
|
|
|
# We (may) need to rebuild these if config changes
|
2020-08-31 10:43:25 +09:30
|
|
|
wire/peer_wire.csv wire/onion_wire.csv: config.vars
|
2019-07-24 14:10:29 +09:30
|
|
|
|
2019-08-01 14:29:10 +09:30
|
|
|
# tlvs_n1 and n2 are used for test vectors, thus not referenced: expose them
|
|
|
|
# for testing and to prevent compile error about them being unused.
|
|
|
|
# This will be easier if test vectors are moved to separate files.
|
2020-08-31 10:43:25 +09:30
|
|
|
wire/peer_wiregen.h_args := --include='common/channel_id.h' --include='bitcoin/tx.h' --include='bitcoin/preimage.h' --include='bitcoin/short_channel_id.h' --include='common/node_id.h' --include='common/bigsize.h' --include='bitcoin/block.h' --include='bitcoin/privkey.h' -s --expose-tlv-type=n1 --expose-tlv-type=n2
|
2017-01-06 13:40:35 +10:30
|
|
|
|
2020-08-31 10:43:25 +09:30
|
|
|
wire/peer_wiregen.c_args := -s --expose-tlv-type=n1 --expose-tlv-type=n2
|
2019-04-16 12:32:30 -07:00
|
|
|
|
2019-08-02 12:54:25 +09:30
|
|
|
# The tlv_payload isn't parsed in a fromwire, so we need to expose it.
|
2020-08-31 10:43:25 +09:30
|
|
|
wire/onion_wiregen.h_args := --include='bitcoin/short_channel_id.h' --include='bitcoin/privkey.h' --include='common/bigsize.h' --include='common/amount.h' --include='common/node_id.h' --include='bitcoin/block.h' -s --expose-tlv-type=tlv_payload
|
2019-11-28 19:07:52 +01:00
|
|
|
|
2020-08-31 10:43:25 +09:30
|
|
|
wire/onion_wiregen.c_args := -s --expose-tlv-type=tlv_payload
|
2019-11-28 19:07:52 +01:00
|
|
|
|
2017-01-10 15:23:20 +10:30
|
|
|
maintainer-clean: wire-maintainer-clean
|
|
|
|
|
|
|
|
wire-maintainer-clean:
|
2019-04-16 12:36:19 -07:00
|
|
|
$(RM) wire/gen_*_csv wire/extracted_*_experimental_csv
|
2017-01-10 15:23:20 +10:30
|
|
|
|
2017-01-04 14:09:20 +10:30
|
|
|
include wire/test/Makefile
|