kbuild: ensure Make >= 3.82 is used
PATCH 1/1 kbuild: ensure Make >= 3.82 is used
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).
---
Changes in v3:
- Check the version in a different way
Makefile | 5 +++++ 1 file changed, 5 insertions(+)
Makefile +5 -0
@@ -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))
Signature · 1 line
2.34.1
Quoted 9 lines · Masahiro Yamada
Documentation/process/changes.rstnotes 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 <[email protected]>
Quoted 13 lines
---
Changes in v3:
- Check the version in a different wayMakefile | 5 +++++ 1 file changed, 5 insertions(+)Makefile +0
-0
Makefile NAME = Hurr durr I'ma ninja sloth · line 16
Quoted 6 lines
Makefile +3
-0@@ -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?
Quoted 8 lines
Makefile +2
-0+endif + $(if $(filter __%, $(MAKECMDGOALS)), \ $(error targets prefixed with '__' are only for internal use))Signature · 1 line
2.34.1
Nicolas Schier
Reviewed-byQuoted 4 lines · Nathan Chancellor
Quoted 3 lines · Masahiro Yamada
Documentation/process/changes.rstnotes the minimal GNU Make version, but it is not checked anywhere.
Quoted 8 lines
Quoted 6 lines
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 <[email protected]>Reviewed-by Nathan Chancellor <[email protected]>
Quoted 16 lines
Quoted 16 lines
---
Changes in v3:
- Check the version in a different wayMakefile | 5 +++++ 1 file changed, 5 insertions(+)Makefile +0
-0@@ -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.
Quoted 6 lines
Makefile NAME = Hurr durr I'ma ninja sloth · line 16
Quoted 3 lines
Makefile +3
-0+# 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
Kconfigchecks 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
Quoted 39 lines · On Tue, Dec 13, 2022 at 04:58:30AM +0100 Nicolas Schier wrote:
Quoted 4 lines · Nathan Chancellor
Quoted 3 lines · Masahiro Yamada
Documentation/process/changes.rstnotes the minimal GNU Make version, but it is not checked anywhere.Quoted 8 lines
Quoted 6 lines
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 <[email protected]>Reviewed-by Nathan Chancellor <[email protected]>Reviewed-by Nicolas Schier <[email protected]>Quoted 16 lines
Quoted 16 lines
---
Changes in v3:
- Check the version in a different wayMakefile | 5 +++++ 1 file changed, 5 insertions(+)Makefile +0
-0@@ -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.Quoted 6 lines
Makefile NAME = Hurr durr I'ma ninja sloth · line 16
Quoted 3 lines
Makefile +3
-0+# 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
Kconfigchecks for compiler and binutils?
Quoted 4 lines
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
Nathan Chancellor
maintainerQuoted 40 lines · Nicolas Schier
Quoted 39 lines · On Tue, Dec 13, 2022 at 04:58:30AM +0100 Nicolas Schier wrote:
Quoted 4 lines · Nathan Chancellor
Quoted 3 lines · Masahiro Yamada
Documentation/process/changes.rstnotes the minimal GNU Make version, but it is not checked anywhere.Quoted 8 lines
Quoted 6 lines
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 <[email protected]>Reviewed-by Nathan Chancellor <[email protected]>Reviewed-by Nicolas Schier <[email protected]>Quoted 22 lines
Quoted 13 lines
---
Changes in v3:
- Check the version in a different wayMakefile | 5 +++++ 1 file changed, 5 insertions(+)Makefile +0
-0Makefile NAME = Hurr durr I'ma ninja sloth · line 16
Quoted 6 lines
Makefile +3
-0@@ -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
Kconfigchecks for compiler and binutils?
Quoted 7 lines
Quoted 4 lines
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
From: Nicolas Schier
Quoted 1 line
Sent: 13 December 2022 03:59
...
Quoted 9 lines
Quoted 9 lines
Makefile NAME = Hurr durr I'ma ninja sloth · line 14
Quoted 9 lines
Makefile +1
-0@@ -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)
Quoted 20 lines · David Laight
From: Nicolas Schier
Quoted 1 line
Sent: 13 December 2022 03:59
...
Quoted 9 lines
Quoted 9 lines
Makefile NAME = Hurr durr I'ma ninja sloth · line 14
Quoted 9 lines
Makefile +1
-0@@ -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.82Wouldn'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.
Quoted 1 line
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