From 6fadd5aea234c8726b14b0097e0f9e1a5606c191 Mon Sep 17 00:00:00 2001 From: ZmnSCPxj jxPCSnmZ Date: Wed, 5 Aug 2020 22:26:16 +0800 Subject: [PATCH] Makefile: Remove gen_version.h from ALL_GEN_HEADERS. This prevents recompiling everything when you are changing just a doc, or touching only one file among hundreds of sources, just because the `gen_version.h` is changed, especially since only one source actually depends on that header. --- Makefile | 2 -- common/Makefile | 3 +++ common/version.c | 4 +++- 3 files changed, 6 insertions(+), 3 deletions(-) diff --git a/Makefile b/Makefile index a396fbf5f..b5a3eda67 100644 --- a/Makefile +++ b/Makefile @@ -196,8 +196,6 @@ CCAN_HEADERS := \ $(CCANDIR)/ccan/typesafe_cb/typesafe_cb.h \ $(CCANDIR)/ccan/utf8/utf8.h -ALL_GEN_HEADERS += gen_version.h - CDUMP_OBJS := ccan-cdump.o ccan-strmap.o BOLT_GEN := tools/generate-wire.py diff --git a/common/Makefile b/common/Makefile index bcce39002..c56be7466 100644 --- a/common/Makefile +++ b/common/Makefile @@ -96,6 +96,9 @@ COMMON_OBJS := $(COMMON_SRC:.c=.o) # Common objects depends on bitcoin/ external/ and ccan $(COMMON_OBJS): $(CCAN_HEADERS) $(BITCOIN_HEADERS) $(EXTERNAL_HEADERS) $(COMMON_HEADERS_GEN) +# Only common/version.c can include this header. +common/version.o: gen_version.h + ALL_GEN_HEADERS += $(COMMON_HEADERS_GEN) ALL_OBJS += $(COMMON_OBJS) diff --git a/common/version.c b/common/version.c index 0bc7772ef..ea6aef255 100644 --- a/common/version.c +++ b/common/version.c @@ -1,7 +1,9 @@ -#include "gen_version.h" #include "version.h" #include +/* Only common/version.c can safely include this. */ +# include "gen_version.h" + const char *version(void) { return VERSION;