selftests: enforce local header dependency in lib.mk
Shuah Khan
maintainerPATCH 1/1 selftests: enforce local header dependency in lib.mk
Add local header dependency in lib.mk. This enforces the dependency blindly even when a test doesn't include the file, with the benefit of a simpler common logic without requiring individual tests to have special rule for it.
--- tools/testing/selftests/lib.mk | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
tools/testing/selftests/lib.mk +2 -1
@@ -137,7 +137,8 @@ endif # Selftest makefiles can override those targets by setting # OVERRIDE_TARGETS = 1. ifeq ($(OVERRIDE_TARGETS),) -$(OUTPUT)/%:%.c +LOCAL_HDRS := $(selfdir)/kselftest_harness.h $(selfdir)/kselftest.h +$(OUTPUT)/%:%.c $(LOCAL_HDRS) $(LINK.c) $^ $(LDLIBS) -o $@ $(OUTPUT)/%.o:%.S
Signature · 1 line
2.20.1
Quoted 6 lines · Shuah Khan
Add local header dependency in lib.mk. This enforces the dependency blindly even when a test doesn't include the file, with the benefit of a simpler common logic without requiring individual tests to have special rule for it.
Signed-off-by Shuah Khan <[email protected]>
style nit below...
Quoted 9 lines
--- tools/testing/selftests/lib.mk | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)tools/testing/selftests/lib.mk +0
-0
tools/testing/selftests/lib.mk endif · line 142
Quoted 7 lines
tools/testing/selftests/lib.mk +2
-1@@ -137,7 +137,8 @@ endif # Selftest makefiles can override those targets by setting # OVERRIDE_TARGETS = 1. ifeq ($(OVERRIDE_TARGETS),) -$(OUTPUT)/%:%.c +LOCAL_HDRS := $(selfdir)/kselftest_harness.h $(selfdir)/kselftest.h +$(OUTPUT)/%:%.c $(LOCAL_HDRS) $(LINK.c) $^ $(LDLIBS) -o $@
It's already in lib.mk as "target:deps" but the tradition for kernel make rules has been "target: deps". i.e.:
$(OUTPUT)/%: %.c $(LOCAL_HDRS)
But it doesn't actually matter. :)
-Kees
Quoted 5 lines
tools/testing/selftests/lib.mk +0
-0$(OUTPUT)/%.o:%.SSignature · 1 line
2.20.1
Signature · 1 line
Kees Cook