diff mbox series

[RFC,v3,2/3] kvm: selftests: Use the right INSTALL_HDR_PATH when OUTPUT specified and MAKELEVEL is 0

Message ID 20200326030750.173972-3-xiaoyao.li@intel.com (mailing list archive)
State New
Headers show
Series Fix errors when try to build kvm selftests on specified output | expand

Commit Message

Xiaoyao Li March 26, 2020, 3:07 a.m. UTC
Assume linux headers exist in linux_src/usr works with OUTPUT specified
currently, even though headers are installed to $(OUTPUT)/usr based on
lib.mk. Because there are building output in linux_src/usr when
"make headers_install" to prepare headers and they are not cleaned.

Assign the correct path to INSTALL_HDR_PATH is always not bad.

Signed-off-by: Xiaoyao Li <xiaoyao.li@intel.com>
---
 tools/testing/selftests/kvm/Makefile | 10 +++++++++-
 1 file changed, 9 insertions(+), 1 deletion(-)
diff mbox series

Patch

diff --git a/tools/testing/selftests/kvm/Makefile b/tools/testing/selftests/kvm/Makefile
index 91b41092def6..6a95878b2ab7 100644
--- a/tools/testing/selftests/kvm/Makefile
+++ b/tools/testing/selftests/kvm/Makefile
@@ -43,7 +43,15 @@  TEST_GEN_PROGS_s390x += kvm_create_max_vcpus
 TEST_GEN_PROGS += $(TEST_GEN_PROGS_$(UNAME_M))
 LIBKVM += $(LIBKVM_$(UNAME_M))
 
-INSTALL_HDR_PATH = $(top_srcdir)/usr
+ifeq (0,$(MAKELEVEL))
+    ifneq ($(OUTPUT),)
+	INSTALL_HDR_PATH := $(OUTPUT)/usr
+    else
+	INSTALL_HDR_PATH := $(top_srcdir)/usr
+    endif
+else
+	INSTALL_HDR_PATH := $(top_srcdir)/usr
+endif
 LINUX_HDR_PATH = $(INSTALL_HDR_PATH)/include/
 LINUX_TOOL_INCLUDE = $(top_srcdir)/tools/include
 LINUX_TOOL_ARCH_INCLUDE = $(top_srcdir)/tools/arch/x86/include