diff options
author | Shuah Khan <shuahkh@osg.samsung.com> | 2017-09-06 20:36:22 -0400 |
---|---|---|
committer | Shuah Khan <shuahkh@osg.samsung.com> | 2017-09-21 09:55:36 -0400 |
commit | 8050ef2b83a18f628f9501af958fbff39443d58d (patch) | |
tree | 6584b2f30756947387528ef80b2b08b0f379ccc9 | |
parent | 2bc84526d174a2a89c76438f049fc03ac259a159 (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.mk | 15 |
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) | |||
7 | endif | 7 | endif |
8 | 8 | ||
9 | TEST_GEN_PROGS := $(patsubst %,$(OUTPUT)/%,$(TEST_GEN_PROGS)) | 9 | TEST_GEN_PROGS := $(patsubst %,$(OUTPUT)/%,$(TEST_GEN_PROGS)) |
10 | TEST_GEN_PROGS_EXTENDED := $(patsubst %,$(OUTPUT)/%,$(TEST_GEN_PROGS_EXTENDED)) | ||
10 | TEST_GEN_FILES := $(patsubst %,$(OUTPUT)/%,$(TEST_GEN_FILES)) | 11 | TEST_GEN_FILES := $(patsubst %,$(OUTPUT)/%,$(TEST_GEN_FILES)) |
11 | 12 | ||
12 | all: $(TEST_GEN_PROGS) $(TEST_GEN_PROGS_EXTENDED) $(TEST_GEN_FILES) | 13 | all: $(TEST_GEN_PROGS) $(TEST_GEN_PROGS_EXTENDED) $(TEST_GEN_FILES) |
@@ -62,6 +63,11 @@ endef | |||
62 | emit_tests: | 63 | emit_tests: |
63 | $(EMIT_TESTS) | 64 | $(EMIT_TESTS) |
64 | 65 | ||
66 | # define if isn't already. It is undefined in make O= case. | ||
67 | ifeq ($(RM),) | ||
68 | RM := rm -f | ||
69 | endif | ||
70 | |||
65 | define CLEAN | 71 | define 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) |
67 | endef | 73 | endef |
@@ -69,6 +75,15 @@ endef | |||
69 | clean: | 75 | clean: |
70 | $(CLEAN) | 76 | $(CLEAN) |
71 | 77 | ||
78 | # When make O= with kselftest target from main level | ||
79 | # the following aren't defined. | ||
80 | # | ||
81 | ifneq ($(KBUILD_SRC),) | ||
82 | LINK.c = $(CC) $(CFLAGS) $(CPPFLAGS) $(LDFLAGS) $(TARGET_ARCH) | ||
83 | COMPILE.S = $(CC) $(ASFLAGS) $(CPPFLAGS) $(TARGET_ARCH) -c | ||
84 | LINK.S = $(CC) $(ASFLAGS) $(CPPFLAGS) $(LDFLAGS) $(TARGET_ARCH) | ||
85 | endif | ||
86 | |||
72 | $(OUTPUT)/%:%.c | 87 | $(OUTPUT)/%:%.c |
73 | $(LINK.c) $^ $(LDLIBS) -o $@ | 88 | $(LINK.c) $^ $(LDLIBS) -o $@ |
74 | 89 | ||