All of lore.kernel.org
 help / color / mirror / Atom feed
From: Masahiro Yamada <yamada.masahiro@socionext.com>
To: Wei Yang <richard.weiyang@gmail.com>
Cc: Michal Marek <mmarek@suse.com>,
	Linux Kbuild mailing list <linux-kbuild@vger.kernel.org>,
	Linux Kernel Mailing List <linux-kernel@vger.kernel.org>
Subject: Re: [PATCH] kbuild: strip the last slash in KBUILD_EXTMOD
Date: Sat, 11 Mar 2017 22:34:50 +0900	[thread overview]
Message-ID: <CAK7LNATuG=RqghbmGrx99E95fFAbx9U8DUPp0XQtEO+fbBr-mA@mail.gmail.com> (raw)
In-Reply-To: <20170222150833.83149-1-richard.weiyang@gmail.com>

Hi Wei,


2017-02-23 0:08 GMT+09:00 Wei Yang <richard.weiyang@gmail.com>:
> Current kbuild will build the target again if we run "make M=dir" and "make
> M=dir/" by turns, since if_changed will see the prerequisite is changed.
> The behavior may confuse the user a little, since actually we are building
> the same target and no difference.
>
> According to current implementation in scripts/Makefile.build, the obj
> passed to next level is a directory name with last slash stripped. This
> patch strips the last slash in KBUILD_EXTMOD which is assigned from "M=".
>
> Signed-off-by: Wei Yang <richard.weiyang@gmail.com>
> ---
>  Makefile | 6 ++++--
>  1 file changed, 4 insertions(+), 2 deletions(-)
>
> diff --git a/Makefile b/Makefile
> index b1037774e8e8..db6ed60928ab 100644
> --- a/Makefile
> +++ b/Makefile
> @@ -184,13 +184,15 @@ endif
>  # Old syntax make ... SUBDIRS=$PWD is still supported
>  # Setting the environment variable KBUILD_EXTMOD take precedence
>  ifdef SUBDIRS
> -  KBUILD_EXTMOD ?= $(SUBDIRS)
> +  __KBUILD_EXTMOD ?= $(SUBDIRS)
>  endif
>
>  ifeq ("$(origin M)", "command line")
> -  KBUILD_EXTMOD := $(M)
> +  __KBUILD_EXTMOD := $(M)
>  endif
>
> +KBUILD_EXTMOD = $(patsubst %/,%,$(__KBUILD_EXTMOD))
> +
>  # If building an external module we do not care about the all: rule
>  # but instead _all depend on modules
>  PHONY += all

This patch would break a use-case
where KBUILD_EXTMOD is given as an environment.



Maybe adding the following should be enough?

KBUILD_EXTMOD := $(patsubst %/,%,$(KBUILD_EXTMOD))


-- 
Best Regards
Masahiro Yamada

  reply	other threads:[~2017-03-11 13:35 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-02-22 15:08 [PATCH] kbuild: strip the last slash in KBUILD_EXTMOD Wei Yang
2017-03-11 13:34 ` Masahiro Yamada [this message]
2017-03-12 11:56   ` Wei Yang
2017-03-12 12:01 Wei Yang

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to='CAK7LNATuG=RqghbmGrx99E95fFAbx9U8DUPp0XQtEO+fbBr-mA@mail.gmail.com' \
    --to=yamada.masahiro@socionext.com \
    --cc=linux-kbuild@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mmarek@suse.com \
    --cc=richard.weiyang@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.