[02/11] selftests: lib.mk: kselftest and kselftest-clean fail for make O=dir case
diff mbox

Message ID dd63fd5880f99775267c5e19c873903355b1c78c.1505257614.git.shuahkh@osg.samsung.com
State New
Headers show

Commit Message

Shuah Khan Sept. 12, 2017, 11:52 p.m. UTC
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>
 tools/testing/selftests/lib.mk | 15 +++++++++++++++
 1 file changed, 15 insertions(+)

diff mbox

diff --git a/tools/testing/selftests/lib.mk b/tools/testing/selftests/lib.mk
index 693616651da5..e779c8758e15 100644
--- a/tools/testing/selftests/lib.mk
+++ b/tools/testing/selftests/lib.mk
@@ -7,6 +7,7 @@  OUTPUT := $(shell pwd)
 TEST_GEN_PROGS := $(patsubst %,$(OUTPUT)/%,$(TEST_GEN_PROGS))
 TEST_GEN_FILES := $(patsubst %,$(OUTPUT)/%,$(TEST_GEN_FILES))
@@ -62,6 +63,11 @@  endef
+# define if isn't already. It is undefined in make O= case.
+ifeq ($(RM),)
+RM := rm -f
 define CLEAN
@@ -69,6 +75,15 @@  endef
+# When make O= with kselftest target from main level
+# the following aren't defined.
+ifneq ($(KBUILD_SRC),)
 	$(LINK.c) $^ $(LDLIBS) -o $@