From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1161277AbcFOPqZ (ORCPT ); Wed, 15 Jun 2016 11:46:25 -0400 Received: from mout.kundenserver.de ([212.227.17.13]:54972 "EHLO mout.kundenserver.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1161213AbcFOPqP (ORCPT ); Wed, 15 Jun 2016 11:46:15 -0400 From: Arnd Bergmann To: Michal Marek Cc: linux-kbuild@vger.kernel.org, linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org, netdev@vger.kernel.org, dri-devel@lists.freedesktop.org, Arnd Bergmann 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= Sender: linux-kernel-owner@vger.kernel.org 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(-) 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