check-source-bolt: generalize.

This way sub-Makefiles can add their own files to check.

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
This commit is contained in:
Rusty Russell 2017-01-04 14:09:20 +10:30
parent b4f495fe99
commit 0861ec33a5
4 changed files with 14 additions and 2 deletions

View File

@ -240,8 +240,13 @@ check-makefile: check-daemon-makefile
@if [ x"$(CCANDIR)/config.h `find $(CCANDIR)/ccan -name '*.h' | grep -v /test/ | LC_ALL=C sort | tr '\n' ' '`" != x"$(CCAN_HEADERS) " ]; then echo CCAN_HEADERS incorrect; exit 1; fi @if [ x"$(CCANDIR)/config.h `find $(CCANDIR)/ccan -name '*.h' | grep -v /test/ | LC_ALL=C sort | tr '\n' ' '`" != x"$(CCAN_HEADERS) " ]; then echo CCAN_HEADERS incorrect; exit 1; fi
# Any mention of BOLT# must be followed by an exact quote, modulo whitepace. # Any mention of BOLT# must be followed by an exact quote, modulo whitepace.
check-source-bolt: check-bolt bolt-check/%: % bolt-precheck check-bolt
@if [ ! -d $(BOLTDIR) ]; then echo Not checking BOLT references: BOLTDIR $(BOLTDIR) does not exist >&2; else set -e; rm -rf .tmp.lightningrfc; if [ -n "$(BOLTVERSION)" ]; then git clone -q -b $(BOLTVERSION) $(BOLTDIR) .tmp.lightningrfc; else cp -a $(BOLTDIR) .tmp.lightningrfc; fi; ./check-bolt .tmp.lightningrfc $(CORE_SRC) $(BITCOIN_SRC) $(DAEMON_SRC) $(CORE_HEADERS) $(BITCOIN_HEADERS) $(DAEMON_HEADERS) $(WIRE_SRC) $(WIRE_HEADERS) $(TEST_PROGRAMS:=.c); fi @[ ! -d .tmp.lightningrfc ] || ./check-bolt .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 -b $(BOLTVERSION) $(BOLTDIR) .tmp.lightningrfc; else cp -a $(BOLTDIR) .tmp.lightningrfc; fi
check-source-bolt: $(CORE_SRC:%=bolt-check/%) $(CORE_HEADERS:%=bolt-check/%) $(TEST_PROGRAMS:%=bolt-check/%.c)
check-bolt: check-bolt.o $(CCAN_OBJS) check-bolt: check-bolt.o $(CCAN_OBJS)

View File

@ -13,4 +13,6 @@ $(BITCOIN_TEST_OBJS): $(CCAN_HEADERS) $(BITCOIN_HEADERS) $(BITCOIN_SRC)
check: bitcoin-tests check: bitcoin-tests
check-source-bolt: $(BITCOIN_SRC:%=bolt-check/%) $(BITCOIN_HEADERS:%=bolt-check/%)
bitcoin-tests: $(BITCOIN_TEST_PROGRAMS:%=unittest/%) bitcoin-tests: $(BITCOIN_TEST_PROGRAMS:%=unittest/%)

View File

@ -121,6 +121,8 @@ check-source: $(DAEMON_HEADERS:%=check-hdr-include-order/%)
check-daemon-makefile: check-daemon-makefile:
@if [ "`ls daemon/*.h | grep -v daemon/gen | tr '\012' ' '`" != "`echo $(DAEMON_HEADERS) ''`" ]; then echo DAEMON_HEADERS incorrect; exit 1; fi @if [ "`ls daemon/*.h | grep -v daemon/gen | tr '\012' ' '`" != "`echo $(DAEMON_HEADERS) ''`" ]; then echo DAEMON_HEADERS incorrect; exit 1; fi
check-source-bolt: $(DAEMON_SRC:%=bolt-check/%) $(DAEMON_HEADERS:%=bolt-check/%)
# Git submodules are seriously broken. # Git submodules are seriously broken.
daemon/jsmn/jsmn.h: daemon/jsmn/jsmn.h:
git submodule update daemon/jsmn/ git submodule update daemon/jsmn/

View File

@ -25,6 +25,9 @@ wire/gen_wire.c: wire/tools/generate-wire.py wire/gen_wire_csv
wire/gen_wire.o: wire/gen_wire.h wire/gen_wire.o: wire/gen_wire.h
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/%)
clean: wire-clean clean: wire-clean
wire-all: wire/gen_wire.o wire/fromwire.o wire/towire.o wire-all: wire/gen_wire.o wire/fromwire.o wire/towire.o