From: Chen Miao <chenmiao.ku@gmail.com>
To: corbet@lwn.net, alexs@kernel.org, si.yanteng@linux.dev,
skhan@linuxfoundation.org, dzm91@hust.edu.cn, mchehab@kernel.org,
wy@wyuan.org
Cc: linux-doc@vger.kernel.org, linux-kernel@vger.kernel.org,
Chen Miao <chenmiao.ku@gmail.com>
Subject: [PATCH v2 2/5] docs: sphinx-pre-install: check GNU Make version
Date: Mon, 10 Aug 2026 22:33:06 +0800 [thread overview]
Message-ID: <20260810143311.57775-3-chenmiao.ku@gmail.com> (raw)
In-Reply-To: <20260810143311.57775-1-chenmiao.ku@gmail.com>
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. Document the requirement and the macOS gmake
invocation.
Signed-off-by: Chen Miao <chenmiao.ku@gmail.com>
---
Documentation/doc-guide/sphinx.rst | 4 ++-
tools/docs/sphinx-pre-install | 41 +++++++++++++++++++++++++++++-
2 files changed, 43 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 1b9d77ec3..54f36c3b8 100755
--- a/tools/docs/sphinx-pre-install
+++ b/tools/docs/sphinx-pre-install
@@ -40,6 +40,7 @@ from kdoc.python_version import PythonVersion
RECOMMENDED_VERSION = PythonVersion("3.4.3").version
MIN_PYTHON_VERSION = PythonVersion("3.7").version
+MIN_MAKE_VERSION = PythonVersion("4.0").version
class DepManager:
@@ -308,6 +309,44 @@ class MissingCheckers(AncillaryMethods):
return None
+ def get_make_version(self, cmd):
+ """Get the GNU Make version, or None if cmd is not GNU Make."""
+ if not cmd:
+ return None
+
+ try:
+ result = self.run(
+ [cmd, "--version"],
+ capture_output=True,
+ text=True,
+ check=True,
+ )
+ except (OSError, subprocess.CalledProcessError):
+ return None
+
+ match = re.search(
+ r"^GNU Make\s+([0-9]+(?:\.[0-9]+)*)", result.stdout, re.MULTILINE
+ )
+ if not match:
+ return None
+
+ return PythonVersion.parse_version(match.group(1))
+
+ def check_make(self):
+ """Check for GNU Make 4.0 or newer."""
+ candidates = (
+ os.environ.get("MAKE"),
+ self.which("gmake"),
+ self.which("make"),
+ )
+
+ for make in candidates:
+ version = self.get_make_version(make)
+ if version and version >= MIN_MAKE_VERSION:
+ 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 +1598,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)
next prev parent reply other threads:[~2026-08-10 14:33 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-08-10 14:33 [PATCH v2 0/5] docs: sphinx-pre-install: improve dependency checks Chen Miao
2026-08-10 14:33 ` [PATCH v2 1/5] docs: sphinx-pre-install: add macOS Homebrew support Chen Miao
2026-08-10 19:56 ` Mauro Carvalho Chehab
2026-08-10 14:33 ` Chen Miao [this message]
2026-08-10 14:33 ` [PATCH v2 3/5] docs: sphinx-build-wrapper: prefer gmake Chen Miao
2026-08-10 14:33 ` [PATCH v2 4/5] docs/zh_CN: doc-guide: document macOS Sphinx setup Chen Miao
2026-08-10 14:33 ` [PATCH v2 5/5] docs/zh_CN: how-to: document case-sensitive APFS setup Chen Miao
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20260810143311.57775-3-chenmiao.ku@gmail.com \
--to=chenmiao.ku@gmail.com \
--cc=alexs@kernel.org \
--cc=corbet@lwn.net \
--cc=dzm91@hust.edu.cn \
--cc=linux-doc@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=mchehab@kernel.org \
--cc=si.yanteng@linux.dev \
--cc=skhan@linuxfoundation.org \
--cc=wy@wyuan.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox