"Das U-Boot" Source Tree
0
fork

Configure Feed

Select the types of activity you want to include in your feed.

kbuild: unexport sub_make_done to fix child make invocations

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.

There is a workaround that resets sub_make_done to 0 for specific test
targets, but this isn't great since it has tolist every target that
spawns independent make invocations.

Instead, unexport sub_make_done once we are in the final make
invocation. The direct sub-make already has the value in its
environment from the export, and no further propagation is needed.
This also allows the per-target workaround to be removed.

Fixes: 27529f1cb02d ("kbuild: skip parsing pre sub-make code for recursion")
Signed-off-by: Simon Glass <simon.glass@canonical.com>

authored by

Simon Glass and committed by
Tom Rini
4284306d 8353239d

+4 -4
+4 -4
Makefile
··· 194 194 # We process the rest of the Makefile if this is the final invocation of make 195 195 ifeq ($(need-sub-make),) 196 196 197 + # Do not propagate sub_make_done to non-submake children (e.g. test scripts 198 + # that invoke make separately with O= need to process the KBUILD_OUTPUT block) 199 + unexport sub_make_done 200 + 197 201 # Do not print "Entering directory ...", 198 202 # but we want to display it when entering to the output directory 199 203 # so that IDEs/editors are able to understand relative filenames. ··· 2736 2740 @echo '' 2737 2741 @echo 'Execute "make" or "make all" to build all targets marked with [*] ' 2738 2742 @echo 'For further info see the ./README file' 2739 - 2740 - ifneq ($(filter tests pcheck qcheck tcheck,$(MAKECMDGOALS)),) 2741 - export sub_make_done := 0 2742 - endif 2743 2743 2744 2744 tests check: 2745 2745 $(srctree)/test/run