Skip to content

rust: Run rustdoc for the target triple #272

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
May 17, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 10 additions & 2 deletions rust/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -13,10 +13,18 @@ obj-$(CONFIG_RUST) += exports.o

RUSTDOC = rustdoc

quiet_cmd_rustdoc_host = RUSTDOC $<
cmd_rustdoc_host = \
RUST_BINDINGS_FILE=$(abspath $(objtree)/rust/bindings_generated.rs) \
$(RUSTDOC) $(filter-out --emit=%, $(rustc_flags)) \
$(rustdoc_target_flags) -L $(objtree)/rust/ \
--output $(objtree)/rust/doc --crate-name $(subst rustdoc-,,$@) \
-Fmissing-docs @$(objtree)/include/generated/rustc_cfg $<

quiet_cmd_rustdoc = RUSTDOC $<
cmd_rustdoc = \
RUST_BINDINGS_FILE=$(abspath $(objtree)/rust/bindings_generated.rs) \
$(RUSTDOC) $(filter-out --emit=%, $(rustc_flags)) \
$(RUSTDOC) $(rustc_cross_flags) $(filter-out --emit=%, $(rustc_flags)) \
$(rustdoc_target_flags) -L $(objtree)/rust/ \
--output $(objtree)/rust/doc --crate-name $(subst rustdoc-,,$@) \
-Fmissing-docs @$(objtree)/include/generated/rustc_cfg $<
Expand All @@ -26,7 +34,7 @@ rustdoc: rustdoc-module rustdoc-compiler_builtins rustdoc-kernel
rustdoc-module: private rustdoc_target_flags = --crate-type proc-macro \
--extern proc_macro
rustdoc-module: $(srctree)/rust/module.rs FORCE
$(call if_changed,rustdoc)
$(call if_changed,rustdoc_host)

rustdoc-compiler_builtins: $(srctree)/rust/compiler_builtins.rs FORCE
$(call if_changed,rustdoc)
Expand Down
4 changes: 3 additions & 1 deletion scripts/Makefile.build
Original file line number Diff line number Diff line change
Expand Up @@ -291,7 +291,9 @@ $(obj)/%.lst: $(src)/%.c FORCE
# Compile Rust sources (.rs)
# ---------------------------------------------------------------------------

rustc_cross_flags := --target=$(KBUILD_RUSTC_TARGET)
# Need to use absolute path here and have symbolic links resolved;
# otherwise rustdoc and rustc compute different hashes for the target.
rustc_cross_flags := --target=$(realpath $(KBUILD_RUSTC_TARGET))

quiet_cmd_rustc_o_rs = $(RUSTC_OR_CLIPPY_QUIET) $(quiet_modtag) $@
cmd_rustc_o_rs = \
Expand Down