2016-11-29 20:51:50 +01:00
|
|
|
#! /usr/bin/make
|
|
|
|
|
|
|
|
# Designed to be run one level up
|
|
|
|
wire-wrongdir:
|
|
|
|
$(MAKE) -C .. wire-all
|
|
|
|
|
|
|
|
WIRE_HEADERS := wire/wire.h
|
2017-01-06 04:10:35 +01:00
|
|
|
WIRE_GEN_HEADERS := wire/gen_peer_wire.h wire/gen_onion_wire.h
|
2017-01-04 04:39:20 +01:00
|
|
|
WIRE_GEN_SRC := wire/gen_peer_wire.c
|
2017-01-06 04:10:35 +01:00
|
|
|
WIRE_GEN_ONION_SRC := wire/gen_onion_wire.c
|
2017-01-04 04:39:20 +01:00
|
|
|
WIRE_SRC := wire/fromwire.c \
|
|
|
|
wire/towire.c
|
|
|
|
|
|
|
|
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)
|
2016-11-29 20:51:50 +01:00
|
|
|
|
|
|
|
# They may not have the bolts.
|
|
|
|
BOLT_EXTRACT=$(BOLTDIR)/tools/extract-formats.py
|
2017-01-06 04:10:35 +01:00
|
|
|
# FIXME: Re-enable --check-alignment!
|
2017-01-04 04:39:20 +01:00
|
|
|
wire/gen_peer_wire_csv: FORCE
|
2017-01-06 04:10:35 +01:00
|
|
|
@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
|
2017-01-06 04:10:35 +01:00
|
|
|
|
|
|
|
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 --check-alignment $(BOLTDIR)/04*.md >> $@; break; fi; done; fi
|
2016-11-29 20:51:50 +01:00
|
|
|
|
2017-01-04 04:39:20 +01:00
|
|
|
wire/gen_peer_wire.h: $(WIRE_GEN) wire/gen_peer_wire_csv
|
|
|
|
$(WIRE_GEN) --header $@ wire_type < wire/gen_peer_wire_csv > $@
|
2016-11-29 20:51:50 +01:00
|
|
|
|
2017-01-04 04:39:20 +01:00
|
|
|
wire/gen_peer_wire.c: $(WIRE_GEN) wire/gen_peer_wire_csv
|
|
|
|
$(WIRE_GEN) ${@:.c=.h} wire_type < wire/gen_peer_wire_csv > $@
|
2016-11-29 20:51:50 +01:00
|
|
|
|
2017-01-06 04:10:35 +01:00
|
|
|
wire/gen_onion_wire.h: $(WIRE_GEN) wire/gen_onion_wire_csv
|
|
|
|
$(WIRE_GEN) --header $@ onion_type < wire/gen_onion_wire_csv > $@
|
|
|
|
|
|
|
|
wire/gen_onion_wire.c: $(WIRE_GEN) wire/gen_onion_wire_csv
|
|
|
|
$(WIRE_GEN) ${@:.c=.h} onion_type < wire/gen_onion_wire_csv > $@
|
|
|
|
|
2017-01-04 04:39:20 +01:00
|
|
|
wire/gen_peer_wire.o: wire/gen_peer_wire.h
|
2017-01-06 04:10:35 +01:00
|
|
|
wire/gen_onion_wire.o: wire/gen_onion_wire.h
|
2016-11-29 20:51:50 +01:00
|
|
|
|
2017-01-04 04:39:20 +01:00
|
|
|
check-source: $(WIRE_SRC:%=check-src-include-order/%) $(WIRE_HEADERS:%=check-hdr-include-order/%)
|
|
|
|
|
|
|
|
check-source-bolt: $(WIRE_SRC:%=bolt-check/%) $(WIRE_HEADERS:%=bolt-check/%)
|
2017-01-04 04:39:20 +01:00
|
|
|
|
|
|
|
check-whitespace: $(WIRE_SRC:%=check-whitespace/%) $(WIRE_HEADERS:%=check-whitespace/%) check-whitespace/wire/Makefile
|
|
|
|
|
2016-11-29 20:51:50 +01:00
|
|
|
clean: wire-clean
|
|
|
|
|
2017-01-06 04:10:35 +01:00
|
|
|
wire-all: wire/gen_peer_wire.o wire/gen_onion_wire.o wire/fromwire.o wire/towire.o
|
2016-11-30 14:43:26 +01:00
|
|
|
|
2016-11-29 20:51:50 +01:00
|
|
|
wire-clean:
|
2016-11-30 14:43:26 +01:00
|
|
|
$(RM) $(WIRE_OBJS) $(WIRE_GEN_SRC) $(WIRE_GEN_HEADERS) towire.c fromwire.c
|
2016-11-29 20:51:50 +01:00
|
|
|
|
2017-01-04 04:39:20 +01:00
|
|
|
include wire/test/Makefile
|