]> git.ipfire.org Git - thirdparty/man-pages.git/commitdiff
GNUmakefile: Require the user to specify '-R' if their make(1) is too old
authorAlejandro Colomar <alx@kernel.org>
Mon, 3 Feb 2025 09:12:28 +0000 (10:12 +0100)
committerAlejandro Colomar <alx@kernel.org>
Mon, 10 Feb 2025 11:51:18 +0000 (12:51 +0100)
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 <sam@gentoo.org>
Cc: Paul Smith <psmith@gnu.org>
Cc: Guenther Noack <gnoack@google.com>
Signed-off-by: Alejandro Colomar <alx@kernel.org>
GNUmakefile

index fcc96a3647b600b8850ed20e2b5b86b88bded2f0..63e7393928d7749fa124398149fca98cfd65dca7 100644 (file)
@@ -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' option)
+  endif
+endif
+
+
 MAKEFLAGS += --no-builtin-rules
 MAKEFLAGS += --no-builtin-variables
 MAKEFLAGS += --warn-undefined-variables
@@ -38,7 +45,7 @@ nothing:;
 .PHONY: help
 help:
        $(info  $(INFO_)To see a list of targets, run:)
-       $(info  $(INFO_)        $$ make nothing -p \)
+       $(info  $(INFO_)        $$ make -R -p nothing \)
        $(info  $(INFO_)        | grep '^\.PHONY:' \)
        $(info  $(INFO_)        | tr ' ' '\n' \)
        $(info  $(INFO_)        | grep -v '^\.PHONY:' \)