mirror of
https://github.com/ElementsProject/lightning.git
synced 2024-11-19 01:43:36 +01:00
wire/Makefile: generate CSVs from specs based on BOLTVERSION.
Not whatever happens to be lying around! Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
This commit is contained in:
parent
fc02af12d0
commit
e8a7a7addb
4
Makefile
4
Makefile
@ -240,8 +240,10 @@ check-makefile:
|
||||
bolt-check/%: % bolt-precheck tools/check-bolt
|
||||
@[ ! -d .tmp.lightningrfc ] || tools/check-bolt .tmp.lightningrfc $<
|
||||
|
||||
LOCAL_BOLTDIR=.tmp.lightningrfc
|
||||
|
||||
bolt-precheck:
|
||||
@rm -rf .tmp.lightningrfc; if [ ! -d $(BOLTDIR) ]; then echo Not checking BOLT references: BOLTDIR $(BOLTDIR) does not exist >&2; exit 0; fi; set -e; if [ -n "$(BOLTVERSION)" ]; then git clone -q $(BOLTDIR) .tmp.lightningrfc && cd .tmp.lightningrfc && git checkout -q $(BOLTVERSION); else cp -a $(BOLTDIR) .tmp.lightningrfc; fi
|
||||
@rm -rf $(LOCAL_BOLTDIR); if [ ! -d $(BOLTDIR) ]; then echo Not checking BOLTs: BOLTDIR $(BOLTDIR) does not exist >&2; exit 0; fi; set -e; if [ -n "$(BOLTVERSION)" ]; then git clone -q $(BOLTDIR) $(LOCAL_BOLTDIR) && cd $(LOCAL_BOLTDIR) && git checkout -q $(BOLTVERSION); else cp -a $(BOLTDIR) $(LOCAL_BOLTDIR); fi
|
||||
|
||||
check-source-bolt: $(ALL_TEST_PROGRAMS:%=bolt-check/%.c)
|
||||
|
||||
|
@ -26,12 +26,15 @@ ALL_OBJS += $(WIRE_OBJS) $(WIRE_ONION_OBJS)
|
||||
ALL_GEN_HEADERS += $(WIRE_GEN_HEADERS)
|
||||
|
||||
# They may not have the bolts.
|
||||
BOLT_EXTRACT=$(BOLTDIR)/tools/extract-formats.py
|
||||
wire/gen_peer_wire_csv: FORCE
|
||||
@set -e; if [ -f $(BOLT_EXTRACT) ]; then for f in $(BOLTDIR)/0[127]*.md $(BOLT_EXTRACT); do if [ $$f -nt $@ -o ! -f $@ ]; then $(BOLT_EXTRACT) --message-fields --message-types $(BOLTDIR)/0[127]*.md > $@; break; fi; done; fi
|
||||
BOLT_EXTRACT=$(LOCAL_BOLTDIR)/tools/extract-formats.py
|
||||
|
||||
wire/gen_onion_wire_csv: FORCE
|
||||
@set -e; if [ -f $(BOLT_EXTRACT) ]; then for f in $(BOLTDIR)/04*.md $(BOLT_EXTRACT); do if [ $$f -nt $@ -o ! -f $@ ]; then echo '#include <wire/onion_defs.h>' > $@ && $(BOLT_EXTRACT) --message-fields --message-types $(BOLTDIR)/04*.md >> $@; break; fi; done; fi
|
||||
ifeq ($(DEVELOPER),1)
|
||||
wire/gen_peer_wire_csv: bolt-precheck
|
||||
@set -e; if [ -d $(LOCAL_BOLTDIR) ]; then for f in $(LOCAL_BOLTDIR)/0[127]*.md $(BOLT_EXTRACT); do if [ $$f -nt $@ -o ! -f $@ ]; then $(BOLT_EXTRACT) --message-fields --message-types $(LOCAL_BOLTDIR)/0[127]*.md > $@; break; fi; done; fi
|
||||
|
||||
wire/gen_onion_wire_csv: bolt-precheck
|
||||
@set -e; if [ -f $(BOLT_EXTRACT) ]; then for f in $(LOCAL_BOLTDIR)/04*.md $(BOLT_EXTRACT); do if [ $$f -nt $@ -o ! -f $@ ]; then echo '#include <wire/onion_defs.h>' > $@ && $(BOLT_EXTRACT) --message-fields --message-types $(LOCAL_BOLTDIR)/04*.md >> $@; break; fi; done; fi
|
||||
endif
|
||||
|
||||
wire/gen_peer_wire.h: $(WIRE_GEN) wire/gen_peer_wire_csv
|
||||
$(WIRE_GEN) --bolt --header $@ wire_type < wire/gen_peer_wire_csv > $@
|
||||
|
Loading…
Reference in New Issue
Block a user