From patchwork Mon Jun 13 21:19:44 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Arnd Bergmann X-Patchwork-Id: 102226 Delivered-To: patch@linaro.org Received: by 10.140.106.246 with SMTP id e109csp1739667qgf; Mon, 13 Jun 2016 14:19:36 -0700 (PDT) X-Received: by 10.107.39.144 with SMTP id n138mr26101706ion.145.1465852776836; Mon, 13 Jun 2016 14:19:36 -0700 (PDT) Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id n1si17008088pax.163.2016.06.13.14.19.36; Mon, 13 Jun 2016 14:19:36 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1423982AbcFMVTc (ORCPT + 30 others); Mon, 13 Jun 2016 17:19:32 -0400 Received: from mout.kundenserver.de ([212.227.126.134]:54275 "EHLO mout.kundenserver.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1423106AbcFMVTb (ORCPT ); Mon, 13 Jun 2016 17:19:31 -0400 Received: from wuerfel.lan. ([78.42.132.4]) by mrelayeu.kundenserver.de (mreue003) with ESMTPA (Nemesis) id 0M1CHs-1bSBM613eK-00t9Tp; Mon, 13 Jun 2016 23:18:22 +0200 From: Arnd Bergmann To: Michal Marek Cc: linux-kbuild@vger.kernel.org, linux-kernel@vger.kernel.org, Arnd Bergmann Subject: [PATCH 1/3] Kbuild: don't add ../../ to include path Date: Mon, 13 Jun 2016 23:19:44 +0200 Message-Id: <1465852786-3559357-1-git-send-email-arnd@arndb.de> X-Mailer: git-send-email 2.7.0 X-Provags-ID: V03:K0:ybvsElyU9ffsJVXZZDPST6n/GxIj2FelzuQbUnXQ5SLyPhHKJPb fwKfMGyGqDiPYaXsj9CoFhiXvJ3HMyBlOcM0713eSAljrBDrhzOdBL2xc0ncqZBAXCbNgU6 ieJneg5uc32rMuOrOKMBkcevEXLNyNW6FXjb4R0BflPnvnMTZD32tjHQdGTlyt27L++cBN5 NAoUqoNJsp231oKAoLG+A== X-UI-Out-Filterresults: notjunk:1; V01:K0:e6Bj2h/uKbU=:axOY3qzUGmuipCZDAIYsRj ZX96QH9xLXscKg+tr8qKsVP7AGOPjmYXVPsvLAg+KCsxX2s7kgXNLKwNjciYTLInEWTGTVMwD 6M4f1S/vaaP1QATMlmoT7Zur8JDCuvbq4eZBo6slBAmCIq/x5+rglS0V3A2/kMICk9pMWvAIF h5VQZharGG3yhVaRECOs+jXs33Y2P/7ot0c5Gwyi3LS7OeSF7NTbje0Q9TVevM8Tmu7tfTSO0 L+tsEy5fek0Im6ITabi0sMejJ6RF5/a2WHyZHEPUxUQ5d1FX8Hl9A0zBNZqIOwSUq8Tlbi+o5 zWYkCSifdTng11W1jCbKX3/F11fXxJCrBo6NaO3AhUvcWtT9B6PQSzrlmYyaK1PHec2O90HIN SJNLaSNwhjzBeqeveQotmKIOMT076JlI/M8tE6bAU7V6COnduZ5zu3iR8oEaz/K4t47fbtzQc VBdN+HKjEv8YrDEbJ9wYrD7Xict+/eApcu19D1IhImE5v8qmETfjWRHsRkyQ77YYHHD3BoyIZ cUX6S/kvdtRUd9ZvQ22nwgPqk3MziydsSC2bNXbxaQ9xcm/kPjhxoeD+CzVN/nNmHMvHr35Tm m90YIFWQ4XlvwPzsE/y3o5YopFoO4Bo2iggDNg2KArmk+xpgAfozfmAZoXOAjIuxCG0ZlP102 iF77Dh2Arq+LYks0PvGu/TMFc1tsAKlAcfXDGCCkwPnz3xAJFo003pZKJi09Wa2NaTAA= Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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 --- scripts/Kbuild.include | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) -- 2.7.0 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))) From patchwork Mon Jun 13 21:19:45 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Arnd Bergmann X-Patchwork-Id: 102227 Delivered-To: patch@linaro.org Received: by 10.140.106.246 with SMTP id e109csp1739347qgf; Mon, 13 Jun 2016 14:18:35 -0700 (PDT) X-Received: by 10.36.90.206 with SMTP id v197mr20518399ita.16.1465852715720; Mon, 13 Jun 2016 14:18:35 -0700 (PDT) Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id 185si2306728pfz.17.2016.06.13.14.18.35; Mon, 13 Jun 2016 14:18:35 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1423663AbcFMVSc (ORCPT + 30 others); Mon, 13 Jun 2016 17:18:32 -0400 Received: from mout.kundenserver.de ([212.227.126.134]:54257 "EHLO mout.kundenserver.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1423106AbcFMVSb (ORCPT ); Mon, 13 Jun 2016 17:18:31 -0400 Received: from wuerfel.lan. ([78.42.132.4]) by mrelayeu.kundenserver.de (mreue003) with ESMTPA (Nemesis) id 0Lv6gg-1bcaQW1qPC-010LXj; Mon, 13 Jun 2016 23:18:22 +0200 From: Arnd Bergmann To: Michal Marek Cc: linux-kbuild@vger.kernel.org, linux-kernel@vger.kernel.org, Arnd Bergmann Subject: [PATCH 2/3] Kbuild: don't add obj tree in additional includes Date: Mon, 13 Jun 2016 23:19:45 +0200 Message-Id: <1465852786-3559357-2-git-send-email-arnd@arndb.de> X-Mailer: git-send-email 2.7.0 In-Reply-To: <1465852786-3559357-1-git-send-email-arnd@arndb.de> References: <1465852786-3559357-1-git-send-email-arnd@arndb.de> X-Provags-ID: V03:K0:b87Kh/OfT0lQ2Omk4+Aee7MQAyusEAriojTJmE4lQtKKjm4WXzz ICDR2urxnaoeuTLIh5WRWORnZR7JMfx1hrAisymCcZSKeYeL2CZL8UmOnDQRq+8Oc9JZuSW djadxB6yIYbZuXnhxATIhg9CZAWB1Zcvl7kN/kVXUtFUghNIo0bqTSkzJIDyOJn4iaRB4cR Scpz/JOr9NCbbBvatHJcQ== X-UI-Out-Filterresults: notjunk:1; V01:K0:ocmU1/Oj3N4=:SQCWOUCloBE53/IL+1R1ZV 2TEofVV3+eA+ZddnzSMVM9TCfe71rfWytnakfk9BuiVyAi0adcRdkRcJu74q8kGCo1igQ2cvk l4Y3AkGQnfzB6P4Od8ilArhwx9thSiK6GPJPrRAk3JzxUxr0sGFx6tNmO7x+pcfJyUZXCjfhI SV9iaQYShZdy+1bIRDxtb2Ik09OPbj5PL+P0uiGoTrdNWpa63gNgkrW3++2CjgGT877KRz7Mz NTLRXFosTnNFwPrRg1P5AKvS9WIdfLSmTb51xy3b0RQcIr3UYxJl4dOlgLlGWK12cOExCgo+G fDGZLu0y2N7pwekEtIQdKFmD5oUefYJa+SWx7Q6ACf+rwnkJzuLsMkM9yZEv02tNFqmTySCYz EOPrJhRz0rmKmkQunchaYLGVT19z1xZHGij2dPifgQO2zf2KIAM1Yo2TRO9FJND0+eZ2gf5FI y4mDJnNCgFYb+AhWCH8Dl/Raianfxr/lP7SMqMqyEHR3qJo8VcWDCubVoQWu+MmEo7dy1IZVx 6QKFtbbGucUcuWA4H3qd2HyQ++sziggxuW+BRuxpuyBoBtUTNx5zsaomB2diUsxNOdaczyy7A RaHs/yragQKD5AQ1+hO7mhceWFqh5u2ZkqpmkzsFY3kU2zOruWLaJnfU50/daONZrUGRX1LT+ 6iwVaKFW23ktNH1Ij9xSzrQe4tt5QlBYCko2I4QYT81GjeZxBrGIZ86KxaCa4w5rdwgk= Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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 --- scripts/Kbuild.include | 2 +- scripts/Makefile.lib | 7 ++++--- 2 files changed, 5 insertions(+), 4 deletions(-) -- 2.7.0 diff --git a/scripts/Kbuild.include b/scripts/Kbuild.include index f8b45eb47ed3..f8f95e32a746 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/% -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))) diff --git a/scripts/Makefile.lib b/scripts/Makefile.lib index 76494e15417b..0a07f9014944 100644 --- a/scripts/Makefile.lib +++ b/scripts/Makefile.lib @@ -155,9 +155,10 @@ else # $(call addtree,-I$(obj)) locates .h files in srctree, from generated .c files # and locates generated .h files # FIXME: Replace both with specific CFLAGS* statements in the makefiles -__c_flags = $(call addtree,-I$(obj)) $(call flags,_c_flags) -__a_flags = $(call flags,_a_flags) -__cpp_flags = $(call flags,_cpp_flags) +__c_flags = $(if $(obj),-I$(srctree)/$(src) -I$(obj)) \ + $(call flags,_c_flags) +__a_flags = $(call flags,_a_flags) +__cpp_flags = $(call flags,_cpp_flags) endif c_flags = -Wp,-MD,$(depfile) $(NOSTDINC_FLAGS) $(LINUXINCLUDE) \ From patchwork Mon Jun 13 21:19:46 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Arnd Bergmann X-Patchwork-Id: 102225 Delivered-To: patch@linaro.org Received: by 10.140.106.246 with SMTP id e109csp1739756qgf; Mon, 13 Jun 2016 14:19:54 -0700 (PDT) X-Received: by 10.107.166.137 with SMTP id p131mr26203447ioe.121.1465852794450; Mon, 13 Jun 2016 14:19:54 -0700 (PDT) Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id y63si34162412pfy.97.2016.06.13.14.19.53; Mon, 13 Jun 2016 14:19:54 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1424092AbcFMVTp (ORCPT + 30 others); Mon, 13 Jun 2016 17:19:45 -0400 Received: from mout.kundenserver.de ([212.227.126.187]:55659 "EHLO mout.kundenserver.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1423581AbcFMVTb (ORCPT ); Mon, 13 Jun 2016 17:19:31 -0400 Received: from wuerfel.lan. ([78.42.132.4]) by mrelayeu.kundenserver.de (mreue003) with ESMTPA (Nemesis) id 0LmPUU-1blLps2cSo-00Zz0J; Mon, 13 Jun 2016 23:18:22 +0200 From: Arnd Bergmann To: Michal Marek Cc: linux-kbuild@vger.kernel.org, linux-kernel@vger.kernel.org, Arnd Bergmann Subject: [PATCH 3/3] Kbuild: avoid duplicate include path Date: Mon, 13 Jun 2016 23:19:46 +0200 Message-Id: <1465852786-3559357-3-git-send-email-arnd@arndb.de> X-Mailer: git-send-email 2.7.0 In-Reply-To: <1465852786-3559357-1-git-send-email-arnd@arndb.de> References: <1465852786-3559357-1-git-send-email-arnd@arndb.de> X-Provags-ID: V03:K0:WmCrliuVMyYTzzqCGhvJi6eQYG8bvyghzmw5MuaWHQBmncScyI7 wy131flI0hlR2u1mwigEe1acyEGAl0Xkksk/+KORGPrNrt059Ddgo1Zel9QLSsI8dj0ZJuG Ut9FRXhtv+ybmUdGaYgfs2MvUbIr9c1q72m0NxV0GEKLun7rmwUv7R5HicxvxNJMSjBo+i8 AM5h1XKmnnJ3G1kTizm/A== X-UI-Out-Filterresults: notjunk:1; V01:K0:4pM2EmjOqBE=:kzdMfcO4sEifvDvkryeIxq ldDnmq5gz0iEgfClboWef6YNTpJ7mpNxSu4Pq6WHtmh6xWDofIni/1abfELwPAr0Ihdekxn9T ZmY2xhoH7g5cQasD3yVAu5J5OoNwSGzXPWA7aEqIA3TGIbWzwa64/oZWu/piEZfx0GyEusyKD ziLI1vWiDlcKWlsdfPePmqMaaeETqRcK032RX+0vM0fuhiiTkqhR6L7XGeRpngQ80B48Adrc3 Gj6g0bgG1Qby72oeZmw8IK6AfU9uuKQk5gdlnAmH1b5zaopZpT8Lr7Mve3JC9Iil9CU9CZiuj jH1j5cfL2K4d4fqQW16WwgW0jSqR2HIo6ByWYQ6W5oxALoxMdJrlG95X0YkDnXQevm9iv0Stj rTg9rfAXYQoJZF8GCfQGql6Ij2AMayQs0aTMiI4K592oQK5zqRgLYwmSuS1vuK9ccf9WtzKhz uYQuB1AuC3wmooCr0SRsYeNAqSoTCTLAiV6qDfnORSxVECcZT2M+yeWpLiNVKccwBkrn3UAEb zqU6FwcdpddM6nHdRxEziNedX9DxFe1SKRFi6nVEt64QeSSqXWVnulMwpeICLZayNBAmzMfJb 9wDhoorrbcssP9jND5KNJ7WJ+RisODv9IQNsHqWxo6jK5vRhRN+Z/nor7UUNwSDZ4YGlORmJa Og8FqYOzTDanuDWZ+AvEDBBEIYOcRt571RH//p5kdwXhu/eWNibtzSwc8t/dIR3cGuPY= Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org arch/$(hdr-arch)/include/generated/uapi is included twice in the header search path, which is unnecessary, so this changes the top-level Makefile to drop the second instance by filtering out everything from USERINCLUDE that was already part of LINUXINCLUDE. This should have very little effect other than making the 'make V=1' output slightly smaller and making the build time faster by a miniscule amount, but it seems to be cleaner. Signed-off-by: Arnd Bergmann --- Makefile | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) -- 2.7.0 diff --git a/Makefile b/Makefile index a1551fe4d829..abaffba5ff11 100644 --- a/Makefile +++ b/Makefile @@ -389,8 +389,9 @@ LINUXINCLUDE := \ -Iarch/$(hdr-arch)/include/generated/uapi \ -Iarch/$(hdr-arch)/include/generated \ $(if $(KBUILD_SRC), -I$(srctree)/include) \ - -Iinclude \ - $(USERINCLUDE) + -Iinclude + +LINUXINCLUDE += $(filter-out $(LINUXINCLUDE),$(USERINCLUDE)) KBUILD_CPPFLAGS := -D__KERNEL__