In Makefile.include, CC_NO_CLANG unconditionally executed a GCC/Clang compiler inspection fork (gcc -dM -E ...) during Makefile parse time. Because Makefile.include is included across more than 40 sub-makes and component directories throughout the Kbuild tree, Make continuously re-executed this compiler probe dozens of times during incremental builds. Wrap CC_NO_CLANG with a conditional check and export the variable to sub-makes. This guarantees Kbuild evaluates the compiler backend exactly once during top-level Make invocation, eliminating 40+ redundant shell forks across the build tree. Assisted-by: Gemini:gemini-3.1-pro-preview Signed-off-by: Ian Rogers --- tools/scripts/Makefile.include | 3 +++ 1 file changed, 3 insertions(+) diff --git a/tools/scripts/Makefile.include b/tools/scripts/Makefile.include index 41971a68972d..3c7803122ae2 100644 --- a/tools/scripts/Makefile.include +++ b/tools/scripts/Makefile.include @@ -74,7 +74,10 @@ $(call allow-override,CXX,$(CROSS_COMPILE)g++) $(call allow-override,STRIP,$(CROSS_COMPILE)strip) endif +ifeq ($(CC_NO_CLANG),) CC_NO_CLANG := $(shell $(CC) -dM -E -x c /dev/null | grep -Fq "__clang__"; echo $$?) +endif +export CC_NO_CLANG ifneq ($(LLVM),) HOSTAR ?= $(LLVM_PREFIX)llvm-ar$(LLVM_SUFFIX) -- 2.54.0.563.g4f69b47b94-goog