From 992a2db1fc64987c0c68c66e74bff81468b6f7b8 Mon Sep 17 00:00:00 2001 From: Alex Crichton Date: Mon, 9 Jun 2014 13:00:18 -0700 Subject: [PATCH] mk: Ensure docs have relative links to each other When generating documentation, rustdoc has the ability to generate relative links within the current distribution of crates to one another. To do this, it must recognize when a crate's documentation is in the same output directory. The current threshold for "local documentation for crate X being available" is whether the directory "doc/X" exists. This change modifies the build system to have new dependencies for each directory of upstream crates for a rustdoc invocation. This will ensure that when building documentation that all the crates in the standard distribution are guaranteed to have relative links to one another. This change is prompted by guaranteeing that offline docs always work with one another. Before this change, races could mean that some docs were built before others, and hence may have http links when relative links would suffice. Closes #14747 --- mk/docs.mk | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/mk/docs.mk b/mk/docs.mk index dab40cb1654..575ecec9d92 100644 --- a/mk/docs.mk +++ b/mk/docs.mk @@ -273,14 +273,18 @@ LIB_DOC_DEP_$(1) = \ $$(RSINPUTS_$(1)) \ $$(RUSTDOC_EXE) \ $$(foreach dep,$$(RUST_DEPS_$(1)), \ - $$(TLIB2_T_$(CFG_BUILD)_H_$(CFG_BUILD))/stamp.$$(dep)) + $$(TLIB2_T_$(CFG_BUILD)_H_$(CFG_BUILD))/stamp.$$(dep) \ + doc/$$(dep)/) else LIB_DOC_DEP_$(1) = $$(CRATEFILE_$(1)) $$(RSINPUTS_$(1)) endif +doc/$(1)/: + $$(Q)mkdir -p $$@ + $(2) += doc/$(1)/index.html doc/$(1)/index.html: CFG_COMPILER_HOST_TRIPLE = $(CFG_TARGET) -doc/$(1)/index.html: $$(LIB_DOC_DEP_$(1)) +doc/$(1)/index.html: $$(LIB_DOC_DEP_$(1)) doc/$(1)/ @$$(call E, rustdoc $$@) $$(Q)$$(RUSTDOC) --cfg dox --cfg stage2 $$< endef