From a8ba798bc8ec663cf02e80b0dd770324de9bafd9 Mon Sep 17 00:00:00 2001 From: "bamvor.zhangjian@huawei.com" Date: Tue, 29 Nov 2016 19:55:52 +0800 Subject: selftests: enable O and KBUILD_OUTPUT Enable O and KBUILD_OUTPUT for kselftest. User could compile kselftest to another directory by passing O or KBUILD_OUTPUT. And O is high priority than KBUILD_OUTPUT. Signed-off-by: Bamvor Jian Zhang Signed-off-by: Shuah Khan --- tools/testing/selftests/futex/Makefile | 21 ++++++++++++++++----- 1 file changed, 16 insertions(+), 5 deletions(-) (limited to 'tools/testing/selftests/futex') diff --git a/tools/testing/selftests/futex/Makefile b/tools/testing/selftests/futex/Makefile index 6a17529..653c5cd 100644 --- a/tools/testing/selftests/futex/Makefile +++ b/tools/testing/selftests/futex/Makefile @@ -3,13 +3,18 @@ SUBDIRS := functional TEST_PROGS := run.sh .PHONY: all clean -all: - for DIR in $(SUBDIRS); do $(MAKE) -C $$DIR $@ ; done include ../lib.mk +all: + for DIR in $(SUBDIRS); do \ + BUILD_TARGET=$$OUTPUT/$$DIR; \ + mkdir $$BUILD_TARGET -p; \ + make OUTPUT=$$BUILD_TARGET -C $$DIR $@;\ + done + override define RUN_TESTS - ./run.sh + @if [ `dirname $(OUTPUT)` = $(PWD) ]; then ./run.sh; fi endef override define INSTALL_RULE @@ -17,7 +22,9 @@ override define INSTALL_RULE install -t $(INSTALL_PATH) $(TEST_PROGS) $(TEST_PROGS_EXTENDED) $(TEST_FILES) @for SUBDIR in $(SUBDIRS); do \ - $(MAKE) -C $$SUBDIR INSTALL_PATH=$(INSTALL_PATH)/$$SUBDIR install; \ + BUILD_TARGET=$$OUTPUT/$$SUBDIR; \ + mkdir $$BUILD_TARGET -p; \ + $(MAKE) OUTPUT=$$BUILD_TARGET -C $$SUBDIR INSTALL_PATH=$(INSTALL_PATH)/$$SUBDIR install; \ done; endef @@ -26,4 +33,8 @@ override define EMIT_TESTS endef clean: - for DIR in $(SUBDIRS); do $(MAKE) -C $$DIR $@ ; done + for DIR in $(SUBDIRS); do \ + BUILD_TARGET=$$OUTPUT/$$DIR; \ + mkdir $$BUILD_TARGET -p; \ + make OUTPUT=$$BUILD_TARGET -C $$DIR $@;\ + done -- cgit v1.1