From e3a89c4e4bcd25158690408cfc52886b4e67e602 Mon Sep 17 00:00:00 2001 From: John Crispin Date: Sat, 19 Sep 2026 09:24:50 +0200 Subject: [PATCH] build: detect the host triplet once per build The top-level Makefile calls itself for prereq and for the build, and every call runs config.guess again. config.guess runs the host C compiler three times, which takes about 40 ms. Take GNU_HOST_NAME from the environment in recursive calls, as for REVISION and SOURCE_DATE_EPOCH. Signed-off-by: John Crispin --- include/toplevel.mk | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/include/toplevel.mk b/include/toplevel.mk index 0dd09a1cd34..a3fae3e761e 100644 --- a/include/toplevel.mk +++ b/include/toplevel.mk @@ -22,7 +22,10 @@ export SOURCE_DATE_EPOCH export GIT_CONFIG_PARAMETERS='core.autocrlf=false' export GIT_ASKPASS:=/bin/true export MAKE_JOBSERVER=$(filter --jobserver%,$(MAKEFLAGS)) -export GNU_HOST_NAME:=$(shell $(TOPDIR)/scripts/config.guess) +ifneq ($(filter-out 0,$(MAKELEVEL))$(origin GNU_HOST_NAME),$(MAKELEVEL)environment) + GNU_HOST_NAME:=$(shell $(TOPDIR)/scripts/config.guess) +endif +export GNU_HOST_NAME export HOST_OS:=$(shell uname) export HOST_ARCH:=$(shell uname -m)