about summary refs log tree commit diff
path: root/mk/docs.mk
diff options
context:
space:
mode:
authorGraydon Hoare <graydon@mozilla.com>2012-01-12 19:10:30 -0800
committerGraydon Hoare <graydon@mozilla.com>2012-01-12 19:10:30 -0800
commitfefdb63c4c2b078c43836e2ae9d7ffcaeec32890 (patch)
tree1ce371a50ece05cec0d1b9755fadaed376b7723e /mk/docs.mk
parent565ea068ca6deb50c5866475508c538dc7e3acee (diff)
Begin shift over to using pandoc, markdown and llnextgen for reference manual. Fix man page URL while at it.
Diffstat (limited to 'mk/docs.mk')
-rw-r--r--mk/docs.mk67
1 files changed, 50 insertions, 17 deletions
diff --git a/mk/docs.mk b/mk/docs.mk
index bf41413de3b..866d5f20a19 100644
--- a/mk/docs.mk
+++ b/mk/docs.mk
@@ -2,28 +2,61 @@
 # Doc variables and rules
 ######################################################################
 
-doc/keywords.texi: $(S)doc/keywords.txt $(S)src/etc/gen-keywords-table.py
-	@$(call E, gen-keywords-table: $@)
-	$(Q)$(S)src/etc/gen-keywords-table.py
-
-doc/version.texi: $(MKFILE_DEPS) rust.texi
+doc/version.md: $(MKFILE_DEPS) rust.md
 	@$(call E, version-stamp: $@)
-	$(Q)echo "@macro gitversion" >$@
 	$(Q)echo "$(CFG_VERSION)" >>$@
-	$(Q)echo "@end macro" >>$@
 
-GENERATED += doc/keywords.texi doc/version.texi
+doc/keywords.md: $(MKFILE_DEPS) rust.md
+	@$(call E, grep -v: $$@)
+	$(Q)grep -v '^#' $< >$@
+
+ifdef CFG_PANDOC
+
+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 \
+         --output=$@ \
+         $<
+
+ifdef CFG_PDFLATEX
+
+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 \
+        $<
+
+endif
+
+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
 
-doc/%.pdf: %.texi doc/version.texi doc/keywords.texi
-	@$(call E, texi2pdf: $@)
-	@# LC_COLLATE=C works around a bug in texi2dvi; see
-	@# https://bugzilla.redhat.com/show_bug.cgi?id=583011 and
-	@# https://github.com/graydon/rust/issues/1134
-	$(Q)LC_COLLATE=C texi2pdf --silent --batch -I doc -o $@ --clean $<
 
-doc/%.html: %.texi doc/version.texi doc/keywords.texi
-	@$(call E, makeinfo: $@)
-	$(Q)makeinfo -I doc --html --ifhtml --force --no-split --output=$@ $<
+GENERATED += doc/keywords.md doc/version.md
 
 docsnap: doc/rust.pdf
 	@$(call E, snap: doc/rust-$(shell date +"%Y-%m-%d")-snap.pdf)