[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <20250813-kbuild-userprogs-bits-v1-1-2d9f7f411083@linutronix.de>
Date: Wed, 13 Aug 2025 07:43:40 +0200
From: Thomas Weißschuh <thomas.weissschuh@...utronix.de>
To: Nathan Chancellor <nathan@...nel.org>,
Nicolas Schier <nicolas.schier@...ux.dev>
Cc: linux-kbuild@...r.kernel.org, linux-kernel@...r.kernel.org,
Masahiro Yamada <masahiroy@...nel.org>,
Thomas Weißschuh <thomas.weissschuh@...utronix.de>,
Nicolas Schier <nicolas.schier@...ux.dev>
Subject: [PATCH 1/2] kbuild: userprogs: avoid duplication of flags
inherited from kernel
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>
Reviewed-by: Nicolas Schier <n.schier@....de>
Acked-by: Masahiro Yamada <masahiroy@...nel.org>
---
Makefile | 5 +++--
1 file changed, 3 insertions(+), 2 deletions(-)
diff --git a/Makefile b/Makefile
index 6bfe776bf3c5ff0cf187dc6719dd5817cd4af2ca..d0f5262a9c0f3b4aa79a91c20cc149d034ffa0b7 100644
--- a/Makefile
+++ b/Makefile
@@ -1138,8 +1138,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))
# userspace programs are linked via the compiler, use the correct linker
ifdef CONFIG_CC_IS_CLANG
--
2.50.1
Powered by blists - more mailing lists