aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorShuah Khan <shuahkh@osg.samsung.com>2017-09-06 20:36:22 -0400
committerShuah Khan <shuahkh@osg.samsung.com>2017-09-21 09:55:36 -0400
commit8050ef2b83a18f628f9501af958fbff39443d58d (patch)
tree6584b2f30756947387528ef80b2b08b0f379ccc9
parent2bc84526d174a2a89c76438f049fc03ac259a159 (diff)
selftests: lib.mk: kselftest and kselftest-clean fail for make O=dir case
kselftest and kselftest-clean targets fail when object directory is specified to relocate objects. Main Makefile make O= path clears the built-in defines LINK.c, COMPILE.S, LINK.S, and RM that are used in lib.mk to build and clean targets. Define them. Signed-off-by: Shuah Khan <shuahkh@osg.samsung.com>
-rw-r--r--tools/testing/selftests/lib.mk15
1 files changed, 15 insertions, 0 deletions
diff --git a/tools/testing/selftests/lib.mk b/tools/testing/selftests/lib.mk
index 4665463779f5..266d3ed4bb41 100644
--- a/tools/testing/selftests/lib.mk
+++ b/tools/testing/selftests/lib.mk
@@ -7,6 +7,7 @@ OUTPUT := $(shell pwd)
7endif 7endif
8 8
9TEST_GEN_PROGS := $(patsubst %,$(OUTPUT)/%,$(TEST_GEN_PROGS)) 9TEST_GEN_PROGS := $(patsubst %,$(OUTPUT)/%,$(TEST_GEN_PROGS))
10TEST_GEN_PROGS_EXTENDED := $(patsubst %,$(OUTPUT)/%,$(TEST_GEN_PROGS_EXTENDED))
10TEST_GEN_FILES := $(patsubst %,$(OUTPUT)/%,$(TEST_GEN_FILES)) 11TEST_GEN_FILES := $(patsubst %,$(OUTPUT)/%,$(TEST_GEN_FILES))
11 12
12all: $(TEST_GEN_PROGS) $(TEST_GEN_PROGS_EXTENDED) $(TEST_GEN_FILES) 13all: $(TEST_GEN_PROGS) $(TEST_GEN_PROGS_EXTENDED) $(TEST_GEN_FILES)
@@ -62,6 +63,11 @@ endef
62emit_tests: 63emit_tests:
63 $(EMIT_TESTS) 64 $(EMIT_TESTS)
64 65
66# define if isn't already. It is undefined in make O= case.
67ifeq ($(RM),)
68RM := rm -f
69endif
70
65define CLEAN 71define CLEAN
66 $(RM) -r $(TEST_GEN_PROGS) $(TEST_GEN_PROGS_EXTENDED) $(TEST_GEN_FILES) $(EXTRA_CLEAN) 72 $(RM) -r $(TEST_GEN_PROGS) $(TEST_GEN_PROGS_EXTENDED) $(TEST_GEN_FILES) $(EXTRA_CLEAN)
67endef 73endef
@@ -69,6 +75,15 @@ endef
69clean: 75clean:
70 $(CLEAN) 76 $(CLEAN)
71 77
78# When make O= with kselftest target from main level
79# the following aren't defined.
80#
81ifneq ($(KBUILD_SRC),)
82LINK.c = $(CC) $(CFLAGS) $(CPPFLAGS) $(LDFLAGS) $(TARGET_ARCH)
83COMPILE.S = $(CC) $(ASFLAGS) $(CPPFLAGS) $(TARGET_ARCH) -c
84LINK.S = $(CC) $(ASFLAGS) $(CPPFLAGS) $(LDFLAGS) $(TARGET_ARCH)
85endif
86
72$(OUTPUT)/%:%.c 87$(OUTPUT)/%:%.c
73 $(LINK.c) $^ $(LDLIBS) -o $@ 88 $(LINK.c) $^ $(LDLIBS) -o $@
74 89