[PATCH 1/3] GNUmakefile: Require the user to specify '-R' if their make(1) is too old
From: Alejandro Colomar <alx@kernel.org>
Date: 2025-02-03 10:13:47
Subsystem:
the rest · Maintainer:
Linus Torvalds
From: Alejandro Colomar <alx@kernel.org>
Date: 2025-02-03 10:13:47
Subsystem:
the rest · Maintainer:
Linus Torvalds
And everyone's make(1) is too old. :-) This will allow us to use ?= assignments. Once a new GNU make(1) release is done, we'll be able to rely on our setting of MAKEFLAGS+=-R at the top of the GNUMakefile, but currently, that's not enough, and the user must specify -R to unset implicit variables. Cc: Sam James <redacted> Cc: Paul Smith <redacted> Cc: Guenther Noack <gnoack@google.com> Signed-off-by: Alejandro Colomar <alx@kernel.org> --- GNUmakefile | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-)
diff --git a/GNUmakefile b/GNUmakefile
index fcc96a364..2ed8bcc30 100644
--- a/GNUmakefile
+++ b/GNUmakefile@@ -1,4 +1,4 @@ -# Copyright 2021-2024, Alejandro Colomar <alx@kernel.org> +# Copyright 2021-2025, Alejandro Colomar <alx@kernel.org> # SPDX-License-Identifier: LGPL-3.0-only WITH LGPL-3.0-linking-exception
@@ -6,6 +6,13 @@ SHELL := bash .SHELLFLAGS := -Eeuo pipefail -c +ifneq (4.4.999,$(firstword $(sort 4.4.999 $(MAKE_VERSION)))) + ifneq (R,$(findstring R, $(firstword -$(MAKEFLAGS)))) + $(error Please run make(1) with the '-R' flag) + endif +endif + + MAKEFLAGS += --no-builtin-rules MAKEFLAGS += --no-builtin-variables MAKEFLAGS += --warn-undefined-variables
--
2.47.2