From 0861ec33a54a0830806a6112a7e8b7584a55e22f Mon Sep 17 00:00:00 2001 From: Rusty Russell Date: Wed, 4 Jan 2017 14:09:20 +1030 Subject: [PATCH] check-source-bolt: generalize. This way sub-Makefiles can add their own files to check. Signed-off-by: Rusty Russell --- Makefile | 9 +++++++-- bitcoin/Makefile | 2 ++ daemon/Makefile | 2 ++ wire/Makefile | 3 +++ 4 files changed, 14 insertions(+), 2 deletions(-) diff --git a/Makefile b/Makefile index 5fcfefe4f..4de383bbf 100644 --- a/Makefile +++ b/Makefile @@ -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 # Any mention of BOLT# must be followed by an exact quote, modulo whitepace. -check-source-bolt: 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 +bolt-check/%: % bolt-precheck check-bolt + @[ ! -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) diff --git a/bitcoin/Makefile b/bitcoin/Makefile index 28e67a968..9a412d656 100644 --- a/bitcoin/Makefile +++ b/bitcoin/Makefile @@ -13,4 +13,6 @@ $(BITCOIN_TEST_OBJS): $(CCAN_HEADERS) $(BITCOIN_HEADERS) $(BITCOIN_SRC) check: bitcoin-tests +check-source-bolt: $(BITCOIN_SRC:%=bolt-check/%) $(BITCOIN_HEADERS:%=bolt-check/%) + bitcoin-tests: $(BITCOIN_TEST_PROGRAMS:%=unittest/%) diff --git a/daemon/Makefile b/daemon/Makefile index 9c54d97c5..d69d82243 100644 --- a/daemon/Makefile +++ b/daemon/Makefile @@ -121,6 +121,8 @@ check-source: $(DAEMON_HEADERS:%=check-hdr-include-order/%) check-daemon-makefile: @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. daemon/jsmn/jsmn.h: git submodule update daemon/jsmn/ diff --git a/wire/Makefile b/wire/Makefile index 4a9872a0d..4539329c4 100644 --- a/wire/Makefile +++ b/wire/Makefile @@ -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 +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 wire-all: wire/gen_wire.o wire/fromwire.o wire/towire.o