From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mail-pg1-f169.google.com (mail-pg1-f169.google.com [209.85.215.169]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 9F5EF391E7C for ; Sun, 9 Aug 2026 10:19:42 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.215.169 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1786270784; cv=none; b=gj9ni4Pj8dwQ2s9Nhr6yIwX5mujnTsqX98ki2KS6xF/WvtDEf1vaNDoWndHH+Wc/W3VquqN2LPEZFfpY+1vxC9OrUXLOeKSsj8sUhBmyCTu4ndZBqYs/HQaWMJwTMKJs9ofltYd4U/iZsGMI5crhvRO1e2gaU5B2vXIUlU9MDf0= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1786270784; c=relaxed/simple; bh=/i6kEpz5wmIoaseuOyVhaNR4V1C7KIvR8SZtaPFOafU=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=FWSTfcT8bg//1bUsvtpvkjdCGM89K7h59LXwcKJd/JRAJlH3XqhoWfclYMtkrlQNAqp0EKp6wbtjReh3DYcfbQmlLUBbJ9uxV5AvCxUBbW+SGhtJFsAN2Qkp2WLAtBfCjR92KcHAtr61MHUeuIwno7R00Pe+J/uUPyxh+f8Zs/0= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com; spf=pass smtp.mailfrom=gmail.com; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b=MD8gvEG1; arc=none smtp.client-ip=209.85.215.169 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="MD8gvEG1" Received: by mail-pg1-f169.google.com with SMTP id 41be03b00d2f7-ca88130e09aso612772a12.3 for ; Sun, 09 Aug 2026 03:19:42 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20251104; t=1786270782; x=1786875582; darn=vger.kernel.org; h=content-transfer-encoding:content-type:mime-version:references :in-reply-to:message-id:date:subject:cc:to:from:from:to:cc:subject :date:message-id:reply-to:content-type; bh=QPwYJ1xuRDlGdV5WCrmZ+pmRm2w/eGmXKPl/ug4pFzw=; b=MD8gvEG1S4t/EuEALsziJ670Hz8OlFs1HqeBNS7nXYDZWEnHd9lD3OMKTJGYgcWITw +B9+ECDn0b3bg3obZrBe01PQDhMA72R3RvJJ5wq3YdWBD97earaBDqV3xF1DQOsfHSzr uFtSJXMrEThfHfwjQlLXSUE6y2TpTEmqXUojhK09DLrjyAHEIgmQKSaPoZst/rLkz+gJ lvv35UtcA3rqPhXtwIK/9gvbfDmLd/TLn+znl/VjtUPA3PGXD1csKzrfLlg3nuKaSz/G S9D9ba11zQt/hdrgEIzWHPAhH0T5pB0J6fplL3qWwC7LWWH2D4L+ooJr0P6qlcocOoWe IuAQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1786270782; x=1786875582; h=content-transfer-encoding:content-type:mime-version:references :in-reply-to:message-id:date:subject:cc:to:from:x-gm-gg :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to :content-type; bh=QPwYJ1xuRDlGdV5WCrmZ+pmRm2w/eGmXKPl/ug4pFzw=; b=Bg2IIPDU78WgVnbqRlUpoXHPp0nXTGnLAgolafn6LoqMlNIB1hxLZcJrmCw6GzNIUH 2CoZErKYn4PMEKoQB79AHGlbOevg6Sbi9fvQgXJEhAOTfeCY2He+wPXRjgMhcx8uoUU1 vOAI7YrT+qGYLPikdG4E3OTAYQ+s/IZXFbo1Efbg6ko7rw4f/9Fd7BRyqsyRXikdo4kb NzWuxMKD4wVaFNaNDq0N1Anl/mB5scVL917OqP6aXf5lg70/5eWc4TU60RaU5meZfWuo tJ3Bl9hMqZhIW0G1BBluvyOY1ywm9Y725gA++ksF+jNS1TakjEErnxnCaxPwuzdd/w6F fXfA== X-Forwarded-Encrypted: i=1; AHgh+RpYKjQOPmx95Rjz8mO4F3V63Ib0vnU9ZXxV29/Pe7C1Puor5HneRlYWyacLRs7f1qs8wzRutYTAq6GY9Sg=@vger.kernel.org X-Gm-Message-State: AOJu0YzXKHGiNY+JGhsxVc3e9JF/cjgMSN7NIWtHWfECe7hTM9rqpO3A mst0TDIB37FNKJoKCqMMpxHFPqJa2RELueH5ympfYTD5svaurBxti3zG X-Gm-Gg: AR+sD124+CdH2HONgQPmv3d/FIzU1O+mbUxYggNm5yvczVUUyE0yW8G6xqefWg2gL6w NvS/zMX9gtMavnbYUN93K6Ex1Xi2SHEODBqA8XteA7bj/JQoBFicjmFZMfnwO1e61FiWY6a131f hCC9a0AciQ8Gfkau92+nBpQdF2/TsnlGcNTi7yPHPIoQTGn1I4N+53DSim+fb2nW40Wjq0oTX0J JH9S6wCFCHTD9tg532KlAMUAlRWYygpvdMGdms2ukS7atDivX+vAQEYXvmHUCGfutqRLFyNJ09t Miil3QO86l+cOiZYRWqb0/ZJ9wHexoZBPsX236VnY/XpYQ2U0X80NQ/5cQnPAoqO+0rFmyarMHc CTVNIdGezfmx866IN7/g576E7nmbeYmh4N1/xCz74nC9J1OtgLbY8ypK0yzNYNgo6k/bFClUlo2 2y8CwPHoq5qwyT60YLoE0FcV645ZhHUTDHAw4i/2M3WCekUX+nlQw0HG43EuBl2yNBK3KEZsbzD Ho= X-Received: by 2002:a05:6a20:9e48:b0:3c3:875d:704d with SMTP id adf61e73a8af0-3cb85ee77c2mr46113590637.25.1786270781667; Sun, 09 Aug 2026 03:19:41 -0700 (PDT) Received: from localhost.localdomain ([64.186.250.142]) by smtp.gmail.com with ESMTPSA id 5a478bee46e88-315be8a9220sm31496134eec.7.2026.08.09.03.19.38 (version=TLS1_3 cipher=TLS_CHACHA20_POLY1305_SHA256 bits=256/256); Sun, 09 Aug 2026 03:19:41 -0700 (PDT) From: Chen Miao 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 Subject: [PATCH v1 2/2] docs: sphinx-pre-install: check GNU Make version Date: Sun, 9 Aug 2026 18:19:21 +0800 Message-ID: <20260809101923.13176-3-chenmiao.ku@gmail.com> X-Mailer: git-send-email 2.50.1 In-Reply-To: <20260809101923.13176-1-chenmiao.ku@gmail.com> References: <20260809101923.13176-1-chenmiao.ku@gmail.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 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 --- 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)