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 <john@phrozen.org>
This commit is contained in:
John Crispin committed 2026-09-22 18:18:58 +02:00
1 parent d29ffc6f39
commit 177325ba1a
1 file changed
+2
+2
View File
@@ -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)