2011-05-01 20:18:52 +00:00
|
|
|
######################################################################
|
|
|
|
# Doc variables and rules
|
|
|
|
######################################################################
|
|
|
|
|
2012-01-18 22:14:28 +00:00
|
|
|
DOCS :=
|
2011-05-01 20:18:52 +00:00
|
|
|
|
2012-01-13 03:10:30 +00:00
|
|
|
|
2012-01-18 22:14:28 +00:00
|
|
|
######################################################################
|
|
|
|
# Pandoc (reference-manual related)
|
|
|
|
######################################################################
|
|
|
|
ifeq ($(CFG_PANDOC),)
|
|
|
|
$(info cfg: no pandoc found, omitting doc/rust.pdf)
|
|
|
|
else
|
2012-01-13 03:10:30 +00:00
|
|
|
|
2012-03-21 00:50:32 +00:00
|
|
|
ifeq ($(CFG_NODE),)
|
|
|
|
$(info cfg: no node found, omitting doc/tutorial.html)
|
|
|
|
else
|
|
|
|
|
2012-03-27 00:59:09 +00:00
|
|
|
doc/rust.css: rust.css
|
|
|
|
@$(call E, cp: $@)
|
|
|
|
$(Q)cp -a $< $@ 2> /dev/null
|
|
|
|
|
2012-01-19 13:19:23 +00:00
|
|
|
DOCS += doc/rust.html
|
2012-03-27 00:59:09 +00:00
|
|
|
doc/rust.html: rust.md doc/version.md doc/keywords.md doc/rust.css
|
2012-01-13 03:10:30 +00:00
|
|
|
@$(call E, pandoc: $@)
|
2012-03-21 00:50:32 +00:00
|
|
|
$(Q)$(CFG_NODE) $(S)doc/prep.js --highlight $< | \
|
|
|
|
"$(CFG_PANDOC)" \
|
2012-01-13 03:10:30 +00:00
|
|
|
--standalone --toc \
|
|
|
|
--section-divs \
|
|
|
|
--number-sections \
|
|
|
|
--from=markdown --to=html \
|
2012-01-18 08:58:08 +00:00
|
|
|
--css=rust.css \
|
2012-03-21 00:50:32 +00:00
|
|
|
--output=$@
|
|
|
|
endif
|
2012-01-13 03:10:30 +00:00
|
|
|
|
2012-01-18 22:14:28 +00: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
|
2012-01-13 03:10:30 +00:00
|
|
|
|
2012-01-18 22:14:28 +00:00
|
|
|
DOCS += doc/rust.pdf
|
2012-01-13 03:10:30 +00:00
|
|
|
doc/rust.tex: rust.md doc/version.md doc/keywords.md
|
|
|
|
@$(call E, pandoc: $@)
|
2012-03-27 20:07:26 +00:00
|
|
|
$(Q)$(CFG_NODE) $(S)doc/prep.js $< | \
|
|
|
|
"$(CFG_PANDOC)" \
|
2012-01-13 03:10:30 +00:00
|
|
|
--standalone --toc \
|
|
|
|
--number-sections \
|
|
|
|
--from=markdown --to=latex \
|
2012-03-27 20:07:26 +00:00
|
|
|
--output=$@
|
2012-01-13 03:10:30 +00:00
|
|
|
|
|
|
|
doc/rust.pdf: doc/rust.tex
|
|
|
|
@$(call E, pdflatex: $@)
|
|
|
|
$(Q)$(CFG_PDFLATEX) \
|
|
|
|
-interaction=batchmode \
|
|
|
|
-output-directory=doc \
|
|
|
|
$<
|
|
|
|
|
2012-01-18 22:14:28 +00:00
|
|
|
endif
|
|
|
|
endif
|
|
|
|
endif
|
2012-01-19 11:51:20 +00:00
|
|
|
|
|
|
|
######################################################################
|
|
|
|
# Node (tutorial related)
|
|
|
|
######################################################################
|
|
|
|
ifeq ($(CFG_NODE),)
|
|
|
|
$(info cfg: no node found, omitting doc/tutorial.html)
|
|
|
|
else
|
|
|
|
|
|
|
|
DOCS += doc/tutorial.html
|
2012-03-27 00:59:09 +00:00
|
|
|
doc/tutorial.html: tutorial.md doc/rust.css
|
2012-01-19 11:51:20 +00:00
|
|
|
@$(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 \
|
|
|
|
--output=$@
|
|
|
|
|
|
|
|
endif
|
2012-01-13 03:10:30 +00:00
|
|
|
endif
|
|
|
|
|
2012-01-18 22:14:28 +00: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: $@)
|
|
|
|
$(Q)$(S)src/etc/extract_grammar.py $< >$@
|
|
|
|
|
|
|
|
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 00:49:57 +00:00
|
|
|
endif
|
|
|
|
|
|
|
|
|
2012-01-18 22:14:28 +00:00
|
|
|
######################################################################
|
2012-03-10 06:53:46 +00:00
|
|
|
# Rustdoc (libcore/std)
|
2012-01-18 22:14:28 +00:00
|
|
|
######################################################################
|
2011-05-01 20:18:52 +00:00
|
|
|
|
2012-03-10 06:53:46 +00:00
|
|
|
ifeq ($(CFG_PANDOC),)
|
|
|
|
$(info cfg: no pandoc found, omitting library doc build)
|
2012-01-18 22:14:28 +00:00
|
|
|
else
|
2011-10-24 22:25:41 +00:00
|
|
|
|
2012-03-10 06:53:46 +00:00
|
|
|
# The rustdoc executable
|
|
|
|
RUSTDOC = $(HBIN2_H_$(CFG_HOST_TRIPLE))/rustdoc$(X)
|
2011-12-06 00:46:37 +00:00
|
|
|
|
2012-03-10 06:53:46 +00: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 00:46:37 +00:00
|
|
|
|
2012-03-27 00:59:09 +00:00
|
|
|
doc/$(1)/rust.css: rust.css
|
2011-12-06 00:46:37 +00:00
|
|
|
@$$(call E, cp: $$@)
|
|
|
|
$(Q)cp $$< $$@
|
|
|
|
|
2012-03-10 06:53:46 +00:00
|
|
|
DOCS += doc/$(1)/index.html
|
2011-12-06 00:46:37 +00:00
|
|
|
endef
|
|
|
|
|
2012-03-10 06:53:46 +00:00
|
|
|
$(eval $(call libdoc,core,$(CORELIB_CRATE),$(CORELIB_INPUTS)))
|
|
|
|
$(eval $(call libdoc,std,$(STDLIB_CRATE),$(STDLIB_INPUTS)))
|
2012-01-18 22:14:28 +00:00
|
|
|
endif
|
|
|
|
|
|
|
|
|
|
|
|
ifdef CFG_DISABLE_DOCS
|
|
|
|
$(info cfg: disabling doc build (CFG_DISABLE_DOCS))
|
|
|
|
DOCS :=
|
|
|
|
endif
|
|
|
|
|
|
|
|
|
|
|
|
doc/version.md: $(MKFILE_DEPS) rust.md
|
|
|
|
@$(call E, version-stamp: $@)
|
2012-01-18 22:45:47 +00:00
|
|
|
$(Q)echo "$(CFG_VERSION)" >$@
|
2012-01-18 22:14:28 +00:00
|
|
|
|
2012-03-27 00:59:09 +00:00
|
|
|
doc/keywords.md: $(S)doc/keywords.txt $(MKFILE_DEPS) rust.md
|
2012-01-18 22:14:28 +00:00
|
|
|
@$(call E, grep -v: $$@)
|
|
|
|
$(Q)grep -v '^#' $< >$@
|
|
|
|
|
|
|
|
GENERATED += doc/keywords.md doc/version.md
|
2011-12-30 20:47:43 +00:00
|
|
|
|
|
|
|
docs: $(DOCS)
|