From patchwork Sat Jul 6 03:07:11 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Masahiro Yamada X-Patchwork-Id: 168590 Delivered-To: patch@linaro.org Received: by 2002:a92:4782:0:0:0:0:0 with SMTP id e2csp4292254ilk; Fri, 5 Jul 2019 20:08:11 -0700 (PDT) X-Google-Smtp-Source: APXvYqxIhvkirXRhNkXyNVPLaUYzzPy4CejmOq+G3zxmo32cKdFVYTptiux4qNoi6zsYUOeyKvUg X-Received: by 2002:a17:90a:26ea:: with SMTP id m97mr9313150pje.59.1562382490900; Fri, 05 Jul 2019 20:08:10 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1562382490; cv=none; d=google.com; s=arc-20160816; b=qAsHTw1LPMNB1QnrmLIBfgjVhPTDyQtyCf73xOFb0nwAo/nTl2xXuQNelHJoCt1XCh Xx1XT3AO1vKFL2t0LZ0mR3mmiD10/dArhOuMQBxe32z21iX0bSZRcEJVrWh8Q5yvMYLM pRaN3FKWebEAX3ZaGEl6y/kLANAsjWPlK5++yqfYcIrk9KDSj7zxKSwoTBEvgbNhyQ50 RhhEG6fVg4JOLlm9L6oCkazKatZRYboENcD3DPEUsL/72UwT8sgPfzQSpGxMTktwjYNm nwuNtcuBsxTa5Yzgx7ZYBBXS11afIqFLN0doSZTglZbySQmDFlBztDo/wvQS4pFlzJNh uaEw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:message-id:date:subject:cc:to:from :dkim-signature:dkim-filter; bh=NVx1Ga77bNYYYlQkkNzV5nPWpsmBD+I7gojwThxsH2o=; b=NjbdSEh6VRVo09tCzjNgZ/pn0lIHk1kFhtmVu7mtV64Gmj+bWzbA2breK7kkl4F3zE /HRy3M7uRxBrvAQp/Ui24+g/aHFJNaGt4DirJaH89z0hZ+1RPtv63XinPKgq+OK8H6Ue T2DtyScCIuH32zhyuloD7lxd7F8AODX8YVvGcboTnw/+l9jx/q56sTqqCXbHlVdkkfvQ KmWTRw1DR0U5S7EoG3AJJpBbWlkNBgLfSNhsW50MmxxOt+T5dCd4Q+Okd/i2klhQ2evv ZN8jBZMr0jMaKDbVTVqYL+nU7J3FN/oDZClx9rBiiclshF3aCzZ6+deUlkmB5AmzTY+2 hJaw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@nifty.com header.s=dec2015msa header.b=Xupetkh3; 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 s12si9833770plp.63.2019.07.05.20.08.10; Fri, 05 Jul 2019 20:08:10 -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=Xupetkh3; 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 S1726833AbfGFDIF (ORCPT + 30 others); Fri, 5 Jul 2019 23:08:05 -0400 Received: from conuserg-09.nifty.com ([210.131.2.76]:48638 "EHLO conuserg-09.nifty.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725887AbfGFDIF (ORCPT ); Fri, 5 Jul 2019 23:08:05 -0400 Received: from grover.flets-west.jp (softbank126026094249.bbtec.net [126.26.94.249]) (authenticated) by conuserg-09.nifty.com with ESMTP id x6637E3M030660; Sat, 6 Jul 2019 12:07:15 +0900 DKIM-Filter: OpenDKIM Filter v2.10.3 conuserg-09.nifty.com x6637E3M030660 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=nifty.com; s=dec2015msa; t=1562382435; bh=NVx1Ga77bNYYYlQkkNzV5nPWpsmBD+I7gojwThxsH2o=; h=From:To:Cc:Subject:Date:From; b=Xupetkh3p7qOZRG+fNWqqwNgT5BxHZxn+A6FsJIQgTBZgseca0NY4fomzPQrExsxv TS31swD0wzKw3tmzyQIG8DQNKbOq5x3cVv0C1zDA7Vul4XJukIQuP8c2Wh576tJzV+ 6Q3ULwK/o5XIE1rSZgnU70peMJrlfTKbYHpMSNXUFotPMlfObDO/I2t1HI3y59jH0k lKfEY5AF+PsgXh1YnFSJ5yeAuXmnm6cscyjPUq75f6Fy/OoWPdqXF0xPIDblhKH7v4 P4WMITUr5HzEBd9VAXTZTDskdaYiKDTFvw5+OfGt5CE37024inINZzYOe7GoFF51jB pzJ86LfoJybpg== X-Nifty-SrcIP: [126.26.94.249] From: Masahiro Yamada To: linux-kbuild@vger.kernel.org Cc: Sam Ravnborg , Pawan Gupta , Masahiro Yamada , Michal Marek , linux-kernel@vger.kernel.org Subject: [PATCH 1/3] kbuild: remove obj and src from the top Makefile Date: Sat, 6 Jul 2019 12:07:11 +0900 Message-Id: <20190706030713.6221-1-yamada.masahiro@socionext.com> X-Mailer: git-send-email 2.17.1 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org $(obj) is not used in the top Makefile at all. $(src) is used in 3 sites, but they can be replaced with $(srctree). Signed-off-by: Masahiro Yamada --- Makefile | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) -- 2.17.1 diff --git a/Makefile b/Makefile index 014390e32b0e..a5615edf2196 100644 --- a/Makefile +++ b/Makefile @@ -248,9 +248,6 @@ endif export KBUILD_CHECKSRC KBUILD_EXTMOD KBUILD_SRC objtree := . -src := $(srctree) -obj := $(objtree) - VPATH := $(srctree) export srctree objtree VPATH @@ -1705,7 +1702,7 @@ CHECKSTACK_ARCH := $(ARCH) endif checkstack: $(OBJDUMP) -d vmlinux $$(find . -name '*.ko') | \ - $(PERL) $(src)/scripts/checkstack.pl $(CHECKSTACK_ARCH) + $(PERL) $(srctree)/scripts/checkstack.pl $(CHECKSTACK_ARCH) kernelrelease: @echo "$(KERNELVERSION)$$($(CONFIG_SHELL) $(srctree)/scripts/setlocalversion $(srctree))" @@ -1724,11 +1721,11 @@ endif tools/: FORCE $(Q)mkdir -p $(objtree)/tools - $(Q)$(MAKE) LDFLAGS= MAKEFLAGS="$(tools_silent) $(filter --j% -j,$(MAKEFLAGS))" O=$(abspath $(objtree)) subdir=tools -C $(src)/tools/ + $(Q)$(MAKE) LDFLAGS= MAKEFLAGS="$(tools_silent) $(filter --j% -j,$(MAKEFLAGS))" O=$(abspath $(objtree)) subdir=tools -C $(srctree)/tools/ tools/%: FORCE $(Q)mkdir -p $(objtree)/tools - $(Q)$(MAKE) LDFLAGS= MAKEFLAGS="$(tools_silent) $(filter --j% -j,$(MAKEFLAGS))" O=$(abspath $(objtree)) subdir=tools -C $(src)/tools/ $* + $(Q)$(MAKE) LDFLAGS= MAKEFLAGS="$(tools_silent) $(filter --j% -j,$(MAKEFLAGS))" O=$(abspath $(objtree)) subdir=tools -C $(srctree)/tools/ $* # Single targets # --------------------------------------------------------------------------- From patchwork Sat Jul 6 03:07:12 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Masahiro Yamada X-Patchwork-Id: 168589 Delivered-To: patch@linaro.org Received: by 2002:a92:4782:0:0:0:0:0 with SMTP id e2csp4292248ilk; Fri, 5 Jul 2019 20:08:10 -0700 (PDT) X-Google-Smtp-Source: APXvYqwFNwR9DuYOsZ6Qw6FK7wSK8IlQcY0gXKFLi7qmFv+ca/Bp8yIGMGyM9OflfsntF73PKheQ X-Received: by 2002:a17:90b:f12:: with SMTP id br18mr8907088pjb.127.1562382490533; Fri, 05 Jul 2019 20:08:10 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1562382490; cv=none; d=google.com; s=arc-20160816; b=i0w98zlNFKw6pYJsynKqmxaPADl+zXK0hPn4LzOrqaQV3VFo4p+0A0pVQb+8s7Uf8N XXFfc2TKqwyub/FreiZ1uvyNI6S23Wy7A/8ct9SvxeHfTiN/qVi4RS4F6/LTpe+ImJ/S Y84iUJytv2exDkj1atrHMO1FmGqWouEhnV64f4wcnvM1jUH7/WKT3BR33apEFrFJAa9h h9BqtPurasTM9PFWlD9XYMggQRow+bN5AFS0bGScTEQdRaz7Ltw3PJLUFu3jAvGo+mSb kTopgZBiqy9zzMqtW1rVCRotFszFQ91HfCLIu/NpjBe2D73j65GAK2jG91IOp6SMk24T u76Q== 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=DqMeEpsYLg2FNqTNDCaAigGm7/V+QKqBZZKT+giJbgg=; b=BhPkuePfognUZBdS4Lgyk2We6LMyTIBE1zulkGURgw95HCBOW6BtbLcjLfNx9yqvN3 yhgbDOyrmm7zBz0olX8YxOsxGKAAPFOiiYStX24m1ex1zPhxY+Xl9oJa6X2f6zjb1tZ+ J2xbIPQJg/DLUFxlQ54ChHvqDtyrenIvFnXUE99/ooGR9qoabty+zKRY5i0VCkhFtuOw RKMwlqJjQgjzElEO95YEcNiveR+tA3BhiQ9Shy02jg9Ud+OP23cbwVxElCWDB/DRcD3t n8wkflXd3Uh/JmAYqUJxDzVJ3PSFC96P4Qjkx/F8Gg8VhniBOv3OFjR03gY6ioA/rN/l WjhQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@nifty.com header.s=dec2015msa header.b=kJnvv7Ba; 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 s12si9833770plp.63.2019.07.05.20.08.10; Fri, 05 Jul 2019 20:08:10 -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=kJnvv7Ba; 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 S1726696AbfGFDIF (ORCPT + 30 others); Fri, 5 Jul 2019 23:08:05 -0400 Received: from conuserg-09.nifty.com ([210.131.2.76]:48579 "EHLO conuserg-09.nifty.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725878AbfGFDIE (ORCPT ); Fri, 5 Jul 2019 23:08:04 -0400 Received: from grover.flets-west.jp (softbank126026094249.bbtec.net [126.26.94.249]) (authenticated) by conuserg-09.nifty.com with ESMTP id x6637E3N030660; Sat, 6 Jul 2019 12:07:15 +0900 DKIM-Filter: OpenDKIM Filter v2.10.3 conuserg-09.nifty.com x6637E3N030660 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=nifty.com; s=dec2015msa; t=1562382436; bh=DqMeEpsYLg2FNqTNDCaAigGm7/V+QKqBZZKT+giJbgg=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=kJnvv7BatHzNkfx4kfoKaFfSjB+Fu9Ax2s8IbKQtg2vu/HTFAzBzq8NGCBizAQJ/z qSULExu8ajajVh3uqkJH/e2MgR80ZFwY8FtbWRO6nIHYgnsbXX9nY056Qhxohqd8Ix 7YynWU+HM9FZR3FiChRzDr8UcOQHBa7zwDxgPjmOhjXH+UCKLuAbtHeZYVSbodcg6r VunG+Tu0+talczuN/CdDgDQoVvGX2Q+mfB6q1Gkk0yBrVjqbhHAD4XKZ19oZR7BryA I/9zBwAKh2oIGP0XFetJew2+HOAkMHiLJdqLVzwMuvm4mZZDFl1ChDE1L/5h7GUJt7 fxHya3EpK3Tpg== X-Nifty-SrcIP: [126.26.94.249] From: Masahiro Yamada To: linux-kbuild@vger.kernel.org Cc: Sam Ravnborg , Pawan Gupta , Masahiro Yamada , Shuah Khan , linux-kernel@vger.kernel.org, Kieran Bingham , Michal Marek , linux-kselftest@vger.kernel.org, Jan Kiszka Subject: [PATCH 2/3] kbuild: replace KBUILD_SRCTREE with boolean building_out_of_srctree Date: Sat, 6 Jul 2019 12:07:12 +0900 Message-Id: <20190706030713.6221-2-yamada.masahiro@socionext.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20190706030713.6221-1-yamada.masahiro@socionext.com> References: <20190706030713.6221-1-yamada.masahiro@socionext.com> Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Commit 25b146c5b8ce ("kbuild: allow Kbuild to start from any directory") deprecated KBUILD_SRCTREE. It is only used in tools/testing/selftest/ to distinguish out-of-tree build. Replace it with a new boolean flag, building_out_of_srctree. I also replaced the conditional ($(srctree),.) because the next commit will allow an absolute path for $(srctree) even when building in the source tree. Signed-off-by: Masahiro Yamada --- Makefile | 19 ++++++++----------- scripts/Makefile.build | 2 +- scripts/Makefile.host | 2 +- scripts/Makefile.lib | 2 +- scripts/Makefile.modbuiltin | 2 +- scripts/gdb/linux/Makefile | 2 +- tools/testing/selftests/Makefile | 2 +- tools/testing/selftests/lib.mk | 4 ++-- 8 files changed, 16 insertions(+), 19 deletions(-) -- 2.17.1 diff --git a/Makefile b/Makefile index a5615edf2196..534a5dc796b1 100644 --- a/Makefile +++ b/Makefile @@ -228,9 +228,12 @@ ifeq ("$(origin M)", "command line") KBUILD_EXTMOD := $(M) endif +export KBUILD_CHECKSRC KBUILD_EXTMOD + ifeq ($(abs_srctree),$(abs_objtree)) # building in the source tree srctree := . + building_out_of_srctree := else ifeq ($(abs_srctree)/,$(dir $(abs_objtree))) # building in a subdirectory of the source tree @@ -238,19 +241,13 @@ else else srctree := $(abs_srctree) endif - - # TODO: - # KBUILD_SRC is only used to distinguish in-tree/out-of-tree build. - # Replace it with $(srctree) or something. - KBUILD_SRC := $(abs_srctree) + building_out_of_srctree := 1 endif -export KBUILD_CHECKSRC KBUILD_EXTMOD KBUILD_SRC - objtree := . VPATH := $(srctree) -export srctree objtree VPATH +export building_out_of_srctree srctree objtree VPATH # To make sure we do not include .config for any of the *config targets # catch them early, and hand them over to scripts/kconfig/Makefile @@ -453,7 +450,7 @@ USERINCLUDE := \ LINUXINCLUDE := \ -I$(srctree)/arch/$(SRCARCH)/include \ -I$(objtree)/arch/$(SRCARCH)/include/generated \ - $(if $(filter .,$(srctree)),,-I$(srctree)/include) \ + $(if $(building_out_of_srctree),-I$(srctree)/include) \ -I$(objtree)/include \ $(USERINCLUDE) @@ -509,7 +506,7 @@ PHONY += outputmakefile # At the same time when output Makefile generated, generate .gitignore to # ignore whole output directory outputmakefile: -ifneq ($(srctree),.) +ifdef building_out_of_srctree $(Q)ln -fsn $(srctree) source $(Q)$(CONFIG_SHELL) $(srctree)/scripts/mkmakefile $(srctree) $(Q)test -e .gitignore || \ @@ -1093,7 +1090,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 ($(srctree),.) +ifdef building_out_of_srctree @$(kecho) ' Using $(srctree) as source for kernel' $(Q)if [ -f $(srctree)/.config -o \ -d $(srctree)/include/config -o \ diff --git a/scripts/Makefile.build b/scripts/Makefile.build index 341fca59d28f..1086caaac786 100644 --- a/scripts/Makefile.build +++ b/scripts/Makefile.build @@ -509,7 +509,7 @@ existing-targets := $(wildcard $(sort $(targets))) -include $(foreach f,$(existing-targets),$(dir $(f)).$(notdir $(f)).cmd) -ifneq ($(srctree),.) +ifdef building_out_of_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 b6a54bdf0965..fcf0213e6ac8 100644 --- a/scripts/Makefile.host +++ b/scripts/Makefile.host @@ -69,7 +69,7 @@ _hostcxx_flags = $(KBUILD_HOSTCXXFLAGS) $(HOST_EXTRACXXFLAGS) \ # $(objtree)/$(obj) for including generated headers from checkin source files ifeq ($(KBUILD_EXTMOD),) -ifneq ($(srctree),.) +ifdef building_out_of_srctree _hostc_flags += -I $(objtree)/$(obj) _hostcxx_flags += -I $(objtree)/$(obj) endif diff --git a/scripts/Makefile.lib b/scripts/Makefile.lib index 4d006923763c..f835a40ebae5 100644 --- a/scripts/Makefile.lib +++ b/scripts/Makefile.lib @@ -148,7 +148,7 @@ endif # $(srctree)/$(src) for including checkin headers from generated source files # $(objtree)/$(obj) for including generated headers from checkin source files ifeq ($(KBUILD_EXTMOD),) -ifneq ($(srctree),.) +ifdef building_out_of_srctree _c_flags += -I $(srctree)/$(src) -I $(objtree)/$(obj) _a_flags += -I $(srctree)/$(src) -I $(objtree)/$(obj) _cpp_flags += -I $(srctree)/$(src) -I $(objtree)/$(obj) diff --git a/scripts/Makefile.modbuiltin b/scripts/Makefile.modbuiltin index 12ac300fe51b..7d4711b88656 100644 --- a/scripts/Makefile.modbuiltin +++ b/scripts/Makefile.modbuiltin @@ -15,7 +15,7 @@ include include/config/tristate.conf include scripts/Kbuild.include -ifneq ($(srctree),.) +ifdef building_out_of_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 9fd3d8ed731a..124755087510 100644 --- a/scripts/gdb/linux/Makefile +++ b/scripts/gdb/linux/Makefile @@ -1,6 +1,6 @@ # SPDX-License-Identifier: GPL-2.0 -ifneq ($(srctree),.) +ifdef building_out_of_srctree symlinks := $(patsubst $(srctree)/$(src)/%,%,$(wildcard $(srctree)/$(src)/*.py)) diff --git a/tools/testing/selftests/Makefile b/tools/testing/selftests/Makefile index 9781ca79794a..25b43a8c2b15 100644 --- a/tools/testing/selftests/Makefile +++ b/tools/testing/selftests/Makefile @@ -74,7 +74,7 @@ endif # Append kselftest to KBUILD_OUTPUT to avoid cluttering # KBUILD_OUTPUT with selftest objects and headers installed # by selftests Makefile or lib.mk. -ifneq ($(KBUILD_SRC),) +ifdef building_out_of_srctree override LDFLAGS = endif diff --git a/tools/testing/selftests/lib.mk b/tools/testing/selftests/lib.mk index 077337195783..1c8a1963d03f 100644 --- a/tools/testing/selftests/lib.mk +++ b/tools/testing/selftests/lib.mk @@ -70,7 +70,7 @@ define RUN_TESTS endef run_tests: all -ifneq ($(KBUILD_SRC),) +ifdef building_out_of_srctree @if [ "X$(TEST_PROGS) $(TEST_PROGS_EXTENDED) $(TEST_FILES)" != "X" ]; then @rsync -aq $(TEST_PROGS) $(TEST_PROGS_EXTENDED) $(TEST_FILES) $(OUTPUT) fi @@ -125,7 +125,7 @@ clean: # When make O= with kselftest target from main level # the following aren't defined. # -ifneq ($(KBUILD_SRC),) +ifdef building_out_of_srctree LINK.c = $(CC) $(CFLAGS) $(CPPFLAGS) $(LDFLAGS) $(TARGET_ARCH) COMPILE.S = $(CC) $(ASFLAGS) $(CPPFLAGS) $(TARGET_ARCH) -c LINK.S = $(CC) $(ASFLAGS) $(CPPFLAGS) $(LDFLAGS) $(TARGET_ARCH) From patchwork Sat Jul 6 03:07:13 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Masahiro Yamada X-Patchwork-Id: 168591 Delivered-To: patch@linaro.org Received: by 2002:a92:4782:0:0:0:0:0 with SMTP id e2csp4292271ilk; Fri, 5 Jul 2019 20:08:11 -0700 (PDT) X-Google-Smtp-Source: APXvYqzoxI170G7/hAtJVAZCoutw5nCaPRLZ5i5lVSOQltue6TYxKAeMSiO4i5jwUB95RseSkQm0 X-Received: by 2002:a65:6541:: with SMTP id a1mr8760134pgw.409.1562382491571; Fri, 05 Jul 2019 20:08:11 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1562382491; cv=none; d=google.com; s=arc-20160816; b=ydZDGWVU33iDlpH00FdY9BXBKUKpi89KGwTcopwKNMd3RTijF7ab9tezm6IEqbHCBz dtYIHPh2T5PuAHlOEoYWsYU3GB04B6sY+I9cA9hWNlaoB0fLI97ggQFYFwO3JkgkO0DM S6b4fTrQ88yPyTChC0Sd30wHUB5bitkHBOe94winh96OsOiZ83GW9ibYLcEWB6GHV95n omm4DPO1qCgwnO2BNYAtjJn6zRWyT0ib0nz3lqtOtvCXN7IF0ikT7SRsoBRak0Lk2BWD 1ZKFHfyp9+0Wm2io7gGvNMiDYifb5kizud848s2DHOLTFQSGpRsL9KVz+mQ/IJ9GaBnb IT2A== 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=BXranRnGobQsHmPdkgRbmYAS0JjPT04S0nMG/+Roa7I=; b=QoWGd9csrjK7ogxifar9utRt2SjtPuH/HGAo0Z+hk2Ad61fyzS3/OGsI7dBTvDa9Ce W3UNJmH8lpR2O77V/Vx+ajR3jfvieTU9hCZ9facO8olILIgzcm78WNZ1Go7+xmjKMsaM DBpI6xaLj2UbEd6V8Lyhwjq7w3LtEEyQqpN818Uf8l1MFb+gxpAU1WCrli0Gs/e+xfS3 A2GdMCNeGa0NFy641EU7kdd8mqabkZU79cJCzqfvr4B6tuZEmIZnjRtjgqV1a/0WYzR/ iFOjNrjgCfaA8ObHgEkzaHSLfGy/Keqb0f2NNwGAsa1SAwT3zhN5NieugZKEkvpqa777 k68w== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@nifty.com header.s=dec2015msa header.b=WubaS67x; 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 s12si9833770plp.63.2019.07.05.20.08.11; Fri, 05 Jul 2019 20:08:11 -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=WubaS67x; 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 S1726903AbfGFDIH (ORCPT + 30 others); Fri, 5 Jul 2019 23:08:07 -0400 Received: from conuserg-09.nifty.com ([210.131.2.76]:48657 "EHLO conuserg-09.nifty.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725917AbfGFDIG (ORCPT ); Fri, 5 Jul 2019 23:08:06 -0400 Received: from grover.flets-west.jp (softbank126026094249.bbtec.net [126.26.94.249]) (authenticated) by conuserg-09.nifty.com with ESMTP id x6637E3O030660; Sat, 6 Jul 2019 12:07:16 +0900 DKIM-Filter: OpenDKIM Filter v2.10.3 conuserg-09.nifty.com x6637E3O030660 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=nifty.com; s=dec2015msa; t=1562382437; bh=BXranRnGobQsHmPdkgRbmYAS0JjPT04S0nMG/+Roa7I=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=WubaS67xUsMj78YonzUEFRxs7Ogw/ltP28Bl+bOOgceIgHJ0CqbRy5zTGeiHsoxS9 i1a+a3A54Ph5hW/bvFf7EZRKnFArJQMwvz5CNmDFVzcQy0kyofx3l1LNkNBxDxJnk0 F9sU/q5ZKQDkwHhcfVBOJuhpdSkwYk0p8nRN5e57K/b1UyKSIiF5CXo6Ie3FZqc682 cl75+fzxeRFpTJNAx+k/w+/Is4tRXsA9RjvjUOKKP1Zl7MQfWo8JjCp6WtLjtZuUFx g1LrVFUjK97hgxZbVFmEBFlcqYV0dPPk0he3+No2OC9SD/jOCKyWXLYVMFmNr8b5MR IJX3mqdMV9MVQ== X-Nifty-SrcIP: [126.26.94.249] From: Masahiro Yamada To: linux-kbuild@vger.kernel.org Cc: Sam Ravnborg , Pawan Gupta , Masahiro Yamada , linux-doc@vger.kernel.org, linux-kernel@vger.kernel.org, Jonathan Corbet , Michal Marek Subject: [PATCH 3/3] kbuild: add a flag to force absolute path for srctree Date: Sat, 6 Jul 2019 12:07:13 +0900 Message-Id: <20190706030713.6221-3-yamada.masahiro@socionext.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20190706030713.6221-1-yamada.masahiro@socionext.com> References: <20190706030713.6221-1-yamada.masahiro@socionext.com> Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org In old days, Kbuild always used an absolute path for $(srctree). Since commit 890676c65d69 ("kbuild: Use relative path when building in the source tree"), $(srctree) is '.' when not using O=. Yet, using absolute paths is useful in some cases even without O=, for instance, to create a cscope file with absolute path tags. O=. was used as an idiom to force Kbuild to use absolute paths even when you are building in the source tree. Since commit 25b146c5b8ce ("kbuild: allow Kbuild to start from any directory"), Kbuild is too clever to be tricked. Even if you pass O=. Kbuild notices you are building in the source tree, then use '.' for $(srctree). So, "make O=. cscope" is no help to create absolute path tags. We cannot force one or the other according to commit e93bc1a0cab3 ("Revert "kbuild: specify absolute paths for cscope""). Both of relative path and absolute path have pros and cons. This commit adds a new flag KBUILD_ABS_SRCTREE to allow users to choose the absolute path for $(srctree). "make KBUILD_ABS_SRCTREE=1 cscope" will work as a replacement of "make O=. cscope". I added Fixes since that commit broke some users' workflow. Fixes: 25b146c5b8ce ("kbuild: allow Kbuild to start from any directory") Reported-by: Pawan Gupta Signed-off-by: Masahiro Yamada --- Documentation/kbuild/kbuild.txt | 9 +++++++++ Makefile | 4 ++++ scripts/tags.sh | 3 +-- 3 files changed, 14 insertions(+), 2 deletions(-) -- 2.17.1 diff --git a/Documentation/kbuild/kbuild.txt b/Documentation/kbuild/kbuild.txt index 7a7e2aa2fab5..3ef42f87f275 100644 --- a/Documentation/kbuild/kbuild.txt +++ b/Documentation/kbuild/kbuild.txt @@ -182,6 +182,15 @@ The output directory is often set using "O=..." on the commandline. The value can be overridden in which case the default value is ignored. +KBUILD_ABS_SRCTREE +-------------------------------------------------- +Kbuild uses a relative path to point to the tree when possible. For instance, +when building in the source tree, the source tree path is '.' + +Setting this flag requests Kbuild to use absolute path to the source tree. +There are some useful cases to do so, like when generating tag files with +absolute path entries etc. + KBUILD_SIGN_PIN -------------------------------------------------- This variable allows a passphrase or PIN to be passed to the sign-file diff --git a/Makefile b/Makefile index 534a5dc796b1..6dc453f86f00 100644 --- a/Makefile +++ b/Makefile @@ -244,6 +244,10 @@ else building_out_of_srctree := 1 endif +ifneq ($(KBUILD_ABS_SRCTREE),) +srctree := $(abs_srctree) +endif + objtree := . VPATH := $(srctree) diff --git a/scripts/tags.sh b/scripts/tags.sh index 7fea4044749b..4e18ae5282a6 100755 --- a/scripts/tags.sh +++ b/scripts/tags.sh @@ -17,8 +17,7 @@ ignore="$(echo "$RCS_FIND_IGNORE" | sed 's|\\||g' )" # tags and cscope files should also ignore MODVERSION *.mod.c files ignore="$ignore ( -name *.mod.c ) -prune -o" -# Do not use full path if we do not use O=.. builds -# Use make O=. {tags|cscope} +# Use make KBUILD_ABS_SRCTREE=1 {tags|cscope} # to force full paths for a non-O= build if [ "${srctree}" = "." -o -z "${srctree}" ]; then tree=