docs: Integrate rustdoc into Rust documentation
Subsystems (2)
PATCH 1/1 docs: Integrate rustdoc into Rust documentation
Include HTML output generated with rustdoc into the Linux kernel documentation on Rust. Change target make htmldocs to combine RST Sphinx and the generation of Rust documentation, when support is available.
--- Documentation/Makefile | 4 ++++ Documentation/rust/index.rst | 1 + Documentation/rust/rustdoc.rst | 7 +++++++ rust/Makefile | 15 +++++++++------ 4 files changed, 21 insertions(+), 6 deletions(-) create mode 100644 Documentation/rust/rustdoc.rst
Documentation/Makefile +4 -0
@@ -92,6 +92,10 @@ quiet_cmd_sphinx = SPHINX $@ --> file://$(abspath $(BUILDDIR)/$3/$4) fi htmldocs: +# If Rust support is available, add rustdoc generated contents +ifdef CONFIG_RUST + @make LLVM=1 rustdoc +endif @$(srctree)/scripts/sphinx-pre-install --version-check @+$(foreach var,$(SPHINXDIRS),$(call loop_cmd,sphinx,html,$(var),,$(var)))
Documentation/rust/index.rst +1 -0
@@ -13,6 +13,7 @@ in the kernel, please read the quick-start.rst guide. general-information coding-guidelines arch-support + rustdoc .. only:: subproject and html
Documentation/rust/rustdoc.rst new file +7 -0
@@ -0,0 +1,7 @@ +.. SPDX-License-Identifier: GPL-2.0 + +Rustdoc output +============== + +If this documentation includes rustdoc-generated HTML, the entry point +can be found `here. <rustdoc/kernel/index.html>`_
rust/Makefile +9 -6
@@ -1,5 +1,8 @@ # SPDX-License-Identifier: GPL-2.0 +# Where to place rustdoc generated documentation +RUSTDOC_OUTPUT=$(objtree)/Documentation/output/rust/rustdoc + always-$(CONFIG_RUST) += target.json no-clean-files += target.json
@@ -67,7 +70,7 @@ quiet_cmd_rustdoc = RUSTDOC $(if $(rustdoc_host),H, ) $< OBJTREE=$(abspath $(objtree)) \ $(RUSTDOC) $(if $(rustdoc_host),$(rust_common_flags),$(rust_flags)) \ $(rustc_target_flags) -L$(objtree)/$(obj) \ - --output $(objtree)/$(obj)/doc \ + --output $(RUSTDOC_OUTPUT) \ --crate-name $(subst rustdoc-,,$@) \ @$(objtree)/include/generated/rustc_cfg $<
@@ -84,15 +87,15 @@ quiet_cmd_rustdoc = RUSTDOC $(if $(rustdoc_host),H, ) $< # and then retouch the generated files. rustdoc: rustdoc-core rustdoc-macros rustdoc-compiler_builtins \ rustdoc-alloc rustdoc-kernel - $(Q)cp $(srctree)/Documentation/images/logo.svg $(objtree)/$(obj)/doc - $(Q)cp $(srctree)/Documentation/images/COPYING-logo $(objtree)/$(obj)/doc - $(Q)find $(objtree)/$(obj)/doc -name '*.html' -type f -print0 | xargs -0 sed -Ei \ + $(Q)cp $(srctree)/Documentation/images/logo.svg $(RUSTDOC_OUTPUT) + $(Q)cp $(srctree)/Documentation/images/COPYING-logo $(RUSTDOC_OUTPUT) + $(Q)find $(RUSTDOC_OUTPUT) -name '*.html' -type f -print0 | xargs -0 sed -Ei \ -e 's:rust-logo\.svg:logo.svg:g' \ -e 's:rust-logo\.png:logo.svg:g' \ -e 's:favicon\.svg:logo.svg:g' \ -e 's:<link rel="alternate icon" type="image/png" href="[./]*favicon-(16x16|32x32)\.png">::g' $(Q)echo '.logo-container > img { object-fit: contain; }' \ - >> $(objtree)/$(obj)/doc/rustdoc.css + >> $(RUSTDOC_OUTPUT)/rustdoc.css rustdoc-macros: private rustdoc_host = yes rustdoc-macros: private rustc_target_flags = --crate-type proc-macro \
@@ -153,7 +156,7 @@ quiet_cmd_rustdoc_test = RUSTDOC T $< @$(objtree)/include/generated/rustc_cfg \ $(rustc_target_flags) $(rustdoc_test_target_flags) \ --sysroot $(objtree)/$(obj)/test/sysroot $(rustdoc_test_quiet) \ - -L$(objtree)/$(obj)/test --output $(objtree)/$(obj)/doc \ + -L$(objtree)/$(obj)/test --output $(RUSTDOC_OUTPUT) \ --crate-name $(subst rusttest-,,$@) $< quiet_cmd_rustdoc_test_kernel = RUSTDOC TK $<
Signature · 1 line
2.34.1
Quoted 4 lines · Carlos Bilbao
Include HTML output generated with rustdoc into the Linux kernel documentation on Rust. Change target
make htmldocsto combine RST Sphinx and the generation of Rust documentation, when support is available.
Looks better, thanks for this v2! A few comments below...
Documentation/Makefile quiet_cmd_sphinx = SPHINX $@ --> file://$(abspath $(BUILDDIR)/$3/$4) · line 98
Quoted 3 lines
Documentation/Makefile +3
-0+ifdef CONFIG_RUST + @make LLVM=1 rustdoc +endif
The Rust docs should probably be built with the build system/config/... as given, whether it is GCC, LLVM, etc. This should probably use $(MAKE) too; and if you intended to remove the command line definitions, MAKEOVERRIDES too.
Ideally htmldocs would depend on rustdoc, though that would require shuffling quite a few things since to build the Rust docs we need a subset of the Rust dependencies built. Given we may be changing things soon anyway on the Rust Makefile, we can leave that for the future.
By the way, while checking this, I noticed we use some CONFIG_s in this Makefile, but we do not perform a config sync for the *docs targets, so one needs to do so manually, i.e. it can be a pitfall for e.g. CONFIG_WARN_MISSING_DOCUMENTS and as well as a potential CONFIG_RUST`. Should this be fixed orthogonally, or is it intended? (some targets do not need the sync, and the ones that need are probably less used, so I guess that could be the reason?).
Documentation/rust/rustdoc.rst line 7
Quoted 5 lines
Documentation/rust/rustdoc.rst new file +5
-0+Rustdoc output +============== + +If this documentation includes rustdoc-generated HTML, the entry point +can be found `here. <rustdoc/kernel/index.html>`_
Perhaps this sentence could be moved to the top of the index file, so that users do not need two clicks when visiting "Rust"? That way we avoid one more file too.
Quoted 1 line
+RUSTDOC_OUTPUT=$(objtree)/Documentation/output/rust/rustdoc
Please add a space around the equal sign to be consistent with (most) of the rest of the file.
Cheers,
Miguel
Quoted 9 lines · Miguel Ojeda
Documentation/Makefile quiet_cmd_sphinx = SPHINX $@ --> file://$(abspath $(BUILDDIR)/$3/$4) · line 98
Quoted 3 lines · Carlos Bilbao
Documentation/Makefile +3
-0+ifdef CONFIG_RUST + @make LLVM=1 rustdoc +endifThe Rust docs should probably be built with the build system/config/... as given, whether it is GCC, LLVM, etc. This should probably use
$(MAKE)too; and if you intended to remove the command line definitions,MAKEOVERRIDEStoo.
Sounds good.
Quoted 7 lines
By the way, while checking this, I noticed we use some
CONFIG_s in thisMakefile, but we do not perform a config sync for the*docstargets, so one needs to do so manually, i.e. it can be a pitfall for e.g.CONFIG_WARN_MISSING_DOCUMENTSandas well as a potentialCONFIG_RUST`. Should this be fixed orthogonally, or is it intended? (some targets do not need the sync, and the ones that need are probably less used, so I guess that could be the reason?).
I don't understand config sync. Perhaps that, e.g. Documentation/Makefile checks for broken docs, for CONFIG_WARN_MISSING_DOCUMENTS, but we don't do that for rust/Makefile? I'm not sure, but it does sound orthogonal, yes.
Quoted 9 lines
Documentation/rust/rustdoc.rst line 7
Quoted 6 lines
Documentation/rust/rustdoc.rst new file +5
-0+Rustdoc output +============== + +If this documentation includes rustdoc-generated HTML, the entry point +can be found `here. <rustdoc/kernel/index.html>`_Perhaps this sentence could be moved to the top of the index file, so that users do not need two clicks when visiting "Rust"? That way we avoid one more file too.
Yes, that will be better :)
Quoted 4 lines
Quoted 2 lines
+RUSTDOC_OUTPUT=$(objtree)/Documentation/output/rust/rustdoc
Please add a space around the equal sign to be consistent with (most) of the rest of the file.
Ack
Quoted 3 lines
Cheers,
Miguel
Thanks,
Carlos
Quoted 4 lines · Carlos Bilbao
I don't understand config sync. Perhaps that, e.g.
Documentation/Makefilechecks for broken docs, forCONFIG_WARN_MISSING_DOCUMENTS, but we don't do that forrust/Makefile? I'm not sure, but it does sound orthogonal, yes.
Config sync is what needs to happen to make a bunch of files in include/ up to date with respect to the .config. It runs automatically for some targets, but not always. For instance, the *docs targets do not trigger it. So if you enable e.g. CONFIG_WARN_MISSING_DOCUMENTS, and immediately afterwards run htmldocs, it will not take it into account.
But don't worry about it: that part of my comment was directed at others (e.g. Jon, Akira...) that may know the historical context or the reason behind it -- no need to fix it here. I mentioned it here since it affects CONFIG_RUST if we use it there (in the same way as the other CONFIG_* used there).
Cheers,
Miguel
Quoted 11 lines · Miguel Ojeda
Quoted 3 lines · Carlos Bilbao
I don't understand config sync. Perhaps that, e.g.
Documentation/Makefilechecks for broken docs, forCONFIG_WARN_MISSING_DOCUMENTS, but we don't do that forrust/Makefile? I'm not sure, but it does sound orthogonal, yes.Config sync is what needs to happen to make a bunch of files in
include/up to date with respect to the.config. It runs automatically for some targets, but not always. For instance, the*docstargets do not trigger it. So if you enable e.g.CONFIG_WARN_MISSING_DOCUMENTS, and immediately afterwards runhtmldocs, it will not take it into account.
Quoted 5 lines
But don't worry about it: that part of my comment was directed at others (e.g. Jon, Akira...) that may know the historical context or the reason behind it -- no need to fix it here. I mentioned it here since it affects
CONFIG_RUSTif we use it there (in the same way as the otherCONFIG_*used there).
Ah, that makes sense. I appreciate the clarification!
Quoted 3 lines
Cheers,
Miguel
Thanks,
Carlos
PATCH v2 1/1 docs: Integrate rustdoc into Rust documentation
In reply to Carlos BilbaoInclude HTML output generated with rustdoc into the Linux kernel documentation on Rust. Change target make htmldocs to combine RST Sphinx and the generation of Rust documentation, when support is available.
---
Changes since V1:
- Work on top of v6.1-rc1.
- Don't use rustdoc.rst, instead add link to Documentation/rust/index.rst.
- In Documentation/Makefile, replace @make rustdoc for $(Q)$(MAKE) rustdoc.
- Don't do LLVM=1 for all rustdoc generation within make htmldocs.
- Add spaces on definition of RUSTDOC_OUTPUT, for consistency.
--- Documentation/Makefile | 4 ++++ Documentation/rust/index.rst | 3 +++ rust/Makefile | 15 +++++++++------ 3 files changed, 16 insertions(+), 6 deletions(-)
Documentation/Makefile +4 -0
@@ -92,6 +92,10 @@ quiet_cmd_sphinx = SPHINX $@ --> file://$(abspath $(BUILDDIR)/$3/$4) fi htmldocs: +# If Rust support is available, add rustdoc generated contents +ifdef CONFIG_RUST + $(Q)$(MAKE) rustdoc +endif @$(srctree)/scripts/sphinx-pre-install --version-check @+$(foreach var,$(SPHINXDIRS),$(call loop_cmd,sphinx,html,$(var),,$(var)))
Documentation/rust/index.rst +3 -0
@@ -6,6 +6,9 @@ Rust Documentation related to Rust within the kernel. To start using Rust in the kernel, please read the quick-start.rst guide. +If this documentation includes rustdoc-generated HTML, the entry point can +be found `here. <rustdoc/kernel/index.html>`_ + .. toctree:: :maxdepth: 1
rust/Makefile +9 -6
@@ -1,5 +1,8 @@ # SPDX-License-Identifier: GPL-2.0 +# Where to place rustdoc generated documentation +RUSTDOC_OUTPUT = $(objtree)/Documentation/output/rust/rustdoc + always-$(CONFIG_RUST) += target.json no-clean-files += target.json
@@ -58,7 +61,7 @@ quiet_cmd_rustdoc = RUSTDOC $(if $(rustdoc_host),H, ) $< OBJTREE=$(abspath $(objtree)) \ $(RUSTDOC) $(if $(rustdoc_host),$(rust_common_flags),$(rust_flags)) \ $(rustc_target_flags) -L$(objtree)/$(obj) \ - --output $(objtree)/$(obj)/doc \ + --output $(RUSTDOC_OUTPUT) \ --crate-name $(subst rustdoc-,,$@) \ @$(objtree)/include/generated/rustc_cfg $<
@@ -75,15 +78,15 @@ quiet_cmd_rustdoc = RUSTDOC $(if $(rustdoc_host),H, ) $< # and then retouch the generated files. rustdoc: rustdoc-core rustdoc-macros rustdoc-compiler_builtins \ rustdoc-alloc rustdoc-kernel - $(Q)cp $(srctree)/Documentation/images/logo.svg $(objtree)/$(obj)/doc - $(Q)cp $(srctree)/Documentation/images/COPYING-logo $(objtree)/$(obj)/doc - $(Q)find $(objtree)/$(obj)/doc -name '*.html' -type f -print0 | xargs -0 sed -Ei \ + $(Q)cp $(srctree)/Documentation/images/logo.svg $(RUSTDOC_OUTPUT) + $(Q)cp $(srctree)/Documentation/images/COPYING-logo $(RUSTDOC_OUTPUT) + $(Q)find $(RUSTDOC_OUTPUT) -name '*.html' -type f -print0 | xargs -0 sed -Ei \ -e 's:rust-logo\.svg:logo.svg:g' \ -e 's:rust-logo\.png:logo.svg:g' \ -e 's:favicon\.svg:logo.svg:g' \ -e 's:<link rel="alternate icon" type="image/png" href="[./]*favicon-(16x16|32x32)\.png">::g' $(Q)echo '.logo-container > img { object-fit: contain; }' \ - >> $(objtree)/$(obj)/doc/rustdoc.css + >> $(RUSTDOC_OUTPUT)/rustdoc.css rustdoc-macros: private rustdoc_host = yes rustdoc-macros: private rustc_target_flags = --crate-type proc-macro \
@@ -141,7 +144,7 @@ quiet_cmd_rustdoc_test = RUSTDOC T $< @$(objtree)/include/generated/rustc_cfg \ $(rustc_target_flags) $(rustdoc_test_target_flags) \ --sysroot $(objtree)/$(obj)/test/sysroot $(rustdoc_test_quiet) \ - -L$(objtree)/$(obj)/test --output $(objtree)/$(obj)/doc \ + -L$(objtree)/$(obj)/test --output $(RUSTDOC_OUTPUT) \ --crate-name $(subst rusttest-,,$@) $< # We cannot use `-Zpanic-abort-tests` because some tests are dynamic,
base-commit: 9abf2313adc1ca1b6180c508c25f22f9395cc780
Signature · 1 line
2.34.1
Hi,
Quoted 9 lines · Carlos Bilbao
Include HTML output generated with rustdoc into the Linux kernel documentation on Rust. Change target
make htmldocsto combine RST Sphinx and the generation of Rust documentation, when support is available.Signed-off-by Carlos Bilbao <[email protected]>---
Changes since V1:
- Work on top of v6.1-rc1.
Thank you for the rebase.
Quoted 16 lines
- Don't use
rustdoc.rst, instead add link toDocumentation/rust/index.rst.
- InDocumentation/Makefile, replace @make rustdoc for $(Q)$(MAKE) rustdoc.
- Don't do LLVM=1 for all rustdoc generation withinmake htmldocs.
- Add spaces on definition ofRUSTDOC_OUTPUT, for consistency.--- Documentation/Makefile | 4 ++++ Documentation/rust/index.rst | 3 +++ rust/Makefile | 15 +++++++++------ 3 files changed, 16 insertions(+), 6 deletions(-)Documentation/Makefile +0
-0
Documentation/Makefile quiet_cmd_sphinx = SPHINX $@ --> file://$(abspath $(BUILDDIR)/$3/$4) · line 100
Quoted 9 lines
Documentation/Makefile +4
-0@@ -92,6 +92,10 @@ quiet_cmd_sphinx = SPHINX $@ --> file://$(abspath $(BUILDDIR)/$3/$4) fi htmldocs: +# If Rust support is available, add rustdoc generated contents +ifdef CONFIG_RUST + $(Q)$(MAKE) rustdoc +endif @$(srctree)/scripts/sphinx-pre-install --version-check @+$(foreach var,$(SPHINXDIRS),$(call loop_cmd,sphinx,html,$(var),,$(var)))
So, this means "make htmldocs" will require kernel .config if CONFIG_RUST=y. I'm not sure this new requirement is acceptable for kernel documentation testers who just want to build kernel documentation.
You are doing three things in this patch.
1) Change the destination of rustdoc to under Documentation/output/
2) Add a cross reference to the generated rustdoc in Documentation/rust/index.rst.
3) Integrate rustdoc generation into htmldocs.
I'm OK with 1) and 2).
Can you separate 3) into another patch and respin?
By the way, is rustdoc's requirement of .config only for CONFIG_RUST? In other words, are contents of rustdoc affected by other config settings?
If not, I think rustdoc can be generated regardless of config settings as far as necessary tools (rustc, bindgen, etc.) are available.
Documentation/rust/index.rst Rust · line 10
Quoted 11 lines
Documentation/rust/index.rst +2
-0@@ -6,6 +6,9 @@ Rust Documentation related to Rust within the kernel. To start using Rust in the kernel, please read the quick-start.rst guide. +If this documentation includes rustdoc-generated HTML, the entry point can +be found `here. <rustdoc/kernel/index.html>`_
This cross reference will only make sense in htmldocs build. Perhaps, you can use the "only::" directive [1] as follows:
.. only:: html
If this documentation includes rustdoc-generated HTML, the entry point can be found here. <rustdoc/kernel/index.html>_
[1]: https://www.sphinx-doc.org/en/master/usage/restructuredtext/directives.html#directive-only
Thanks, Akira
Quoted 57 lines
Documentation/rust/index.rst +1
-0+ .. toctree:: :maxdepth: 1rust/Makefile +9
-6@@ -1,5 +1,8 @@ # SPDX-License-Identifier: GPL-2.0 +# Where to place rustdoc generated documentation +RUSTDOC_OUTPUT = $(objtree)/Documentation/output/rust/rustdoc + always-$(CONFIG_RUST) += target.json no-clean-files += target.json@@ -58,7 +61,7 @@ quiet_cmd_rustdoc = RUSTDOC $(if $(rustdoc_host),H, ) $< OBJTREE=$(abspath $(objtree)) \ $(RUSTDOC) $(if $(rustdoc_host),$(rust_common_flags),$(rust_flags)) \ $(rustc_target_flags) -L$(objtree)/$(obj) \ - --output $(objtree)/$(obj)/doc \ + --output $(RUSTDOC_OUTPUT) \ --crate-name $(subst rustdoc-,,$@) \ @$(objtree)/include/generated/rustc_cfg $<@@ -75,15 +78,15 @@ quiet_cmd_rustdoc = RUSTDOC $(if $(rustdoc_host),H, ) $< # and then retouch the generated files. rustdoc: rustdoc-core rustdoc-macros rustdoc-compiler_builtins \ rustdoc-alloc rustdoc-kernel - $(Q)cp $(srctree)/Documentation/images/logo.svg $(objtree)/$(obj)/doc - $(Q)cp $(srctree)/Documentation/images/COPYING-logo $(objtree)/$(obj)/doc - $(Q)find $(objtree)/$(obj)/doc -name '*.html' -type f -print0 | xargs -0 sed -Ei \ + $(Q)cp $(srctree)/Documentation/images/logo.svg $(RUSTDOC_OUTPUT) + $(Q)cp $(srctree)/Documentation/images/COPYING-logo $(RUSTDOC_OUTPUT) + $(Q)find $(RUSTDOC_OUTPUT) -name '*.html' -type f -print0 | xargs -0 sed -Ei \ -e 's:rust-logo\.svg:logo.svg:g' \ -e 's:rust-logo\.png:logo.svg:g' \ -e 's:favicon\.svg:logo.svg:g' \ -e 's:<link rel="alternate icon" type="image/png" href="[./]*favicon-(16x16|32x32)\.png">::g' $(Q)echo '.logo-container > img { object-fit: contain; }' \ - >> $(objtree)/$(obj)/doc/rustdoc.css + >> $(RUSTDOC_OUTPUT)/rustdoc.css rustdoc-macros: private rustdoc_host = yes rustdoc-macros: private rustc_target_flags = --crate-type proc-macro \@@ -141,7 +144,7 @@ quiet_cmd_rustdoc_test = RUSTDOC T $< @$(objtree)/include/generated/rustc_cfg \ $(rustc_target_flags) $(rustdoc_test_target_flags) \ --sysroot $(objtree)/$(obj)/test/sysroot $(rustdoc_test_quiet) \ - -L$(objtree)/$(obj)/test --output $(objtree)/$(obj)/doc \ + -L$(objtree)/$(obj)/test --output $(RUSTDOC_OUTPUT) \ --crate-name $(subst rusttest-,,$@) $< # We cannot use `-Zpanic-abort-tests` because some tests are dynamic,base-commit:
9abf2313adc1ca1b6180c508c25f22f9395cc780
Quoted 4 lines · Akira Yokosawa
So, this means "make htmldocs" will require kernel .config if
CONFIG_RUST=y. I'm not sure this new requirement is acceptable for kernel documentation testers who just want to build kernel documentation.
If the worry is that "full tree testers" (or CIs in general) cannot fully test the docs anymore without a config, that is definitely a change, and one of the reasons why I initially didn't add it to htmldocs.
However, full tree testers will need other changes anyway (at least installing the Rust toolchain), even if there was no need for a config. So it may be not too bad, and putting it in htmldocs means not having to call another target in the CIs; and for humans, less chance of forgetting etc.
(It is also why I wondered above about CONFIG_WARN_MISSING_DOCUMENTS: if Documentation/ intended to require a config as a whole, then it would be fine. I assume that is not the case, though, but not doing the sync is nevertheless a bit confusing)
Quoted 5 lines
By the way, is rustdoc's requirement of .config only for
CONFIG_RUST? In other words, are contents of rustdoc affected by other config settings?If not, I think rustdoc can be generated regardless of config settings as far as necessary tools (rustc, bindgen, etc.) are available.
Yeah, at the moment the config affects what gets generated. However, that may change in the future: there has been some movement around the Rust features needed for this recently, so I want to try that approach again (it would require some other changes, though).
Cheers,
Miguel
Quoted 10 lines · Miguel Ojeda
Quoted 4 lines · Akira Yokosawa
So, this means "make htmldocs" will require kernel .config if
CONFIG_RUST=y. I'm not sure this new requirement is acceptable for kernel documentation testers who just want to build kernel documentation.If the worry is that "full tree testers" (or CIs in general) cannot fully test the docs anymore without a config, that is definitely a change, and one of the reasons why I initially didn't add it to
htmldocs.
Well, I'm actually worrying about additional TAT when I want to test a particular change in a .rst file and test-build under the relevant subdirectory using a command, e.g., "make SPHINXDIRS=doc-guide htmldocs".
This completes almost instantly when CONFIG_RUST is not set.
With CONFIG_RUST=y, in my test, it runs RUSTDOC even when rustdoc is already generated once, as shown below:
------
CALL scripts/checksyscalls.sh
DESCEND objtool
RUSTDOC /home/foo/.rustup/toolchains/1.62.0-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/core/src/lib.rs
RUSTDOC H rust/macros/lib.rs
RUSTDOC rust/compiler_builtins.rs RUSTDOC rust/alloc/lib.rs RUSTDOC rust/kernel/lib.rs
SPHINX htmldocs --> file:///linux/Documentation/output/doc-guide
make[2]: Nothing to be done for 'html'.
Using classic theme
source directory: doc-guide
------
It takes 10 seconds or so (under a not-fast PC), 97% or more of which is wasted for redundant RUSTDOC runs.
Why is RUSTDOC invoked when there is no change in rustdoc?
If those redundant runs can be resolved, I might change my mind and ack the integration of generating rustdoc and htmldocs.
Quoted 6 lines
However, full tree testers will need other changes anyway (at least installing the Rust toolchain), even if there was no need for a config. So it may be not too bad, and putting it in
htmldocsmeans not having to call another target in the CIs; and for humans, less chance of forgetting etc.
Full tree testers wouldn't mind the redundant runs of RUSTDOC.
I think you can add a new target in the top-devel Makefile which runs both rustdoc and htmldocs for CIs. Something like 'htmldocsboth' or 'htmldocsall'???
htmldocs and other *docs targets are the most primitive ones for running Sphinx, so my gut feeling tells me _not_ to contaminate htmldocs with rustdoc or vice versa.
Quoted 6 lines
(It is also why I wondered above about
CONFIG_WARN_MISSING_DOCUMENTS: ifDocumentation/intended to require a config as a whole, then it would be fine. I assume that is not the case, though, but not doing the sync is nevertheless a bit confusing)
I have no idea. (Note: I was not around when the kernel documentation transitioned to Sphinx.)
Quoted 11 lines
Quoted 6 lines
By the way, is rustdoc's requirement of .config only for
CONFIG_RUST? In other words, are contents of rustdoc affected by other config settings?If not, I think rustdoc can be generated regardless of config settings as far as necessary tools (rustc, bindgen, etc.) are available.
Yeah, at the moment the config affects what gets generated. However, that may change in the future: there has been some movement around the Rust features needed for this recently, so I want to try that approach again (it would require some other changes, though).
Interesting.
So rustdoc needs .config. I'm convinced.
Thanks, Akira
Quoted 3 lines
Cheers,
Miguel
Jonathan Corbet
maintainerQuoted 8 lines · Akira Yokosawa
Well, I'm actually worrying about additional TAT when I want to test a particular change in a .rst file and test-build under the relevant subdirectory using a command, e.g., "make SPHINXDIRS=doc-guide htmldocs".
This completes almost instantly when
CONFIG_RUSTis not set.With
CONFIG_RUST=y, in my test, it runs RUSTDOC even when rustdoc is already generated once, as shown below:
This is something that would be nice to avoid if we can; narrowing things with SPHINXDIRS should avoid building anything that the user isn't asking for. I'm not sure how much makefile pain would be required to make that happen...Documentation/Makefile is not the easiest place to make changes, alas.
Quoted 7 lines
I think you can add a new target in the top-devel
Makefilewhich runs both rustdoc and htmldocs for CIs. Something like 'htmldocsboth' or 'htmldocsall'???htmldocs and other *docs targets are the most primitive ones for running Sphinx, so my gut feeling tells me _not_ to contaminate htmldocs with rustdoc or vice versa.
Well, I *would* like for a bare "make htmldocs" to make *all* of the docs; I don't think Rust should be special in that regard.
Quoted 8 lines
Quoted 5 lines
(It is also why I wondered above about
CONFIG_WARN_MISSING_DOCUMENTS: ifDocumentation/intended to require a config as a whole, then it would be fine. I assume that is not the case, though, but not doing the sync is nevertheless a bit confusing)I have no idea. (Note: I was not around when the kernel documentation transitioned to Sphinx.)
I think we're just seeing the implementation as was rammed in by somebody in a hurry; I don't doubt it could be improved.
Thanks,
jon (currently traveling and scrambling to get ready for the merge window)
Quoted 2 lines · Akira Yokosawa
Why is RUSTDOC invoked when there is no change in rustdoc?
I think we can give proper dependencies to rustdoc, so if that is the main concern, then it should be OK.
But note that htmldocs also calls Sphinx every run. It does a subset of the work, but perhaps we can save some time there if we could detect whether anything changed.
Quoted 7 lines
I think you can add a new target in the top-devel
Makefilewhich runs both rustdoc and htmldocs for CIs. Something like 'htmldocsboth' or 'htmldocsall'???htmldocs and other *docs targets are the most primitive ones for running Sphinx, so my gut feeling tells me _not_ to contaminate htmldocs with rustdoc or vice versa.
That is reasonable, but others wanted it in htmldocs (and the goal is to eventually do so, so if we can do it already, even better).
Cheers,
Miguel
Quoted 32 lines · Akira Yokosawa
Hi,
Quoted 9 lines · Carlos Bilbao
Include HTML output generated with rustdoc into the Linux kernel documentation on Rust. Change target
make htmldocsto combine RST Sphinx and the generation of Rust documentation, when support is available.Signed-off-by Carlos Bilbao <[email protected]>---
Changes since V1:
- Work on top of v6.1-rc1.Thank you for the rebase.
Quoted 18 lines
- Don't use
rustdoc.rst, instead add link toDocumentation/rust/index.rst.
- InDocumentation/Makefile, replace @make rustdoc for $(Q)$(MAKE) rustdoc.
- Don't do LLVM=1 for all rustdoc generation withinmake htmldocs.
- Add spaces on definition ofRUSTDOC_OUTPUT, for consistency.--- Documentation/Makefile | 4 ++++ Documentation/rust/index.rst | 3 +++ rust/Makefile | 15 +++++++++------ 3 files changed, 16 insertions(+), 6 deletions(-)Documentation/Makefile +0
-0@@ -92,6 +92,10 @@ quiet_cmd_sphinx = SPHINX $@ --> file://$(abspath $(BUILDDIR)/$3/$4) fi
Quoted 10 lines
Documentation/Makefile quiet_cmd_sphinx = SPHINX $@ --> file://$(abspath $(BUILDDIR)/$3/$4) · line 100
Quoted 7 lines
Documentation/Makefile +4
-0htmldocs: +# If Rust support is available, add rustdoc generated contents +ifdef CONFIG_RUST + $(Q)$(MAKE) rustdoc +endif @$(srctree)/scripts/sphinx-pre-install --version-check @+$(foreach var,$(SPHINXDIRS),$(call loop_cmd,sphinx,html,$(var),,$(var)))So, this means "make htmldocs" will require kernel .config if
CONFIG_RUST=y. I'm not sure this new requirement is acceptable for kernel documentation testers who just want to build kernel documentation.
This is already kind of the case for Rust-related business.
Quoted 10 lines
You are doing three things in this patch.
1) Change the destination of rustdoc to under
Documentation/output/
2) Add a cross reference to the generated rustdoc inDocumentation/rust/index.rst.
3) Integrate rustdoc generation into htmldocs.I'm OK with 1) and 2).
Can you separate 3) into another patch and respin?
Glad we can agree on 1) and 2). Why moving 3)? This is a small patch with one overall purpose (Integrate rustdoc into website).
Quoted 6 lines
By the way, is rustdoc's requirement of .config only for
CONFIG_RUST? In other words, are contents of rustdoc affected by other config settings?If not, I think rustdoc can be generated regardless of config settings as far as necessary tools (rustc, bindgen, etc.) are available.
Yes, but someone with the tools may not want to use them. Keep in mind that generating rustdoc takes a few extra seconds.
Quoted 10 lines
Quoted 10 lines
Documentation/rust/index.rst +0
-0@@ -6,6 +6,9 @@ Rust Documentation related to Rust within the kernel. To start using Rust in the kernel, please read the quick-start.rst guide.
Quoted 6 lines
Documentation/rust/index.rst Rust · line 10
Quoted 2 lines
Documentation/rust/index.rst +2
-0+If this documentation includes rustdoc-generated HTML, the entry point can +be found `here. <rustdoc/kernel/index.html>`_This cross reference will only make sense in htmldocs build. Perhaps, you can use the "only::" directive [1] as follows:
.. only:: html
This I can gladly do on a V3. I will wait for an answer on issues above.
Quoted 62 lines
If this documentation includes rustdoc-generated HTML, the entry point can be found
here. <rustdoc/kernel/index.html>_Thanks, Akira
Quoted 54 lines
Documentation/rust/index.rst +1
-0+ .. toctree:: :maxdepth: 1rust/Makefile +9
-6@@ -1,5 +1,8 @@ # SPDX-License-Identifier: GPL-2.0 +# Where to place rustdoc generated documentation +RUSTDOC_OUTPUT = $(objtree)/Documentation/output/rust/rustdoc + always-$(CONFIG_RUST) += target.json no-clean-files += target.json@@ -58,7 +61,7 @@ quiet_cmd_rustdoc = RUSTDOC $(if $(rustdoc_host),H, ) $< OBJTREE=$(abspath $(objtree)) \ $(RUSTDOC) $(if $(rustdoc_host),$(rust_common_flags),$(rust_flags)) \ $(rustc_target_flags) -L$(objtree)/$(obj) \ - --output $(objtree)/$(obj)/doc \ + --output $(RUSTDOC_OUTPUT) \ --crate-name $(subst rustdoc-,,$@) \ @$(objtree)/include/generated/rustc_cfg $<@@ -75,15 +78,15 @@ quiet_cmd_rustdoc = RUSTDOC $(if $(rustdoc_host),H, ) $< # and then retouch the generated files. rustdoc: rustdoc-core rustdoc-macros rustdoc-compiler_builtins \ rustdoc-alloc rustdoc-kernel - $(Q)cp $(srctree)/Documentation/images/logo.svg $(objtree)/$(obj)/doc - $(Q)cp $(srctree)/Documentation/images/COPYING-logo $(objtree)/$(obj)/doc - $(Q)find $(objtree)/$(obj)/doc -name '*.html' -type f -print0 | xargs -0 sed -Ei \ + $(Q)cp $(srctree)/Documentation/images/logo.svg $(RUSTDOC_OUTPUT) + $(Q)cp $(srctree)/Documentation/images/COPYING-logo $(RUSTDOC_OUTPUT) + $(Q)find $(RUSTDOC_OUTPUT) -name '*.html' -type f -print0 | xargs -0 sed -Ei \ -e 's:rust-logo\.svg:logo.svg:g' \ -e 's:rust-logo\.png:logo.svg:g' \ -e 's:favicon\.svg:logo.svg:g' \ -e 's:<link rel="alternate icon" type="image/png" href="[./]*favicon-(16x16|32x32)\.png">::g' $(Q)echo '.logo-container > img { object-fit: contain; }' \ - >> $(objtree)/$(obj)/doc/rustdoc.css + >> $(RUSTDOC_OUTPUT)/rustdoc.css rustdoc-macros: private rustdoc_host = yes rustdoc-macros: private rustc_target_flags = --crate-type proc-macro \@@ -141,7 +144,7 @@ quiet_cmd_rustdoc_test = RUSTDOC T $< @$(objtree)/include/generated/rustc_cfg \ $(rustc_target_flags) $(rustdoc_test_target_flags) \ --sysroot $(objtree)/$(obj)/test/sysroot $(rustdoc_test_quiet) \ - -L$(objtree)/$(obj)/test --output $(objtree)/$(obj)/doc \ + -L$(objtree)/$(obj)/test --output $(RUSTDOC_OUTPUT) \ --crate-name $(subst rusttest-,,$@) $<
Quoted 3 lines
Quoted 3 lines
rust/Makefile +0
-0# We cannot use `-Zpanic-abort-tests` because some tests are dynamic,base-commit:
9abf2313adc1ca1b6180c508c25f22f9395cc780
Thanks,
Carlos
Quoted 56 lines · Carlos Bilbao
Quoted 25 lines · Akira Yokosawa
Hi,
Quoted 9 lines · Carlos Bilbao
Include HTML output generated with rustdoc into the Linux kernel documentation on Rust. Change target
make htmldocsto combine RST Sphinx and the generation of Rust documentation, when support is available.Signed-off-by Carlos Bilbao <[email protected]>---
Changes since V1:
- Work on top of v6.1-rc1.Thank you for the rebase.
Quoted 11 lines
- Don't use
rustdoc.rst, instead add link toDocumentation/rust/index.rst.
- InDocumentation/Makefile, replace @make rustdoc for $(Q)$(MAKE) rustdoc.
- Don't do LLVM=1 for all rustdoc generation withinmake htmldocs.
- Add spaces on definition ofRUSTDOC_OUTPUT, for consistency.---
Documentation/Makefile | 4 ++++Documentation/rust/index.rst| 3 +++ rust/Makefile | 15 +++++++++------3 files changed, 16 insertions(+), 6 deletions(-)Quoted 16 lines
Quoted 11 lines
Documentation/Makefile +0
-0@@ -92,6 +92,10 @@ quiet_cmd_sphinx = SPHINX $@ --> file://$(abspath $(BUILDDIR)/$3/$4)fi
htmldocs:Documentation/Makefile +4
-0+# If Rust support is available, add rustdoc generated contents +ifdef CONFIG_RUST + $(Q)$(MAKE) rustdoc +endifQuoted 2 lines
@$(srctree)/scripts/sphinx-pre-install --version-check @+$(foreach var,$(SPHINXDIRS),$(call loop_cmd,sphinx,html,$(var),,$(var)))
So, this means "make htmldocs" will require kernel .config if
CONFIG_RUST=y. I'm not sure this new requirement is acceptable for kernel documentation testers who just want to build kernel documentation.This is already kind of the case for Rust-related business.
Quoted 8 lines
You are doing three things in this patch.
1) Change the destination of rustdoc to under
Documentation/output/
2) Add a cross reference to the generated rustdoc inDocumentation/rust/index.rst.
3) Integrate rustdoc generation into htmldocs.
Quoted 6 lines
Quoted 2 lines
I'm OK with 1) and 2).
Can you separate 3) into another patch and respin?Glad we can agree on 1) and 2). Why moving 3)? This is a small patch with one overall purpose (Integrate rustdoc into website).
Yes, I agree that 3) is a small change. I understand what you want to do. But there are a couple of options for _how_ to do it. My current position is that Documentation/Makefile is _not_ the right place for the change, as mentioned in my reply to Miguel.
Quoted 6 lines
Quoted 6 lines
By the way, is rustdoc's requirement of .config only for
CONFIG_RUST? In other words, are contents of rustdoc affected by other config settings?
Quoted 6 lines
Quoted 2 lines
If not, I think rustdoc can be generated regardless of config settings as far as necessary tools (rustc, bindgen, etc.) are available.
Yes, but someone with the tools may not want to use them. Keep in mind that generating rustdoc takes a few extra seconds.
As mentioned in another reply, I'm convinced of the dependency on .config.
Quoted 15 lines
Quoted 15 lines
Quoted 8 lines
diff --git
a/Documentation/rust/index.rstb/Documentation/rust/index.rstindex4ae8c66b94fa..4005326c3ba9100644Documentation/rust/index.rst +0
-0@@ -6,6 +6,9 @@ RustQuoted 4 lines
Documentation related to Rust within the kernel. To start using Rust in the kernel, please read the
quick-start.rstguide.
+If this documentation includes rustdoc-generated HTML, the entry point can +be foundhere. <rustdoc/kernel/index.html>_This cross reference will only make sense in htmldocs build. Perhaps, you can use the "only::" directive [1] as follows:
Quoted 4 lines
Quoted 1 line
.. only:: html
This I can gladly do on a V3. I will wait for an answer on issues above.
OK.
So if you split this into a two-patch series, 1/2 for 1) and 2), and 2/2 for 3) (or an updated one), I'm glad to give my RB tag to 1/2 for Miguel to be able take it for v6.2 (timing is tight!). 2/2 will need at least a couple of respins, I guess.
Thanks, Akira
Quoted 65 lines
Quoted 60 lines
If this documentation includes rustdoc-generated HTML, the entry point can be found
here. <rustdoc/kernel/index.html>_Thanks, Akira
Quoted 50 lines
+
.. toctree::
:maxdepth: 1
diff --git a/rust/Makefile b/rust/Makefile
index7700d3853404..080c07048065100644rust/Makefile +0
-0@@ -1,5 +1,8 @@ # SPDX-License-Identifier: GPL-2.0+# Where to place rustdoc generated documentation
rust/Makefile +2
-0+RUSTDOC_OUTPUT = $(objtree)/Documentation/output/rust/rustdoc +always-$(CONFIG_RUST) += target.json
no-clean-files += target.json
@@ -58,7 +61,7 @@quiet_cmd_rustdoc= RUSTDOC $(if $(rustdoc_host),H, ) $< OBJTREE=$(abspath $(objtree)) \
$(RUSTDOC) $(if $(rustdoc_host),$(rust_common_flags),$(rust_flags)) \
$(rustc_target_flags) -L$(objtree)/$(obj) \
- --output $(objtree)/$(obj)/doc \
+ --output $(RUSTDOC_OUTPUT) \
--crate-name $(subst rustdoc-,,$@) \
@$(objtree)/include/generated/rustc_cfg $<
@@ -75,15 +78,15 @@quiet_cmd_rustdoc= RUSTDOC $(if $(rustdoc_host),H, ) $<# and then retouch the generated files. rustdoc: rustdoc-core rustdoc-macros rustdoc-compiler_builtins \ rustdoc-alloc rustdoc-kernel - $(Q)cp $(srctree)/Documentation/images/logo.svg $(objtree)/$(obj)/doc - $(Q)cp $(srctree)/Documentation/images/COPYING-logo $(objtree)/$(obj)/doc - $(Q)find $(objtree)/$(obj)/doc -name '*.html' -type f -print0 | xargs -0 sed -Ei \ + $(Q)cp $(srctree)/Documentation/images/logo.svg $(RUSTDOC_OUTPUT) + $(Q)cp $(srctree)/Documentation/images/COPYING-logo $(RUSTDOC_OUTPUT) + $(Q)find $(RUSTDOC_OUTPUT) -name '*.html' -type f -print0 | xargs -0 sed -Ei \ -e 's:rust-logo\.svg:logo.svg:g' \ -e 's:rust-logo\.png:logo.svg:g' \ -e 's:favicon\.svg:logo.svg:g' \ -e 's:<link rel="alternate icon" type="image/png" href="[./]*favicon-(16x16|32x32)\.png">::g' $(Q)echo '.logo-container > img { object-fit: contain; }' \ - >> $(objtree)/$(obj)/doc/rustdoc.css + >> $(RUSTDOC_OUTPUT)/rustdoc.css rustdoc-macros: private rustdoc_host = yes rustdoc-macros: private rustc_target_flags = --crate-type proc-macro \rust/Makefile +1
-1@@ -141,7 +144,7 @@ quiet_cmd_rustdoc_test = RUSTDOC T $< @$(objtree)/include/generated/rustc_cfg \ $(rustc_target_flags) $(rustdoc_test_target_flags) \ --sysroot $(objtree)/$(obj)/test/sysroot $(rustdoc_test_quiet) \ - -L$(objtree)/$(obj)/test --output $(objtree)/$(obj)/doc \ + -L$(objtree)/$(obj)/test --output $(RUSTDOC_OUTPUT) \--crate-name $(subst rusttest-,,$@) $<
# We cannot use-Zpanic-abort-testsbecause some tests are dynamic,Quoted 1 line
Quoted 1 line
base-commit:
9abf2313adc1ca1b6180c508c25f22f9395cc780Thanks,
Carlos
Quoted 91 lines · Akira Yokosawa
Quoted 54 lines · Carlos Bilbao
Quoted 25 lines · Akira Yokosawa
Hi,
Quoted 9 lines · Carlos Bilbao
Include HTML output generated with rustdoc into the Linux kernel documentation on Rust. Change target
make htmldocsto combine RST Sphinx and the generation of Rust documentation, when support is available.Signed-off-by Carlos Bilbao <[email protected]>---
Changes since V1:
- Work on top of v6.1-rc1.Thank you for the rebase.
Quoted 11 lines
- Don't use
rustdoc.rst, instead add link toDocumentation/rust/index.rst.
- InDocumentation/Makefile, replace @make rustdoc for $(Q)$(MAKE) rustdoc.
- Don't do LLVM=1 for all rustdoc generation withinmake htmldocs.
- Add spaces on definition ofRUSTDOC_OUTPUT, for consistency.--- Documentation/Makefile | 4 ++++ Documentation/rust/index.rst | 3 +++ rust/Makefile | 15 +++++++++------ 3 files changed, 16 insertions(+), 6 deletions(-)Quoted 16 lines
Documentation/Makefile quiet_cmd_sphinx = SPHINX $@ --> file://$(abspath $(BUILDDIR)/$3/$4) · line 99
Quoted 13 lines
Documentation/Makefile +4
-0@@ -92,6 +92,10 @@ quiet_cmd_sphinx = SPHINX $@ --> file://$(abspath $(BUILDDIR)/$3/$4) fi htmldocs: +# If Rust support is available, add rustdoc generated contents +ifdef CONFIG_RUST + $(Q)$(MAKE) rustdoc +endif @$(srctree)/scripts/sphinx-pre-install --version-check @+$(foreach var,$(SPHINXDIRS),$(call loop_cmd,sphinx,html,$(var),,$(var)))So, this means "make htmldocs" will require kernel .config if
CONFIG_RUST=y. I'm not sure this new requirement is acceptable for kernel documentation testers who just want to build kernel documentation.This is already kind of the case for Rust-related business.
Quoted 7 lines
You are doing three things in this patch.
1) Change the destination of rustdoc to under
Documentation/output/
2) Add a cross reference to the generated rustdoc inDocumentation/rust/index.rst.
3) Integrate rustdoc generation into htmldocs.Quoted 5 lines
Quoted 2 lines
I'm OK with 1) and 2).
Can you separate 3) into another patch and respin?Glad we can agree on 1) and 2). Why moving 3)? This is a small patch with one overall purpose (Integrate rustdoc into website).
Yes, I agree that 3) is a small change. I understand what you want to do. But there are a couple of options for _how_ to do it. My current position is that
Documentation/Makefileis _not_ the right place for the change, as mentioned in my reply to Miguel.Quoted 9 lines
Quoted 6 lines
By the way, is rustdoc's requirement of .config only for
CONFIG_RUST? In other words, are contents of rustdoc affected by other config settings?If not, I think rustdoc can be generated regardless of config settings as far as necessary tools (rustc, bindgen, etc.) are available.
Yes, but someone with the tools may not want to use them. Keep in mind that generating rustdoc takes a few extra seconds.
As mentioned in another reply, I'm convinced of the dependency on .config.
Quoted 15 lines
Quoted 14 lines
Documentation/rust/index.rst Rust · line 9
Quoted 10 lines
Documentation/Makefile +0
-0diff --git a/Documentation/rust/index.rst b/Documentation/rust/index.rstindex
4ae8c66b94fa..4005326c3ba9100644Documentation/rust/index.rst +1
-0@@ -6,6 +6,9 @@ Rust Documentation related to Rust within the kernel. To start using Rust in the kernel, please read the quick-start.rst guide. +If this documentation includes rustdoc-generated HTML, the entry point can +be found `here. <rustdoc/kernel/index.html>`_This cross reference will only make sense in htmldocs build. Perhaps, you can use the "only::" directive [1] as follows:
.. only:: html
Quoted 7 lines
Quoted 1 line
This I can gladly do on a V3. I will wait for an answer on issues above.
OK.
So if you split this into a two-patch series, 1/2 for 1) and 2), and 2/2 for 3) (or an updated one), I'm glad to give my RB tag to 1/2 for Miguel to be able take it for v6.2 (timing is tight!). 2/2 will need at least a couple of respins, I guess.
Sounds good, I will divide for v3.
Quoted 64 lines
Thanks, Akira
Quoted 62 lines
Quoted 58 lines
If this documentation includes rustdoc-generated HTML, the entry point can be found
here. <rustdoc/kernel/index.html>_Thanks, Akira
Quoted 50 lines
Documentation/rust/index.rst +1
-0+ .. toctree:: :maxdepth: 1 diff --git a/rust/Makefile b/rust/Makefileindex
7700d3853404..080c07048065100644rust/Makefile +8
-6@@ -1,5 +1,8 @@ # SPDX-License-Identifier: GPL-2.0 +# Where to place rustdoc generated documentation +RUSTDOC_OUTPUT = $(objtree)/Documentation/output/rust/rustdoc + always-$(CONFIG_RUST) += target.json no-clean-files += target.json @@ -58,7 +61,7 @@ quiet_cmd_rustdoc = RUSTDOC $(if $(rustdoc_host),H, ) $< OBJTREE=$(abspath $(objtree)) \ $(RUSTDOC) $(if $(rustdoc_host),$(rust_common_flags),$(rust_flags)) \ $(rustc_target_flags) -L$(objtree)/$(obj) \ - --output $(objtree)/$(obj)/doc \ + --output $(RUSTDOC_OUTPUT) \ --crate-name $(subst rustdoc-,,$@) \ @$(objtree)/include/generated/rustc_cfg $< @@ -75,15 +78,15 @@ quiet_cmd_rustdoc = RUSTDOC $(if $(rustdoc_host),H, ) $< # and then retouch the generated files. rustdoc: rustdoc-core rustdoc-macros rustdoc-compiler_builtins \ rustdoc-alloc rustdoc-kernel - $(Q)cp $(srctree)/Documentation/images/logo.svg $(objtree)/$(obj)/doc - $(Q)cp $(srctree)/Documentation/images/COPYING-logo $(objtree)/$(obj)/doc - $(Q)find $(objtree)/$(obj)/doc -name '*.html' -type f -print0 | xargs -0 sed -Ei \ + $(Q)cp $(srctree)/Documentation/images/logo.svg $(RUSTDOC_OUTPUT) + $(Q)cp $(srctree)/Documentation/images/COPYING-logo $(RUSTDOC_OUTPUT) + $(Q)find $(RUSTDOC_OUTPUT) -name '*.html' -type f -print0 | xargs -0 sed -Ei \ -e 's:rust-logo\.svg:logo.svg:g' \ -e 's:rust-logo\.png:logo.svg:g' \ -e 's:favicon\.svg:logo.svg:g' \ -e 's:<link rel="alternate icon" type="image/png" href="[./]*favicon-(16x16|32x32)\.png">::g' $(Q)echo '.logo-container > img { object-fit: contain; }' \ - >> $(objtree)/$(obj)/doc/rustdoc.css + >> $(RUSTDOC_OUTPUT)/rustdoc.css rustdoc-macros: private rustdoc_host = yes rustdoc-macros: private rustc_target_flags = --crate-type proc-macro \@@ -141,7 +144,7 @@ quiet_cmd_rustdoc_test = RUSTDOC T $< @$(objtree)/include/generated/rustc_cfg \ $(rustc_target_flags) $(rustdoc_test_target_flags) \ --sysroot $(objtree)/$(obj)/test/sysroot $(rustdoc_test_quiet) \ - -L$(objtree)/$(obj)/test --output $(objtree)/$(obj)/doc \ + -L$(objtree)/$(obj)/test --output $(RUSTDOC_OUTPUT) \ --crate-name $(subst rusttest-,,$@) $< # We cannot use `-Zpanic-abort-tests` because some tests are dynamic,Quoted 1 line
Quoted 1 line
base-commit:
9abf2313adc1ca1b6180c508c25f22f9395cc780Thanks,
Carlos
Quoted 58 lines · Akira Yokosawa
Quoted 57 lines · Carlos Bilbao
Quoted 25 lines · Akira Yokosawa
Hi,
Quoted 9 lines · Carlos Bilbao
Include HTML output generated with rustdoc into the Linux kernel documentation on Rust. Change target
make htmldocsto combine RST Sphinx and the generation of Rust documentation, when support is available.Signed-off-by Carlos Bilbao <[email protected]>---
Changes since V1:
- Work on top of v6.1-rc1.Thank you for the rebase.
Quoted 11 lines
- Don't use
rustdoc.rst, instead add link toDocumentation/rust/index.rst.
- InDocumentation/Makefile, replace @make rustdoc for $(Q)$(MAKE) rustdoc.
- Don't do LLVM=1 for all rustdoc generation withinmake htmldocs.
- Add spaces on definition ofRUSTDOC_OUTPUT, for consistency.--- Documentation/Makefile | 4 ++++ Documentation/rust/index.rst | 3 +++ rust/Makefile | 15 +++++++++------ 3 files changed, 16 insertions(+), 6 deletions(-)Quoted 16 lines
Documentation/Makefile quiet_cmd_sphinx = SPHINX $@ --> file://$(abspath $(BUILDDIR)/$3/$4) · line 99
Quoted 13 lines
Documentation/Makefile +4
-0@@ -92,6 +92,10 @@ quiet_cmd_sphinx = SPHINX $@ --> file://$(abspath $(BUILDDIR)/$3/$4) fi htmldocs: +# If Rust support is available, add rustdoc generated contents +ifdef CONFIG_RUST + $(Q)$(MAKE) rustdoc +endif @$(srctree)/scripts/sphinx-pre-install --version-check @+$(foreach var,$(SPHINXDIRS),$(call loop_cmd,sphinx,html,$(var),,$(var)))So, this means "make htmldocs" will require kernel .config if
CONFIG_RUST=y. I'm not sure this new requirement is acceptable for kernel documentation testers who just want to build kernel documentation.This is already kind of the case for Rust-related business.
Quoted 9 lines
You are doing three things in this patch.
1) Change the destination of rustdoc to under
Documentation/output/
2) Add a cross reference to the generated rustdoc inDocumentation/rust/index.rst.
3) Integrate rustdoc generation into htmldocs.I'm OK with 1) and 2).
Can you separate 3) into another patch and respin?
Quoted 6 lines
Quoted 2 lines
Glad we can agree on 1) and 2). Why moving 3)? This is a small patch with one overall purpose (Integrate rustdoc into website).
Yes, I agree that 3) is a small change. I understand what you want to do. But there are a couple of options for _how_ to do it. My current position is that
Documentation/Makefileis _not_ the right place for the change, as mentioned in my reply to Miguel.
Actually, I originally used make rustdocs [1] but good arguments were given to use make htmldocs instead, and I was convinced too.
Quoted 27 lines
Quoted 10 lines
Quoted 7 lines
By the way, is rustdoc's requirement of .config only for
CONFIG_RUST? In other words, are contents of rustdoc affected by other config settings?If not, I think rustdoc can be generated regardless of config settings as far as necessary tools (rustc, bindgen, etc.) are available.
Yes, but someone with the tools may not want to use them. Keep in mind that generating rustdoc takes a few extra seconds.
As mentioned in another reply, I'm convinced of the dependency on .config.
Quoted 15 lines
Quoted 14 lines
Documentation/rust/index.rst Rust · line 9
Quoted 10 lines
Documentation/Makefile +0
-0diff --git a/Documentation/rust/index.rst b/Documentation/rust/index.rstindex
4ae8c66b94fa..4005326c3ba9100644Documentation/rust/index.rst +1
-0@@ -6,6 +6,9 @@ Rust Documentation related to Rust within the kernel. To start using Rust in the kernel, please read the quick-start.rst guide. +If this documentation includes rustdoc-generated HTML, the entry point can +be found `here. <rustdoc/kernel/index.html>`_This cross reference will only make sense in htmldocs build. Perhaps, you can use the "only::" directive [1] as follows:
.. only:: html
Quoted 7 lines
Quoted 1 line
This I can gladly do on a V3. I will wait for an answer on issues above.
OK.
So if you split this into a two-patch series, 1/2 for 1) and 2), and 2/2 for 3) (or an updated one), I'm glad to give my RB tag to 1/2 for Miguel to be able take it for v6.2 (timing is tight!). 2/2 will need at least a couple of respins, I guess.
Sounds good, I will divide for v3.
Quoted 64 lines
Thanks, Akira
Quoted 62 lines
Quoted 58 lines
If this documentation includes rustdoc-generated HTML, the entry point can be found
here. <rustdoc/kernel/index.html>_Thanks, Akira
Quoted 50 lines
Documentation/rust/index.rst +1
-0+ .. toctree:: :maxdepth: 1 diff --git a/rust/Makefile b/rust/Makefileindex
7700d3853404..080c07048065100644rust/Makefile +8
-6@@ -1,5 +1,8 @@ # SPDX-License-Identifier: GPL-2.0 +# Where to place rustdoc generated documentation +RUSTDOC_OUTPUT = $(objtree)/Documentation/output/rust/rustdoc + always-$(CONFIG_RUST) += target.json no-clean-files += target.json @@ -58,7 +61,7 @@ quiet_cmd_rustdoc = RUSTDOC $(if $(rustdoc_host),H, ) $< OBJTREE=$(abspath $(objtree)) \ $(RUSTDOC) $(if $(rustdoc_host),$(rust_common_flags),$(rust_flags)) \ $(rustc_target_flags) -L$(objtree)/$(obj) \ - --output $(objtree)/$(obj)/doc \ + --output $(RUSTDOC_OUTPUT) \ --crate-name $(subst rustdoc-,,$@) \ @$(objtree)/include/generated/rustc_cfg $< @@ -75,15 +78,15 @@ quiet_cmd_rustdoc = RUSTDOC $(if $(rustdoc_host),H, ) $< # and then retouch the generated files. rustdoc: rustdoc-core rustdoc-macros rustdoc-compiler_builtins \ rustdoc-alloc rustdoc-kernel - $(Q)cp $(srctree)/Documentation/images/logo.svg $(objtree)/$(obj)/doc - $(Q)cp $(srctree)/Documentation/images/COPYING-logo $(objtree)/$(obj)/doc - $(Q)find $(objtree)/$(obj)/doc -name '*.html' -type f -print0 | xargs -0 sed -Ei \ + $(Q)cp $(srctree)/Documentation/images/logo.svg $(RUSTDOC_OUTPUT) + $(Q)cp $(srctree)/Documentation/images/COPYING-logo $(RUSTDOC_OUTPUT) + $(Q)find $(RUSTDOC_OUTPUT) -name '*.html' -type f -print0 | xargs -0 sed -Ei \ -e 's:rust-logo\.svg:logo.svg:g' \ -e 's:rust-logo\.png:logo.svg:g' \ -e 's:favicon\.svg:logo.svg:g' \ -e 's:<link rel="alternate icon" type="image/png" href="[./]*favicon-(16x16|32x32)\.png">::g' $(Q)echo '.logo-container > img { object-fit: contain; }' \ - >> $(objtree)/$(obj)/doc/rustdoc.css + >> $(RUSTDOC_OUTPUT)/rustdoc.css rustdoc-macros: private rustdoc_host = yes rustdoc-macros: private rustc_target_flags = --crate-type proc-macro \@@ -141,7 +144,7 @@ quiet_cmd_rustdoc_test = RUSTDOC T $< @$(objtree)/include/generated/rustc_cfg \ $(rustc_target_flags) $(rustdoc_test_target_flags) \ --sysroot $(objtree)/$(obj)/test/sysroot $(rustdoc_test_quiet) \ - -L$(objtree)/$(obj)/test --output $(objtree)/$(obj)/doc \ + -L$(objtree)/$(obj)/test --output $(RUSTDOC_OUTPUT) \ --crate-name $(subst rusttest-,,$@) $< # We cannot use `-Zpanic-abort-tests` because some tests are dynamic,Quoted 1 line
Quoted 1 line
base-commit:
9abf2313adc1ca1b6180c508c25f22f9395cc780Thanks,
Carlos
[1] https://lore.kernel.org/lkml/[email protected]/T/
Thanks,
Carlos
v3 cover docs: Integrate rustdoc into Rust documentation
In reply to Carlos BilbaoInclude HTML output generated with rustdoc into the Linux kernel documentation on Rust.
Carlos Bilbao:
docs: Move rustdoc output, cross-reference it
docs: Integrate rustdoc generation into htmldocs
---
Changes since V2:
- Split v2 into two-patch series.
- Add "only:: html" directive in Documentation/rust/index.rst reference
Changes since V1:
- Work on top of v6.1-rc1.
- Don't use rustdoc.rst, instead add link to Documentation/rust/index.rst.
- In Documentation/Makefile, replace @make rustdoc for $(Q)$(MAKE) rustdoc.
- Don't do LLVM=1 for all rustdoc generation within make htmldocs.
- Add spaces on definition of RUSTDOC_OUTPUT, for consistency.
--- Documentation/Makefile | 4 ++++ Documentation/rust/index.rst | 5 +++++ rust/Makefile | 15 +++++++++------ 3 files changed, 18 insertions(+), 6 deletions(-)
PATCH v3 1/2 docs: Move rustdoc output, cross-reference it
Generate rustdoc documentation with the rest of subsystem's documentation in Documentation/output. Add a cross reference to the generated rustdoc in Documentation/rust/index.rst.
--- Documentation/rust/index.rst | 5 +++++ rust/Makefile | 15 +++++++++------ 2 files changed, 14 insertions(+), 6 deletions(-)
Documentation/rust/index.rst +5 -0
@@ -6,6 +6,11 @@ Rust Documentation related to Rust within the kernel. To start using Rust in the kernel, please read the quick-start.rst guide. +.. only:: html + + If this documentation includes rustdoc-generated HTML, the entry + point can be found `here <rustdoc/kernel/index.html>`_. + .. toctree:: :maxdepth: 1
rust/Makefile +9 -6
@@ -1,5 +1,8 @@ # SPDX-License-Identifier: GPL-2.0 +# Where to place rustdoc generated documentation +RUSTDOC_OUTPUT = $(objtree)/Documentation/output/rust/rustdoc + always-$(CONFIG_RUST) += target.json no-clean-files += target.json
@@ -58,7 +61,7 @@ quiet_cmd_rustdoc = RUSTDOC $(if $(rustdoc_host),H, ) $< OBJTREE=$(abspath $(objtree)) \ $(RUSTDOC) $(if $(rustdoc_host),$(rust_common_flags),$(rust_flags)) \ $(rustc_target_flags) -L$(objtree)/$(obj) \ - --output $(objtree)/$(obj)/doc \ + --output $(RUSTDOC_OUTPUT) \ --crate-name $(subst rustdoc-,,$@) \ @$(objtree)/include/generated/rustc_cfg $<
@@ -75,15 +78,15 @@ quiet_cmd_rustdoc = RUSTDOC $(if $(rustdoc_host),H, ) $< # and then retouch the generated files. rustdoc: rustdoc-core rustdoc-macros rustdoc-compiler_builtins \ rustdoc-alloc rustdoc-kernel - $(Q)cp $(srctree)/Documentation/images/logo.svg $(objtree)/$(obj)/doc - $(Q)cp $(srctree)/Documentation/images/COPYING-logo $(objtree)/$(obj)/doc - $(Q)find $(objtree)/$(obj)/doc -name '*.html' -type f -print0 | xargs -0 sed -Ei \ + $(Q)cp $(srctree)/Documentation/images/logo.svg $(RUSTDOC_OUTPUT) + $(Q)cp $(srctree)/Documentation/images/COPYING-logo $(RUSTDOC_OUTPUT) + $(Q)find $(RUSTDOC_OUTPUT) -name '*.html' -type f -print0 | xargs -0 sed -Ei \ -e 's:rust-logo\.svg:logo.svg:g' \ -e 's:rust-logo\.png:logo.svg:g' \ -e 's:favicon\.svg:logo.svg:g' \ -e 's:<link rel="alternate icon" type="image/png" href="[./]*favicon-(16x16|32x32)\.png">::g' $(Q)echo '.logo-container > img { object-fit: contain; }' \ - >> $(objtree)/$(obj)/doc/rustdoc.css + >> $(RUSTDOC_OUTPUT)/rustdoc.css rustdoc-macros: private rustdoc_host = yes rustdoc-macros: private rustc_target_flags = --crate-type proc-macro \
@@ -141,7 +144,7 @@ quiet_cmd_rustdoc_test = RUSTDOC T $< @$(objtree)/include/generated/rustc_cfg \ $(rustc_target_flags) $(rustdoc_test_target_flags) \ --sysroot $(objtree)/$(obj)/test/sysroot $(rustdoc_test_quiet) \ - -L$(objtree)/$(obj)/test --output $(objtree)/$(obj)/doc \ + -L$(objtree)/$(obj)/test --output $(RUSTDOC_OUTPUT) \ --crate-name $(subst rusttest-,,$@) $< # We cannot use `-Zpanic-abort-tests` because some tests are dynamic,
Signature · 1 line
2.34.1
Re: [PATCH v3 1/2] docs: Move rustdoc output, cross-reference it
Quoted 5 lines · Carlos Bilbao
Generate rustdoc documentation with the rest of subsystem's documentation in
Documentation/output. Add a cross reference to the generated rustdoc inDocumentation/rust/index.rst.Signed-off-by Carlos Bilbao <[email protected]>
Quoted 72 lines
--- Documentation/rust/index.rst | 5 +++++ rust/Makefile | 15 +++++++++------ 2 files changed, 14 insertions(+), 6 deletions(-)Documentation/rust/index.rst +5
-0@@ -6,6 +6,11 @@ Rust Documentation related to Rust within the kernel. To start using Rust in the kernel, please read the quick-start.rst guide. +.. only:: html + + If this documentation includes rustdoc-generated HTML, the entry + point can be found `here <rustdoc/kernel/index.html>`_. + .. toctree:: :maxdepth: 1rust/Makefile +9
-6@@ -1,5 +1,8 @@ # SPDX-License-Identifier: GPL-2.0 +# Where to place rustdoc generated documentation +RUSTDOC_OUTPUT = $(objtree)/Documentation/output/rust/rustdoc + always-$(CONFIG_RUST) += target.json no-clean-files += target.json@@ -58,7 +61,7 @@ quiet_cmd_rustdoc = RUSTDOC $(if $(rustdoc_host),H, ) $< OBJTREE=$(abspath $(objtree)) \ $(RUSTDOC) $(if $(rustdoc_host),$(rust_common_flags),$(rust_flags)) \ $(rustc_target_flags) -L$(objtree)/$(obj) \ - --output $(objtree)/$(obj)/doc \ + --output $(RUSTDOC_OUTPUT) \ --crate-name $(subst rustdoc-,,$@) \ @$(objtree)/include/generated/rustc_cfg $<@@ -75,15 +78,15 @@ quiet_cmd_rustdoc = RUSTDOC $(if $(rustdoc_host),H, ) $< # and then retouch the generated files. rustdoc: rustdoc-core rustdoc-macros rustdoc-compiler_builtins \ rustdoc-alloc rustdoc-kernel - $(Q)cp $(srctree)/Documentation/images/logo.svg $(objtree)/$(obj)/doc - $(Q)cp $(srctree)/Documentation/images/COPYING-logo $(objtree)/$(obj)/doc - $(Q)find $(objtree)/$(obj)/doc -name '*.html' -type f -print0 | xargs -0 sed -Ei \ + $(Q)cp $(srctree)/Documentation/images/logo.svg $(RUSTDOC_OUTPUT) + $(Q)cp $(srctree)/Documentation/images/COPYING-logo $(RUSTDOC_OUTPUT) + $(Q)find $(RUSTDOC_OUTPUT) -name '*.html' -type f -print0 | xargs -0 sed -Ei \ -e 's:rust-logo\.svg:logo.svg:g' \ -e 's:rust-logo\.png:logo.svg:g' \ -e 's:favicon\.svg:logo.svg:g' \ -e 's:<link rel="alternate icon" type="image/png" href="[./]*favicon-(16x16|32x32)\.png">::g' $(Q)echo '.logo-container > img { object-fit: contain; }' \ - >> $(objtree)/$(obj)/doc/rustdoc.css + >> $(RUSTDOC_OUTPUT)/rustdoc.css rustdoc-macros: private rustdoc_host = yes rustdoc-macros: private rustc_target_flags = --crate-type proc-macro \@@ -141,7 +144,7 @@ quiet_cmd_rustdoc_test = RUSTDOC T $< @$(objtree)/include/generated/rustc_cfg \ $(rustc_target_flags) $(rustdoc_test_target_flags) \ --sysroot $(objtree)/$(obj)/test/sysroot $(rustdoc_test_quiet) \ - -L$(objtree)/$(obj)/test --output $(objtree)/$(obj)/doc \ + -L$(objtree)/$(obj)/test --output $(RUSTDOC_OUTPUT) \ --crate-name $(subst rusttest-,,$@) $< # We cannot use `-Zpanic-abort-tests` because some tests are dynamic,
Re: [PATCH v3 1/2] docs: Move rustdoc output, cross-reference it
In reply to Carlos BilbaoQuoted 15 lines · Carlos Bilbao
Generate rustdoc documentation with the rest of subsystem's documentation in
Documentation/output. Add a cross reference to the generated rustdoc inDocumentation/rust/index.rst.Signed-off-by Carlos Bilbao <[email protected]>--- Documentation/rust/index.rst | 5 +++++ rust/Makefile | 15 +++++++++------ 2 files changed, 14 insertions(+), 6 deletions(-)Documentation/rust/index.rst +0
-0
Documentation/rust/index.rst Rust · line 13
Quoted 8 lines
Documentation/rust/index.rst +5
-0@@ -6,6 +6,11 @@ Rust Documentation related to Rust within the kernel. To start using Rust in the kernel, please read the quick-start.rst guide. +.. only:: html + + If this documentation includes rustdoc-generated HTML, the entry + point can be found `here <rustdoc/kernel/index.html>`_. +
It's a bit meh to have documentation that points to places that might 404 and the user has to figure it out.
We can do better than that.
You could use CONFIG_RUST to pass e.g. "-t rustdoc" to Sphinx in the Makefile, and use:
.. only:: rustdoc
and
.. only:: not rustdoc
And document accordingly.
Also, please don't use "here" as the link text.
BR,
Jani.
Quoted 54 lines
Documentation/rust/index.rst +0
-0.. toctree:: :maxdepth: 1rust/Makefile +9
-6@@ -1,5 +1,8 @@ # SPDX-License-Identifier: GPL-2.0 +# Where to place rustdoc generated documentation +RUSTDOC_OUTPUT = $(objtree)/Documentation/output/rust/rustdoc + always-$(CONFIG_RUST) += target.json no-clean-files += target.json@@ -58,7 +61,7 @@ quiet_cmd_rustdoc = RUSTDOC $(if $(rustdoc_host),H, ) $< OBJTREE=$(abspath $(objtree)) \ $(RUSTDOC) $(if $(rustdoc_host),$(rust_common_flags),$(rust_flags)) \ $(rustc_target_flags) -L$(objtree)/$(obj) \ - --output $(objtree)/$(obj)/doc \ + --output $(RUSTDOC_OUTPUT) \ --crate-name $(subst rustdoc-,,$@) \ @$(objtree)/include/generated/rustc_cfg $<@@ -75,15 +78,15 @@ quiet_cmd_rustdoc = RUSTDOC $(if $(rustdoc_host),H, ) $< # and then retouch the generated files. rustdoc: rustdoc-core rustdoc-macros rustdoc-compiler_builtins \ rustdoc-alloc rustdoc-kernel - $(Q)cp $(srctree)/Documentation/images/logo.svg $(objtree)/$(obj)/doc - $(Q)cp $(srctree)/Documentation/images/COPYING-logo $(objtree)/$(obj)/doc - $(Q)find $(objtree)/$(obj)/doc -name '*.html' -type f -print0 | xargs -0 sed -Ei \ + $(Q)cp $(srctree)/Documentation/images/logo.svg $(RUSTDOC_OUTPUT) + $(Q)cp $(srctree)/Documentation/images/COPYING-logo $(RUSTDOC_OUTPUT) + $(Q)find $(RUSTDOC_OUTPUT) -name '*.html' -type f -print0 | xargs -0 sed -Ei \ -e 's:rust-logo\.svg:logo.svg:g' \ -e 's:rust-logo\.png:logo.svg:g' \ -e 's:favicon\.svg:logo.svg:g' \ -e 's:<link rel="alternate icon" type="image/png" href="[./]*favicon-(16x16|32x32)\.png">::g' $(Q)echo '.logo-container > img { object-fit: contain; }' \ - >> $(objtree)/$(obj)/doc/rustdoc.css + >> $(RUSTDOC_OUTPUT)/rustdoc.css rustdoc-macros: private rustdoc_host = yes rustdoc-macros: private rustc_target_flags = --crate-type proc-macro \@@ -141,7 +144,7 @@ quiet_cmd_rustdoc_test = RUSTDOC T $< @$(objtree)/include/generated/rustc_cfg \ $(rustc_target_flags) $(rustdoc_test_target_flags) \ --sysroot $(objtree)/$(obj)/test/sysroot $(rustdoc_test_quiet) \ - -L$(objtree)/$(obj)/test --output $(objtree)/$(obj)/doc \ + -L$(objtree)/$(obj)/test --output $(RUSTDOC_OUTPUT) \ --crate-name $(subst rusttest-,,$@) $< # We cannot use `-Zpanic-abort-tests` because some tests are dynamic,
Signature · 1 line
Jani Nikula, Intel Open Source Graphics Center
Re: [PATCH v3 1/2] docs: Move rustdoc output, cross-reference it
Quoted 35 lines · Jani Nikula
Quoted 15 lines · Carlos Bilbao
Generate rustdoc documentation with the rest of subsystem's documentation in
Documentation/output. Add a cross reference to the generated rustdoc inDocumentation/rust/index.rst.Signed-off-by Carlos Bilbao <[email protected]>--- Documentation/rust/index.rst | 5 +++++ rust/Makefile | 15 +++++++++------ 2 files changed, 14 insertions(+), 6 deletions(-)Documentation/rust/index.rst +0
-0Documentation/rust/index.rst Rust · line 13
Quoted 8 lines
Documentation/rust/index.rst +5
-0@@ -6,6 +6,11 @@ Rust Documentation related to Rust within the kernel. To start using Rust in the kernel, please read the quick-start.rst guide. +.. only:: html + + If this documentation includes rustdoc-generated HTML, the entry + point can be found `here <rustdoc/kernel/index.html>`_. +It's a bit meh to have documentation that points to places that might 404 and the user has to figure it out.
We can do better than that.
You could use
CONFIG_RUSTto pass e.g. "-t rustdoc" to Sphinx in theMakefile, and use:.. only:: rustdoc
Quoted 7 lines
and
.. only:: not rustdoc
And document accordingly.
Also, please don't use "here" as the link text.
Why not?
Quoted 58 lines
BR,
Jani.Quoted 53 lines
Documentation/rust/index.rst +0
-0.. toctree:: :maxdepth: 1rust/Makefile +9
-6@@ -1,5 +1,8 @@ # SPDX-License-Identifier: GPL-2.0 +# Where to place rustdoc generated documentation +RUSTDOC_OUTPUT = $(objtree)/Documentation/output/rust/rustdoc + always-$(CONFIG_RUST) += target.json no-clean-files += target.json@@ -58,7 +61,7 @@ quiet_cmd_rustdoc = RUSTDOC $(if $(rustdoc_host),H, ) $< OBJTREE=$(abspath $(objtree)) \ $(RUSTDOC) $(if $(rustdoc_host),$(rust_common_flags),$(rust_flags)) \ $(rustc_target_flags) -L$(objtree)/$(obj) \ - --output $(objtree)/$(obj)/doc \ + --output $(RUSTDOC_OUTPUT) \ --crate-name $(subst rustdoc-,,$@) \ @$(objtree)/include/generated/rustc_cfg $<@@ -75,15 +78,15 @@ quiet_cmd_rustdoc = RUSTDOC $(if $(rustdoc_host),H, ) $< # and then retouch the generated files. rustdoc: rustdoc-core rustdoc-macros rustdoc-compiler_builtins \ rustdoc-alloc rustdoc-kernel - $(Q)cp $(srctree)/Documentation/images/logo.svg $(objtree)/$(obj)/doc - $(Q)cp $(srctree)/Documentation/images/COPYING-logo $(objtree)/$(obj)/doc - $(Q)find $(objtree)/$(obj)/doc -name '*.html' -type f -print0 | xargs -0 sed -Ei \ + $(Q)cp $(srctree)/Documentation/images/logo.svg $(RUSTDOC_OUTPUT) + $(Q)cp $(srctree)/Documentation/images/COPYING-logo $(RUSTDOC_OUTPUT) + $(Q)find $(RUSTDOC_OUTPUT) -name '*.html' -type f -print0 | xargs -0 sed -Ei \ -e 's:rust-logo\.svg:logo.svg:g' \ -e 's:rust-logo\.png:logo.svg:g' \ -e 's:favicon\.svg:logo.svg:g' \ -e 's:<link rel="alternate icon" type="image/png" href="[./]*favicon-(16x16|32x32)\.png">::g' $(Q)echo '.logo-container > img { object-fit: contain; }' \ - >> $(objtree)/$(obj)/doc/rustdoc.css + >> $(RUSTDOC_OUTPUT)/rustdoc.css rustdoc-macros: private rustdoc_host = yes rustdoc-macros: private rustc_target_flags = --crate-type proc-macro \@@ -141,7 +144,7 @@ quiet_cmd_rustdoc_test = RUSTDOC T $< @$(objtree)/include/generated/rustc_cfg \ $(rustc_target_flags) $(rustdoc_test_target_flags) \ --sysroot $(objtree)/$(obj)/test/sysroot $(rustdoc_test_quiet) \ - -L$(objtree)/$(obj)/test --output $(objtree)/$(obj)/doc \ + -L$(objtree)/$(obj)/test --output $(RUSTDOC_OUTPUT) \ --crate-name $(subst rusttest-,,$@) $<
Quoted 2 lines
rust/Makefile quiet_cmd_rustdoc_test = RUSTDOC T $< · line 150
Quoted 1 line
rust/Makefile +0
-0# We cannot use `-Zpanic-abort-tests` because some tests are dynamic,
Thanks,
Carlos
Re: [PATCH v3 1/2] docs: Move rustdoc output, cross-reference it
Quoted 4 lines · Carlos Bilbao
Quoted 1 line · Jani Nikula
Also, please don't use "here" as the link text.
Why not?
It's considered bad style, see e.g. [1] or [2] or the plethora of results you get if you search for "here as the link text".
The link text should describe what's at the destination.
BR,
Jani.
[1] https://ux.stackexchange.com/questions/12100/why-shouldnt-we-use-words-such-as-here-and-this-in-textlinks
[2] https://www.w3.org/QA/Tips/noClickHere
Signature · 1 line
Jani Nikula, Intel Open Source Graphics Center
Re: [PATCH v3 1/2] docs: Move rustdoc output, cross-reference it
Quoted 8 lines · Jani Nikula
Quoted 3 lines · Carlos Bilbao
Quoted 1 line · Jani Nikula
Also, please don't use "here" as the link text.
Why not?
It's considered bad style, see e.g. [1] or [2] or the plethora of results you get if you search for "here as the link text".
The link text should describe what's at the destination.
Understood, thanks!
Quoted 9 lines
BR,
Jani.[1] https://ux.stackexchange.com/questions/12100/why-shouldnt-we-use-words-such-as-here-and-this-in-textlinks
[2] https://www.w3.org/QA/Tips/noClickHere
Best regards,
Carlos
Jonathan Corbet
maintainerRe: [PATCH v3 1/2] docs: Move rustdoc output, cross-reference it
In reply to Carlos BilbaoQuoted 4 lines · Carlos Bilbao
Quoted 1 line · Jani Nikula
Also, please don't use "here" as the link text.
Why not?
Among other things, that makes things harder for people using screen readers and other assistive technology.
Thanks,
jon
PATCH v3 2/2 docs: Integrate rustdoc generation into htmldocs
In reply to Carlos BilbaoChange target make htmldocs to combine RST Sphinx and the generation of Rust documentation, when support is available.
--- Documentation/Makefile | 4 ++++ 1 file changed, 4 insertions(+)
Documentation/Makefile +4 -0
@@ -92,6 +92,10 @@ quiet_cmd_sphinx = SPHINX $@ --> file://$(abspath $(BUILDDIR)/$3/$4) fi htmldocs: +# If Rust support is available, add rustdoc generated contents +ifdef CONFIG_RUST + $(Q)$(MAKE) rustdoc +endif @$(srctree)/scripts/sphinx-pre-install --version-check @+$(foreach var,$(SPHINXDIRS),$(call loop_cmd,sphinx,html,$(var),,$(var)))
Signature · 1 line
2.34.1
Re: [PATCH v3 2/2] docs: Integrate rustdoc generation into htmldocs
Quoted 13 lines · Carlos Bilbao
Change target
make htmldocsto combine RST Sphinx and the generation of Rust documentation, when support is available.Signed-off-by Carlos Bilbao <[email protected]>--- Documentation/Makefile | 4 ++++ 1 file changed, 4 insertions(+)Documentation/Makefile +0
-0
Documentation/Makefile quiet_cmd_sphinx = SPHINX $@ --> file://$(abspath $(BUILDDIR)/$3/$4) · line 101
Quoted 10 lines
Documentation/Makefile +4
-0@@ -92,6 +92,10 @@ quiet_cmd_sphinx = SPHINX $@ --> file://$(abspath $(BUILDDIR)/$3/$4) fi htmldocs: +# If Rust support is available, add rustdoc generated contents +ifdef CONFIG_RUST + $(Q)$(MAKE) rustdoc +endif @$(srctree)/scripts/sphinx-pre-install --version-check @+$(foreach var,$(SPHINXDIRS),$(call loop_cmd,sphinx,html,$(var),,$(var)))
What about patch below on top of this?
This way, it is possible to skip rustdoc generation by saying:
make CONFIG_RUST=n SPHINXDIRS=doc-guide htmldocs
The reordering is to complete Sphinx runs even if rustdoc generation ends up in error.
With this applied on top,
Thanks, Akira
------
Documentation/Makefile +3 -3
@@ -92,12 +92,12 @@ quiet_cmd_sphinx = SPHINX $@ --> file://$(abspath $(BUILDDIR)/$3/$4) fi htmldocs: + @$(srctree)/scripts/sphinx-pre-install --version-check + @+$(foreach var,$(SPHINXDIRS),$(call loop_cmd,sphinx,html,$(var),,$(var))) # If Rust support is available, add rustdoc generated contents -ifdef CONFIG_RUST +ifeq ($(CONFIG_RUST),y) $(Q)$(MAKE) rustdoc endif - @$(srctree)/scripts/sphinx-pre-install --version-check - @+$(foreach var,$(SPHINXDIRS),$(call loop_cmd,sphinx,html,$(var),,$(var))) texinfodocs: @$(srctree)/scripts/sphinx-pre-install --version-check
Randy Dunlap
reviewerRe: [PATCH v3 2/2] docs: Integrate rustdoc generation into htmldocs
Quoted 30 lines · Akira Yokosawa
Quoted 13 lines · Carlos Bilbao
Change target
make htmldocsto combine RST Sphinx and the generation of Rust documentation, when support is available.Signed-off-by Carlos Bilbao <[email protected]>--- Documentation/Makefile | 4 ++++ 1 file changed, 4 insertions(+)Documentation/Makefile +0
-0Documentation/Makefile quiet_cmd_sphinx = SPHINX $@ --> file://$(abspath $(BUILDDIR)/$3/$4) · line 101
Quoted 10 lines
Documentation/Makefile +4
-0@@ -92,6 +92,10 @@ quiet_cmd_sphinx = SPHINX $@ --> file://$(abspath $(BUILDDIR)/$3/$4) fi htmldocs: +# If Rust support is available, add rustdoc generated contents +ifdef CONFIG_RUST + $(Q)$(MAKE) rustdoc +endif @$(srctree)/scripts/sphinx-pre-install --version-check @+$(foreach var,$(SPHINXDIRS),$(call loop_cmd,sphinx,html,$(var),,$(var)))What about patch below on top of this?
This way, it is possible to skip rustdoc generation by saying:make
CONFIG_RUST=nSPHINXDIRS=doc-guide htmldocs
Quoted 9 lines
The reordering is to complete Sphinx runs even if rustdoc generation ends up in error.
With this applied on top,
Reviewed-by Akira Yokosawa <[email protected]>Thanks, Akira
Oh yes, I like both of those changes.
Thanks.
Quoted 21 lines
------
Documentation/Makefile +3
-3@@ -92,12 +92,12 @@ quiet_cmd_sphinx = SPHINX $@ --> file://$(abspath $(BUILDDIR)/$3/$4) fi htmldocs: + @$(srctree)/scripts/sphinx-pre-install --version-check + @+$(foreach var,$(SPHINXDIRS),$(call loop_cmd,sphinx,html,$(var),,$(var))) # If Rust support is available, add rustdoc generated contents -ifdef CONFIG_RUST +ifeq ($(CONFIG_RUST),y) $(Q)$(MAKE) rustdoc endif - @$(srctree)/scripts/sphinx-pre-install --version-check - @+$(foreach var,$(SPHINXDIRS),$(call loop_cmd,sphinx,html,$(var),,$(var))) texinfodocs: @$(srctree)/scripts/sphinx-pre-install --version-check
Signature · 1 line
~Randy