aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorArnd Bergmann <arnd@arndb.de>2016-06-15 11:45:47 -0400
committerMichal Marek <mmarek@suse.com>2016-07-18 15:31:35 -0400
commitdb547ef1906400eb34682e43035dd4d81b9fdcfb (patch)
tree9cebb398039e98e20f336ecfaa9d9a0ac2eff432
parent58ab5e0c2c40ec48e682179e8f2e4cda2ece201b (diff)
Kbuild: don't add obj tree in additional includes
When building with separate object directories and driver specific Makefiles that add additional header include paths, Kbuild adjusts the gcc flags so that we include both the directory in the source tree and in the object tree. However, due to another bug I fixed earlier, this did not actually include the correct directory in the object tree, so we know that we only really need the source tree here. Also, including the object tree sometimes causes warnings about nonexisting directories when the include path only exists in the source. This changes the logic to only emit the -I argument for the srctree, not for objects. We still need both $(srctree)/$(src) and $(obj) though, so I'm adding them manually. Signed-off-by: Arnd Bergmann <arnd@arndb.de> Signed-off-by: Michal Marek <mmarek@suse.com>
-rw-r--r--scripts/Kbuild.include2
-rw-r--r--scripts/Makefile.lib7
2 files changed, 5 insertions, 4 deletions
diff --git a/scripts/Kbuild.include b/scripts/Kbuild.include
index f8b45eb47ed3..15b196fc2f49 100644
--- a/scripts/Kbuild.include
+++ b/scripts/Kbuild.include
@@ -202,7 +202,7 @@ hdr-inst := -f $(srctree)/scripts/Makefile.headersinst obj
202# Prefix -I with $(srctree) if it is not an absolute path. 202# Prefix -I with $(srctree) if it is not an absolute path.
203# skip if -I has no parameter 203# skip if -I has no parameter
204addtree = $(if $(patsubst -I%,%,$(1)), \ 204addtree = $(if $(patsubst -I%,%,$(1)), \
205$(if $(filter-out -I/% -I../%,$(1)),$(patsubst -I%,-I$(srctree)/%,$(1))) $(1)) 205$(if $(filter-out -I/% -I./% -I../%,$(1)),$(patsubst -I%,-I$(srctree)/%,$(1)),$(1)))
206 206
207# Find all -I options and call addtree 207# Find all -I options and call addtree
208flags = $(foreach o,$($(1)),$(if $(filter -I%,$(o)),$(call addtree,$(o)),$(o))) 208flags = $(foreach o,$($(1)),$(if $(filter -I%,$(o)),$(call addtree,$(o)),$(o)))
diff --git a/scripts/Makefile.lib b/scripts/Makefile.lib
index e7df0f5db7ec..e89c214745eb 100644
--- a/scripts/Makefile.lib
+++ b/scripts/Makefile.lib
@@ -155,9 +155,10 @@ else
155# $(call addtree,-I$(obj)) locates .h files in srctree, from generated .c files 155# $(call addtree,-I$(obj)) locates .h files in srctree, from generated .c files
156# and locates generated .h files 156# and locates generated .h files
157# FIXME: Replace both with specific CFLAGS* statements in the makefiles 157# FIXME: Replace both with specific CFLAGS* statements in the makefiles
158__c_flags = $(call addtree,-I$(obj)) $(call flags,_c_flags) 158__c_flags = $(if $(obj),-I$(srctree)/$(src) -I$(obj)) \
159__a_flags = $(call flags,_a_flags) 159 $(call flags,_c_flags)
160__cpp_flags = $(call flags,_cpp_flags) 160__a_flags = $(call flags,_a_flags)
161__cpp_flags = $(call flags,_cpp_flags)
161endif 162endif
162 163
163c_flags = -Wp,-MD,$(depfile) $(NOSTDINC_FLAGS) $(LINUXINCLUDE) \ 164c_flags = -Wp,-MD,$(depfile) $(NOSTDINC_FLAGS) $(LINUXINCLUDE) \