[PATCH v2 6/6] selftests: export INSTALL_HDR_PATH if using "O" to specify output dir
From: Xiaoyao Li
Date: Wed Mar 25 2020 - 10:19:25 EST
When build kvm selftests in tools/testing/selftests directory with
make O=/path/to/kselftests TARGETS=kvm
it fails building some kvm test binaries due to lack of header files.
Export INSTALL_HDR_PATH when "O" is specified, so that sub TARGET can get
the right kernel headers with INSTALL_HDR_PATH.
Signed-off-by: Xiaoyao Li <xiaoyao.li@xxxxxxxxx>
---
tools/testing/selftests/Makefile | 6 +++++-
1 file changed, 5 insertions(+), 1 deletion(-)
diff --git a/tools/testing/selftests/Makefile b/tools/testing/selftests/Makefile
index be22dbe94a4c..f36bc6fd8086 100644
--- a/tools/testing/selftests/Makefile
+++ b/tools/testing/selftests/Makefile
@@ -110,6 +110,10 @@ ARCH ?= $(SUBARCH)
export KSFT_KHDR_INSTALL_DONE := 1
export BUILD
+ifneq (1,$(DEFAULT_INSTALL_HDR_PATH))
+export INSTALL_HDR_PATH := $(BUILD)/usr
+endif
+
# build and run gpio when output directory is the src dir.
# gpio has dependency on tools/gpio and builds tools/gpio
# objects in the src directory in all cases making the src
@@ -142,7 +146,7 @@ khdr:
ifeq (1,$(DEFAULT_INSTALL_HDR_PATH))
$(MAKE) --no-builtin-rules ARCH=$(ARCH) -C $(top_srcdir) headers_install
else
- $(MAKE) --no-builtin-rules INSTALL_HDR_PATH=$$BUILD/usr \
+ $(MAKE) --no-builtin-rules INSTALL_HDR_PATH=$(INSTALL_HDR_PATH) \
ARCH=$(ARCH) -C $(top_srcdir) headers_install
endif
--
2.20.1