From: Ilias Apalodimas Date: Tue, 20 May 2025 05:21:17 +0000 (+0300) Subject: kbuild: skip 'addtree' and 'flags' magic for external module build X-Git-Tag: v2025.10-rc1~118^2~61^2~18 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=3d21332c2f3e299836fc55d69887aa88168ac567;p=thirdparty%2Fu-boot.git kbuild: skip 'addtree' and 'flags' magic for external module build Backport from kernel commit 58156ba4468f ("kbuild: skip 'addtree' and 'flags' magic for external module build") Signed-off-by: Ilias Apalodimas --- diff --git a/scripts/Makefile.host b/scripts/Makefile.host index 7624304e3e9..bd5ed4c63b7 100644 --- a/scripts/Makefile.host +++ b/scripts/Makefile.host @@ -72,13 +72,15 @@ _hostc_flags = $(KBUILD_HOSTCFLAGS) $(HOST_EXTRACFLAGS) \ _hostcxx_flags = $(KBUILD_HOSTCXXFLAGS) $(HOST_EXTRACXXFLAGS) \ $(HOSTCXXFLAGS_$(basetarget).o) -ifeq ($(KBUILD_SRC),) __hostc_flags = $(_hostc_flags) __hostcxx_flags = $(_hostcxx_flags) -else + +ifeq ($(KBUILD_EXTMOD),) +ifneq ($(KBUILD_SRC),) __hostc_flags = -I$(obj) $(call flags,_hostc_flags) __hostcxx_flags = -I$(obj) $(call flags,_hostcxx_flags) endif +endif hostc_flags = -Wp,-MD,$(depfile) $(__hostc_flags) hostcxx_flags = -Wp,-MD,$(depfile) $(__hostcxx_flags) diff --git a/scripts/Makefile.lib b/scripts/Makefile.lib index 7690cc61f9a..f1a78886e84 100644 --- a/scripts/Makefile.lib +++ b/scripts/Makefile.lib @@ -143,15 +143,14 @@ _c_flags += $(if $(patsubst n%,, \ $(CFLAGS_KASAN)) endif -# If building the kernel in a separate objtree expand all occurrences -# of -Idir to -I$(srctree)/dir except for absolute paths (starting with '/'). - -ifeq ($(KBUILD_SRC),) __c_flags = $(_c_flags) __a_flags = $(_a_flags) __cpp_flags = $(_cpp_flags) -else +# If building the kernel in a separate objtree expand all occurrences +# of -Idir to -I$(srctree)/dir except for absolute paths (starting with '/'). +ifeq ($(KBUILD_EXTMOD),) +ifneq ($(KBUILD_SRC),) # -I$(obj) locates generated .h files # $(call addtree,-I$(obj)) locates .h files in srctree, from generated .c files # and locates generated .h files @@ -161,6 +160,7 @@ __c_flags = $(if $(obj),$(call addtree,-I$(src)) -I$(obj)) \ __a_flags = $(call flags,_a_flags) __cpp_flags = $(call flags,_cpp_flags) endif +endif # Modified for U-Boot: LINUXINCLUDE -> UBOOTINCLUDE c_flags = -Wp,-MD,$(depfile) $(NOSTDINC_FLAGS) $(UBOOTINCLUDE) \