Skip to content

Commit 48fadf4

Browse files
Zildj1anJonathan Corbet
authored andcommitted
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 if Sphinx target rustdoc is set. Reviewed-by: Akira Yokosawa <[email protected]> Signed-off-by: Carlos Bilbao <[email protected]> Reviewed-by: Martin Rodriguez Reboredo <[email protected]> Signed-off-by: Jonathan Corbet <[email protected]> Link: https://lore.kernel.org/r/[email protected]
1 parent b4047e5 commit 48fadf4

File tree

2 files changed

+17
-6
lines changed

2 files changed

+17
-6
lines changed

Documentation/rust/index.rst

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,14 @@ Rust
66
Documentation related to Rust within the kernel. To start using Rust
77
in the kernel, please read the quick-start.rst guide.
88

9+
.. only:: rustdoc and html
10+
11+
You can also browse `rustdoc documentation <rustdoc/kernel/index.html>`_.
12+
13+
.. only:: not rustdoc and html
14+
15+
This documentation does not include rustdoc generated information.
16+
917
.. toctree::
1018
:maxdepth: 1
1119

rust/Makefile

Lines changed: 9 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,8 @@
11
# SPDX-License-Identifier: GPL-2.0
22

3+
# Where to place rustdoc generated documentation
4+
rustdoc_output := $(objtree)/Documentation/output/rust/rustdoc
5+
36
obj-$(CONFIG_RUST) += core.o compiler_builtins.o
47
always-$(CONFIG_RUST) += exports_core_generated.h
58

@@ -65,7 +68,7 @@ quiet_cmd_rustdoc = RUSTDOC $(if $(rustdoc_host),H, ) $<
6568
OBJTREE=$(abspath $(objtree)) \
6669
$(RUSTDOC) $(if $(rustdoc_host),$(rust_common_flags),$(rust_flags)) \
6770
$(rustc_target_flags) -L$(objtree)/$(obj) \
68-
--output $(objtree)/$(obj)/doc \
71+
--output $(rustdoc_output) \
6972
--crate-name $(subst rustdoc-,,$@) \
7073
@$(objtree)/include/generated/rustc_cfg $<
7174

@@ -82,15 +85,15 @@ quiet_cmd_rustdoc = RUSTDOC $(if $(rustdoc_host),H, ) $<
8285
# and then retouch the generated files.
8386
rustdoc: rustdoc-core rustdoc-macros rustdoc-compiler_builtins \
8487
rustdoc-alloc rustdoc-kernel
85-
$(Q)cp $(srctree)/Documentation/images/logo.svg $(objtree)/$(obj)/doc
86-
$(Q)cp $(srctree)/Documentation/images/COPYING-logo $(objtree)/$(obj)/doc
87-
$(Q)find $(objtree)/$(obj)/doc -name '*.html' -type f -print0 | xargs -0 sed -Ei \
88+
$(Q)cp $(srctree)/Documentation/images/logo.svg $(rustdoc_output)
89+
$(Q)cp $(srctree)/Documentation/images/COPYING-logo $(rustdoc_output)
90+
$(Q)find $(rustdoc_output) -name '*.html' -type f -print0 | xargs -0 sed -Ei \
8891
-e 's:rust-logo\.svg:logo.svg:g' \
8992
-e 's:rust-logo\.png:logo.svg:g' \
9093
-e 's:favicon\.svg:logo.svg:g' \
9194
-e 's:<link rel="alternate icon" type="image/png" href="[./]*favicon-(16x16|32x32)\.png">::g'
9295
$(Q)echo '.logo-container > img { object-fit: contain; }' \
93-
>> $(objtree)/$(obj)/doc/rustdoc.css
96+
>> $(rustdoc_output)/rustdoc.css
9497

9598
rustdoc-macros: private rustdoc_host = yes
9699
rustdoc-macros: private rustc_target_flags = --crate-type proc-macro \
@@ -154,7 +157,7 @@ quiet_cmd_rustdoc_test = RUSTDOC T $<
154157
@$(objtree)/include/generated/rustc_cfg \
155158
$(rustc_target_flags) $(rustdoc_test_target_flags) \
156159
--sysroot $(objtree)/$(obj)/test/sysroot $(rustdoc_test_quiet) \
157-
-L$(objtree)/$(obj)/test --output $(objtree)/$(obj)/doc \
160+
-L$(objtree)/$(obj)/test --output $(rustdoc_output) \
158161
--crate-name $(subst rusttest-,,$@) $<
159162

160163
# We cannot use `-Zpanic-abort-tests` because some tests are dynamic,

0 commit comments

Comments
 (0)