Add compile flag in Makefile and export it in lib.mk
Also add CFLAGS in sync/Makefile's rules to fix include path
error for kselftest.h.

Signed-off-by: Bala-Vignesh-Reddy <reddybalavignesh9...@gmail.com>
---
 tools/testing/selftests/Makefile | 4 ++++
 tools/testing/selftests/lib.mk   | 2 ++
 2 files changed, 6 insertions(+)

diff --git a/tools/testing/selftests/Makefile b/tools/testing/selftests/Makefile
index 030da61dbff3..7c9db82a81e6 100644
--- a/tools/testing/selftests/Makefile
+++ b/tools/testing/selftests/Makefile
@@ -194,11 +194,15 @@ else
   DEFAULT_INSTALL_HDR_PATH := 1
 endif
 
+# Include path for kselftest.h
+KSFT_INCLUDES := -I${abs_srctree}/tools/testing/selftests
+
 # Prepare for headers install
 include $(top_srcdir)/scripts/subarch.include
 ARCH           ?= $(SUBARCH)
 export BUILD
 export KHDR_INCLUDES
+export KSFT_INCLUDES
 
 # set default goal to all, so make without a target runs all, even when
 # all isn't the first target in the file.
diff --git a/tools/testing/selftests/lib.mk b/tools/testing/selftests/lib.mk
index 530390033929..50289b9a1e1d 100644
--- a/tools/testing/selftests/lib.mk
+++ b/tools/testing/selftests/lib.mk
@@ -199,6 +199,8 @@ clean: $(if $(TEST_GEN_MODS_DIR),clean_mods_dir)
 # Build with _GNU_SOURCE by default
 CFLAGS += -D_GNU_SOURCE=
 
+CFLAGS += $(KSFT_INCLUDES)
+
 # Enables to extend CFLAGS and LDFLAGS from command line, e.g.
 # make USERCFLAGS=-Werror USERLDFLAGS=-static
 CFLAGS += $(USERCFLAGS)
-- 
2.43.0


Reply via email to