Change target `make htmldocs` to combine RST Sphinx and the generation of
Rust documentation, when support is available and .config exists.
Reviewed-by: Akira Yokosawa <akiyks@gmail.com>
Signed-off-by: Carlos Bilbao <carlos.bilbao@amd.com>
---
Documentation/Makefile | 20 ++++++++++++++++++++
1 file changed, 20 insertions(+)
diff --git a/Documentation/Makefile b/Documentation/Makefile
index 023fa658a0a8..3c375c34fd81 100644
--- a/Documentation/Makefile
+++ b/Documentation/Makefile
@@ -59,6 +59,12 @@ PAPEROPT_letter = -D latex_paper_size=letter
KERNELDOC = $(srctree)/scripts/kernel-doc
KERNELDOC_CONF = -D kerneldoc_srctree=$(srctree) -D kerneldoc_bin=$(KERNELDOC)
ALLSPHINXOPTS = $(KERNELDOC_CONF) $(PAPEROPT_$(PAPER)) $(SPHINXOPTS)
+ifneq ($(wildcard $(srctree)/.config),)
+ifeq ($(CONFIG_RUST),y)
+ # Let Sphinx know we will include rustdoc
+ ALLSPHINXOPTS += -t rustdoc
+endif
+endif
# the i18n builder cannot share the environment and doctrees with the others
I18NSPHINXOPTS = $(PAPEROPT_$(PAPER)) $(SPHINXOPTS) .
@@ -95,6 +101,20 @@ htmldocs:
@$(srctree)/scripts/sphinx-pre-install --version-check
@+$(foreach var,$(SPHINXDIRS),$(call loop_cmd,sphinx,html,$(var),,$(var)))
+# If Rust support is available and .config exists, add rustdoc generated contents.
+# If there are any, the errors from this make rustdoc will be displayed but
+# won't stop the execution of htmldocs
+
+ifneq ($(wildcard $(srctree)/.config),)
+ifeq ($(CONFIG_RUST),y)
+ $(Q)$(MAKE) rustdoc || true
+else
+ @echo " Skipping Rust documentation since CONFIG_RUST is not y."
+endif
+else
+ @echo " Skipping Rust documentation since .config was not found."
+endif
+
texinfodocs:
@$(srctree)/scripts/sphinx-pre-install --version-check
@+$(foreach var,$(SPHINXDIRS),$(call loop_cmd,sphinx,texinfo,$(var),texinfo,$(var)))
--
2.34.1
On Mon, Jul 17, 2023 at 5:17 PM Carlos Bilbao <carlos.bilbao@amd.com> wrote: > > + # Let Sphinx know we will include rustdoc > + ALLSPHINXOPTS += -t rustdoc This is needed in the previous patch, no? I don't know if it fails or just does not work, but either way, perhaps you can split that from the first commit to put it last. > +else > + @echo " Skipping Rust documentation since CONFIG_RUST is not y." > +endif Is this printed for everybody? If so, then I think it is a good idea for the future, but perhaps a bit annoying right for most users right now. Cheers, Miguel
On 7/17/23 11:39, Miguel Ojeda wrote: > On Mon, Jul 17, 2023 at 5:17 PM Carlos Bilbao <carlos.bilbao@amd.com> wrote: >> >> + # Let Sphinx know we will include rustdoc >> + ALLSPHINXOPTS += -t rustdoc > > This is needed in the previous patch, no? I don't know if it fails or > just does not work, but either way, perhaps you can split that from > the first commit to put it last. The previous patch works without this, the generated HTML will show in the Rust index: This documentation does not include rustdoc generated information. > >> +else >> + @echo " Skipping Rust documentation since CONFIG_RUST is not y." >> +endif > > Is this printed for everybody? If so, then I think it is a good idea > for the future, but perhaps a bit annoying right for most users right > now. Fair point, will remove as part of v8. > > Cheers, > Miguel (CC'ed rust-for-linux list) Thanks, Carlos
On Tue, Jul 18, 2023 at 3:54 PM Carlos Bilbao <carlos.bilbao@amd.com> wrote: > > The previous patch works without this, the generated HTML will show in the > Rust index: > > This documentation does not include rustdoc generated information. I see, thanks, then it does not matter much. I guess you put it in the first commit because the docs were moved to the URL the docs talk about, but it still means we are using a tag that does not yet exist, so I would have put the "link/URL feature" as a separate commit (together with the creation of the tag). Cheers, Miguel
© 2016 - 2026 Red Hat, Inc.