[PATCH v2 4/6] selftests: Create variable INSTALL_HDR_PATH if need to install linux headers to $(OUTPUT)/usr

From: Xiaoyao Li
Date: Wed Mar 25 2020 - 10:19:22 EST


So sub TARGETs of selftest can know where the linux headers installed by
checking INSTALL_HDR_PATH.

Signed-off-by: Xiaoyao Li <xiaoyao.li@xxxxxxxxx>
---
tools/testing/selftests/lib.mk | 8 +++++++-
1 file changed, 7 insertions(+), 1 deletion(-)

diff --git a/tools/testing/selftests/lib.mk b/tools/testing/selftests/lib.mk
index 78fb00bdf5c4..b51ff93da4de 100644
--- a/tools/testing/selftests/lib.mk
+++ b/tools/testing/selftests/lib.mk
@@ -35,6 +35,12 @@ top_srcdir ?= ../../../..
include $(top_srcdir)/scripts/subarch.include
ARCH ?= $(SUBARCH)

+ifndef KSFT_KHDR_INSTALL_DONE
+ifneq (1,$(DEFAULT_INSTALL_HDR_PATH))
+INSTALL_HDR_PATH := $(OUTPUT)/usr
+endif
+endif
+
# set default goal to all, so make without a target runs all, even when
# all isn't the first target in the file.
.DEFAULT_GOAL := all
@@ -59,7 +65,7 @@ ifndef KSFT_KHDR_INSTALL_DONE
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=$$OUTPUT/usr \
+ make --no-builtin-rules INSTALL_HDR_PATH=$(INSTALL_HDR_PATH) \
ARCH=$(ARCH) -C $(top_srcdir) headers_install
endif
endif
--
2.20.1