selftests: Fix kselftest O=objdir build from cluttering top level objdir
authorShuah Khan <skhan@linuxfoundation.org>
Wed, 26 Feb 2020 22:54:49 +0000 (15:54 -0700)
committerShuah Khan <skhan@linuxfoundation.org>
Fri, 13 Mar 2020 19:46:12 +0000 (13:46 -0600)
make kselftest-all O=objdir builds create generated objects in objdir.
This clutters the top level directory with kselftest objects. Fix it
to create sub-directory under objdir for kselftest objects.

Signed-off-by: Shuah Khan <skhan@linuxfoundation.org>
tools/testing/selftests/Makefile

index 63430e2..be22dbe 100644 (file)
@@ -85,7 +85,7 @@ override LDFLAGS =
 override MAKEFLAGS =
 endif
 
-# Append kselftest to KBUILD_OUTPUT to avoid cluttering
+# Append kselftest to KBUILD_OUTPUT and O to avoid cluttering
 # KBUILD_OUTPUT with selftest objects and headers installed
 # by selftests Makefile or lib.mk.
 ifdef building_out_of_srctree
@@ -93,7 +93,7 @@ override LDFLAGS =
 endif
 
 ifneq ($(O),)
-       BUILD := $(O)
+       BUILD := $(O)/kselftest
 else
        ifneq ($(KBUILD_OUTPUT),)
                BUILD := $(KBUILD_OUTPUT)/kselftest