[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-Id: <20240415101345.3807776-1-vchernou@cisco.com>
Date: Mon, 15 Apr 2024 03:13:44 -0700
From: Valerii Chernous <vchernou@...co.com>
To: Masahiro Yamada <masahiroy@...nel.org>,
Nathan Chancellor <nathan@...nel.org>,
Nicolas Schier <nicolas@...sle.eu>
Cc: xe-linux-external@...co.com, linux-kbuild@...r.kernel.org,
linux-kernel@...r.kernel.org
Subject: [PATCH] scripts/Makefile.build: fix ext mod subdirs build with separate src,build dirs
The change allow to build external modules with nested makefiles.
Current unofficial way(using "src" variable) allow to build
external(out of tree) kernel module with separating source and build
artifacts dirs but with nested makefiles it doesn't work properly.
Build system trap to recursion inside makefiles, articafts output dir
path grow with each iteration until exceed max path len and build failed
This fix update "src" var during processing subdirs and resolve
recursion issue
Usage example:
make -C KERNEL_SOURCE_TREE M=BUILD_OUT_DIR src=EXT_MOD_SRC_DIR modules
Cc: Valerii Chernous <vchernou@...co.com>
Cc: xe-linux-external@...co.com
Signed-off-by: Valerii Chernous <vchernou@...co.com>
---
scripts/Makefile.build | 1 +
1 file changed, 1 insertion(+)
diff --git a/scripts/Makefile.build b/scripts/Makefile.build
index a293950e2e07..75ea9052ea4a 100644
--- a/scripts/Makefile.build
+++ b/scripts/Makefile.build
@@ -490,6 +490,7 @@ $(single-subdir-goals): $(single-subdirs)
PHONY += $(subdir-ym)
$(subdir-ym):
$(Q)$(MAKE) $(build)=$@ \
+ $(if $(findstring command line,$(origin src)),src=$(patsubst $(obj)/%,$(src)/%,$@)) \
need-builtin=$(if $(filter $@...ilt-in.a, $(subdir-builtin)),1) \
need-modorder=$(if $(filter $@...dules.order, $(subdir-modorder)),1) \
$(filter $@/%, $(single-subdir-goals))
--
2.35.6
Powered by blists - more mailing lists