linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] kbuild: ensure Make >= 3.82 is used
@ 2022-12-11  3:03 Masahiro Yamada
  2022-12-12 17:21 ` Nathan Chancellor
  0 siblings, 1 reply; 7+ messages in thread
From: Masahiro Yamada @ 2022-12-11  3:03 UTC (permalink / raw)
  To: linux-kbuild
  Cc: linux-kernel, Masahiro Yamada, Nathan Chancellor,
	Nick Desaulniers, Nicolas Schier

Documentation/process/changes.rst notes the minimal GNU Make version,
but it is not checked anywhere.

We could check $(MAKE_VERSION), but another simple way is to check
$(.FEATURES) since the feature list always grows although this way
is not always possible. For example Make 4.0 through 4.2 have the
same set of $(.FEATURES).

Signed-off-by: Masahiro Yamada <masahiroy@kernel.org>
---

Changes in v3:
  - Check the version in a different way

 Makefile | 5 +++++
 1 file changed, 5 insertions(+)

diff --git a/Makefile b/Makefile
index 2dda1e9a717a..66dfc5751470 100644
--- a/Makefile
+++ b/Makefile
@@ -11,6 +11,11 @@ NAME = Hurr durr I'ma ninja sloth
 # Comments in this file are targeted only to the developer, do not
 # expect to learn how to build the kernel reading this file.
 
+# Ensure Make >= 3.82
+ifeq ($(filter undefine,$(.FEATURES)),)
+$(error Make $(MAKE_VERSION) is too old)
+endif
+
 $(if $(filter __%, $(MAKECMDGOALS)), \
 	$(error targets prefixed with '__' are only for internal use))
 
-- 
2.34.1


^ permalink raw reply related	[flat|nested] 7+ messages in thread

* Re: [PATCH] kbuild: ensure Make >= 3.82 is used
  2022-12-11  3:03 [PATCH] kbuild: ensure Make >= 3.82 is used Masahiro Yamada
@ 2022-12-12 17:21 ` Nathan Chancellor
  2022-12-13  3:58   ` Nicolas Schier
  0 siblings, 1 reply; 7+ messages in thread
From: Nathan Chancellor @ 2022-12-12 17:21 UTC (permalink / raw)
  To: Masahiro Yamada
  Cc: linux-kbuild, linux-kernel, Nick Desaulniers, Nicolas Schier

On Sun, Dec 11, 2022 at 12:03:52PM +0900, Masahiro Yamada wrote:
> Documentation/process/changes.rst notes the minimal GNU Make version,
> but it is not checked anywhere.
> 
> We could check $(MAKE_VERSION), but another simple way is to check
> $(.FEATURES) since the feature list always grows although this way
> is not always possible. For example Make 4.0 through 4.2 have the
> same set of $(.FEATURES).
> 
> Signed-off-by: Masahiro Yamada <masahiroy@kernel.org>

Reviewed-by: Nathan Chancellor <nathan@kernel.org>

> ---
> 
> Changes in v3:
>   - Check the version in a different way
> 
>  Makefile | 5 +++++
>  1 file changed, 5 insertions(+)
> 
> diff --git a/Makefile b/Makefile
> index 2dda1e9a717a..66dfc5751470 100644
> --- a/Makefile
> +++ b/Makefile
> @@ -11,6 +11,11 @@ NAME = Hurr durr I'ma ninja sloth
>  # Comments in this file are targeted only to the developer, do not
>  # expect to learn how to build the kernel reading this file.
>  
> +# Ensure Make >= 3.82
> +ifeq ($(filter undefine,$(.FEATURES)),)
> +$(error Make $(MAKE_VERSION) is too old)

Would it make sense to state what version is needed, similar to the
Kconfig checks for compiler and binutils?

> +endif
> +
>  $(if $(filter __%, $(MAKECMDGOALS)), \
>  	$(error targets prefixed with '__' are only for internal use))
>  
> -- 
> 2.34.1
> 

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [PATCH] kbuild: ensure Make >= 3.82 is used
  2022-12-12 17:21 ` Nathan Chancellor
