From patchwork Wed Jun 15 15:45:43 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Arnd Bergmann X-Patchwork-Id: 102203 Delivered-To: patch@linaro.org Received: by 10.140.106.246 with SMTP id e109csp2640277qgf; Wed, 15 Jun 2016 08:45:53 -0700 (PDT) X-Received: by 10.107.52.133 with SMTP id b127mr203685ioa.6.1466005548654; Wed, 15 Jun 2016 08:45:48 -0700 (PDT) Return-Path: Received: from gabe.freedesktop.org (gabe.freedesktop.org. [2610:10:20:722:a800:ff:fe36:1795]) by mx.google.com with ESMTP id e128si45725325pfe.226.2016.06.15.08.45.48; Wed, 15 Jun 2016 08:45:48 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of dri-devel-bounces@lists.freedesktop.org designates 2610:10:20:722:a800:ff:fe36:1795 as permitted sender) client-ip=2610:10:20:722:a800:ff:fe36:1795; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of dri-devel-bounces@lists.freedesktop.org designates 2610:10:20:722:a800:ff:fe36:1795 as permitted sender) smtp.mailfrom=dri-devel-bounces@lists.freedesktop.org Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 0A36F6E983; Wed, 15 Jun 2016 15:45:43 +0000 (UTC) X-Original-To: dri-devel@lists.freedesktop.org Delivered-To: dri-devel@lists.freedesktop.org Received: from mout.kundenserver.de (mout.kundenserver.de [212.227.17.13]) by gabe.freedesktop.org (Postfix) with ESMTPS id CB2746E988 for ; Wed, 15 Jun 2016 15:45:36 +0000 (UTC) Received: from wuerfel.lan. ([78.42.132.4]) by mrelayeu.kundenserver.de (mreue102) with ESMTPA (Nemesis) id 0LoYV0-1btgLG2Atm-00gW4k; Wed, 15 Jun 2016 17:44:28 +0200 From: Arnd Bergmann To: Michal Marek Subject: [PATCH v2 01/11] Kbuild: don't add ../../ to include path Date: Wed, 15 Jun 2016 17:45:43 +0200 Message-Id: <20160615154553.3177021-2-arnd@arndb.de> X-Mailer: git-send-email 2.9.0 In-Reply-To: <20160615154553.3177021-1-arnd@arndb.de> References: <20160615154553.3177021-1-arnd@arndb.de> X-Provags-ID: V03:K0:O3e6yf0z+bYo5LStA6V8AJ3uAwyOuZd7dLeQWyEuNPDv1dpkBq9 GQ+W7uTVSQbea8UEOVPtGqCgQaNwSpaLNNe1DOOyJe7KUVeTHHJhPvOpTm6pvLffnIkMknS 7bxiRlhjcU1mbuPYdyFTZPoZ3hDlztfLqFceS4Y3GallxL/Mp58OupgZWGnSHFzEYAznUO7 kIwb3c+y23z6uRv4V/fkA== X-UI-Out-Filterresults: notjunk:1; V01:K0:Rboai0NtkeI=:NJQdW6zxzvBFKSgBf9qWZC nYx95qJN9PuVH0MJatPGQ/DzNcJAuCxDgV9B1H/kOl6uPSMRn/3c+Pk6PWpm/Mp6JM3mBn98Y kFBc8PntAq0EO+P2om6QIWdth7LAqE9o1/sJ1uXcPA5m41aFtKCNOFa7Zo0VSFgLpoXtqpX5u 4QU0kEFKSE46yCSU62lT946HS/pFWbm5xqPY4603sp5z1vikNseAYtJYSI3sIxHRQynvZ3HZB kZekreNJZS/3dtkK7OSTKIpLb+0OEzrD3tVWUxZSYAghzFrd8/t4TUW/+bFeuGE7ArZ1Bz5sJ v6d/N1q2A9ymyceJdj2elBGUhEfWAqSa3U7OxVG5L8jpkIeBdmz3aSQ7/jYbqUUKwSOVnD86Q HYnljkYhVhJ+VLc8s7Dit1PdP2s0j4GxMzbxvbLyf+3Qv7ZewjB3Hj1DTxdDwYYQn+nQsAVVD Q2Yz1FPJZJDJ46DnUJjWqPWyODUCnYecy17R51ReZ1Or5WNzBdCG+GPUZHimY2uXZHR4BiIlJ 9YZK/uRH3JuTNlTRcSj0bkegiD57jYUY2fRcX3ZVy/fd3XNaq/b9rZ8C4nzBm2d88uqfwS8rO bnZcLwRpWJSzdNuTKbKsoBJ/DaG/Qy+4RUJ1Nily0lnz8XEpl6u0nROPHJQAAk5SrrfHKqTPi i0cadcE452J7EHlg7uQoxmiqUEtpRmUeob7rICIzvRs1iwiXGfi00Ak17SE0sH8InRQQ= Cc: Arnd Bergmann , linux-kbuild@vger.kernel.org, netdev@vger.kernel.org, linux-kernel@vger.kernel.org, dri-devel@lists.freedesktop.org, linux-arm-kernel@lists.infradead.org X-BeenThere: dri-devel@lists.freedesktop.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: Direct Rendering Infrastructure - Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" 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(-) 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)))