From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-7.0 required=3.0 tests=DKIM_SIGNED,DKIM_VALID, HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_PATCH,MAILING_LIST_MULTI,SIGNED_OFF_BY, SPF_PASS,URIBL_BLOCKED autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 753F4C4360F for ; Tue, 2 Apr 2019 14:24:01 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 3D522204EC for ; Tue, 2 Apr 2019 14:24:01 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=nifty.com header.i=@nifty.com header.b="z8ICpJZz" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1730610AbfDBOYA (ORCPT ); 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-Google-Smtp-Source: APXvYqytaA1SamhYLAFxemuW+bjtZBvoAr6+RH0vwwU4G/XxoYkbsq3vRkQuwisx7K8Mt1rGuJaWdLLkN5ajleQ1HBw= 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