Received: by 2002:a25:4158:0:0:0:0:0 with SMTP id o85csp1356195yba; Tue, 2 Apr 2019 07:26:20 -0700 (PDT) X-Google-Smtp-Source: APXvYqxnba/n9xmQ/Z4b4/31aeIJpC9r/VYRC8Su8LKh87CzKTe7jAO6UIsv4RbMKhOR8XQhjho6 X-Received: by 2002:a63:3188:: with SMTP id x130mr65202846pgx.64.1554215180110; Tue, 02 Apr 2019 07:26:20 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1554215180; cv=none; d=google.com; s=arc-20160816; b=vwl2TzfXW/VfBxcpi/5WGbP0xQL+YIFfQTT4PhoPB57STp8iBHue/jcPucgmYvCITe 8+PeuD5FkVUz7RH5mGVbsfIEng+BGZDraTFJtNxHxjVqu0ZkGGz5iw79x9KPVIht5dze T6mKoblQSLmao4VkNIqeQFYFIFebTzk5qd66jRfOIz9NVksjrtTBThHSXun9z6ehu/t7 IoRpqYjei+xTSA/wShqJnLRGQFbOBYHMacGOpnUbt1fR/GwxYBmeZ5u2jtaUR3g2Gl3K OgMylO6hLK8MIOdr75LtH8PDljd8szi9Tu+c2kv1wwNn78gwPyaw+KGGDkJt5itfz9ED L0kQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:dkim-signature:dkim-filter; bh=bbAhzq6SiFMsQqCZLGw2iTj/W+HyNnE00Wii2xbClRc=; b=R91EYfzjcj9Ne9o1pXtuHazhl35VMh8Wyw1Q5m0iO18ciGxoPEgbH8RH8UZ04m76sn RbQ2nWjCcBHnijBM5b8IvBts4zvJUJvHzs2OcYCpGvCFhgJX9CFrGfR9uT5hoFqGPAgX 0y8Z/sbxkPGpCmSi6+bZuaCA0GHNPHeGLpHwmOzCKgyH8wOslpuwqG00pkKaewnCQOLx LMPJayT5jPQLoi6TOBcMMQVHWiBJolhXgkplQ0kz7q/YbHI522745MHVtUhYxbMx5W6U ZoX6gxu6RoZK8HYt0mrpTB0Hg0/GjkOWWKvl7aNcc8HvB3RQVI6PCgVin56fECIYV4XS VtZQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@nifty.com header.s=dec2015msa header.b=z8ICpJZz; 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 e5si1090877pgb.262.2019.04.02.07.26.04; Tue, 02 Apr 2019 07:26:20 -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=z8ICpJZz; 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 S1730527AbfDBOYA (ORCPT + 99 others); Tue, 2 Apr 2019 10:24:00 -0400 Received: from conssluserg-02.nifty.com ([210.131.2.81]:20905 "EHLO conssluserg-02.nifty.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726903AbfDBOX7 (ORCPT ); Tue, 2 Apr 2019 10:23:59 -0400 Received: from mail-ua1-f48.google.com (mail-ua1-f48.google.com [209.85.222.48]) (authenticated) by conssluserg-02.nifty.com with ESMTP id x32ENpxI012919; Tue, 2 Apr 2019 23:23:51 +0900 DKIM-Filter: OpenDKIM Filter v2.10.3 conssluserg-02.nifty.com x32ENpxI012919 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=nifty.com; s=dec2015msa; t=1554215032; bh=bbAhzq6SiFMsQqCZLGw2iTj/W+HyNnE00Wii2xbClRc=; h=References:In-Reply-To:From:Date:Subject:To:Cc:From; b=z8ICpJZzG6mJrWabuMJrPwhM8n1hHBrhfJPK++qkYUZMev83iaJIocR/JuSTn9zqh 0b8moUfC5x93gEzKbGrkxyMrQUEfnHbUcytsq45SvArghWxMYBwMu8h14c2KQyiJQ6 JYcQ8Nnj0IZOlLqycGHdfHNR3pYDXphWOSZZmkiXjkNTUbgBMYD/Snu0Wub9prytrN LbcjhyBWPTfX04pNdoc50RW0x6izZjr1cFeKhmfJP9QZ2p+jKu8xbmxnjXaOtTmmkY NQui8ZUMH1dfaxo8H8NofEys0PUSaU3bsuNHuIRTwv8Fb7sQhGrNEOPf1JQlESXTmb ENmhxHZiRzjug== X-Nifty-SrcIP: [209.85.222.48] Received: by mail-ua1-f48.google.com with SMTP id b8so4416483uaq.7; Tue, 02 Apr 2019 07:23:51 -0700 (PDT) X-Gm-Message-State: APjAAAUajaBNzJhEB/42MRWai1Y7+0T5TVKsPUrdm4AFAGOfUEI78oPN FV+GVp/y+DzXyYK3iYjvGhsb+AQ4gfxQI5jnXAE= X-Received: by 2002:ab0:65c7:: with SMTP id n7mr21056318uaq.3.1554215030462; Tue, 02 Apr 2019 07:23:50 -0700 (PDT) MIME-Version: 1.0 References: <1553947458-8311-1-git-send-email-yamada.masahiro@socionext.com> <1553947458-8311-2-git-send-email-yamada.masahiro@socionext.com> In-Reply-To: From: Masahiro Yamada Date: Tue, 2 Apr 2019 23:23:14 +0900 X-Gmail-Original-Message-ID: Message-ID: Subject: Re: [PATCH 2/6] kbuild: allow Kbuild to start from any directory To: Kieran Bingham Cc: Linux Kbuild mailing list , Michal Marek , Linux Kernel Mailing List Content-Type: text/plain; charset="UTF-8" Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Hi Kieran, On Tue, Apr 2, 2019 at 1:41 PM Kieran Bingham wrote: > > Hi Yamada-san, > > Thank you for the patches, > > I like the direction this series is taking. > > Small spelling error spotted below... > But as I've now gone through all of it I'll offer > > Reviewed-by: Kieran Bingham > > > On 30/03/2019 12:04, Masahiro Yamada wrote: > > Kbuild always runs in the top of the output directory. > > > > If Make starts in the source directory with O=, it relocates the > > working directory to the location specified by O=. > > > > Also, users can start build from the output directory by using the > > Makefile generated by scripts/mkmakefile. > > > > With a little more effort, Kbuild will be able to start from any > > directory path. > > > > This commit allows to specify the source directory by using > > the -f option. > > > > For example, you can do: > > > > $ cd path/to/output/dir > > $ make -f path/to/source/dir/Makefile > > > > Or, for the equivalent behavior, you can do: > > > > $ make O=path/to/output/dir -f path/to/source/dir/Makefile > > > > KBUILD_SRC is now deprecated. > > > > Signed-off-by: Masahiro Yamada > > --- > > > > Makefile | 87 +++++++++++++++++++++++++++++++++++++--------------------------- > > 1 file changed, 50 insertions(+), 37 deletions(-) > > > > diff --git a/Makefile b/Makefile > > index 9cbd367..1b2a70e 100644 > > --- a/Makefile > > +++ b/Makefile > > @@ -96,56 +96,65 @@ endif > > > > export quiet Q KBUILD_VERBOSE > > > > -# kbuild supports saving output files in a separate directory. > > -# To locate output files in a separate directory two syntaxes are supported. > > -# In both cases the working directory must be the root of the kernel src. > > +# Kbuild will save output files in the current working directory. > > +# This does not need to match to the root of the kernel source tree. > > +# > > +# For example, you can do this: > > +# > > +# cd /dir/to/store/output/files; make -f /dir/to/kernel/source/Makefile > > +# > > +# If you want to save output files in a different location, there are > > +# two syntaxes to specify it. > > +# > > # 1) O= > > # Use "make O=dir/to/store/output/files/" > > # > > # 2) Set KBUILD_OUTPUT > > -# Set the environment variable KBUILD_OUTPUT to point to the directory > > -# where the output files shall be placed. > > -# export KBUILD_OUTPUT=dir/to/store/output/files/ > > -# make > > +# Set the environment variable KBUILD_OUTPUT to point to the output directory. > > +# export KBUILD_OUTPUT=dir/to/store/output/files/; make > > # > > # The O= assignment takes precedence over the KBUILD_OUTPUT environment > > # variable. > > > > -# KBUILD_SRC is not intended to be used by the regular user (for now), > > -# it is set on invocation of make with KBUILD_OUTPUT or O= specified. > > - > > -# OK, Make called in directory where kernel src resides > > -# Do we want to locate output files in a separate directory? > > +# Do we want to change the working directory? > > ifeq ("$(origin O)", "command line") > > KBUILD_OUTPUT := $(O) > > endif > > > > -ifneq ($(words $(subst :, ,$(CURDIR))), 1) > > - $(error main directory cannot contain spaces nor colons) > > +ifneq ($(KBUILD_OUTPUT),) > > +# Make's built-in functions such as $(abspath ...), $(realpath ...) cannot > > +# expand a shell special character '~'. We use a bit tredious way to handle it. > > very minor, but I noticed while looking through the series ^^ > > s/bit tredious/somewhat tedious/ Oops, 'tredious' is a typo. As a non-native, I do not understand the difference between 'a bit' and 'somewhat', but I will apply it. Thanks. -- Best Regards Masahiro Yamada