@ 2022-12-13  3:58   ` Nicolas Schier
  2022-12-13 10:05     ` Nicolas Schier
  2022-12-14 11:05     ` David Laight
  0 siblings, 2 replies; 7+ messages in thread
From: Nicolas Schier @ 2022-12-13  3:58 UTC (permalink / raw)
  To: Nathan Chancellor
  Cc: Masahiro Yamada, linux-kbuild, linux-kernel, Nick Desaulniers

[-- Attachment #1: Type: text/plain, Size: 1598 bytes --]

On Mon 12 Dec 2022 10:21:10 GMT, Nathan Chancellor wrote:
> On Sun, Dec 11, 2022 at 12:03:52PM +0900, Masahiro Yamada wrote:
> > Documentation/process/changes.rst notes the minimal GNU Make version,
> > but it is not checked anywhere.
> > 
> > We could check $(MAKE_VERSION), but another simple way is to check
> > $(.FEATURES) since the feature list always grows although this way
> > is not always possible. For example Make 4.0 through 4.2 have the
> > same set of $(.FEATURES).
> > 
> > Signed-off-by: Masahiro Yamada <masahiroy@kernel.org>
> 
> Reviewed-by: Nathan Chancellor <nathan@kernel.org>

Reviewed-by: Nicolas Schier <nicolas@fjasle.eu>

> > ---
> > 
> > Changes in v3:
> >   - Check the version in a different way
> > 
> >  Makefile | 5 +++++
> >  1 file changed, 5 insertions(+)
> > 
> > diff --git a/Makefile b/Makefile
> > index 2dda1e9a717a..66dfc5751470 100644
> > --- a/Makefile
> > +++ b/Makefile
> > @@ -11,6 +11,11 @@ NAME = Hurr durr I'ma ninja sloth
> >  # Comments in this file are targeted only to the developer, do not
> >  # expect to learn how to build the kernel reading this file.
> >  
> > +# Ensure Make >= 3.82
> > +ifeq ($(filter undefine,$(.FEATURES)),)
> > +$(error Make $(MAKE_VERSION) is too old)
> 
> Would it make sense to state what version is needed, similar to the
> Kconfig checks for compiler and binutils?

Checking against 'undefine' (introduced in make-3.82~38) is quite a 
nice way, I think.  Otherwise we needed something like
$(filter 3.82% 3.9% 4.% 5.% ..., $(MAKE_VERSION)).

Kind regards,
Nicolas

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 833 bytes --]

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [PATCH] kbuild: ensure Make >= 3.82 is used
  2022-12-13  3:58   ` Nicolas Schier
@ 2022-12-13 10:05     ` Nicolas Schier
  2022-12-13 16:42       ` Nathan Chancellor
  2022-12-14 11:05     ` David Laight
  1 sibling, 1 reply; 7+ messages in thread
From: Nicolas Schier @ 2022-12-13 10:05 UTC (permalink / raw)
  To: Nathan Chancellor
  Cc: Masahiro Yamada, linux-kbuild, linux-kernel, Nick Desaulniers

On Tue, Dec 13, 2022 at 04:58:30AM +0100 Nicolas Schier wrote:
> On Mon 12 Dec 2022 10:21:10 GMT, Nathan Chancellor wrote:
> > On Sun, Dec 11, 2022 at 12:03:52PM +0900, Masahiro Yamada wrote:
> > > Documentation/process/changes.rst notes the minimal GNU Make version,
> > > but it is not checked anywhere.
> > > 
> > > We could check $(MAKE_VERSION), but another simple way is to check
> > > $(.FEATURES) since the feature list always grows although this way
> > > is not always possible. For example Make 4.0 through 4.2 have the
> > > same set of $(.FEATURES).
> > > 
> > > Signed-off-by: Masahiro Yamada <masahiroy@kernel.org>
> > 
> > Reviewed-by: Nathan Chancellor <nathan@kernel.org>
> 
> Reviewed-by: Nicolas Schier <nicolas@fjasle.eu>
> 
> > > ---
> > > 
> > > Changes in v3:
> > >   - Check the version in a different way
> > > 
> > >  Makefile | 5 +++++
> > >  1 file changed, 5 insertions(+)
> > > 
> > > diff --git a/Makefile b/Makefile
> > > index 2dda1e9a717a..66dfc5751470 100644
> > > --- a/Makefile
> > > +++ b/Makefile
> > > @@ -11,6 +11,11 @@ NAME = Hurr durr I'ma ninja sloth
> > >  # Comments in this file are targeted only to the developer, do not
> > >  # expect to learn how to build the kernel reading this file.
> > >  
> > > +# Ensure Make >= 3.82
> > > +ifeq ($(filter undefine,$(.FEATURES)),)
> > > +$(error Make $(MAKE_VERSION) is too old)
> > 
> > Would it make sense to state what version is needed, similar to the
> > Kconfig checks for compiler and binutils?
> 
> Checking against 'undefine' (introduced in make-3.82~38) is quite a 
> nice way, I think.  Otherwise we needed something like
> $(filter 3.82% 3.9% 4.% 5.% ..., $(MAKE_VERSION)).
> 

Nathan, sorry, I somehow I read your question completely wrong.  I would also
appreciate if the minimum make version would be shown in the error message.

Kind regards,
Nicolas

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [PATCH] kbuild: ensure Make >= 3.82 is used
  2022-12-13 10:05     ` Nicolas Schier
