Skip to content

Commit 2c55daf

Browse files
t-8chshuahkh
authored andcommitted
selftests: always install UAPI headers to the correct directory
Currently the UAPI headers are always installed into the source directory. When building out-of-tree this doesn't work, as the include path will be wrong and it dirties the source tree, leading to complains by kbuild. Make sure the 'headers' target installs the UAPI headers in the correctly. The real target directory can come from multiple places. To handle them all extract the target directory from KHDR_INCLUDES. Link: https://lore.kernel.org/r/20250918-kselftest-uapi-out-of-tree-v1-1-f4434f28adcd@linutronix.de Reported-by: Jason Gunthorpe <jgg@nvidia.com> Closes: https://lore.kernel.org/lkml/20250917153209.GA2023406@nvidia.com/ Fixes: 1a59f5d ("selftests: Add headers target") Signed-off-by: Thomas Weißschuh <thomas.weissschuh@linutronix.de> Reviewed-by: Jason Gunthorpe <jgg@nvidia.com> Signed-off-by: Shuah Khan <skhan@linuxfoundation.org>
1 parent 3e23a3f commit 2c55daf

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

tools/testing/selftests/lib.mk

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -228,7 +228,10 @@ $(OUTPUT)/%:%.S
228228
$(LINK.S) $^ $(LDLIBS) -o $@
229229
endif
230230

231+
# Extract the expected header directory
232+
khdr_output := $(patsubst %/usr/include,%,$(filter %/usr/include,$(KHDR_INCLUDES)))
233+
231234
headers:
232-
$(Q)$(MAKE) -C $(top_srcdir) headers
235+
$(Q)$(MAKE) -f $(top_srcdir)/Makefile -C $(khdr_output) headers
233236

234237
.PHONY: run_tests all clean install emit_tests gen_mods_dir clean_mods_dir headers

0 commit comments

Comments
 (0)