[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <CAK7LNASVLGD6FMqyFd_Siy_JuRZX-TMAZ5TVH8+kN1Bwjwx5eg@mail.gmail.com>
Date: Sat, 5 Jul 2025 06:51:14 +0900
From: Masahiro Yamada <masahiroy@...nel.org>
To: Thomas Weißschuh <thomas.weissschuh@...utronix.de>
Cc: Nathan Chancellor <nathan@...nel.org>, Andrew Morton <akpm@...ux-foundation.org>,
Willy Tarreau <w@....eu>, Thomas Weißschuh <linux@...ssschuh.net>,
Brendan Higgins <brendan.higgins@...ux.dev>, David Gow <davidgow@...gle.com>,
Rae Moar <rmoar@...gle.com>, Shuah Khan <shuah@...nel.org>, Jonathan Corbet <corbet@....net>,
Nicolas Schier <nicolas.schier@...ux.dev>, Christophe Leroy <christophe.leroy@...roup.eu>,
linux-kbuild@...r.kernel.org, linux-kernel@...r.kernel.org,
linux-kselftest@...r.kernel.org, kunit-dev@...glegroups.com,
linux-doc@...r.kernel.org, workflows@...r.kernel.org
Subject: Re: [PATCH v4 01/15] kbuild: userprogs: avoid duplication of flags
inherited from kernel
On Thu, Jun 26, 2025 at 3:10 PM Thomas Weißschuh
<thomas.weissschuh@...utronix.de> wrote:
>
> The duplication makes maintenance harder. Changes need to be done in two
> places and the lines will grow overly long.
>
> Use an intermediary variable instead.
>
> Signed-off-by: Thomas Weißschuh <thomas.weissschuh@...utronix.de>
> ---
> Makefile | 5 +++--
> 1 file changed, 3 insertions(+), 2 deletions(-)
>
> diff --git a/Makefile b/Makefile
> index 35e6e5240c61a8a329011929fcd0352b881dccdc..c4293cf91e968ca8ee64452841fb266e24df63f6 100644
> --- a/Makefile
> +++ b/Makefile
> @@ -1130,8 +1130,9 @@ LDFLAGS_vmlinux += --emit-relocs --discard-none
> endif
>
> # Align the bit size of userspace programs with the kernel
> -KBUILD_USERCFLAGS += $(filter -m32 -m64 --target=%, $(KBUILD_CPPFLAGS) $(KBUILD_CFLAGS))
> -KBUILD_USERLDFLAGS += $(filter -m32 -m64 --target=%, $(KBUILD_CPPFLAGS) $(KBUILD_CFLAGS))
> +USERFLAGS_FROM_KERNEL := -m32 -m64 --target=%
> +KBUILD_USERCFLAGS += $(filter $(USERFLAGS_FROM_KERNEL), $(KBUILD_CPPFLAGS) $(KBUILD_CFLAGS))
> +KBUILD_USERLDFLAGS += $(filter $(USERFLAGS_FROM_KERNEL), $(KBUILD_CPPFLAGS) $(KBUILD_CFLAGS))
>
Acked-by: Masahiro Yamada <masahiroy@...nel.org>
However, as I mentioned before, the following code is shorter.
USERFLAGS_FROM_KERNEL := $(filter -m32 -m64 --target=%,
$(KBUILD_CPPFLAGS) $(KBUILD_CFLAGS))
KBUILD_USERCFLAGS += $(USERFLAGS_FROM_KERNEL)
KBUILD_USERLDFLAGS += $(USERFLAGS_FROM_KERNEL)
--
Best Regards
Masahiro Yamada
Powered by blists - more mailing lists