From 7ef8645aad5155a370d63a410165f392ea574e44 Mon Sep 17 00:00:00 2001 From: Rusty Russell Date: Tue, 2 Jul 2024 11:32:11 +0930 Subject: [PATCH] Makefile: don't make every file depend on version headers. common/version.o depends on common/version_gen.h explicitly already, and header_versions_gen.h is only used by lightningd, so we can make that dependency explicit. This means when version changes (i.e. different git commit) we only relink, not recompile. Before: ``` real 0m6.578s user 0m14.705s sys 0m13.621s ``` After: ``` real 0m2.098s user 0m6.763s sys 0m4.844s ``` Signed-off-by: Rusty Russell --- Makefile | 4 ++-- lightningd/Makefile | 3 +++ 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/Makefile b/Makefile index 583dbc9665ba..62583726acc5 100644 --- a/Makefile +++ b/Makefile @@ -232,7 +232,7 @@ ALL_TEST_PROGRAMS := ALL_TEST_GEN := ALL_FUZZ_TARGETS := ALL_C_SOURCES := -ALL_C_HEADERS := header_versions_gen.h version_gen.h +ALL_C_HEADERS := # Extra (non C) targets that should be built by default. DEFAULT_TARGETS := @@ -640,7 +640,7 @@ version_gen.h: $(FORCE) endif # That forces this rule to be run every time, too. -header_versions_gen.h: tools/headerversions +header_versions_gen.h: tools/headerversions $(FORCE) @tools/headerversions $@ # We make a static library, this way linker can discard unused parts. diff --git a/lightningd/Makefile b/lightningd/Makefile index e9766343b60b..77f86286d4bc 100644 --- a/lightningd/Makefile +++ b/lightningd/Makefile @@ -69,6 +69,9 @@ ALL_C_SOURCES += $(LIGHTNINGD_SRC) $(LIGHTNINGD_SRC_NOHDR) ALL_C_HEADERS += $(LIGHTNINGD_HDRS) ALL_PROGRAMS += lightningd/lightningd +# We explicitly check header versions in lightningd.c +lightningd/lightningd.o: header_versions_gen.h + # Common source we use. LIGHTNINGD_COMMON_OBJS := \ common/addr.o \