From 177325ba1a7860994aea060d861e1513ea91c5b4 Mon Sep 17 00:00:00 2001 From: John Crispin Date: Fri, 18 Sep 2026 20:43:32 +0200 Subject: [PATCH] build: compute REVISION and SOURCE_DATE_EPOCH once per build The top-level Makefile calls itself for prereq and for the build, and every call runs getver.sh and get_source_date_epoch.sh again, although the values are already exported by the first call. Take them from the environment in recursive calls. The first call still computes them, so a value in the environment of the user is ignored as before. Signed-off-by: John Crispin --- include/toplevel.mk | 2 ++ 1 file changed, 2 insertions(+) diff --git a/include/toplevel.mk b/include/toplevel.mk index c55c92077f6..0dd09a1cd34 100644 --- a/include/toplevel.mk +++ b/include/toplevel.mk @@ -10,6 +10,8 @@ include $(TOPDIR)/include/verbose.mk ifeq ($(SDK),1) include $(TOPDIR)/include/version.mk +else ifeq ($(filter-out 0,$(MAKELEVEL))$(origin REVISION)$(origin SOURCE_DATE_EPOCH),$(MAKELEVEL)environmentenvironment) + # Recursive calls of the top-level Makefile get both from its environment. else REVISION:=$(shell $(TOPDIR)/scripts/getver.sh) SOURCE_DATE_EPOCH:=$(shell $(TOPDIR)/scripts/get_source_date_epoch.sh)