[PATCH 04/10] selftests/bpf: Make skeleton headers order-only prerequisites of .test.d

Ricardo B. Marlière posted 10 patches 4 hours ago
[PATCH 04/10] selftests/bpf: Make skeleton headers order-only prerequisites of .test.d
Posted by Ricardo B. Marlière 4 hours ago
The .test.d dependency files are generated by the C pre-processor and list
actual #include dependencies. Skeleton headers are not #included directly;
they are merely needed before compilation starts so that the compiler can
find them.

Making them order-only prerequisites of .test.d means that a missing or
newly-generated skeleton does not invalidate the .test.d timestamp,
avoiding unnecessary recompilation and, more importantly, avoiding build
errors when a skeleton was intentionally skipped due to a BPF compilation
failure.

Signed-off-by: Ricardo B. Marlière <rbm@suse.com>
---
 tools/testing/selftests/bpf/Makefile | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/tools/testing/selftests/bpf/Makefile b/tools/testing/selftests/bpf/Makefile
index 781238152c4f..72f576a8236a 100644
--- a/tools/testing/selftests/bpf/Makefile
+++ b/tools/testing/selftests/bpf/Makefile
@@ -697,11 +697,11 @@ $(TRUNNER_TEST_OBJS): $(TRUNNER_OUTPUT)/%.test.o:			\
 $(TRUNNER_TEST_OBJS:.o=.d): $(TRUNNER_OUTPUT)/%.test.d:			\
 			    $(TRUNNER_TESTS_DIR)/%.c			\
 			    $(TRUNNER_EXTRA_HDRS)			\
+			    $$(BPFOBJ) | $(TRUNNER_OUTPUT)		\
 			    $(TRUNNER_BPF_SKELS)			\
 			    $(TRUNNER_BPF_LSKELS)			\
 			    $(TRUNNER_BPF_LSKELS_SIGNED)		\
-			    $(TRUNNER_BPF_SKELS_LINKED)			\
-			    $$(BPFOBJ) | $(TRUNNER_OUTPUT)
+			    $(TRUNNER_BPF_SKELS_LINKED)
 
 ifeq ($(filter clean docs-clean emit_tests,$(MAKECMDGOALS)),)
 include $(wildcard $(TRUNNER_TEST_OBJS:.o=.d))

-- 
2.53.0