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
Cc: linux-doc@vger.kernel.org, linux-kernel@vger.kernel.org,
Chen Miao <chenmiao.ku@gmail.com>
Subject: [PATCH v1 2/2] docs: sphinx-pre-install: check GNU Make version
Date: Sun, 9 Aug 2026 18:19:21 +0800 [thread overview]
Message-ID: <20260809101923.13176-3-chenmiao.ku@gmail.com> (raw)
In-Reply-To: <20260809101923.13176-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. If make is missing
or too old, report it as a missing dependency. Also accept a compatible
gmake command, which is how Homebrew provides GNU Make on macOS.
Document the requirement and the macOS gmake fallback.
Signed-off-by: Chen Miao <chenmiao.ku@gmail.com>
---
Documentation/doc-guide/sphinx.rst | 4 +-
.../translations/zh_CN/doc-guide/sphinx.rst | 2 +
Documentation/translations/zh_CN/how-to.rst | 3 +-
tools/docs/sphinx-pre-install | 52 ++++++++++++++++++-
4 files changed, 58 insertions(+), 3 deletions(-)
diff --git a/Documentation/doc-guide/sphinx.rst b/Documentation/doc-guide/sphinx.rst
index 62aca56b8..d9b9e025f 100644
--- a/Documentation/doc-guide/sphinx.rst
+++ b/Documentation/doc-guide/sphinx.rst
@@ -136,7 +136,9 @@ commands are printed without ``sudo``. The PDF dependencies are provided by
the ``mactex`` cask; use ``--no-pdf`` when only building HTML documentation.
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/Documentation/translations/zh_CN/doc-guide/sphinx.rst b/Documentation/translations/zh_CN/doc-guide/sphinx.rst
index 154142318..93f27d35a 100644
--- a/Documentation/translations/zh_CN/doc-guide/sphinx.rst
+++ b/Documentation/translations/zh_CN/doc-guide/sphinx.rst
@@ -114,6 +114,8 @@ PDF和LaTeX构建
``sudo``。PDF 依赖通过 ``mactex`` cask 提供;如果只构建 HTML 文档,请使用
``--no-pdf``。macOS 用户建议使用默认的 Python 虚拟环境,因为 PyYAML 会从
``Documentation/sphinx/requirements.txt`` 安装,而不是通过 Homebrew 安装。
+脚本还会检查 GNU Make 4.0 或更高版本;如果 Homebrew 将其安装为 ``gmake``,
+请使用 ``gmake htmldocs``,而不是 ``make htmldocs``。
Sphinx构建
==========
diff --git a/Documentation/translations/zh_CN/how-to.rst b/Documentation/translations/zh_CN/how-to.rst
index e8c91d81a..84f277124 100644
--- a/Documentation/translations/zh_CN/how-to.rst
+++ b/Documentation/translations/zh_CN/how-to.rst
@@ -106,7 +106,8 @@ Linux 发行版和简单地使用 Linux 命令行,那么可以迅速开始了
sudo。PDF 构建所需的 MacTeX 通过 Homebrew cask 安装;如果只构建 HTML 文档,
可以执行 ``./tools/docs/sphinx-pre-install --no-pdf``。macOS 用户建议使用默认
的 Python 虚拟环境,因为 PyYAML 会从 ``Documentation/sphinx/requirements.txt``
-安装,而不是通过 Homebrew 安装。
+安装,而不是通过 Homebrew 安装。脚本还会检查 GNU Make 4.0 或更高版本;如果
+Homebrew 将其安装为 ``gmake``,请使用 ``gmake htmldocs``,而不是 ``make htmldocs``。
如果您处于一个多用户环境中,为了避免对其他人造成影响,建议您配置单用户
sphinx 虚拟环境,即只需要执行::
diff --git a/tools/docs/sphinx-pre-install b/tools/docs/sphinx-pre-install
index 51a296cc7..079655078 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,55 @@ 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 (subprocess.CalledProcessError, FileNotFoundError):
+ 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."""
+ make = self.which("make")
+ version = self.get_make_version(make)
+
+ if version and version >= MIN_MAKE_VERSION:
+ return
+
+ # macOS commonly has an incompatible /usr/bin/make, while Homebrew
+ # installs GNU Make as gmake. Also accept gmake on other systems when
+ # it is the only compatible command available.
+ gmake = self.which("gmake")
+ gmake_version = self.get_make_version(gmake)
+ if gmake_version and gmake_version >= MIN_MAKE_VERSION:
+ make_name = os.path.basename(make) if make else "make"
+ gmake_name = os.path.basename(gmake)
+ make_ver = PythonVersion.ver_str(version) if version else "unknown"
+ gmake_ver = PythonVersion.ver_str(gmake_version)
+ print(
+ f"Note: {make_name} ({make_ver}) does not meet the GNU Make "
+ f"requirement; use {gmake_name} ({gmake_ver}) instead."
+ )
+ return
+
+ self.deps.add_package("make", DepManager.SYSTEM_MANDATORY)
+
def check_perl_module(self, prog, dtype):
"""
Does perl have a dependency? Is it available?
@@ -1535,7 +1585,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-09 10:19 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-08-09 10:19 [PATCH v1 0/2] docs: sphinx-pre-install: improve dependency checks Chen Miao
2026-08-09 10:19 ` [PATCH v1 1/2] docs: sphinx-pre-install: add macOS Homebrew support Chen Miao
2026-08-09 13:02 ` Weijie Yuan
2026-08-09 13:21 ` Dongliang Mu
2026-08-09 14:11 ` Weijie Yuan
2026-08-09 19:07 ` Chen Miao
2026-08-09 18:59 ` Chen Miao
2026-08-09 10:19 ` Chen Miao [this message]
2026-08-09 17:18 ` [PATCH v1 2/2] docs: sphinx-pre-install: check GNU Make version Mauro Carvalho Chehab
2026-08-09 19:11 ` 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=20260809101923.13176-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 \
/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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.