2013-10-11 13:21:46 -05:00
|
|
|
# Copyright 2012-2013 The Rust Project Developers. See the COPYRIGHT
|
2012-12-10 19:32:48 -06: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 15:18:52 -05:00
|
|
|
######################################################################
|
|
|
|
# Doc variables and rules
|
|
|
|
######################################################################
|
|
|
|
|
2012-01-18 16:14:28 -06:00
|
|
|
DOCS :=
|
2013-12-28 23:13:19 -06:00
|
|
|
CDOCS :=
|
2013-08-08 08:38:33 -05:00
|
|
|
DOCS_L10N :=
|
2011-05-01 15:18:52 -05:00
|
|
|
|
2013-12-07 10:42:00 -06:00
|
|
|
BASE_DOC_OPTS := --from=markdown --standalone --toc --number-sections
|
|
|
|
HTML_OPTS = $(BASE_DOC_OPTS) --to=html5 --section-divs --css=rust.css --include-before-body=doc/version_info.html --include-in-header=doc/favicon.inc
|
2013-11-11 15:17:54 -06:00
|
|
|
TEX_OPTS = $(BASE_DOC_OPTS) --to=latex
|
|
|
|
EPUB_OPTS = $(BASE_DOC_OPTS) --to=epub
|
2012-01-12 21:10:30 -06:00
|
|
|
|
2012-01-18 16:14:28 -06:00
|
|
|
######################################################################
|
2013-04-24 00:51:48 -05:00
|
|
|
# Docs, from pandoc, rustdoc (which runs pandoc), and node
|
2012-01-18 16:14:28 -06:00
|
|
|
######################################################################
|
2012-03-20 19:50:32 -05:00
|
|
|
|
2012-03-26 19:59:09 -05:00
|
|
|
doc/rust.css: rust.css
|
|
|
|
@$(call E, cp: $@)
|
|
|
|
$(Q)cp -a $< $@ 2> /dev/null
|
|
|
|
|
2013-10-11 13:21:46 -05:00
|
|
|
doc/manual.inc: manual.inc
|
2012-12-14 20:06:11 -06:00
|
|
|
@$(call E, cp: $@)
|
|
|
|
$(Q)cp -a $< $@ 2> /dev/null
|
|
|
|
|
2013-11-11 09:13:56 -06:00
|
|
|
doc/favicon.inc: favicon.inc
|
|
|
|
@$(call E, cp: $@)
|
|
|
|
$(Q)cp -a $< $@ 2> /dev/null
|
|
|
|
|
2013-04-24 00:51:48 -05:00
|
|
|
ifeq ($(CFG_PANDOC),)
|
|
|
|
$(info cfg: no pandoc found, omitting docs)
|
|
|
|
NO_DOCS = 1
|
|
|
|
endif
|
|
|
|
|
|
|
|
ifeq ($(CFG_NODE),)
|
|
|
|
$(info cfg: no node found, omitting docs)
|
|
|
|
NO_DOCS = 1
|
|
|
|
endif
|
|
|
|
|
|
|
|
ifneq ($(NO_DOCS),1)
|
|
|
|
|
2012-01-19 07:19:23 -06:00
|
|
|
DOCS += doc/rust.html
|
2013-11-11 09:13:56 -06:00
|
|
|
doc/rust.html: rust.md doc/version_info.html doc/rust.css doc/manual.inc \
|
|
|
|
doc/favicon.inc
|
2012-01-12 21:10:30 -06:00
|
|
|
@$(call E, pandoc: $@)
|
2012-03-20 19:50:32 -05:00
|
|
|
$(Q)$(CFG_NODE) $(S)doc/prep.js --highlight $< | \
|
2013-11-11 15:17:54 -06:00
|
|
|
$(CFG_PANDOC) $(HTML_OPTS) --include-in-header=doc/manual.inc --output=$@
|
2012-01-12 21:10:30 -06:00
|
|
|
|
2013-04-30 19:45:08 -05:00
|
|
|
DOCS += doc/rust.tex
|
2012-04-19 22:06:13 -05:00
|
|
|
doc/rust.tex: rust.md doc/version.md
|
2012-01-12 21:10:30 -06:00
|
|
|
@$(call E, pandoc: $@)
|
2012-03-27 15:07:26 -05:00
|
|
|
$(Q)$(CFG_NODE) $(S)doc/prep.js $< | \
|
2013-11-11 15:17:54 -06:00
|
|
|
$(CFG_PANDOC) $(TEX_OPTS) --output=$@
|
2013-10-11 13:21:46 -05:00
|
|
|
|
2013-11-01 14:13:00 -05:00
|
|
|
DOCS += doc/rust.epub
|
2013-11-11 15:17:54 -06:00
|
|
|
doc/rust.epub: rust.md doc/version_info.html doc/rust.css
|
2013-11-01 14:13:00 -05:00
|
|
|
@$(call E, pandoc: $@)
|
|
|
|
$(Q)$(CFG_NODE) $(S)doc/prep.js --highlight $< | \
|
2013-11-11 15:17:54 -06:00
|
|
|
$(CFG_PANDOC) $(EPUB_OPTS) --output=$@
|
2013-11-01 14:13:00 -05:00
|
|
|
|
2013-04-18 18:15:17 -05:00
|
|
|
DOCS += doc/rustpkg.html
|
2013-11-11 15:17:54 -06:00
|
|
|
doc/rustpkg.html: rustpkg.md doc/version_info.html doc/rust.css \
|
2013-11-11 09:13:56 -06:00
|
|
|
doc/favicon.inc
|
2013-04-18 18:15:17 -05:00
|
|
|
@$(call E, pandoc: $@)
|
|
|
|
$(Q)$(CFG_NODE) $(S)doc/prep.js --highlight $< | \
|
2013-11-11 15:17:54 -06:00
|
|
|
$(CFG_PANDOC) $(HTML_OPTS) --output=$@
|
2013-04-18 18:15:17 -05:00
|
|
|
|
2013-12-06 10:29:58 -06:00
|
|
|
DOCS += doc/rustdoc.html
|
|
|
|
doc/rustdoc.html: rustdoc.md doc/version_info.html doc/rust.css \
|
|
|
|
doc/favicon.inc
|
|
|
|
@$(call E, pandoc: $@)
|
|
|
|
$(Q)$(CFG_NODE) $(S)doc/prep.js --highlight $< | \
|
|
|
|
$(CFG_PANDOC) $(HTML_OPTS) --output=$@
|
|
|
|
|
2012-01-19 05:51:20 -06:00
|
|
|
DOCS += doc/tutorial.html
|
2013-11-11 09:13:56 -06:00
|
|
|
doc/tutorial.html: tutorial.md doc/version_info.html doc/rust.css \
|
|
|
|
doc/favicon.inc
|
2012-01-19 05:51:20 -06:00
|
|
|
@$(call E, pandoc: $@)
|
|
|
|
$(Q)$(CFG_NODE) $(S)doc/prep.js --highlight $< | \
|
2013-11-11 15:17:54 -06:00
|
|
|
$(CFG_PANDOC) $(HTML_OPTS) --output=$@
|
2012-09-05 13:03:36 -05:00
|
|
|
|
2013-11-11 09:13:56 -06:00
|
|
|
DOCS += doc/tutorial.tex
|
|
|
|
doc/tutorial.tex: tutorial.md doc/version.md
|
|
|
|
@$(call E, pandoc: $@)
|
|
|
|
$(Q)$(CFG_NODE) $(S)doc/prep.js $< | \
|
2013-11-11 15:17:54 -06:00
|
|
|
$(CFG_PANDOC) $(TEX_OPTS) --output=$@
|
2013-11-11 09:13:56 -06:00
|
|
|
|
2013-11-01 14:13:00 -05:00
|
|
|
DOCS += doc/tutorial.epub
|
|
|
|
doc/tutorial.epub: tutorial.md doc/version_info.html doc/rust.css
|
|
|
|
@$(call E, pandoc: $@)
|
|
|
|
$(Q)$(CFG_NODE) $(S)doc/prep.js --highlight $< | \
|
2013-11-11 15:17:54 -06:00
|
|
|
$(CFG_PANDOC) $(EPUB_OPTS) --output=$@
|
2013-11-01 14:13:00 -05:00
|
|
|
|
|
|
|
|
2013-08-08 08:38:33 -05:00
|
|
|
DOCS_L10N += doc/l10n/ja/tutorial.html
|
|
|
|
doc/l10n/ja/tutorial.html: doc/l10n/ja/tutorial.md doc/version_info.html doc/rust.css
|
|
|
|
@$(call E, pandoc: $@)
|
|
|
|
$(Q)$(CFG_NODE) $(S)doc/prep.js --highlight doc/l10n/ja/tutorial.md | \
|
|
|
|
$(CFG_PANDOC) --standalone --toc \
|
|
|
|
--section-divs --number-sections \
|
2013-10-11 12:18:43 -05:00
|
|
|
--from=markdown --to=html5 --css=../../rust.css \
|
2013-10-11 13:21:46 -05:00
|
|
|
--include-before-body=doc/version_info.html \
|
2013-08-08 08:38:33 -05:00
|
|
|
--output=$@
|
|
|
|
|
2012-09-05 13:03:36 -05:00
|
|
|
DOCS += doc/tutorial-macros.html
|
2013-11-11 09:13:56 -06:00
|
|
|
doc/tutorial-macros.html: tutorial-macros.md doc/version_info.html doc/rust.css \
|
|
|
|
doc/favicon.inc
|
2012-09-05 13:03:36 -05:00
|
|
|
@$(call E, pandoc: $@)
|
|
|
|
$(Q)$(CFG_NODE) $(S)doc/prep.js --highlight $< | \
|
2013-11-11 15:17:54 -06:00
|
|
|
$(CFG_PANDOC) $(HTML_OPTS) --output=$@
|
2012-09-05 13:20:04 -05:00
|
|
|
|
2013-06-27 17:48:12 -05:00
|
|
|
DOCS += doc/tutorial-container.html
|
2013-11-11 09:13:56 -06:00
|
|
|
doc/tutorial-container.html: tutorial-container.md doc/version_info.html doc/rust.css \
|
|
|
|
doc/favicon.inc
|
2013-06-27 17:48:12 -05:00
|
|
|
@$(call E, pandoc: $@)
|
|
|
|
$(Q)$(CFG_NODE) $(S)doc/prep.js --highlight $< | \
|
2013-11-11 15:17:54 -06:00
|
|
|
$(CFG_PANDOC) $(HTML_OPTS) --output=$@
|
2013-06-27 17:48:12 -05:00
|
|
|
|
2012-09-05 13:20:04 -05:00
|
|
|
DOCS += doc/tutorial-ffi.html
|
2013-11-11 09:13:56 -06:00
|
|
|
doc/tutorial-ffi.html: tutorial-ffi.md doc/version_info.html doc/rust.css \
|
|
|
|
doc/favicon.inc
|
2012-09-05 13:20:04 -05:00
|
|
|
@$(call E, pandoc: $@)
|
|
|
|
$(Q)$(CFG_NODE) $(S)doc/prep.js --highlight $< | \
|
2013-11-11 15:17:54 -06:00
|
|
|
$(CFG_PANDOC) $(HTML_OPTS) --output=$@
|
2012-09-15 19:09:21 -05:00
|
|
|
|
|
|
|
DOCS += doc/tutorial-borrowed-ptr.html
|
2013-11-11 09:13:56 -06:00
|
|
|
doc/tutorial-borrowed-ptr.html: tutorial-borrowed-ptr.md doc/version_info.html doc/rust.css \
|
|
|
|
doc/favicon.inc
|
2012-09-15 19:09:21 -05:00
|
|
|
@$(call E, pandoc: $@)
|
|
|
|
$(Q)$(CFG_NODE) $(S)doc/prep.js --highlight $< | \
|
2013-11-11 15:17:54 -06:00
|
|
|
$(CFG_PANDOC) $(HTML_OPTS) --output=$@
|
2012-09-22 17:33:50 -05:00
|
|
|
|
|
|
|
DOCS += doc/tutorial-tasks.html
|
2013-11-11 09:13:56 -06:00
|
|
|
doc/tutorial-tasks.html: tutorial-tasks.md doc/version_info.html doc/rust.css \
|
|
|
|
doc/favicon.inc
|
2012-09-22 17:33:50 -05:00
|
|
|
@$(call E, pandoc: $@)
|
|
|
|
$(Q)$(CFG_NODE) $(S)doc/prep.js --highlight $< | \
|
2013-11-11 15:17:54 -06:00
|
|
|
$(CFG_PANDOC) $(HTML_OPTS) --output=$@
|
2012-01-19 05:51:20 -06:00
|
|
|
|
2013-08-16 18:03:24 -05:00
|
|
|
DOCS += doc/tutorial-conditions.html
|
2013-11-11 09:13:56 -06:00
|
|
|
doc/tutorial-conditions.html: tutorial-conditions.md doc/version_info.html doc/rust.css \
|
|
|
|
doc/favicon.inc
|
2013-08-16 18:03:24 -05:00
|
|
|
@$(call E, pandoc: $@)
|
2013-09-23 16:36:38 -05:00
|
|
|
$(Q)$(CFG_NODE) $(S)doc/prep.js --highlight $< | \
|
2013-11-11 15:17:54 -06:00
|
|
|
$(CFG_PANDOC) $(HTML_OPTS) --output=$@
|
2013-09-23 16:36:38 -05:00
|
|
|
|
|
|
|
DOCS += doc/tutorial-rustpkg.html
|
2013-11-11 09:13:56 -06:00
|
|
|
doc/tutorial-rustpkg.html: tutorial-rustpkg.md doc/version_info.html doc/rust.css \
|
|
|
|
doc/favicon.inc
|
2013-09-23 16:36:38 -05:00
|
|
|
@$(call E, pandoc: $@)
|
2013-08-16 18:03:24 -05:00
|
|
|
$(Q)$(CFG_NODE) $(S)doc/prep.js --highlight $< | \
|
2013-11-11 15:17:54 -06:00
|
|
|
$(CFG_PANDOC) $(HTML_OPTS) --output=$@
|
2013-08-16 18:03:24 -05:00
|
|
|
|
2013-04-24 00:51:48 -05:00
|
|
|
ifeq ($(CFG_PDFLATEX),)
|
|
|
|
$(info cfg: no pdflatex found, omitting doc/rust.pdf)
|
|
|
|
else
|
|
|
|
ifeq ($(CFG_XETEX),)
|
|
|
|
$(info cfg: no xetex found, disabling doc/rust.pdf)
|
|
|
|
else
|
|
|
|
ifeq ($(CFG_LUATEX),)
|
|
|
|
$(info cfg: lacking luatex, disabling pdflatex)
|
|
|
|
else
|
|
|
|
|
2013-04-30 19:45:08 -05:00
|
|
|
DOCS += doc/rust.pdf
|
2013-04-24 00:51:48 -05:00
|
|
|
doc/rust.pdf: doc/rust.tex
|
|
|
|
@$(call E, pdflatex: $@)
|
|
|
|
$(Q)$(CFG_PDFLATEX) \
|
|
|
|
-interaction=batchmode \
|
|
|
|
-output-directory=doc \
|
|
|
|
$<
|
|
|
|
|
2013-10-11 13:21:46 -05:00
|
|
|
DOCS += doc/tutorial.pdf
|
|
|
|
doc/tutorial.pdf: doc/tutorial.tex
|
|
|
|
@$(call E, pdflatex: $@)
|
|
|
|
$(Q)$(CFG_PDFLATEX) \
|
|
|
|
-interaction=batchmode \
|
|
|
|
-output-directory=doc \
|
|
|
|
$<
|
|
|
|
|
2013-04-24 00:51:48 -05:00
|
|
|
endif
|
|
|
|
endif
|
2012-01-19 05:51:20 -06:00
|
|
|
endif
|
2012-01-12 21:10:30 -06:00
|
|
|
|
2013-04-24 00:51:48 -05:00
|
|
|
endif # No pandoc / node
|
2012-01-18 16:14:28 -06:00
|
|
|
|
|
|
|
######################################################################
|
|
|
|
# LLnextgen (grammar analysis from refman)
|
|
|
|
######################################################################
|
|
|
|
ifeq ($(CFG_LLNEXTGEN),)
|
|
|
|
$(info cfg: no llnextgen found, omitting grammar-verification)
|
|
|
|
else
|
|
|
|
.PHONY: verify-grammar
|
|
|
|
|
|
|
|
doc/rust.g: rust.md $(S)src/etc/extract_grammar.py
|
|
|
|
@$(call E, extract_grammar: $@)
|
2013-01-03 01:53:05 -06:00
|
|
|
$(Q)$(CFG_PYTHON) $(S)src/etc/extract_grammar.py $< >$@
|
2012-01-18 16:14:28 -06:00
|
|
|
|
|
|
|
verify-grammar: doc/rust.g
|
|
|
|
@$(call E, LLnextgen: $<)
|
|
|
|
$(Q)$(CFG_LLNEXTGEN) --generate-lexer-wrapper=no $< >$@
|
|
|
|
$(Q)rm -f doc/rust.c doc/rust.h
|
2012-01-17 18:49:57 -06:00
|
|
|
endif
|
|
|
|
|
|
|
|
|
2012-01-18 16:14:28 -06:00
|
|
|
######################################################################
|
2013-05-17 12:45:09 -05:00
|
|
|
# Rustdoc (libstd/extra)
|
2012-01-18 16:14:28 -06:00
|
|
|
######################################################################
|
2011-05-01 15:18:52 -05:00
|
|
|
|
2012-03-10 00:53:46 -06:00
|
|
|
# The rustdoc executable
|
2013-10-21 04:18:21 -05:00
|
|
|
RUSTDOC = $(HBIN2_H_$(CFG_BUILD))/rustdoc$(X_$(CFG_BUILD))
|
2011-12-05 18:46:37 -06:00
|
|
|
|
2012-03-10 00:53:46 -06:00
|
|
|
# The library documenting macro
|
2013-09-22 01:25:48 -05:00
|
|
|
# $(1) - The crate name (std/extra)
|
2012-03-10 00:53:46 -06:00
|
|
|
# $(2) - The crate file
|
2013-09-22 01:25:48 -05:00
|
|
|
# $(3) - The relevant host build triple (to depend on libstd)
|
2013-11-24 22:31:21 -06:00
|
|
|
#
|
|
|
|
# Passes --cfg stage2 to rustdoc because it uses the stage2 librustc.
|
2012-03-10 00:53:46 -06:00
|
|
|
define libdoc
|
2013-09-22 01:25:48 -05:00
|
|
|
doc/$(1)/index.html: $$(RUSTDOC) $$(TLIB2_T_$(3)_H_$(3))/$(CFG_STDLIB_$(3))
|
2012-03-10 00:53:46 -06:00
|
|
|
@$$(call E, rustdoc: $$@)
|
2013-11-24 22:31:21 -06:00
|
|
|
$(Q)$(RUSTDOC) --cfg stage2 $(2)
|
2011-12-05 18:46:37 -06:00
|
|
|
|
2012-03-10 00:53:46 -06:00
|
|
|
DOCS += doc/$(1)/index.html
|
2011-12-05 18:46:37 -06:00
|
|
|
endef
|
|
|
|
|
2013-12-28 23:13:19 -06:00
|
|
|
define compiledoc
|
|
|
|
doc/$(1)/index.html: $$(RUSTDOC) $$(TLIB2_T_$(3)_H_$(3))/$(CFG_STDLIB_$(3))
|
|
|
|
@$$(call E, rustdoc: $$@)
|
|
|
|
$(Q)$(RUSTDOC) --cfg stage2 $(2)
|
|
|
|
|
|
|
|
CDOCS += doc/$(1)/index.html
|
|
|
|
endef
|
|
|
|
|
2013-10-21 04:18:21 -05:00
|
|
|
$(eval $(call libdoc,std,$(STDLIB_CRATE),$(CFG_BUILD)))
|
|
|
|
$(eval $(call libdoc,extra,$(EXTRALIB_CRATE),$(CFG_BUILD)))
|
2013-12-28 12:06:05 -06:00
|
|
|
$(eval $(call libdoc,native,$(LIBNATIVE_CRATE),$(CFG_BUILD)))
|
|
|
|
$(eval $(call libdoc,green,$(LIBGREEN_CRATE),$(CFG_BUILD)))
|
2013-12-28 23:13:19 -06:00
|
|
|
|
|
|
|
$(eval $(call compiledoc,rustc,$(COMPILER_CRATE),$(CFG_BUILD)))
|
|
|
|
$(eval $(call compiledoc,syntax,$(LIBSYNTAX_CRATE),$(CFG_BUILD)))
|
2012-01-18 16:14:28 -06:00
|
|
|
|
|
|
|
|
|
|
|
ifdef CFG_DISABLE_DOCS
|
|
|
|
$(info cfg: disabling doc build (CFG_DISABLE_DOCS))
|
|
|
|
DOCS :=
|
|
|
|
endif
|
|
|
|
|
|
|
|
|
2013-02-06 16:59:03 -06:00
|
|
|
doc/version.md: $(MKFILE_DEPS) $(wildcard $(S)doc/*.*)
|
2012-01-18 16:14:28 -06:00
|
|
|
@$(call E, version-stamp: $@)
|
2012-01-18 16:45:47 -06:00
|
|
|
$(Q)echo "$(CFG_VERSION)" >$@
|
2012-01-18 16:14:28 -06:00
|
|
|
|
2013-02-06 16:59:03 -06:00
|
|
|
doc/version_info.html: version_info.html.template $(MKFILE_DEPS) \
|
|
|
|
$(wildcard $(S)doc/*.*)
|
2012-07-17 18:15:37 -05:00
|
|
|
@$(call E, version-info: $@)
|
|
|
|
sed -e "s/VERSION/$(CFG_RELEASE)/; s/SHORT_HASH/$(shell echo \
|
|
|
|
$(CFG_VER_HASH) | head -c 8)/;\
|
2013-10-11 13:21:46 -05:00
|
|
|
s/STAMP/$(CFG_VER_HASH)/;" $< >$@
|
2012-07-17 18:15:37 -05:00
|
|
|
|
2013-02-06 16:59:03 -06:00
|
|
|
GENERATED += doc/version.md doc/version_info.html
|
2011-12-30 14:47:43 -06:00
|
|
|
|
|
|
|
docs: $(DOCS)
|
2013-12-28 23:13:19 -06:00
|
|
|
compiler-docs: $(CDOCS)
|
2013-07-07 14:12:00 -05:00
|
|
|
|
2013-08-08 08:38:33 -05:00
|
|
|
docs-l10n: $(DOCS_L10N)
|
|
|
|
|
|
|
|
doc/l10n/%.md: doc/po/%.md.po doc/po4a.conf
|
2013-07-16 17:18:42 -05:00
|
|
|
po4a --copyright-holder="The Rust Project Developers" \
|
|
|
|
--package-name="Rust" \
|
|
|
|
--package-version="$(CFG_RELEASE)" \
|
2013-07-29 17:05:47 -05:00
|
|
|
-M UTF-8 -L UTF-8 \
|
2013-07-16 17:18:42 -05:00
|
|
|
doc/po4a.conf
|
2013-07-07 14:12:00 -05:00
|
|
|
|
|
|
|
.PHONY: docs-l10n
|