@ 2022-12-13 16:42       ` Nathan Chancellor
  0 siblings, 0 replies; 7+ messages in thread
From: Nathan Chancellor @ 2022-12-13 16:42 UTC (permalink / raw)
  To: Nicolas Schier
  Cc: Masahiro Yamada, linux-kbuild, linux-kernel, Nick Desaulniers

On Tue, Dec 13, 2022 at 11:05:05AM +0100, Nicolas Schier wrote:
> On Tue, Dec 13, 2022 at 04:58:30AM +0100 Nicolas Schier wrote:
> > On Mon 12 Dec 2022 10:21:10 GMT, Nathan Chancellor wrote:
> > > On Sun, Dec 11, 2022 at 12:03:52PM +0900, Masahiro Yamada wrote:
> > > > Documentation/process/changes.rst notes the minimal GNU Make version,
> > > > but it is not checked anywhere.
> > > > 
> > > > We could check $(MAKE_VERSION), but another simple way is to check
> > > > $(.FEATURES) since the feature list always grows although this way
> > > > is not always possible. For example Make 4.0 through 4.2 have the
> > > > same set of $(.FEATURES).
> > > > 
> > > > Signed-off-by: Masahiro Yamada <masahiroy@kernel.org>
> > > 
> > > Reviewed-by: Nathan Chancellor <nathan@kernel.org>
> > 
> > Reviewed-by: Nicolas Schier <nicolas@fjasle.eu>
> > 
> > > > ---
> > > > 
> > > > Changes in v3:
> > > >   - Check the version in a different way
> > > > 
> > > >  Makefile | 5 +++++
> > > >  1 file changed, 5 insertions(+)
> > > > 
> > > > diff --git a/Makefile b/Makefile
> > > > index 2dda1e9a717a..66dfc5751470 100644
> > > > --- a/Makefile
> > > > +++ b/Makefile
> > > > @@ -11,6 +11,11 @@ NAME = Hurr durr I'ma ninja sloth
> > > >  # Comments in this file are targeted only to the developer, do not
> > > >  # expect to learn how to build the kernel reading this file.
> > > >  
> > > > +# Ensure Make >= 3.82
> > > > +ifeq ($(filter undefine,$(.FEATURES)),)
> > > > +$(error Make $(MAKE_VERSION) is too old)
> > > 
> > > Would it make sense to state what version is needed, similar to the
> > > Kconfig checks for compiler and binutils?
> > 
> > Checking against 'undefine' (introduced in make-3.82~38) is quite a 
> > nice way, I think.  Otherwise we needed something like
> > $(filter 3.82% 3.9% 4.% 5.% ..., $(MAKE_VERSION)).
> > 
> 
> Nathan, sorry, I somehow I read your question completely wrong.  I would also
> appreciate if the minimum make version would be shown in the error message.

No worries, I have done that many a time :) I see Masahiro updated this
to v4 with this feedback taken into consideration so I am glad to see
we are all in agreement.

Cheers,
Nathan

^ permalink raw reply	[flat|nested] 7+ messages in thread

* RE: [PATCH] kbuild: ensure Make >= 3.82 is used
  2022-12-13  3:58   ` Nicolas Schier
  2022-12-13 10:05     ` Nicolas Schier
@ 2022-12-14 11:05     ` David Laight
  2022-12-16  4:30       ` Nicolas Schier
  1 sibling, 1 reply; 7+ messages in thread
From: David Laight @ 2022-12-14 11:05 UTC (permalink / raw)
  To: 'Nicolas Schier', Nathan Chancellor
  Cc: Masahiro Yamada, linux-kbuild, linux-kernel, Nick Desaulniers

From: Nicolas Schier
> Sent: 13 December 2022 03:59
...
> > > diff --git a/Makefile b/Makefile
> > > index 2dda1e9a717a..66dfc5751470 100644
> > > --- a/Makefile
> > > +++ b/Makefile
> > > @@ -11,6 +11,11 @@ NAME = Hurr durr I'ma ninja sloth
> > >  # Comments in this file are targeted only to the developer, do not
> > >  # expect to learn how to build the kernel reading this file.
> > >
> > > +# Ensure Make >= 3.82

Wouldn't it be better to say either:
	# Ensure gmake supports 'undefine' (added in 3.82)
or:
	# Building with gmake versions prior to 3.82 fails due to
	# bug 'brief description'.
	# Check for 'undefine' support as a surrogate for the bug fix.

    David

-
Registered Address Lakeside, Bramley Road, Mount Farm, Milton Keynes, MK1 1PT, UK
Registration No: 1397386 (Wales)


^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [PATCH] kbuild: ensure Make >= 3.82 is used
  2022-12-14 11:05     ` David Laight
