2012-12-11 02:32:48 +01:00
|
|
|
# Copyright 2012 The Rust Project Developers. See the COPYRIGHT
|
|
|
|
# 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
|
|
|
######################################################################
|
|
|
|
# Doc variables and rules
|
|
|
|
######################################################################
|
|
|
|
|
2012-01-18 23:14:28 +01:00
|
|
|
DOCS :=
|
2011-05-01 22:18:52 +02:00
|
|
|
|
2012-01-13 04:10:30 +01:00
|
|
|
|
2012-01-18 23:14:28 +01:00
|
|
|
######################################################################
|
2013-04-24 07:51:48 +02:00
|
|
|
# Docs, from pandoc, rustdoc (which runs pandoc), and node
|
2012-01-18 23:14:28 +01:00
|
|
|
######################################################################
|
2012-03-21 01:50:32 +01:00
|
|
|
|
2012-03-27 02:59:09 +02:00
|
|
|
doc/rust.css: rust.css
|
|
|
|
@$(call E, cp: $@)
|
|
|
|
$(Q)cp -a $< $@ 2> /dev/null
|
|
|
|
|
2012-12-15 03:06:11 +01:00
|
|
|
doc/manual.css: manual.css
|
|
|
|
@$(call E, cp: $@)
|
|
|
|
$(Q)cp -a $< $@ 2> /dev/null
|
|
|
|
|
2013-04-24 07:51:48 +02: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 14:19:23 +01:00
|
|
|
DOCS += doc/rust.html
|
2012-12-15 03:06:11 +01:00
|
|
|
doc/rust.html: rust.md doc/version_info.html doc/rust.css doc/manual.css
|
2012-01-13 04:10:30 +01:00
|
|
|
@$(call E, pandoc: $@)
|
2012-03-21 01:50:32 +01:00
|
|
|
$(Q)$(CFG_NODE) $(S)doc/prep.js --highlight $< | \
|
|
|
|
"$(CFG_PANDOC)" \
|
2012-01-13 04:10:30 +01:00
|
|
|
--standalone --toc \
|
|
|
|
--section-divs \
|
|
|
|
--number-sections \
|
|
|
|
--from=markdown --to=html \
|
2012-01-18 09:58:08 +01:00
|
|
|
--css=rust.css \
|
2012-12-15 03:06:11 +01:00
|
|
|
--css=manual.css \
|
2013-02-06 23:59:03 +01:00
|
|
|
--include-before-body=doc/version_info.html \
|
2012-03-21 01:50:32 +01:00
|
|
|
--output=$@
|
2012-01-13 04:10:30 +01:00
|
|
|
|
2013-05-01 02:45:08 +02:00
|
|
|
DOCS += doc/rust.tex
|
2012-04-20 05:06:13 +02:00
|
|
|
doc/rust.tex: rust.md doc/version.md
|
2012-01-13 04:10:30 +01:00
|
|
|
@$(call E, pandoc: $@)
|
2012-03-27 22:07:26 +02:00
|
|
|
$(Q)$(CFG_NODE) $(S)doc/prep.js $< | \
|
|
|
|
"$(CFG_PANDOC)" \
|
2012-01-13 04:10:30 +01:00
|
|
|
--standalone --toc \
|
|
|
|
--number-sections \
|
2013-02-06 23:59:03 +01:00
|
|
|
--include-before-body=doc/version.md \
|
2012-01-13 04:10:30 +01:00
|
|
|
--from=markdown --to=latex \
|
2012-03-27 22:07:26 +02:00
|
|
|
--output=$@
|
2012-01-13 04:10:30 +01:00
|
|
|
|
2013-04-19 01:15:17 +02:00
|
|
|
DOCS += doc/rustpkg.html
|
|
|
|
doc/rustpkg.html: rustpkg.md doc/version_info.html doc/rust.css doc/manual.css
|
|
|
|
@$(call E, pandoc: $@)
|
|
|
|
$(Q)$(CFG_NODE) $(S)doc/prep.js --highlight $< | \
|
|
|
|
"$(CFG_PANDOC)" \
|
|
|
|
--standalone --toc \
|
|
|
|
--section-divs \
|
|
|
|
--number-sections \
|
|
|
|
--from=markdown --to=html \
|
|
|
|
--css=rust.css \
|
|
|
|
--css=manual.css \
|
|
|
|
--include-before-body=doc/version_info.html \
|
|
|
|
--output=$@
|
|
|
|
|
2012-01-19 12:51:20 +01:00
|
|
|
DOCS += doc/tutorial.html
|
2012-07-18 01:15:37 +02:00
|
|
|
doc/tutorial.html: tutorial.md doc/version_info.html doc/rust.css
|
2012-01-19 12:51:20 +01:00
|
|
|
@$(call E, pandoc: $@)
|
|
|
|
$(Q)$(CFG_NODE) $(S)doc/prep.js --highlight $< | \
|
|
|
|
$(CFG_PANDOC) --standalone --toc \
|
|
|
|
--section-divs --number-sections \
|
2012-09-05 20:03:36 +02:00
|
|
|
--from=markdown --to=html --css=rust.css \
|
|
|
|
--include-before-body=doc/version_info.html \
|
|
|
|
--output=$@
|
|
|
|
|
|
|
|
DOCS += doc/tutorial-macros.html
|
|
|
|
doc/tutorial-macros.html: tutorial-macros.md doc/version_info.html \
|
|
|
|
doc/rust.css
|
|
|
|
@$(call E, pandoc: $@)
|
|
|
|
$(Q)$(CFG_NODE) $(S)doc/prep.js --highlight $< | \
|
|
|
|
$(CFG_PANDOC) --standalone --toc \
|
|
|
|
--section-divs --number-sections \
|
2012-09-05 20:20:04 +02:00
|
|
|
--from=markdown --to=html --css=rust.css \
|
|
|
|
--include-before-body=doc/version_info.html \
|
|
|
|
--output=$@
|
|
|
|
|
2013-06-28 00:48:12 +02:00
|
|
|
DOCS += doc/tutorial-container.html
|
|
|
|
doc/tutorial-container.html: tutorial-container.md doc/version_info.html doc/rust.css
|
|
|
|
@$(call E, pandoc: $@)
|
|
|
|
$(Q)$(CFG_NODE) $(S)doc/prep.js --highlight $< | \
|
|
|
|
$(CFG_PANDOC) --standalone --toc \
|
|
|
|
--section-divs --number-sections \
|
|
|
|
--from=markdown --to=html --css=rust.css \
|
|
|
|
--include-before-body=doc/version_info.html \
|
|
|
|
--output=$@
|
|
|
|
|
2012-09-05 20:20:04 +02:00
|
|
|
DOCS += doc/tutorial-ffi.html
|
|
|
|
doc/tutorial-ffi.html: tutorial-ffi.md doc/version_info.html doc/rust.css
|
|
|
|
@$(call E, pandoc: $@)
|
|
|
|
$(Q)$(CFG_NODE) $(S)doc/prep.js --highlight $< | \
|
|
|
|
$(CFG_PANDOC) --standalone --toc \
|
|
|
|
--section-divs --number-sections \
|
2012-09-16 02:09:21 +02:00
|
|
|
--from=markdown --to=html --css=rust.css \
|
|
|
|
--include-before-body=doc/version_info.html \
|
|
|
|
--output=$@
|
|
|
|
|
|
|
|
DOCS += doc/tutorial-borrowed-ptr.html
|
|
|
|
doc/tutorial-borrowed-ptr.html: tutorial-borrowed-ptr.md doc/version_info.html doc/rust.css
|
|
|
|
@$(call E, pandoc: $@)
|
|
|
|
$(Q)$(CFG_NODE) $(S)doc/prep.js --highlight $< | \
|
|
|
|
$(CFG_PANDOC) --standalone --toc \
|
|
|
|
--section-divs --number-sections \
|
2012-09-23 00:33:50 +02:00
|
|
|
--from=markdown --to=html --css=rust.css \
|
|
|
|
--include-before-body=doc/version_info.html \
|
|
|
|
--output=$@
|
|
|
|
|
|
|
|
DOCS += doc/tutorial-tasks.html
|
|
|
|
doc/tutorial-tasks.html: tutorial-tasks.md doc/version_info.html doc/rust.css
|
|
|
|
@$(call E, pandoc: $@)
|
|
|
|
$(Q)$(CFG_NODE) $(S)doc/prep.js --highlight $< | \
|
|
|
|
$(CFG_PANDOC) --standalone --toc \
|
|
|
|
--section-divs --number-sections \
|
2012-01-19 12:51:20 +01:00
|
|
|
--from=markdown --to=html --css=rust.css \
|
2012-07-18 01:15:37 +02:00
|
|
|
--include-before-body=doc/version_info.html \
|
2012-01-19 12:51:20 +01:00
|
|
|
--output=$@
|
|
|
|
|
2013-04-24 07:51:48 +02: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-05-01 02:45:08 +02:00
|
|
|
DOCS += doc/rust.pdf
|
2013-04-24 07:51:48 +02:00
|
|
|
doc/rust.pdf: doc/rust.tex
|
|
|
|
@$(call E, pdflatex: $@)
|
|
|
|
$(Q)$(CFG_PDFLATEX) \
|
|
|
|
-interaction=batchmode \
|
|
|
|
-output-directory=doc \
|
|
|
|
$<
|
|
|
|
|
|
|
|
endif
|
|
|
|
endif
|
2012-01-19 12:51:20 +01:00
|
|
|
endif
|
2012-01-13 04:10:30 +01:00
|
|
|
|
2013-04-24 07:51:48 +02:00
|
|
|
endif # No pandoc / node
|
2012-01-18 23:14:28 +01: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 08:53:05 +01:00
|
|
|
$(Q)$(CFG_PYTHON) $(S)src/etc/extract_grammar.py $< >$@
|
2012-01-18 23:14:28 +01: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-18 01:49:57 +01:00
|
|
|
endif
|
|
|
|
|
|
|
|
|
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
|
|
|
|
2012-03-10 07:53:46 +01:00
|
|
|
ifeq ($(CFG_PANDOC),)
|
|
|
|
$(info cfg: no pandoc found, omitting library doc build)
|
2012-01-18 23:14:28 +01:00
|
|
|
else
|
2011-10-25 00:25:41 +02:00
|
|
|
|
2012-03-10 07:53:46 +01:00
|
|
|
# The rustdoc executable
|
2013-03-02 13:25:12 +01:00
|
|
|
RUSTDOC = $(HBIN2_H_$(CFG_BUILD_TRIPLE))/rustdoc$(X_$(CFG_BUILD_TRIPLE))
|
2011-12-06 01:46:37 +01:00
|
|
|
|
2012-03-10 07:53:46 +01:00
|
|
|
# The library documenting macro
|
|
|
|
# $(1) - The output directory
|
|
|
|
# $(2) - The crate file
|
|
|
|
# $(3) - The crate soruce files
|
|
|
|
define libdoc
|
|
|
|
doc/$(1)/index.html: $(2) $(3) $$(RUSTDOC) doc/$(1)/rust.css
|
|
|
|
@$$(call E, rustdoc: $$@)
|
|
|
|
$(Q)$(RUSTDOC) $(2) --output-dir=doc/$(1)
|
2011-12-06 01:46:37 +01:00
|
|
|
|
2012-03-27 02:59:09 +02:00
|
|
|
doc/$(1)/rust.css: rust.css
|
2011-12-06 01:46:37 +01:00
|
|
|
@$$(call E, cp: $$@)
|
|
|
|
$(Q)cp $$< $$@
|
|
|
|
|
2012-03-10 07:53:46 +01:00
|
|
|
DOCS += doc/$(1)/index.html
|
2011-12-06 01:46:37 +01:00
|
|
|
endef
|
|
|
|
|
2012-03-10 07:53:46 +01:00
|
|
|
$(eval $(call libdoc,std,$(STDLIB_CRATE),$(STDLIB_INPUTS)))
|
2013-05-17 19:45:09 +02:00
|
|
|
$(eval $(call libdoc,extra,$(EXTRALIB_CRATE),$(EXTRALIB_INPUTS)))
|
2012-01-18 23:14:28 +01:00
|
|
|
endif
|
|
|
|
|
|
|
|
|
|
|
|
ifdef CFG_DISABLE_DOCS
|
|
|
|
$(info cfg: disabling doc build (CFG_DISABLE_DOCS))
|
|
|
|
DOCS :=
|
|
|
|
endif
|
|
|
|
|
|
|
|
|
2013-02-06 23:59:03 +01:00
|
|
|
doc/version.md: $(MKFILE_DEPS) $(wildcard $(S)doc/*.*)
|
2012-01-18 23:14:28 +01:00
|
|
|
@$(call E, version-stamp: $@)
|
2012-01-18 23:45:47 +01:00
|
|
|
$(Q)echo "$(CFG_VERSION)" >$@
|
2012-01-18 23:14:28 +01:00
|
|
|
|
2013-02-06 23:59:03 +01:00
|
|
|
doc/version_info.html: version_info.html.template $(MKFILE_DEPS) \
|
|
|
|
$(wildcard $(S)doc/*.*)
|
2012-07-18 01:15:37 +02:00
|
|
|
@$(call E, version-info: $@)
|
|
|
|
sed -e "s/VERSION/$(CFG_RELEASE)/; s/SHORT_HASH/$(shell echo \
|
|
|
|
$(CFG_VER_HASH) | head -c 8)/;\
|
|
|
|
s/STAMP/$(CFG_VER_HASH)/;" $< >$@
|
|
|
|
|
2013-02-06 23:59:03 +01:00
|
|
|
GENERATED += doc/version.md doc/version_info.html
|
2011-12-30 21:47:43 +01:00
|
|
|
|
|
|
|
docs: $(DOCS)
|
2013-07-07 21:12:00 +02:00
|
|
|
|
|
|
|
docs-l10n:
|
2013-07-17 00:18:42 +02:00
|
|
|
po4a --copyright-holder="The Rust Project Developers" \
|
|
|
|
--package-name="Rust" \
|
|
|
|
--package-version="$(CFG_RELEASE)" \
|
2013-07-30 00:05:47 +02:00
|
|
|
-M UTF-8 -L UTF-8 \
|
2013-07-17 00:18:42 +02:00
|
|
|
doc/po4a.conf
|
2013-07-07 21:12:00 +02:00
|
|
|
|
|
|
|
.PHONY: docs-l10n
|