From patchwork Sat Mar 30 12:04:17 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Masahiro Yamada X-Patchwork-Id: 161499 Delivered-To: patch@linaro.org Received: by 2002:a02:c6d8:0:0:0:0:0 with SMTP id r24csp3169705jan; Sat, 30 Mar 2019 05:05:49 -0700 (PDT) X-Google-Smtp-Source: APXvYqySXeDGQqYaRSPIkCtTZA+d3cattuxr/JfNB21nMQWJZKVyxhwLb2SWMZNSrpX/7kgm35xX X-Received: by 2002:a62:3186:: with SMTP id x128mr34954956pfx.30.1553947549748; Sat, 30 Mar 2019 05:05:49 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1553947549; cv=none; d=google.com; s=arc-20160816; b=y1HBkHL0K+N9zR61W9QjmunjeuAp19J8c9TQYA44z0Oe1BF8kULOrR4T652KBcQZ1n c5ucAIwnK3EReanan/8L0c36ustcLz+RwcJomLSWxtz/Of0CKSHzItqBf5X2aXJlBmPr gUJlhZtoPu+fn/hMWCGVNlwIpzdSDkFvzeVOSAKS25nUS7YgcTFlw4LfQorQFKuDrCZd ItJ3H66GVF+Px7HyNuas7BYOrGGU+hcUYNCZp5SRQ97Fi2sund4+rzr7kw75Il01fWXW 5uhlIfbWkn9wKMAq+2yw9VRaVEpbPdG5qeIJYr3udwpvueruMQ0cY0WBPyvyjKMnoIZ4 T5+g== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:references:in-reply-to:message-id:date :subject:cc:to:from:dkim-signature:dkim-filter; bh=8V2O1fiyQWP/VAAUtS8guLdWmxJutLI9feIbvt/wlM0=; b=IJJ+wJge523oWaueA4o5GvpjpscK2eSn67xDILT2fKFxJyuK4h/s3HFaKiTNZzXMJZ KmQ81agVNzq1ryR1inluCGWZBXgww1IDbppihirQo2kbnb+z3u2TzLcF+vnqRzecsPZq VnW8ORBuksJlKHldd35Y6l3CdrXDbWu3lAd7pRVaZMu7HeBz4aYpah7DoigDdYcqWCCG BZZTFf+m69TWhBiu/KRUecWP59jodb1n9K0GVRthzlKv+Y5fGQ+IuhFts874gPVP2d1o e1p9aBB+gscQEIMag/8RIUjUD8zSGsjse10ifHBH4n9GcFtqab2jfPM5gr3PyQi2C5e2 LCMA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@nifty.com header.s=dec2015msa header.b="kNk4jvE/"; 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 Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id k75si4313572pgc.515.2019.03.30.05.05.49; Sat, 30 Mar 2019 05:05:49 -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; dkim=pass header.i=@nifty.com header.s=dec2015msa header.b="kNk4jvE/"; 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 S1730828AbfC3MFr (ORCPT + 31 others); Sat, 30 Mar 2019 08:05:47 -0400 Received: from conuserg-10.nifty.com ([210.131.2.77]:37863 "EHLO conuserg-10.nifty.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1730510AbfC3MFr (ORCPT ); Sat, 30 Mar 2019 08:05:47 -0400 Received: from grover.tkatk1.zaq.ne.jp (zaqdadce369.zaq.ne.jp [218.220.227.105]) (authenticated) by conuserg-10.nifty.com with ESMTP id x2UC4MsR021262; Sat, 30 Mar 2019 21:04:26 +0900 DKIM-Filter: OpenDKIM Filter v2.10.3 conuserg-10.nifty.com x2UC4MsR021262 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=nifty.com; s=dec2015msa; t=1553947467; bh=8V2O1fiyQWP/VAAUtS8guLdWmxJutLI9feIbvt/wlM0=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=kNk4jvE/UOCW0Lopt8HNV+PzcKTfbWcFL2XiR2HRLLFRRkB0Ffr46P0dYCuQcPfBK 0EfkcnAkvMYI6/1f8K9e8szITdEpcn5c8ONjASFl/c052xnzeuEXE6JEsJgXBlBcBp d9mlWBdxIKCaukEWY0yShGKusgAU16Wvb/+zAuK1ce4tcUW1ewQXJhby1AHdbiIvGh sxGLs6QAWonrM5FTBv2sm4111bG0gTV+lbkOYDkvvySk4aiC2DEDjW3sz5gXTfcFlm Bb4f//fegq8YYk1jGM72I8fm7j6TgHywfb4IXJ1E+PBih8+Qm+38KmiE1MVMTO68SM HS1zHLEAnAASA== X-Nifty-SrcIP: [218.220.227.105] From: Masahiro Yamada To: linux-kbuild@vger.kernel.org Cc: Masahiro Yamada , "David S. Miller" , Joey Pabalinas , Kirill Tkhai , linux-kernel@vger.kernel.org, Constantine Shulyupin , Michal Marek , Kieran Bingham , Matthew Wilcox , Jan Kiszka , Andrew Morton Subject: [PATCH 5/6] kbuild: use $(srctree) instead of KBUILD_SRC to check out-of-tree build Date: Sat, 30 Mar 2019 21:04:17 +0900 Message-Id: <1553947458-8311-5-git-send-email-yamada.masahiro@socionext.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1553947458-8311-1-git-send-email-yamada.masahiro@socionext.com> References: <1553947458-8311-1-git-send-email-yamada.masahiro@socionext.com> Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org KBUILD_SRC was conventionally used for some different purposes: [1] To remember the source tree path [2] As a flag to check if sub-make is already done [3] As a flag to check if Kbuild runs out of tree For [1], we do not need to remember it because the top Makefile can compute it by $(realpath $(dir $(lastword $(MAKEFILE_LIST)))) [2] has been replaced with self-commenting 'sub_make_done'. For [3], we can distinguish in-tree/out-of-tree by comparing $(srctree) and '.' This commit converts [3] to prepare for the KBUILD_SRC removal. Signed-off-by: Masahiro Yamada --- Makefile | 6 +++--- scripts/Makefile.build | 2 +- scripts/Makefile.host | 2 +- scripts/Makefile.lib | 2 +- scripts/Makefile.modbuiltin | 2 +- scripts/gdb/linux/Makefile | 2 +- scripts/tags.sh | 2 +- 7 files changed, 9 insertions(+), 9 deletions(-) -- 2.7.4 diff --git a/Makefile b/Makefile index 1b2a70e..fa441ca 100644 --- a/Makefile +++ b/Makefile @@ -448,7 +448,7 @@ USERINCLUDE := \ LINUXINCLUDE := \ -I$(srctree)/arch/$(SRCARCH)/include \ -I$(objtree)/arch/$(SRCARCH)/include/generated \ - $(if $(KBUILD_SRC), -I$(srctree)/include) \ + $(if $(filter .,$(srctree)),,-I$(srctree)/include) \ -I$(objtree)/include \ $(USERINCLUDE) @@ -509,7 +509,7 @@ PHONY += outputmakefile # At the same time when output Makefile generated, generate .gitignore to # ignore whole output directory outputmakefile: -ifneq ($(KBUILD_SRC),) +ifneq ($(srctree),.) $(Q)ln -fsn $(srctree) source $(Q)$(CONFIG_SHELL) $(srctree)/scripts/mkmakefile $(srctree) $(Q)test -e .gitignore || \ @@ -1087,7 +1087,7 @@ PHONY += prepare archprepare prepare1 prepare3 # and if so do: # 1) Check that make has not been executed in the kernel src $(srctree) prepare3: include/config/kernel.release -ifneq ($(KBUILD_SRC),) +ifneq ($(srctree),.) @$(kecho) ' Using $(srctree) as source for kernel' $(Q)if [ -f $(srctree)/.config -o -d $(srctree)/include/config ]; then \ echo >&2 " $(srctree) is not clean, please run 'make mrproper'"; \ diff --git a/scripts/Makefile.build b/scripts/Makefile.build index 76ca30c..9dddfb6 100644 --- a/scripts/Makefile.build +++ b/scripts/Makefile.build @@ -501,7 +501,7 @@ existing-targets := $(wildcard $(sort $(targets))) -include $(foreach f,$(existing-targets),$(dir $(f)).$(notdir $(f)).cmd) -ifneq ($(KBUILD_SRC),) +ifneq ($(srctree),.) # Create directories for object files if they do not exist obj-dirs := $(sort $(obj) $(patsubst %/,%, $(dir $(targets)))) # If targets exist, their directories apparently exist. Skip mkdir. diff --git a/scripts/Makefile.host b/scripts/Makefile.host index a115259..73b8041 100644 --- a/scripts/Makefile.host +++ b/scripts/Makefile.host @@ -71,7 +71,7 @@ __hostc_flags = $(_hostc_flags) __hostcxx_flags = $(_hostcxx_flags) ifeq ($(KBUILD_EXTMOD),) -ifneq ($(KBUILD_SRC),) +ifneq ($(srctree),.) __hostc_flags = -I$(obj) $(call flags,_hostc_flags) __hostcxx_flags = -I$(obj) $(call flags,_hostcxx_flags) endif diff --git a/scripts/Makefile.lib b/scripts/Makefile.lib index 8a1f64f..41e98fa 100644 --- a/scripts/Makefile.lib +++ b/scripts/Makefile.lib @@ -144,7 +144,7 @@ __cpp_flags = $(_cpp_flags) # If building the kernel in a separate objtree expand all occurrences # of -Idir to -I$(srctree)/dir except for absolute paths (starting with '/'). ifeq ($(KBUILD_EXTMOD),) -ifneq ($(KBUILD_SRC),) +ifneq ($(srctree),.) # -I$(obj) locates generated .h files # $(call addtree,-I$(obj)) locates .h files in srctree, from generated .c files diff --git a/scripts/Makefile.modbuiltin b/scripts/Makefile.modbuiltin index a072a42..ea90a90 100644 --- a/scripts/Makefile.modbuiltin +++ b/scripts/Makefile.modbuiltin @@ -15,7 +15,7 @@ include include/config/tristate.conf include scripts/Kbuild.include -ifneq ($(KBUILD_SRC),) +ifneq ($(srctree),.) # Create output directory if not already present _dummy := $(shell [ -d $(obj) ] || mkdir -p $(obj)) endif diff --git a/scripts/gdb/linux/Makefile b/scripts/gdb/linux/Makefile index 3df395a..9fd3d8e 100644 --- a/scripts/gdb/linux/Makefile +++ b/scripts/gdb/linux/Makefile @@ -1,6 +1,6 @@ # SPDX-License-Identifier: GPL-2.0 -ifneq ($(KBUILD_SRC),) +ifneq ($(srctree),.) symlinks := $(patsubst $(srctree)/$(src)/%,%,$(wildcard $(srctree)/$(src)/*.py)) diff --git a/scripts/tags.sh b/scripts/tags.sh index f470d99..6a55180 100755 --- a/scripts/tags.sh +++ b/scripts/tags.sh @@ -19,7 +19,7 @@ ignore="$ignore ( -name *.mod.c ) -prune -o" # Do not use full path if we do not use O=.. builds # Use make O=. {tags|cscope} # to force full paths for a non-O= build -if [ "${KBUILD_SRC}" = "" ]; then +if [ "${srctree}" = "." ]; then tree= else tree=${srctree}/