aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDmitry Safonov <[email protected]>2018-01-18 22:26:25 +0000
committerShuah Khan <[email protected]>2018-01-23 07:46:55 -0700
commitcc08d1b91d1e0679d015bf7a99aedb28e2c89e12 (patch)
treeed4f6f280f5a5a3f93a2a5219688c6ab98d3ac48
parent14f1889fd4d7ea1f496e90ae055ecc086575a8cd (diff)
selftests/x86: Add <test_name>{,_32,_64} targets
One can only use `make all` or `make <test_name>_<bitness>` as make targets. `make <test_name>` doesn't work as Ingo noticed: x86> make test_vsyscall gcc -O2 -g -std=gnu99 -pthread -Wall -no-pie test_vsyscall.c -o test_vsyscall /tmp/aBaoo3nb.o: In function `init_vdso': test_vsyscall.c:68: undefined reference to `dlopen' test_vsyscall.c:76: undefined reference to `dlsym' test_vsyscall.c:80: undefined reference to `dlsym' test_vsyscall.c:84: undefined reference to `dlsym' test_vsyscall.c:88: undefined reference to `dlsym' test_vsyscall.c:70: undefined reference to `dlopen' collect2: error: ld returned 1 exit status <builtin>: recipe for target 'test_vsyscall' failed make: *** [test_vsyscall] Error 1 Makefile target substitution neither works :-/ Generate .PHONY targets per-test and fix target substitution. Cc: Andy Lutomirski <[email protected]> Cc: Greg Kroah-Hartman <[email protected]> Cc: Shuah Khan <[email protected]> Cc: Thomas Gleixner <[email protected]> Cc: [email protected] Cc: [email protected] Reported-by: Ingo Molnar <[email protected]> Signed-off-by: Dmitry Safonov <[email protected]> Reviewed-by: Andy Lutomirski <[email protected]> Signed-off-by: Shuah Khan <[email protected]>
-rw-r--r--tools/testing/selftests/x86/Makefile12
1 files changed, 12 insertions, 0 deletions
diff --git a/tools/testing/selftests/x86/Makefile b/tools/testing/selftests/x86/Makefile
index 939a337128db..e7324fbc76b1 100644
--- a/tools/testing/selftests/x86/Makefile
+++ b/tools/testing/selftests/x86/Makefile
@@ -27,14 +27,26 @@ UNAME_M := $(shell uname -m)
CAN_BUILD_I386 := $(shell ./check_cc.sh $(CC) trivial_32bit_program.c -m32)
CAN_BUILD_X86_64 := $(shell ./check_cc.sh $(CC) trivial_64bit_program.c)
+define gen-target-rule-32
+$(1) $(1)_32: $(OUTPUT)/$(1)_32
+.PHONY: $(1) $(1)_32
+endef
+
+define gen-target-rule-64
+$(1) $(1)_64: $(OUTPUT)/$(1)_64
+.PHONY: $(1) $(1)_64
+endef
+
ifeq ($(CAN_BUILD_I386),1)
all: all_32
TEST_PROGS += $(BINARIES_32)
+$(foreach t,$(TARGETS_C_32BIT_ALL),$(eval $(call gen-target-rule-32,$(t))))
endif
ifeq ($(CAN_BUILD_X86_64),1)
all: all_64
TEST_PROGS += $(BINARIES_64)
+$(foreach t,$(TARGETS_C_64BIT_ALL),$(eval $(call gen-target-rule-64,$(t))))
endif
all_32: $(BINARIES_32)