2016-11-29 20:51:50 +01:00
|
|
|
#! /usr/bin/make
|
|
|
|
|
|
|
|
# Designed to be run one level up
|
|
|
|
wire-wrongdir:
|
|
|
|
$(MAKE) -C .. wire-all
|
|
|
|
|
2018-09-14 00:43:12 +02:00
|
|
|
WIRE_HEADERS_NOGEN := wire/onion_defs.h \
|
|
|
|
wire/peer_wire.h \
|
2019-07-18 07:20:29 +02:00
|
|
|
wire/tlvstream.h \
|
2017-04-01 12:25:59 +02:00
|
|
|
wire/wire.h \
|
2017-01-10 05:52:20 +01:00
|
|
|
wire/wire_sync.h \
|
|
|
|
wire/wire_io.h
|
2019-11-28 19:07:52 +01:00
|
|
|
WIRE_GEN_HEADERS := wire/gen_peer_wire.h wire/gen_onion_wire.h wire/gen_common_wire.h
|
|
|
|
WIRE_GEN_SRC := wire/gen_peer_wire.c wire/gen_common_wire.c
|
2017-01-06 04:10:35 +01:00
|
|
|
WIRE_GEN_ONION_SRC := wire/gen_onion_wire.c
|
2017-01-10 05:51:20 +01:00
|
|
|
WIRE_SRC := wire/wire_sync.c \
|
2017-01-10 05:52:20 +01:00
|
|
|
wire/wire_io.c \
|
2017-01-10 05:51:20 +01:00
|
|
|
wire/fromwire.c \
|
2017-04-01 12:25:59 +02:00
|
|
|
wire/peer_wire.c \
|
2017-01-04 04:39:20 +01:00
|
|
|
wire/towire.c
|
2017-08-28 18:13:01 +02:00
|
|
|
WIRE_HEADERS := $(WIRE_HEADERS_NOGEN) $(WIRE_GEN_HEADERS)
|
2017-01-04 04:39:20 +01:00
|
|
|
|
|
|
|
WIRE_OBJS := $(WIRE_SRC:.c=.o) $(WIRE_GEN_SRC:.c=.o)
|
2017-01-06 04:10:35 +01:00
|
|
|
WIRE_ONION_OBJS := $(WIRE_GEN_ONION_SRC:.c=.o)
|
2017-08-28 18:13:01 +02:00
|
|
|
|
|
|
|
ALL_OBJS += $(WIRE_OBJS) $(WIRE_ONION_OBJS)
|
2017-08-29 06:12:04 +02:00
|
|
|
ALL_GEN_HEADERS += $(WIRE_GEN_HEADERS)
|
2016-11-29 20:51:50 +01:00
|
|
|
|
|
|
|
# They may not have the bolts.
|
2018-09-14 00:59:22 +02:00
|
|
|
BOLT_EXTRACT=$(LOCAL_BOLTDIR)/tools/extract-formats.py
|
2017-01-06 04:10:35 +01:00
|
|
|
|
2019-07-16 01:20:37 +02:00
|
|
|
WIRE_BOLT_DEPS := $(BOLT_DEPS) tools/gen/impl_template tools/gen/header_template
|
|
|
|
|
2019-04-18 08:27:30 +02:00
|
|
|
# Explicit command to re-extract CSV from BOLTs.
|
|
|
|
extract-bolt-csv: bolt-precheck
|
2019-07-16 01:20:37 +02:00
|
|
|
@$(BOLT_EXTRACT) $(LOCAL_BOLTDIR)/0[127]*.md > wire/extracted_peer_wire_csv
|
2019-04-18 08:27:30 +02:00
|
|
|
@echo '#include <wire/onion_defs.h>' > wire/extracted_onion_wire_csv
|
2019-07-16 01:20:37 +02:00
|
|
|
@$(BOLT_EXTRACT) $(LOCAL_BOLTDIR)/04*.md >> wire/extracted_onion_wire_csv
|
2018-09-14 00:59:22 +02:00
|
|
|
|
2019-09-10 01:57:04 +02:00
|
|
|
# Explicit command to add patchfile for BOLT CSV's
|
2019-07-24 06:41:29 +02:00
|
|
|
extract-experimental-bolt-csv: bolt-precheck
|
2019-09-10 01:57:04 +02: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 21:36:19 +02:00
|
|
|
|
|
|
|
wire/extracted_peer_experimental_csv:
|
|
|
|
@touch $@
|
|
|
|
|
|
|
|
wire/extracted_onion_experimental_csv:
|
|
|
|
@touch $@
|
|
|
|
|
|
|
|
ifeq ($(EXPERIMENTAL_FEATURES),1)
|
2019-09-10 01:57:04 +02:00
|
|
|
EXPERIMENTAL_PEER_PATCHES := $(wildcard wire/extracted_peer_experimental_*)
|
|
|
|
EXPERIMENTAL_ONION_PATCHES := $(wildcard wire/extracted_onion_experimental_*)
|
2019-04-16 21:36:19 +02:00
|
|
|
|
2019-09-10 01:57:04 +02:00
|
|
|
wire/gen_peer_wire_csv: wire/extracted_peer_wire_csv $(EXPERIMENTAL_PEER_PATCHES)
|
2020-05-02 01:24:39 +02:00
|
|
|
@set -e; trap "rm -f $@.$$$$" 0; cp $< $@.$$$$; for exp in $(EXPERIMENTAL_PEER_PATCHES); do patch $@.$$$$ $$exp >/dev/null ; done; mv $@.$$$$ $@
|
2019-09-10 01:57:04 +02:00
|
|
|
|
|
|
|
wire/gen_onion_wire_csv: wire/extracted_onion_wire_csv $(EXPERIMENTAL_ONION_PATCHES)
|
2020-05-02 01:24:39 +02:00
|
|
|
@set -e; trap "rm -f $@.$$$$" 0; cp $< $@.$$$$; for exp in $(EXPERIMENTAL_ONION_PATCHES); do patch $@.$$$$ $$exp; done >/dev/null ; mv $@.$$$$ $@
|
2019-04-16 21:36:19 +02:00
|
|
|
|
|
|
|
else # /* EXPERIMENTAL_FEATURES */
|
2019-04-16 21:32:30 +02:00
|
|
|
wire/gen_peer_wire_csv: wire/extracted_peer_wire_csv
|
|
|
|
@cp $< $@
|
2016-11-29 20:51:50 +01:00
|
|
|
|
2019-04-16 21:32:30 +02:00
|
|
|
wire/gen_onion_wire_csv: wire/extracted_onion_wire_csv
|
|
|
|
@cp $< $@
|
2019-04-16 21:36:19 +02:00
|
|
|
endif
|
2016-11-29 20:51:50 +01:00
|
|
|
|
2019-07-24 06:40:29 +02:00
|
|
|
# We (may) need to rebuild these if config changes
|
|
|
|
wire/gen_peer_wire_csv wire/gen_onion_wire_csv: config.vars
|
|
|
|
|
2019-08-01 06:59:10 +02:00
|
|
|
# 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.
|
2019-08-02 05:24:25 +02:00
|
|
|
wire/gen_peer_wire.h: wire/gen_peer_wire_csv $(WIRE_BOLT_DEPS) wire/Makefile
|
2019-08-01 06:59:10 +02:00
|
|
|
$(BOLT_GEN) -s --expose-tlv-type=n1 --expose-tlv-type=n2 --page header $@ wire_type < $< > $@
|
2017-01-06 04:10:35 +01:00
|
|
|
|
2019-08-02 05:24:25 +02:00
|
|
|
wire/gen_peer_wire.c: wire/gen_peer_wire_csv $(WIRE_BOLT_DEPS) wire/Makefile
|
2019-08-01 06:59:10 +02:00
|
|
|
$(BOLT_GEN) -s --expose-tlv-type=n1 --expose-tlv-type=n2 --page impl ${@:.c=.h} wire_type < $< > $@
|
2019-04-16 21:32:30 +02:00
|
|
|
|
2019-08-02 05:24:25 +02:00
|
|
|
# The tlv_payload isn't parsed in a fromwire, so we need to expose it.
|
|
|
|
wire/gen_onion_wire.h: wire/gen_onion_wire_csv $(WIRE_BOLT_DEPS) wire/Makefile
|
|
|
|
$(BOLT_GEN) -s --expose-tlv-type=tlv_payload --page header $@ onion_type < $< > $@
|
2019-04-16 21:32:30 +02:00
|
|
|
|
2019-08-02 05:24:25 +02:00
|
|
|
wire/gen_onion_wire.c: wire/gen_onion_wire_csv $(WIRE_BOLT_DEPS) wire/Makefile
|
|
|
|
$(BOLT_GEN) -s --expose-tlv-type=tlv_payload --page impl ${@:.c=.h} onion_type < $< > $@
|
2017-01-06 04:10:35 +01:00
|
|
|
|
2019-11-28 19:07:52 +01:00
|
|
|
# Some messages that are common among all daemons
|
|
|
|
wire/gen_common_wire.h: wire/common_wire_csv $(WIRE_BOLT_DEPS) wire/Makefile
|
|
|
|
$(BOLT_GEN) -s --page header $@ common_wire_type < $< > $@
|
|
|
|
|
|
|
|
wire/gen_common_wire.c: wire/common_wire_csv $(WIRE_BOLT_DEPS) wire/Makefile
|
|
|
|
$(BOLT_GEN) -s --page impl ${@:.c=.h} common_wire_type < $< > $@
|
|
|
|
|
2017-08-28 18:13:01 +02:00
|
|
|
check-source: $(WIRE_SRC:%=check-src-include-order/%) $(WIRE_HEADERS_NOGEN:%=check-hdr-include-order/%)
|
2017-01-04 04:39:20 +01:00
|
|
|
|
2017-08-28 18:13:01 +02:00
|
|
|
check-source-bolt: $(WIRE_SRC:%=bolt-check/%) $(WIRE_HEADERS_NOGEN:%=bolt-check/%)
|
2017-01-04 04:39:20 +01:00
|
|
|
|
2017-08-28 18:13:01 +02:00
|
|
|
check-whitespace: $(WIRE_SRC:%=check-whitespace/%) $(WIRE_HEADERS_NOGEN:%=check-whitespace/%) check-whitespace/wire/Makefile
|
2017-01-04 04:39:20 +01:00
|
|
|
|
2016-11-29 20:51:50 +01:00
|
|
|
clean: wire-clean
|
|
|
|
|
2017-01-10 05:53:20 +01:00
|
|
|
maintainer-clean: wire-maintainer-clean
|
|
|
|
|
|
|
|
wire-maintainer-clean:
|
2019-04-16 21:36:19 +02:00
|
|
|
$(RM) wire/gen_*_csv wire/extracted_*_experimental_csv
|
2017-01-10 05:53:20 +01:00
|
|
|
|
|
|
|
wire-all: $(WIRE_OBJS) $(WIRE_ONION_OBJS)
|
2016-11-30 14:43:26 +01:00
|
|
|
|
2016-11-29 20:51:50 +01:00
|
|
|
wire-clean:
|
2019-04-16 21:32:30 +02:00
|
|
|
$(RM) $(WIRE_OBJS) $(WIRE_ONION_OBJS) $(WIRE_GEN_SRC) $(WIRE_GEN_ONION_SRC) $(WIRE_GEN_HEADERS) wire/gen_*_wire_csv
|
2016-11-29 20:51:50 +01:00
|
|
|
|
2017-01-04 04:39:20 +01:00
|
|
|
include wire/test/Makefile
|