[PATCH v5 5/6] selftests/x86: support header files in extra-files

From: Bill Roberts

Date: Mon Nov 09 2026 - 13:37:14 EST


The extra-files Makefile macro uses its file list both as
additional compiler inputs and as target prerequisites.

This prevents header files from being included in the list,
since they would also be passed to the compiler as independent
compilation inputs.

Exclude .h files from EXTRA_FILES while retaining them as
target prerequisites. This allows tests to track header
dependencies and rebuild when those headers change, without
attempting to compile them independently.

Signed-off-by: Bill Roberts <bill.roberts@xxxxxxx>
---
tools/testing/selftests/x86/Makefile | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/tools/testing/selftests/x86/Makefile b/tools/testing/selftests/x86/Makefile
index 407f52ac2628..effbfe9b269f 100644
--- a/tools/testing/selftests/x86/Makefile
+++ b/tools/testing/selftests/x86/Makefile
@@ -115,7 +115,7 @@ endif
# the dependencies ("header3.h"), because clang, unlike gcc, will not accept
# header files as an input to the compiler invocation.
define extra-files
-$(OUTPUT)/$(1): EXTRA_FILES := $(2)
+$(OUTPUT)/$(1): EXTRA_FILES := $(filter-out %.h,$(2))
$(OUTPUT)/$(1): $(2)
endef

--
2.55.0