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 <ilias.apalodimas@linaro.org>
diff --git a/scripts/Makefile.host b/scripts/Makefile.host
index 7624304..bd5ed4c 100644
--- a/scripts/Makefile.host
+++ b/scripts/Makefile.host
@@ -72,13 +72,15 @@
_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)