From 1b80cb42691715e775dc15926198ecce50c16b52 Mon Sep 17 00:00:00 2001 From: Rusty Russell Date: Fri, 21 Sep 2018 17:19:33 +0930 Subject: [PATCH] Makefile: don't rebuild all the time The code to regenerate the local BOLT copy was causing eternal rebuild. So only build if it's wrong. Signed-off-by: Rusty Russell --- Makefile | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Makefile b/Makefile index 4e730bf22..10bcbc757 100644 --- a/Makefile +++ b/Makefile @@ -243,12 +243,12 @@ check-makefile: # Any mention of BOLT# must be followed by an exact quote, modulo whitespace. bolt-check/%: % bolt-precheck tools/check-bolt - @[ ! -d .tmp.lightningrfc ] || tools/check-bolt .tmp.lightningrfc $< + @if [ -d .tmp.lightningrfc ]; then tools/check-bolt .tmp.lightningrfc $<; else Not checking BOLTs: BOLTDIR $(BOLTDIR) does not exist >&2; fi LOCAL_BOLTDIR=.tmp.lightningrfc bolt-precheck: - @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 + @[ -d $(BOLTDIR) ] || exit 0; set -e; if [ -z "$(BOLTVERSION)" ]; then rm -rf $(LOCAL_BOLTDIR); ln -sf $(BOLTDIR) $(LOCAL_BOLTDIR); exit 0; fi; [ "$$(git -C $(LOCAL_BOLTDIR) rev-list --max-count=1 HEAD 2>/dev/null)" != "$(BOLTVERSION)" ] || exit 0; rm -rf $(LOCAL_BOLTDIR) && git clone -q $(BOLTDIR) $(LOCAL_BOLTDIR) && cd $(LOCAL_BOLTDIR) && git checkout -q $(BOLTVERSION) check-source-bolt: $(ALL_TEST_PROGRAMS:%=bolt-check/%.c)