[PATCH] makefile: Fix recursive makes

Heinrich Schuchardt heinrich.schuchardt at canonical.com
Wed Oct 22 18:02:53 CEST 2025


On 10/22/25 13:23, Ilias Apalodimas wrote:
> Since the Kbuild bump to 5.1 and specifically
> commit af1a9935708a ("kbuild: make -r/-R effective in top Makefile for old Make versions")
> the recursion rules have changed.
> 
> 'make O=/output/dir/' as well as './test/py/test.py --bd sandbox --build'
> is working fine but anything that recursively called the makefile was
> failing e.g 'make tests', 'make qcheck' etc, which calls a bash script
> that ends up calling the makefile again.
> 
> The reason is that the internal 'sub_make_done' variable of the makefile was set
> after the first pass and the output dir was never evaluated properly.
> Reset the variable value if we are executing any of these tests.
> 
> Fixes: commit af1a9935708a ("kbuild: make -r/-R effective in top Makefile for old Make versions")
> Reported-by: Heinrich Schuchardt <heinrich.schuchardt at canonical.com>
> Signed-off-by: Ilias Apalodimas <ilias.apalodimas at linaro.org>

Thank you Ilias for resolving this.

Test-by: Heinrich Schuchardt <heinrich.schuchardt at canonical.com>

> ---
>   Makefile | 4 ++++
>   1 file changed, 4 insertions(+)
> 
> diff --git a/Makefile b/Makefile
> index 2402f9313d8b..8cddee3c5a96 100644
> --- a/Makefile
> +++ b/Makefile
> @@ -2666,6 +2666,10 @@ 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
> +
>   tests check:
>   	$(srctree)/test/run
>   



More information about the U-Boot mailing list