2013-10-11 20:21:46 +02:00
|
|
|
# Copyright 2012-2013 The Rust Project Developers. See the COPYRIGHT
|
2012-12-11 02:32:48 +01:00
|
|
|
# file at the top-level directory of this distribution and at
|
|
|
|
# http://rust-lang.org/COPYRIGHT.
|
|
|
|
#
|
|
|
|
# Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
|
|
|
|
# http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
|
|
|
|
# <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
|
|
|
|
# option. This file may not be copied, modified, or distributed
|
|
|
|
# except according to those terms.
|
|
|
|
|
2011-05-01 22:18:52 +02:00
|
|
|
######################################################################
|
2014-12-02 15:20:48 +01:00
|
|
|
# The various pieces of standalone documentation.
|
2014-03-08 15:41:31 +01:00
|
|
|
#
|
|
|
|
# The DOCS variable is their names (with no file extension).
|
|
|
|
#
|
|
|
|
# RUSTDOC_FLAGS_xyz variables are extra arguments to pass to the
|
|
|
|
# rustdoc invocation for xyz.
|
|
|
|
#
|
|
|
|
# RUSTDOC_DEPS_xyz are extra dependencies for the rustdoc invocation
|
|
|
|
# on xyz.
|
|
|
|
#
|
|
|
|
# L10N_LANGS are the languages for which the docs have been
|
|
|
|
# translated.
|
2011-05-01 22:18:52 +02:00
|
|
|
######################################################################
|
2015-11-03 21:46:06 +01:00
|
|
|
DOCS := index \
|
2014-12-02 15:20:48 +01:00
|
|
|
complement-lang-faq complement-design-faq complement-project-faq \
|
2015-02-14 00:00:00 +01:00
|
|
|
rustdoc reference grammar
|
2014-03-08 15:41:31 +01:00
|
|
|
|
2015-01-09 09:47:09 +01:00
|
|
|
# Legacy guides, preserved for a while to reduce the number of 404s
|
|
|
|
DOCS += guide-crates guide-error-handling guide-ffi guide-macros guide \
|
|
|
|
guide-ownership guide-plugins guide-pointers guide-strings guide-tasks \
|
2015-11-03 21:46:06 +01:00
|
|
|
guide-testing tutorial intro
|
2015-01-09 09:47:09 +01:00
|
|
|
|
|
|
|
|
2014-11-07 00:01:45 +01:00
|
|
|
RUSTDOC_DEPS_reference := doc/full-toc.inc
|
|
|
|
RUSTDOC_FLAGS_reference := --html-in-header=doc/full-toc.inc
|
2014-03-08 15:41:31 +01:00
|
|
|
|
|
|
|
L10N_LANGS := ja
|
|
|
|
|
|
|
|
# Generally no need to edit below here.
|
2011-05-01 22:18:52 +02:00
|
|
|
|
2014-03-08 15:41:31 +01:00
|
|
|
# The options are passed to the documentation generators.
|
2014-06-28 12:35:25 +02:00
|
|
|
RUSTDOC_HTML_OPTS_NO_CSS = --html-before-content=doc/version_info.html \
|
|
|
|
--html-in-header=doc/favicon.inc \
|
|
|
|
--html-after-content=doc/footer.inc \
|
2015-08-09 23:15:05 +02:00
|
|
|
--markdown-playground-url='https://play.rust-lang.org/'
|
2011-05-01 22:18:52 +02:00
|
|
|
|
2014-05-14 19:45:51 +02:00
|
|
|
RUSTDOC_HTML_OPTS = $(RUSTDOC_HTML_OPTS_NO_CSS) --markdown-css rust.css
|
|
|
|
|
2014-03-08 15:41:31 +01:00
|
|
|
# The rustdoc executable...
|
|
|
|
RUSTDOC_EXE = $(HBIN2_H_$(CFG_BUILD))/rustdoc$(X_$(CFG_BUILD))
|
|
|
|
# ...with rpath included in case --disable-rpath was provided to
|
|
|
|
# ./configure
|
|
|
|
RUSTDOC = $(RPATH_VAR2_T_$(CFG_BUILD)_H_$(CFG_BUILD)) $(RUSTDOC_EXE)
|
2012-01-13 04:10:30 +01:00
|
|
|
|
2014-12-02 15:20:48 +01:00
|
|
|
# The rustbook executable...
|
|
|
|
RUSTBOOK_EXE = $(HBIN2_H_$(CFG_BUILD))/rustbook$(X_$(CFG_BUILD))
|
|
|
|
# ...with rpath included in case --disable-rpath was provided to
|
|
|
|
# ./configure
|
|
|
|
RUSTBOOK = $(RPATH_VAR2_T_$(CFG_BUILD)_H_$(CFG_BUILD)) $(RUSTBOOK_EXE)
|
|
|
|
|
2016-02-15 07:26:37 +01:00
|
|
|
# The error_index_generator executable...
|
|
|
|
ERR_IDX_GEN_EXE = $(HBIN2_H_$(CFG_BUILD))/error_index_generator$(X_$(CFG_BUILD))
|
2015-05-03 02:57:41 +02:00
|
|
|
ERR_IDX_GEN = $(RPATH_VAR2_T_$(CFG_BUILD)_H_$(CFG_BUILD)) $(ERR_IDX_GEN_EXE)
|
2016-02-07 13:03:11 +01:00
|
|
|
ERR_IDX_GEN_MD = $(RPATH_VAR2_T_$(CFG_BUILD)_H_$(CFG_BUILD)) $(ERR_IDX_GEN_EXE) markdown
|
2015-05-03 02:57:41 +02:00
|
|
|
|
2014-01-28 23:15:29 +01:00
|
|
|
D := $(S)src/doc
|
|
|
|
|
2015-11-19 17:30:18 +01:00
|
|
|
DOC_TARGETS := book nomicon style error-index
|
2014-03-08 15:41:31 +01:00
|
|
|
COMPILER_DOC_TARGETS :=
|
|
|
|
DOC_L10N_TARGETS :=
|
|
|
|
|
|
|
|
# If NO_REBUILD is set then break the dependencies on rustdoc so we
|
|
|
|
# build the documentation without having to rebuild rustdoc.
|
2016-02-02 08:27:04 +01:00
|
|
|
ifeq ($(NO_REBUILD),)
|
2014-03-08 15:41:31 +01:00
|
|
|
HTML_DEPS := $(RUSTDOC_EXE)
|
|
|
|
else
|
|
|
|
HTML_DEPS :=
|
|
|
|
endif
|
|
|
|
|
2014-01-06 22:38:20 +01:00
|
|
|
######################################################################
|
|
|
|
# Rust version
|
|
|
|
######################################################################
|
2014-01-17 19:38:48 +01:00
|
|
|
|
2014-01-06 22:38:20 +01:00
|
|
|
HTML_DEPS += doc/version_info.html
|
2014-01-28 23:15:29 +01:00
|
|
|
doc/version_info.html: $(D)/version_info.html.template $(MKFILE_DEPS) \
|
|
|
|
$(wildcard $(D)/*.*) | doc/
|
2014-01-06 22:38:20 +01:00
|
|
|
@$(call E, version-info: $@)
|
2014-10-04 20:41:37 +02:00
|
|
|
$(Q)sed -e "s/VERSION/$(CFG_RELEASE)/; \
|
|
|
|
s/SHORT_HASH/$(CFG_SHORT_VER_HASH)/; \
|
2014-01-06 22:38:20 +01:00
|
|
|
s/STAMP/$(CFG_VER_HASH)/;" $< >$@
|
|
|
|
|
2015-08-12 02:12:11 +02:00
|
|
|
GENERATED += doc/version_info.html
|
2014-01-06 22:38:20 +01:00
|
|
|
|
2012-01-18 23:14:28 +01:00
|
|
|
######################################################################
|
2015-08-12 02:12:11 +02:00
|
|
|
# Docs from rustdoc
|
2012-01-18 23:14:28 +01:00
|
|
|
######################################################################
|
2012-03-21 01:50:32 +01:00
|
|
|
|
2014-01-28 23:15:29 +01:00
|
|
|
doc/:
|
|
|
|
@mkdir -p $@
|
|
|
|
|
2013-12-23 03:21:45 +01:00
|
|
|
HTML_DEPS += doc/rust.css
|
2014-01-28 23:15:29 +01:00
|
|
|
doc/rust.css: $(D)/rust.css | doc/
|
2012-03-27 02:59:09 +02:00
|
|
|
@$(call E, cp: $@)
|
2015-02-14 14:01:16 +01:00
|
|
|
$(Q)cp -PRp $< $@ 2> /dev/null
|
2012-03-27 02:59:09 +02:00
|
|
|
|
2014-02-07 20:46:39 +01:00
|
|
|
HTML_DEPS += doc/favicon.inc
|
|
|
|
doc/favicon.inc: $(D)/favicon.inc | doc/
|
|
|
|
@$(call E, cp: $@)
|
2015-02-14 14:01:16 +01:00
|
|
|
$(Q)cp -PRp $< $@ 2> /dev/null
|
2014-02-07 20:46:39 +01:00
|
|
|
|
2014-01-28 23:15:29 +01:00
|
|
|
doc/full-toc.inc: $(D)/full-toc.inc | doc/
|
2012-12-15 03:06:11 +01:00
|
|
|
@$(call E, cp: $@)
|
2015-02-14 14:01:16 +01:00
|
|
|
$(Q)cp -PRp $< $@ 2> /dev/null
|
2012-12-15 03:06:11 +01:00
|
|
|
|
2014-02-07 20:46:39 +01:00
|
|
|
HTML_DEPS += doc/footer.inc
|
|
|
|
doc/footer.inc: $(D)/footer.inc | doc/
|
|
|
|
@$(call E, cp: $@)
|
2015-02-14 14:01:16 +01:00
|
|
|
$(Q)cp -PRp $< $@ 2> /dev/null
|
2014-02-07 20:46:39 +01:00
|
|
|
|
2014-03-08 15:41:31 +01:00
|
|
|
# The (english) documentation for each doc item.
|
2014-05-14 19:45:51 +02:00
|
|
|
DOC_TARGETS += doc/not_found.html
|
|
|
|
doc/not_found.html: $(D)/not_found.md $(HTML_DEPS) | doc/
|
2014-06-01 20:09:30 +02:00
|
|
|
@$(call E, rustdoc: $@)
|
|
|
|
$(Q)$(RUSTDOC) $(RUSTDOC_HTML_OPTS_NO_CSS) \
|
2015-06-09 21:47:48 +02:00
|
|
|
--markdown-no-toc \
|
2015-08-09 23:15:05 +02:00
|
|
|
--markdown-css https://doc.rust-lang.org/rust.css $<
|
2014-05-14 19:45:51 +02:00
|
|
|
|
2014-03-08 15:41:31 +01:00
|
|
|
define DEF_DOC
|
|
|
|
|
|
|
|
# HTML (rustdoc)
|
|
|
|
DOC_TARGETS += doc/$(1).html
|
|
|
|
doc/$(1).html: $$(D)/$(1).md $$(HTML_DEPS) $$(RUSTDOC_DEPS_$(1)) | doc/
|
|
|
|
@$$(call E, rustdoc: $$@)
|
2014-06-01 20:09:30 +02:00
|
|
|
$$(Q)$$(RUSTDOC) $$(RUSTDOC_HTML_OPTS) $$(RUSTDOC_FLAGS_$(1)) $$<
|
2014-03-08 15:41:31 +01:00
|
|
|
|
|
|
|
endef
|
|
|
|
|
|
|
|
$(foreach docname,$(DOCS),$(eval $(call DEF_DOC,$(docname))))
|
2013-04-24 07:51:48 +02:00
|
|
|
|
2014-03-08 15:41:31 +01:00
|
|
|
|
2012-01-18 23:14:28 +01:00
|
|
|
######################################################################
|
2013-05-17 19:45:09 +02:00
|
|
|
# Rustdoc (libstd/extra)
|
2012-01-18 23:14:28 +01:00
|
|
|
######################################################################
|
2011-05-01 22:18:52 +02:00
|
|
|
|
2011-12-06 01:46:37 +01:00
|
|
|
|
2012-03-10 07:53:46 +01:00
|
|
|
# The library documenting macro
|
2014-01-25 04:27:22 +01:00
|
|
|
#
|
2013-09-22 08:25:48 +02:00
|
|
|
# $(1) - The crate name (std/extra)
|
2013-11-25 05:31:21 +01:00
|
|
|
#
|
|
|
|
# Passes --cfg stage2 to rustdoc because it uses the stage2 librustc.
|
2014-03-08 15:41:31 +01:00
|
|
|
define DEF_LIB_DOC
|
|
|
|
|
|
|
|
# If NO_REBUILD is set then break the dependencies on rustdoc so we
|
|
|
|
# build crate documentation without having to rebuild rustdoc.
|
2016-02-02 08:27:04 +01:00
|
|
|
ifeq ($(NO_REBUILD),)
|
2014-03-08 15:41:31 +01:00
|
|
|
LIB_DOC_DEP_$(1) = \
|
|
|
|
$$(CRATEFILE_$(1)) \
|
|
|
|
$$(RSINPUTS_$(1)) \
|
|
|
|
$$(RUSTDOC_EXE) \
|
2016-02-08 19:57:41 +01:00
|
|
|
$$(foreach dep,$$(RUST_DEPS_$(1)_T_$(CFG_BUILD)), \
|
2014-12-21 08:29:59 +01:00
|
|
|
$$(TLIB2_T_$(CFG_BUILD)_H_$(CFG_BUILD))/stamp.$$(dep)) \
|
2016-02-08 19:57:41 +01:00
|
|
|
$$(foreach dep,$$(filter $$(DOC_CRATES), $$(RUST_DEPS_$(1)_T_$(CFG_BUILD))), \
|
2014-06-09 22:00:18 +02:00
|
|
|
doc/$$(dep)/)
|
2014-03-08 15:41:31 +01:00
|
|
|
else
|
|
|
|
LIB_DOC_DEP_$(1) = $$(CRATEFILE_$(1)) $$(RSINPUTS_$(1))
|
|
|
|
endif
|
2014-02-07 00:43:27 +01:00
|
|
|
|
2014-06-09 22:00:18 +02:00
|
|
|
doc/$(1)/:
|
|
|
|
$$(Q)mkdir -p $$@
|
|
|
|
|
2014-04-08 19:45:53 +02:00
|
|
|
doc/$(1)/index.html: CFG_COMPILER_HOST_TRIPLE = $(CFG_TARGET)
|
2014-06-09 22:00:18 +02:00
|
|
|
doc/$(1)/index.html: $$(LIB_DOC_DEP_$(1)) doc/$(1)/
|
2014-08-02 01:48:41 +02:00
|
|
|
@$$(call E, rustdoc: $$@)
|
2014-11-26 00:28:49 +01:00
|
|
|
$$(Q)CFG_LLVM_LINKAGE_FILE=$$(LLVM_LINKAGE_PATH_$(CFG_BUILD)) \
|
2015-04-07 00:26:27 +02:00
|
|
|
$$(RUSTDOC) --cfg dox --cfg stage2 $$(RUSTFLAGS_$(1)) $$<
|
2013-12-29 06:13:19 +01:00
|
|
|
endef
|
|
|
|
|
2015-04-08 00:11:16 +02:00
|
|
|
$(foreach crate,$(CRATES),$(eval $(call DEF_LIB_DOC,$(crate))))
|
2015-03-28 04:01:19 +01:00
|
|
|
|
2015-04-08 00:11:16 +02:00
|
|
|
COMPILER_DOC_TARGETS := $(CRATES:%=doc/%/index.html)
|
2015-06-02 23:49:47 +02:00
|
|
|
ifdef CFG_ENABLE_COMPILER_DOCS
|
2015-04-08 00:11:16 +02:00
|
|
|
DOC_TARGETS += $(COMPILER_DOC_TARGETS)
|
|
|
|
else
|
|
|
|
DOC_TARGETS += $(DOC_CRATES:%=doc/%/index.html)
|
2015-03-28 04:01:19 +01:00
|
|
|
endif
|
2012-01-18 23:14:28 +01:00
|
|
|
|
|
|
|
ifdef CFG_DISABLE_DOCS
|
|
|
|
$(info cfg: disabling doc build (CFG_DISABLE_DOCS))
|
2014-03-08 15:41:31 +01:00
|
|
|
DOC_TARGETS :=
|
2014-05-28 02:17:17 +02:00
|
|
|
COMPILER_DOC_TARGETS :=
|
2012-01-18 23:14:28 +01:00
|
|
|
endif
|
|
|
|
|
2014-03-08 15:41:31 +01:00
|
|
|
docs: $(DOC_TARGETS)
|
2015-09-03 00:03:17 +02:00
|
|
|
doc: docs
|
2014-03-08 15:41:31 +01:00
|
|
|
compiler-docs: $(COMPILER_DOC_TARGETS)
|
2014-12-02 15:20:48 +01:00
|
|
|
|
2015-11-19 17:30:18 +01:00
|
|
|
book: doc/book/index.html
|
2014-12-02 15:20:48 +01:00
|
|
|
|
2015-11-19 17:30:18 +01:00
|
|
|
doc/book/index.html: $(RUSTBOOK_EXE) $(wildcard $(S)/src/doc/book/*.md) | doc/
|
2015-02-27 06:00:43 +01:00
|
|
|
@$(call E, rustbook: $@)
|
2014-12-02 15:20:48 +01:00
|
|
|
$(Q)rm -rf doc/book
|
2015-11-19 17:30:18 +01:00
|
|
|
$(Q)$(RUSTBOOK) build $(S)src/doc/book doc/book
|
2015-02-14 18:02:45 +01:00
|
|
|
|
2015-07-31 23:13:59 +02:00
|
|
|
nomicon: doc/nomicon/index.html
|
2015-07-14 08:31:52 +02:00
|
|
|
|
2015-07-31 23:13:59 +02:00
|
|
|
doc/nomicon/index.html: $(RUSTBOOK_EXE) $(wildcard $(S)/src/doc/nomicon/*.md) | doc/
|
2015-07-14 08:31:52 +02:00
|
|
|
@$(call E, rustbook: $@)
|
2015-07-31 23:13:59 +02:00
|
|
|
$(Q)rm -rf doc/nomicon
|
|
|
|
$(Q)$(RUSTBOOK) build $(S)src/doc/nomicon doc/nomicon
|
2015-07-14 08:31:52 +02:00
|
|
|
|
2015-02-14 18:02:45 +01:00
|
|
|
style: doc/style/index.html
|
|
|
|
|
|
|
|
doc/style/index.html: $(RUSTBOOK_EXE) $(wildcard $(S)/src/doc/style/*.md) | doc/
|
2015-02-27 06:00:43 +01:00
|
|
|
@$(call E, rustbook: $@)
|
2015-02-14 18:02:45 +01:00
|
|
|
$(Q)rm -rf doc/style
|
|
|
|
$(Q)$(RUSTBOOK) build $(S)src/doc/style doc/style
|
2015-05-03 02:57:41 +02:00
|
|
|
|
|
|
|
error-index: doc/error-index.html
|
|
|
|
|
2016-02-07 13:03:11 +01:00
|
|
|
# Metadata used to generate the index is created as a side effect of
|
|
|
|
# the build so this depends on every crate being up to date.
|
|
|
|
doc/error-index.html: $(ERR_IDX_GEN_EXE) $(CSREQ$(2)_T_$(CFG_BUILD)_H_$(CFG_BUILD)) | doc/
|
2016-02-15 07:26:37 +01:00
|
|
|
$(Q)$(call E, error_index_generator: $@)
|
2015-05-03 02:57:41 +02:00
|
|
|
$(Q)$(ERR_IDX_GEN)
|
2016-02-07 13:03:11 +01:00
|
|
|
|
|
|
|
doc/error-index.md: $(ERR_IDX_GEN_EXE) $(CSREQ$(2)_T_$(CFG_BUILD)_H_$(CFG_BUILD)) | doc/
|
2016-02-15 07:26:37 +01:00
|
|
|
$(Q)$(call E, error_index_generator: $@)
|
2016-02-07 13:03:11 +01:00
|
|
|
$(Q)$(ERR_IDX_GEN_MD)
|