@ 2022-12-16  4:30       ` Nicolas Schier
  0 siblings, 0 replies; 7+ messages in thread
From: Nicolas Schier @ 2022-12-16  4:30 UTC (permalink / raw)
  To: David Laight
  Cc: Nathan Chancellor, Masahiro Yamada, linux-kbuild, linux-kernel,
	Nick Desaulniers

[-- Attachment #1: Type: text/plain, Size: 1300 bytes --]

On Wed 14 Dec 2022 11:05:10 GMT, David Laight wrote:
> From: Nicolas Schier
> > Sent: 13 December 2022 03:59
> ...
> > > > diff --git a/Makefile b/Makefile
> > > > index 2dda1e9a717a..66dfc5751470 100644
> > > > --- a/Makefile
> > > > +++ b/Makefile
> > > > @@ -11,6 +11,11 @@ NAME = Hurr durr I'ma ninja sloth
> > > >  # Comments in this file are targeted only to the developer, do not
> > > >  # expect to learn how to build the kernel reading this file.
> > > >
> > > > +# Ensure Make >= 3.82
> 
> Wouldn't it be better to say either:
> 	# Ensure gmake supports 'undefine' (added in 3.82)
> or:
> 	# Building with gmake versions prior to 3.82 fails due to
> 	# bug 'brief description'.
> 	# Check for 'undefine' support as a surrogate for the bug fix.
> 
>     David

'undefine' is not the only feature that has been introduced in make 
3.82 that we use,  e.g. 'private' keyword is used in rust/Makefile but 
'private' is not checkable via .FEATURES.  Checking for 'undefine' in 
.FEATURES is kind of a hack to detect make 3.82, but as written 
earlier, it prevents doing other explicit version comparison like 
$(filter-out 3.80 3.81 3.82 3.99.% $(filter 1.% 2.% 3.*)).

I think $(filter undefine,$(.FEATURES)),) is a sensible compromise.

Kind regards,
Nicolas

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 833 bytes --]

^ permalink raw reply	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2022-12-16  4:31 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-12-11  3:03 [PATCH] kbuild: ensure Make >= 3.82 is used Masahiro Yamada
2022-12-12 17:21 ` Nathan Chancellor
2022-12-13  3:58   ` Nicolas Schier
2022-12-13 10:05     ` Nicolas Schier
2022-12-13 16:42       ` Nathan Chancellor
2022-12-14 11:05     ` David Laight
2022-12-16  4:30       ` Nicolas Schier

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).