From: Li Wang <li.wang@linux.dev>
To: Andrea Cervesato <andrea.cervesato@suse.de>
Cc: Linux Test Project <ltp@lists.linux.it>
Subject: Re: [LTP] [PATCH v3 2/3] build: Build shared libs once on subtree make
Date: Mon, 2 Nov 2026 11:39:17 +0800 [thread overview]
Message-ID: <augF5SbHd8Kk2KOG@linux.dev> (raw)
In-Reply-To: <20261021-build_system_optimize-v3-2-71a3c4c6f937@suse.com>
On Wed, Oct 21, 2026 at 10:11:29AM +0200, Andrea Cervesato wrote:
> From: Andrea Cervesato <andrea.cervesato@suse.com>
>
> 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(+)
>
> 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
> +
> +$(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): %:
This code works but isn't elegant. How about refactoring it as follows:
-------------------
ifeq ($(MAKELEVEL),0)
ifneq ($(filter $(abs_top_builddir)/testcases%,$(CURDIR)),)
MAKE_DEPS += $(abs_top_builddir)/lib/libltp.a
MAKE_DEPS += $(abs_top_builddir)/libs-all
$(abs_top_builddir)/lib/libltp.a:
$(MKDIR_P) "$(@D)"
$(MAKE) -C "$(@D)" -f "$(abs_top_srcdir)/lib/Makefile" all
.PHONY: $(abs_top_builddir)/libs-all
$(abs_top_builddir)/libs-all: $(LTPLIBS_FILES)
$(MKDIR_P) "$(@D)"
$(MAKE) -C "$(@D)" -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_P) "$(@D)"
$(MAKE) -C "$(@D)" -f "$(abs_top_srcdir)/testcases/kernel/lib/Makefile" all
endif
endif
--
Regards,
Li Wang
--
Mailing list info: https://lists.linux.it/listinfo/ltp
next prev parent reply other threads:[~2026-11-02 3:39 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-10-21 8:11 [LTP] [PATCH v3 0/3] Speedup LTP compile time by ~20% on multi-machine Andrea Cervesato
2026-10-21 8:11 ` [LTP] [PATCH v3 1/3] build: Fix library prerequisites in testcases.mk Andrea Cervesato
2026-10-21 13:40 ` [LTP] " linuxtestproject.agent
2026-11-02 3:07 ` [LTP] [PATCH v3 1/3] " Li Wang
2026-10-21 8:11 ` [LTP] [PATCH v3 2/3] build: Build shared libs once on subtree make Andrea Cervesato
2026-11-02 3:39 ` Li Wang [this message]
2026-11-02 4:53 ` Li Wang
2026-10-21 8:11 ` [LTP] [PATCH v3 3/3] build: Parallelize subdirectory recursion in generic_trunk_target Andrea Cervesato
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=augF5SbHd8Kk2KOG@linux.dev \
--to=li.wang@linux.dev \
--cc=andrea.cervesato@suse.de \
--cc=ltp@lists.linux.it \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.