Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > linux.kernel > #1423170
| From | Arnd Bergmann <arnd@arndb.de> |
|---|---|
| Newsgroups | linux.kernel |
| Subject | [PATCH v2 01/11] Kbuild: don't add ../../ to include path |
| Date | 2016-06-15 17:50 +0200 |
| Message-ID | <rKleP-4pE-53@gated-at.bofh.it> (permalink) |
| References | <rKleN-4pE-3@gated-at.bofh.it> |
| Organization | linux.* mail to news gateway |
When we build with O=objdir and objdir is directly below the source tree, $(srctree) becomes '..'. When a Makefile adds a CFLAGS option like -Ipath/to/headers and we are building with a separate object directory, Kbuild tries to add two -I options, one for the source tree and one for the object tree. An absolute path is treated as a special case, and don't add this one twice. This also normally catches -I$(srctree)/$(src) as $(srctree) usually is an absolute directory like /home/arnd/linux/. The combination of the two behaviors however results in an invalid path name to be included: we get both ../$(src) and ../../$(src), the latter one pointing outside of the source tree, usually to a nonexisting directory. Building with 'make W=1' makes this obvious: cc1: error: ../../arch/arm/mach-s3c24xx/include: No such file or directory [-Werror=missing-include-dirs] This adds another special case, treating path names starting with ../ like those starting with / so we don't try to prefix that with $(srctree). Signed-off-by: Arnd Bergmann <arnd@arndb.de> --- scripts/Kbuild.include | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/scripts/Kbuild.include b/scripts/Kbuild.include index 0f82314621f2..f8b45eb47ed3 100644 --- a/scripts/Kbuild.include +++ b/scripts/Kbuild.include @@ -202,7 +202,7 @@ hdr-inst := -f $(srctree)/scripts/Makefile.headersinst obj # Prefix -I with $(srctree) if it is not an absolute path. # skip if -I has no parameter addtree = $(if $(patsubst -I%,%,$(1)), \ -$(if $(filter-out -I/%,$(1)),$(patsubst -I%,-I$(srctree)/%,$(1))) $(1)) +$(if $(filter-out -I/% -I../%,$(1)),$(patsubst -I%,-I$(srctree)/%,$(1))) $(1)) # Find all -I options and call addtree flags = $(foreach o,$($(1)),$(if $(filter -I%,$(o)),$(call addtree,$(o)),$(o))) -- 2.9.0
Back to linux.kernel | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread
[PATCH v2 00/11] Kbuild: fix -Wmissing-include-path warnings Arnd Bergmann <arnd@arndb.de> - 2016-06-15 17:50 +0200 [PATCH v2 11/11] [EXPERIMENTAL] Kbuild: enable -Wmissing-include-dirs by default Arnd Bergmann <arnd@arndb.de> - 2016-06-15 17:50 +0200 [PATCH v2 05/11] Kbuild: don't add obj tree in additional includes Arnd Bergmann <arnd@arndb.de> - 2016-06-15 17:50 +0200 [PATCH v2 01/11] Kbuild: don't add ../../ to include path Arnd Bergmann <arnd@arndb.de> - 2016-06-15 17:50 +0200 [PATCH v2 08/11] drm: amd: remove broken include path Arnd Bergmann <arnd@arndb.de> - 2016-06-15 17:50 +0200 [PATCH v2 03/11] Kbuild: always prefix objtree in LINUXINCLUDE Arnd Bergmann <arnd@arndb.de> - 2016-06-15 17:50 +0200 [PATCH v2 02/11] Kbuild: avoid duplicate include path Arnd Bergmann <arnd@arndb.de> - 2016-06-15 17:50 +0200
csiph-web