2011-05-01 15:18:52 -05:00
|
|
|
######################################################################
|
|
|
|
# Doc variables and rules
|
|
|
|
######################################################################
|
|
|
|
|
2012-01-18 16:14:28 -06:00
|
|
|
DOCS :=
|
2011-05-01 15:18:52 -05:00
|
|
|
|
2012-01-12 21:10:30 -06:00
|
|
|
|
2012-01-18 16:14:28 -06:00
|
|
|
######################################################################
|
|
|
|
# Pandoc (reference-manual related)
|
|
|
|
######################################################################
|
|
|
|
ifeq ($(CFG_PANDOC),)
|
|
|
|
$(info cfg: no pandoc found, omitting doc/rust.pdf)
|
|
|
|
else
|
2012-01-12 21:10:30 -06:00
|
|
|
|
2012-01-19 07:19:23 -06:00
|
|
|
DOCS += doc/rust.html
|
2012-01-12 21:10:30 -06:00
|
|
|
doc/rust.html: rust.md doc/version.md doc/keywords.md
|
|
|
|
@$(call E, pandoc: $@)
|
|
|
|
$(Q)$(CFG_PANDOC) \
|
|
|
|
--standalone --toc \
|
|
|
|
--section-divs \
|
|
|
|
--number-sections \
|
|
|
|
--from=markdown --to=html \
|
2012-01-18 02:58:08 -06:00
|
|
|
--css=rust.css \
|
2012-01-12 21:10:30 -06:00
|
|
|
--output=$@ \
|
|
|
|
$<
|
2012-01-18 02:58:08 -06:00
|
|
|
@$(call E, cp: $(S)doc/rust.css)
|
|
|
|
-$(Q)cp -a $(S)doc/rust.css doc/rust.css 2> /dev/null
|
|
|
|
|
2012-01-12 21:10:30 -06:00
|
|
|
|
2012-01-18 16:14:28 -06: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-12 21:10:30 -06:00
|
|
|
|
2012-01-18 16:14:28 -06:00
|
|
|
DOCS += doc/rust.pdf
|
2012-01-12 21:10:30 -06:00
|
|
|
doc/rust.tex: rust.md doc/version.md doc/keywords.md
|
|
|
|
@$(call E, pandoc: $@)
|
|
|
|
$(Q)$(CFG_PANDOC) \
|
|
|
|
--standalone --toc \
|
|
|
|
--number-sections \
|
|
|
|
--from=markdown --to=latex \
|
|
|
|
--output=$@ \
|
|
|
|
$<
|
|
|
|
|
|
|
|
doc/rust.pdf: doc/rust.tex
|
|
|
|
@$(call E, pdflatex: $@)
|
|
|
|
$(Q)$(CFG_PDFLATEX) \
|
|
|
|
-interaction=batchmode \
|
|
|
|
-output-directory=doc \
|
|
|
|
$<
|
|
|
|
|
2012-01-18 16:14:28 -06:00
|
|
|
endif
|
|
|
|
endif
|
|
|
|
endif
|
2012-01-19 05:51:20 -06:00
|
|
|
|
|
|
|
######################################################################
|
|
|
|
# Node (tutorial related)
|
|
|
|
######################################################################
|
|
|
|
ifeq ($(CFG_NODE),)
|
|
|
|
$(info cfg: no node found, omitting doc/tutorial.html)
|
|
|
|
else
|
|
|
|
|
|
|
|
DOCS += doc/tutorial.html
|
|
|
|
doc/tutorial.html: $(S)doc/tutorial.md
|
|
|
|
@$(call E, cp: $(S)doc/rust.css)
|
|
|
|
-$(Q)cp -a $(S)doc/rust.css doc/ 2> /dev/null
|
|
|
|
@$(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-12 21:10:30 -06:00
|
|
|
endif
|
|
|
|
|
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: $@)
|
|
|
|
$(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-17 18:49:57 -06:00
|
|
|
endif
|
|
|
|
|
|
|
|
|
2012-01-18 16:14:28 -06:00
|
|
|
######################################################################
|
|
|
|
# Naturaldocs (library reference related)
|
|
|
|
######################################################################
|
2011-05-01 15:18:52 -05:00
|
|
|
|
2012-01-18 16:14:28 -06:00
|
|
|
ifeq ($(CFG_NATURALDOCS),)
|
|
|
|
$(info cfg: no naturaldocs found, omitting library doc build)
|
|
|
|
else
|
2011-10-24 17:25:41 -05:00
|
|
|
|
2011-12-05 18:46:37 -06:00
|
|
|
define libdoc
|
|
|
|
doc/$(1)/index.html: nd/$(1)/Languages.txt nd/$(1)/Topics.txt \
|
|
|
|
nd/$(1)/lib.css $(2)
|
|
|
|
@$$(call E, naturaldocs: $$@)
|
2012-01-19 15:26:43 -06:00
|
|
|
$(CFG_NATURALDOCS) -i $(S)src/lib$(1) -o HTML doc/$(1) \
|
|
|
|
-p nd/$(1) -r -s Default lib
|
2011-12-05 18:46:37 -06:00
|
|
|
|
|
|
|
nd/$(1)/Languages.txt: $(S)doc/Languages.txt
|
|
|
|
@$$(call E, cp: $$@)
|
|
|
|
$(Q)cp $$< $$@
|
|
|
|
|
|
|
|
nd/$(1)/Topics.txt: $(S)doc/Topics.txt
|
|
|
|
@$$(call E, cp: $$@)
|
|
|
|
$(Q)cp $$< $$@
|
|
|
|
|
|
|
|
nd/$(1)/lib.css: $(S)doc/lib.css
|
|
|
|
@$$(call E, cp: $$@)
|
|
|
|
$(Q)cp $$< $$@
|
|
|
|
|
2011-12-30 14:47:43 -06:00
|
|
|
GENERATED += nd/$(1)/Languages.txt \
|
|
|
|
nd/$(1)/Topics.txt \
|
|
|
|
nd/$(1)/Menu.txt \
|
|
|
|
nd/$(1)/Data
|
|
|
|
|
2011-12-30 17:10:55 -06:00
|
|
|
DOCS += doc/$(1)/index.html nd/$(1)/lib.css
|
2011-12-05 18:46:37 -06:00
|
|
|
endef
|
|
|
|
|
|
|
|
$(eval $(call libdoc,core,$(CORELIB_CRATE) $(CORELIB_INPUTS)))
|
|
|
|
$(eval $(call libdoc,std,$(STDLIB_CRATE) $(STDLIB_INPUTS)))
|
2012-01-18 16:14:28 -06: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 16:45:47 -06:00
|
|
|
$(Q)echo "$(CFG_VERSION)" >$@
|
2012-01-18 16:14:28 -06:00
|
|
|
|
|
|
|
doc/keywords.md: $(MKFILE_DEPS) rust.md
|
|
|
|
@$(call E, grep -v: $$@)
|
|
|
|
$(Q)grep -v '^#' $< >$@
|
|
|
|
|
|
|
|
GENERATED += doc/keywords.md doc/version.md
|
2011-12-30 14:47:43 -06:00
|
|
|
|
|
|
|
docs: $(DOCS)
|