selftests: enforce local header dependency in lib.mk
authorShuah Khan <skhan@linuxfoundation.org>
Wed, 25 Mar 2020 23:16:49 +0000 (17:16 -0600)
committerShuah Khan <skhan@linuxfoundation.org>
Thu, 26 Mar 2020 21:29:55 +0000 (15:29 -0600)
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 <skhan@linuxfoundation.org>
Reviewed-by: Kees Cook <keescook@chromium.org>
Signed-off-by: Shuah Khan <skhan@linuxfoundation.org>
tools/testing/selftests/lib.mk

index 1c8a1963d03f8acf349ae209e5db03ab79e2614e..70f03dff5479e65361b1ce6742148ddee5c515b2 100644 (file)
@@ -134,7 +134,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