summaryrefslogtreecommitdiff
path: root/Makefile
diff options
context:
space:
mode:
authorSimon Glass <[email protected]>2026-03-04 11:48:53 -0700
committerTom Rini <[email protected]>2026-03-16 10:41:40 -0600
commita27980786cfb3c430aa1c05da8e79180c584d221 (patch)
tree706a984712b49c1d7fbb1852edebbd057ae7a973 /Makefile
parent041364141b7daef8318a4b8495cac8570002773f (diff)
kbuild: strip sub_make_done from test-script environment
The exported sub_make_done variable leaks into the environment of all child processes. When make targets like tcheck spawn independent make-invocations with O=, those child-makes inherit sub_make_done=1, skip the KBUILD_OUTPUT setup and try to build in the source tree. A global 'unexport sub_make_done' cannot be used because the build system itself re-invokes the top-level Makefile for syncconfig (via '$(MAKE) -f $(srctree)/Makefile syncconfig'). Without sub_make_done, that child make re-enters the KBUILD_OUTPUT block and recomputes abs_objtree. With a relative O= path this resolves to a nested directory (e.g. build/build/) where .config does not exist. Instead, use 'env -u sub_make_done' in the test-target recipes so only the test scripts see a clean environment. This allows their child make invocations to process O= correctly without affecting internal kbuild recursion. This is not strictly a bugfix, but compare with: commit 27529f1cb02d ("kbuild: skip parsing pre sub-make code for recursion") Signed-off-by: Simon Glass <[email protected]>
Diffstat (limited to 'Makefile')
-rw-r--r--Makefile12
1 files changed, 5 insertions, 7 deletions
diff --git a/Makefile b/Makefile
index 627f1775fe1..8295cd4e5e8 100644
--- a/Makefile
+++ b/Makefile
@@ -2747,21 +2747,19 @@ help:
@echo 'Execute "make" or "make all" to build all targets marked with [*] '
@echo 'For further info see the ./README file'
-ifneq ($(filter tests pcheck qcheck tcheck,$(MAKECMDGOALS)),)
-export sub_make_done := 0
-endif
+run_tests = $(Q)env -u sub_make_done $(srctree)/test/run
tests check:
- $(srctree)/test/run
+ $(run_tests)
pcheck:
- $(srctree)/test/run parallel
+ $(run_tests) parallel
qcheck:
- $(srctree)/test/run quick
+ $(run_tests) quick
tcheck:
- $(srctree)/test/run tools
+ $(run_tests) tools
# Documentation targets
# ---------------------------------------------------------------------------