Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1598320 > unrolled thread

Re: [PATCH] kbuild: strip the last slash in KBUILD_EXTMOD

Started byMasahiro Yamada <yamada.masahiro@socionext.com>
First post2017-03-11 14:40 +0100
Last post2017-03-12 13:00 +0100
Articles 2 — 2 participants

Back to article view | Back to linux.kernel

This discussion starts older than the indexed window; earlier articles aren't shown. The article labeled Started by below is the oldest one visible, not the original post.


Contents

  Re: [PATCH] kbuild: strip the last slash in KBUILD_EXTMOD Masahiro Yamada <yamada.masahiro@socionext.com> - 2017-03-11 14:40 +0100
    Re: [PATCH] kbuild: strip the last slash in KBUILD_EXTMOD Wei Yang <richard.weiyang@gmail.com> - 2017-03-12 13:00 +0100

#1598320 — Re: [PATCH] kbuild: strip the last slash in KBUILD_EXTMOD

FromMasahiro Yamada <yamada.masahiro@socionext.com>
Date2017-03-11 14:40 +0100
SubjectRe: [PATCH] kbuild: strip the last slash in KBUILD_EXTMOD
Message-ID<tjPpv-3nR-9@gated-at.bofh.it>
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

[toc] | [next] | [standalone]


#1598577

FromWei Yang <richard.weiyang@gmail.com>
Date2017-03-12 13:00 +0100
Message-ID<tkakh-Zu-5@gated-at.bofh.it>
In reply to#1598320

[Multipart message — attachments visible in raw view] — view raw

On Sat, Mar 11, 2017 at 10:34:50PM +0900, Masahiro Yamada wrote:
>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.
>

Hi, Masahiro 

Thanks for your comment.

Got your point, you are right.

>
>
>Maybe adding the following should be enough?
>
>KBUILD_EXTMOD := $(patsubst %/,%,$(KBUILD_EXTMOD))
>

Yep, it looks good.

BTW, I found another interesting thing.

     make M=dir//// 

is also a valid target in kbuild.

Even this is a very rare case, I plan to use this to handle it.

KBUILD_EXTMOD := $(subst $(CURDIR)/,,$(KBUILD_EXTMOD))

This also works for an out tree build.

I would send out v2 soon, hope you like this.

>
>-- 
>Best Regards
>Masahiro Yamada

-- 
Wei Yang
Help you, Help me

[toc] | [prev] | [standalone]


Back to top | Article view | linux.kernel


csiph-web