[PATCH 1/2] kselftest/vm: Rename TARGETS to BUILD_TARGETS

From: Alistair Popple
Date: Mon May 24 2021 - 09:03:32 EST


The TARGETS variable can be used when building selftests to specify a
subset of selftests to build and run like so:

make -C tools/testing/selftests TARGETS=ptrace run_tests

However specifying TARGETS=vm results in the following build error as
the TARGETS variable is used internally in the Makefile:

make[1]: *** No rule to make target 'vm.c', needed by
'linux/kselftest/vm/vm_32'. Stop.

Fix this by renaming the vm Makefile TARGETS variable to BUILD_TARGETS.

Signed-off-by: Alistair Popple <apopple@xxxxxxxxxx>
---
tools/testing/selftests/vm/Makefile | 10 +++++-----
1 file changed, 5 insertions(+), 5 deletions(-)

diff --git a/tools/testing/selftests/vm/Makefile b/tools/testing/selftests/vm/Makefile
index 73e1cc96d7c2..110751ce8701 100644
--- a/tools/testing/selftests/vm/Makefile
+++ b/tools/testing/selftests/vm/Makefile
@@ -49,9 +49,9 @@ CAN_BUILD_I386 := $(shell ./../x86/check_cc.sh $(CC) ../x86/trivial_32bit_progra
CAN_BUILD_X86_64 := $(shell ./../x86/check_cc.sh $(CC) ../x86/trivial_64bit_program.c)
CAN_BUILD_WITH_NOPIE := $(shell ./../x86/check_cc.sh $(CC) ../x86/trivial_program.c -no-pie)

-TARGETS := protection_keys
-BINARIES_32 := $(TARGETS:%=%_32)
-BINARIES_64 := $(TARGETS:%=%_64)
+BUILD_TARGETS := protection_keys
+BINARIES_32 := $(BUILD_TARGETS:%=%_32)
+BINARIES_64 := $(BUILD_TARGETS:%=%_64)

ifeq ($(CAN_BUILD_WITH_NOPIE),1)
CFLAGS += -no-pie
@@ -104,7 +104,7 @@ $(BINARIES_32): CFLAGS += -m32
$(BINARIES_32): LDLIBS += -lrt -ldl -lm
$(BINARIES_32): $(OUTPUT)/%_32: %.c
$(CC) $(CFLAGS) $(EXTRA_CFLAGS) $(notdir $^) $(LDLIBS) -o $@
-$(foreach t,$(TARGETS),$(eval $(call gen-target-rule-32,$(t))))
+$(foreach t,$(BUILD_TARGETS),$(eval $(call gen-target-rule-32,$(t))))
endif

ifeq ($(CAN_BUILD_X86_64),1)
@@ -112,7 +112,7 @@ $(BINARIES_64): CFLAGS += -m64
$(BINARIES_64): LDLIBS += -lrt -ldl
$(BINARIES_64): $(OUTPUT)/%_64: %.c
$(CC) $(CFLAGS) $(EXTRA_CFLAGS) $(notdir $^) $(LDLIBS) -o $@
-$(foreach t,$(TARGETS),$(eval $(call gen-target-rule-64,$(t))))
+$(foreach t,$(BUILD_TARGETS),$(eval $(call gen-target-rule-64,$(t))))
endif

# x86_64 users should be encouraged to install 32-bit libraries
--
2.20.1