[PATCH] kbuild: use prefix-map for host and user progs

Thomas Weißschuh <[email protected]>
Newsgroups org.kernel.vger.linux-kbuild,org.kernel.vger.linux-kernel
Message-ID <[email protected]>
Host and user progs may also use __FILE__.

Make sure it shows up canonicalized, as in regular kernel code.

Signed-off-by: Thomas Weißschuh <[email protected]>
---
 Makefile | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/Makefile b/Makefile
index 130926fa592e..322b5ce9f218 100644
--- a/Makefile
+++ b/Makefile
@@ -1188,7 +1188,10 @@ export CFLAGS_GCOV
 
 # change __FILE__ to the relative path to the source directory
 ifdef building_out_of_srctree
-KBUILD_CPPFLAGS += -fmacro-prefix-map=$(srcroot)/=
+CFLAGS_PREFIX_MAP := -fmacro-prefix-map=$(srcroot)/=
+KBUILD_CPPFLAGS += $(CFLAGS_PREFIX_MAP)
+KBUILD_USERCFLAGS += $(CFLAGS_PREFIX_MAP)
+KBUILD_HOSTCFLAGS += $(CFLAGS_PREFIX_MAP)
 ifeq ($(call rustc-option-yn, --remap-path-scope=macro),y)
 KBUILD_RUSTFLAGS += --remap-path-prefix=$(srcroot)/= --remap-path-scope=macro
 endif

---
base-commit: bd5f485f3f026225b86573e559af0b7254ef4184
change-id: 20260819-kbuild-prefix-map-5a056c1baa98

Best regards,
--  
Thomas Weißschuh <[email protected]>
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.