[LTP] [PATCH v3 2/3] build: Build shared libs once on subtree make

Cyril Hrubis chrubis@suse.cz
Mon Nov 23 16:39:19 CET 2026


Hi!
> When make is invoked directly in a trunk subdirectory (MAKELEVEL == 0),
> build shared prerequisites (libltp.a, libs, and libkerntest.a) once
> via MAKE_DEPS before launching parallel subdirectory builds.
> 
> Signed-off-by: Andrea Cervesato <andrea.cervesato@suse.com>
> ---
>  include/mk/generic_trunk_target.inc | 23 +++++++++++++++++++++++
>  1 file changed, 23 insertions(+)

I think this is added to a wrong file. The build isn't triggered from
leaf directories, e.g. testcases/kernel/syscalls/accept/

I suppose that it should go to a separate file
include/mk/generic_lib_deps.inc and should be included from both
generic_trunk_target.mk and generic_leaf_target.mk.

> diff --git a/include/mk/generic_trunk_target.inc b/include/mk/generic_trunk_target.inc
> index f9db7896a..aa8e500e1 100644
> --- a/include/mk/generic_trunk_target.inc
> +++ b/include/mk/generic_trunk_target.inc
> @@ -36,6 +36,29 @@ RECURSIVE_TARGETS		?= all install check
>  
>  $(eval $(get_make_dirs))
>  
> +ifeq ($(MAKELEVEL),0)
> +ifneq ($(filter $(abs_top_builddir)/testcases%,$(CURDIR)),)
> +MAKE_DEPS += $(abs_top_builddir)/lib/libltp.a $(abs_top_builddir)/libs-all

These two targets should be .PHONY so that the libraries are properly
rebuild on:

touch lib/*.c
cd testcases/kernel/syscalls/
make

> +$(abs_top_builddir)/lib/libltp.a:
> +	mkdir -m 00755 -p "$(abs_top_builddir)/lib"
> +	$(MAKE) -C "$(abs_top_builddir)/lib" -f "$(abs_top_srcdir)/lib/Makefile" all
> +
> +.PHONY: $(abs_top_builddir)/libs-all
> +$(abs_top_builddir)/libs-all: $(LTPLIBS_FILES)
> +	mkdir -m 00755 -p "$(abs_top_builddir)/libs"
> +	$(MAKE) -C "$(abs_top_builddir)/libs" -f "$(abs_top_srcdir)/libs/Makefile" all
> +endif
> +
> +ifneq ($(filter $(abs_top_builddir)/testcases/kernel/%,$(CURDIR)),)
> +MAKE_DEPS += $(abs_top_builddir)/testcases/kernel/lib/libkerntest.a
> +
> +$(abs_top_builddir)/testcases/kernel/lib/libkerntest.a:
> +	mkdir -m 00755 -p "$(abs_top_builddir)/testcases/kernel/lib"
> +	$(MAKE) -C "$(abs_top_builddir)/testcases/kernel/lib" -f "$(abs_top_srcdir)/testcases/kernel/lib/Makefile" all
> +endif
> +endif
> +
>  .PHONY: $(RECURSIVE_TARGETS) $(addprefix trunk-,$(RECURSIVE_TARGETS))
>  
>  $(SUBDIRS): %:
> 
> -- 
> 2.51.0
> 
> 
> -- 
> Mailing list info: https://lists.linux.it/listinfo/ltp

-- 
Cyril Hrubis
chrubis@suse.cz


More information about the ltp mailing list