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)))