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