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: 9174415 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id 0FDC06044F for ; Mon, 13 Jun 2016 21:19:41 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 007B527AC2 for ; Mon, 13 Jun 2016 21:19:41 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id E982B27C8F; Mon, 13 Jun 2016 21:19:40 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-6.9 required=2.0 tests=BAYES_00,RCVD_IN_DNSWL_HI autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id D065B27C0C for ; Mon, 13 Jun 2016 21:19:39 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1423868AbcFMVTc (ORCPT ); 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-kbuild-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kbuild@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP 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)))