[PATCH v3 3/6] docs: sphinx-pre-install: check GNU Make version
From: Chen Miao
Date: Wed Aug 12 2026 - 14:24:06 EST
The kernel documentation build requires GNU Make 4.0 or newer, but the
Sphinx dependency checker only verifies that a make executable exists. This
lets incompatible make implementations pass the check and fail later during
the build.
Check the GNU Make version on all supported systems. Prefer a compatible
gmake command, which is how Homebrew provides GNU Make on macOS, and fall
back to make. Use the common kdoc detector so the dependency checker and
build wrapper apply the same selection logic. Document the requirement and
the macOS gmake invocation.
Signed-off-by: Chen Miao <chenmiao.ku@xxxxxxxxx>
---
Documentation/doc-guide/sphinx.rst | 4 +++-
tools/docs/sphinx-pre-install | 10 +++++++++-
2 files changed, 12 insertions(+), 2 deletions(-)
diff --git a/Documentation/doc-guide/sphinx.rst b/Documentation/doc-guide/sphinx.rst
index 1e105542a..4fb716e77 100644
--- a/Documentation/doc-guide/sphinx.rst
+++ b/Documentation/doc-guide/sphinx.rst
@@ -147,7 +147,9 @@ documentation. After installing MacTeX, restart the terminal or run
``eval "$(/usr/libexec/path_helper)"`` so its command-line tools are visible.
The default virtualenv mode is recommended on macOS because PyYAML is
installed from ``Documentation/sphinx/requirements.txt`` rather than from a
-Homebrew formula.
+Homebrew formula. The script also checks for GNU Make 4.0 or newer; when
+Homebrew provides it as ``gmake``, use ``gmake htmldocs`` instead of
+``make htmldocs``.
Installing Sphinx Minimal Version
---------------------------------
diff --git a/tools/docs/sphinx-pre-install b/tools/docs/sphinx-pre-install
index 1956f1369..7625ac5a4 100755
--- a/tools/docs/sphinx-pre-install
+++ b/tools/docs/sphinx-pre-install
@@ -37,6 +37,7 @@ import os.path
src_dir = os.path.dirname(os.path.realpath(__file__))
sys.path.insert(0, os.path.join(src_dir, '../lib/python'))
from kdoc.python_version import PythonVersion
+from kdoc.gmake_detect import find_gmake
RECOMMENDED_VERSION = PythonVersion("3.4.3").version
MIN_PYTHON_VERSION = PythonVersion("3.7").version
@@ -308,6 +309,13 @@ class MissingCheckers(AncillaryMethods):
return None
+ def check_make(self):
+ """Check for GNU Make 4.0 or newer."""
+ if find_gmake(os.environ.get("MAKE")):
+ return
+
+ self.deps.add_package("make", DepManager.SYSTEM_MANDATORY)
+
def check_perl_module(self, prog, dtype):
"""
Does perl have a dependency? Is it available?
@@ -1559,7 +1567,7 @@ class SphinxDependencyChecker(MissingCheckers):
# Check for needed programs/tools
self.check_perl_module("Pod::Usage", DepManager.SYSTEM_MANDATORY)
- self.check_program("make", DepManager.SYSTEM_MANDATORY)
+ self.check_make()
self.check_program("which", DepManager.SYSTEM_MANDATORY)
self.check_program("dot", DepManager.SYSTEM_OPTIONAL)
--
2.50.1 (Apple Git-155)