diff options
| author | Graydon Hoare <graydon@mozilla.com> | 2012-01-18 14:14:28 -0800 |
|---|---|---|
| committer | Graydon Hoare <graydon@mozilla.com> | 2012-01-18 14:14:42 -0800 |
| commit | 193279daa2bef57be8b897d3e7426943db577282 (patch) | |
| tree | fdd0877de3eaa70c9062b637f55f400a0d7beb8c /mk/docs.mk | |
| parent | 5ac57d1891bcea2207fef3bd5302f0b9467656e9 (diff) | |
Refactor the doc building rules a bit, sensitize them to the presence or absence of xetex and luatex (for now).
Diffstat (limited to 'mk/docs.mk')
| -rw-r--r-- | mk/docs.mk | 94 |
1 files changed, 69 insertions, 25 deletions
diff --git a/mk/docs.mk b/mk/docs.mk index 4edc0cc3b8d..60dd912d8c9 100644 --- a/mk/docs.mk +++ b/mk/docs.mk @@ -2,16 +2,17 @@ # Doc variables and rules ###################################################################### -doc/version.md: $(MKFILE_DEPS) rust.md - @$(call E, version-stamp: $@) - $(Q)echo "$(CFG_VERSION)" >>$@ +DOCS := -doc/keywords.md: $(MKFILE_DEPS) rust.md - @$(call E, grep -v: $$@) - $(Q)grep -v '^#' $< >$@ -ifdef CFG_PANDOC +###################################################################### +# Pandoc (reference-manual related) +###################################################################### +ifeq ($(CFG_PANDOC),) + $(info cfg: no pandoc found, omitting doc/rust.pdf) +else +DOCS += doc/rust.html doc/rust.html: rust.md doc/version.md doc/keywords.md @$(call E, pandoc: $@) $(Q)$(CFG_PANDOC) \ @@ -26,8 +27,17 @@ doc/rust.html: rust.md doc/version.md doc/keywords.md -$(Q)cp -a $(S)doc/rust.css doc/rust.css 2> /dev/null -ifdef CFG_PDFLATEX + 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 +DOCS += doc/rust.pdf doc/rust.tex: rust.md doc/version.md doc/keywords.md @$(call E, pandoc: $@) $(Q)$(CFG_PANDOC) \ @@ -44,13 +54,39 @@ doc/rust.pdf: doc/rust.tex -output-directory=doc \ $< + endif + endif + endif endif + +###################################################################### +# 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 endif -ifdef CFG_NODE +###################################################################### +# Node (tutorial related) +###################################################################### +ifeq ($(CFG_NODE),) + $(info cfg: no node found, omitting doc/tutorial/web) +else +DOCS += doc/tutorial/web/index.html doc/tutorial/web/index.html: \ $(wildcard $(S)doc/tutorial/*.md) @$(call E, cp: $(S)doc/tutorial) @@ -61,23 +97,14 @@ doc/tutorial/web/index.html: \ endif -ifdef CFG_LLNEXTGEN -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 -endif - - -GENERATED += doc/keywords.md doc/version.md +###################################################################### +# Naturaldocs (library reference related) +###################################################################### -docsnap: doc/rust.pdf - @$(call E, snap: doc/rust-$(shell date +"%Y-%m-%d")-snap.pdf) - $(Q)mv $< doc/rust-$(shell date +"%Y-%m-%d")-snap.pdf +ifeq ($(CFG_NATURALDOCS),) + $(info cfg: no naturaldocs found, omitting library doc build) +else define libdoc doc/$(1)/index.html: nd/$(1)/Languages.txt nd/$(1)/Topics.txt \ @@ -103,10 +130,27 @@ GENERATED += nd/$(1)/Languages.txt \ nd/$(1)/Data DOCS += doc/$(1)/index.html nd/$(1)/lib.css - endef $(eval $(call libdoc,core,$(CORELIB_CRATE) $(CORELIB_INPUTS))) $(eval $(call libdoc,std,$(STDLIB_CRATE) $(STDLIB_INPUTS))) +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: $@) + $(Q)echo "$(CFG_VERSION)" >>$@ + +doc/keywords.md: $(MKFILE_DEPS) rust.md + @$(call E, grep -v: $$@) + $(Q)grep -v '^#' $< >$@ + +GENERATED += doc/keywords.md doc/version.md docs: $(DOCS) |
