[11/12] selftests: Add kselftest-build target
diff mbox series

Message ID 20190114135144.26096-12-geert+renesas@glider.be
State New
Headers show
Series
  • selftests: Miscellaneous fixes
Related show

Commit Message

Geert Uytterhoeven Jan. 14, 2019, 1:51 p.m. UTC
The documented way to build kselftest is to run

    make -C tools/testing/selftests

with an optional "O=..." parameter to specify the output directory.

However, all of the above assume you run make from the source directory.
while other make commands can simply be run from the output directory,
too (the autogenerated Makefile in the output directory takes care of
this).

Add a "kselftest-build" target, so "make kselftest-build" can be used
from either the source or output directory.

Signed-off-by: Geert Uytterhoeven <geert+renesas@glider.be>
---
Perhaps this make target should just be called "kselftest", and the
existing "kselftest" target be renamed to "kselftest-run"?
---
 Documentation/dev-tools/kselftest.rst | 4 ++++
 Makefile                              | 5 +++++
 2 files changed, 9 insertions(+)

Patch
diff mbox series

diff --git a/Documentation/dev-tools/kselftest.rst b/Documentation/dev-tools/kselftest.rst
index 7756f7a7c23b9408..b90b4ee6334a0941 100644
--- a/Documentation/dev-tools/kselftest.rst
+++ b/Documentation/dev-tools/kselftest.rst
@@ -21,6 +21,10 @@  To build the tests::
 
   $ make -C tools/testing/selftests
 
+Or:
+
+  $ make kselftest-build
+
 To run the tests::
 
   $ make -C tools/testing/selftests run_tests
diff --git a/Makefile b/Makefile
index 5355033dda6ed1ea..27a56de7ed45091e 100644
--- a/Makefile
+++ b/Makefile
@@ -1193,6 +1193,10 @@  PHONY += kselftest
 kselftest:
 	$(Q)$(MAKE) -C $(srctree)/tools/testing/selftests run_tests O=$(abspath $(objtree)/tools/testing/selftests) INSTALL_HDR_PATH=$(abspath $(INSTALL_HDR_PATH))
 
+PHONY += kselftest-build
+kselftest-build:
+	$(Q)$(MAKE) -C $(srctree)/tools/testing/selftests O=$(abspath $(objtree)/tools/testing/selftests) INSTALL_HDR_PATH=$(abspath $(INSTALL_HDR_PATH))
+
 PHONY += kselftest-clean
 kselftest-clean:
 	$(Q)$(MAKE) -C $(srctree)/tools/testing/selftests clean O=$(abspath $(objtree)/tools/testing/selftests)
@@ -1445,6 +1449,7 @@  help:
 	@echo  '  kselftest       - Build and run kernel selftest (run as root)'
 	@echo  '                    Build, install, and boot kernel before'
 	@echo  '                    running kselftest on it'
+	@echo  '  kselftest-build - Build kselftest files'
 	@echo  '  kselftest-clean - Remove all generated kselftest files'
 	@echo  '  kselftest-merge - Merge all the config dependencies of kselftest to existing'
 	@echo  '                    .config.'