[PATCH 2/2] Makefile: drop GNU Make < 4.0 compatibility code

Suraj Kakade <[email protected]>
Newsgroups org.u-boot-project.lists.u-boot
Message-ID <[email protected]>
RHEL/CentOS 7, a popular distribution that installs GNU Make 3.82,
reached EOM/EOL on June 30, 2024. While you may get extended support,
it is a good time to raise the minimum GNU Make version.

The new requirement, GNU Make 4.0, was released in October, 2013.

Raise the enforced minimum GNU Make version to 4.0 and drop the
now-unreachable compatibility code for older versions:

- Add an explicit "GNU Make >= 4.0 is required" version-check gate.
- Simplify the "make -s" (silent mode) detection to a single
  unconditional check instead of branching on make-4 vs make-3.8x.
- Drop the GNU Make 3.x sub-make workaround, which is now dead code.

Fixes: ffe29ebc0701 ("kbuild: sync top Makefile with Linux 3.18-rc1")
Fixes: 5f520875bdf0 ("kbuild: Bump the build system to 5.1")
Signed-off-by: Suraj Kakade <[email protected]>
---
 Makefile | 20 +++++---------------
 1 file changed, 5 insertions(+), 15 deletions(-)

diff --git a/Makefile b/Makefile
index 436f384f22a..889ac7bade5 100644
--- a/Makefile
+++ b/Makefile
@@ -12,6 +12,10 @@ NAME =
 # Comments in this file are targeted only to the developer, do not
 # expect to learn how to build the kernel reading this file.
 
+ifeq ($(filter output-sync,$(.FEATURES)),)
+$(error GNU Make >= 4.0 is required. Your Make version is $(MAKE_VERSION))
+endif
+
 $(if $(filter __%, $(MAKECMDGOALS)), \
 	$(error targets prefixed with '__' are only for internal use))
 
@@ -93,15 +97,9 @@ endif
 
 # If the user is running make -s (silent mode), suppress echoing of
 # commands
-ifneq ($(filter 4.%,$(MAKE_VERSION)),)	# make-4
-ifneq ($(filter %s ,$(firstword x$(MAKEFLAGS))),)
-  quiet=silent_
-endif
-else					# make-3.8x
-ifneq ($(filter s% -s%,$(MAKEFLAGS)),)
+ifneq ($(findstring s,$(firstword -$(MAKEFLAGS))),)
   quiet=silent_
 endif
-endif
 
 export quiet Q KBUILD_VERBOSE
 
@@ -166,14 +164,6 @@ ifneq ($(abs_srctree),$(abs_objtree))
 MAKEFLAGS += --include-dir=$(abs_srctree)
 endif
 
-ifneq ($(filter 3.%,$(MAKE_VERSION)),)
-# 'MAKEFLAGS += -rR' does not immediately become effective for GNU Make 3.x
-# We need to invoke sub-make to avoid implicit rules in the top Makefile.
-need-sub-make := 1
-# Cancel implicit rules for this Makefile.
-$(this-makefile): ;
-endif
-
 export abs_srctree abs_objtree
 export sub_make_done := 1
 
-- 
2.43.7
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.