Skip to content

Commit

Permalink
Merge pull request torvalds#272 from nbdd0121/rustdoc
Browse files Browse the repository at this point in the history
rust: Run rustdoc for the target triple
  • Loading branch information
ojeda authored May 17, 2021
2 parents fc2b177 + 8ed7f36 commit 3abb3f9
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 3 deletions.
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

0 comments on commit 3abb3f9

Please sign in to comment.