Skip to content

Commit

Permalink
mk: reorganize doc build to fix dependencies. rust-lang#6042
Browse files Browse the repository at this point in the history
Most of our documentation requires both pandoc and node.js.
This simplifies the logic around those checks and fixes an
error when building without node.js but with pandoc.
  • Loading branch information
brson committed Apr 24, 2013
1 parent 354460e commit 34f7255
Showing 1 changed file with 33 additions and 38 deletions.
71 changes: 33 additions & 38 deletions mk/docs.mk
Original file line number Diff line number Diff line change
Expand Up @@ -16,15 +16,8 @@ DOCS :=


######################################################################
# Pandoc (reference-manual related)
# Docs, from pandoc, rustdoc (which runs pandoc), and node
######################################################################
ifeq ($(CFG_PANDOC),)
$(info cfg: no pandoc found, omitting doc/rust.pdf)
else

ifeq ($(CFG_NODE),)
$(info cfg: no node found, omitting doc/tutorial.html)
else

doc/rust.css: rust.css
@$(call E, cp: $@)
Expand All @@ -34,6 +27,18 @@ doc/manual.css: manual.css
@$(call E, cp: $@)
$(Q)cp -a $< $@ 2> /dev/null

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)

DOCS += doc/rust.html
doc/rust.html: rust.md doc/version_info.html doc/rust.css doc/manual.css
@$(call E, pandoc: $@)
Expand All @@ -47,17 +52,6 @@ doc/rust.html: rust.md doc/version_info.html doc/rust.css doc/manual.css
--css=manual.css \
--include-before-body=doc/version_info.html \
--output=$@
endif

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
Expand All @@ -70,17 +64,6 @@ doc/rust.tex: rust.md doc/version.md
--from=markdown --to=latex \
--output=$@

doc/rust.pdf: doc/rust.tex
@$(call E, pdflatex: $@)
$(Q)$(CFG_PDFLATEX) \
-interaction=batchmode \
-output-directory=doc \
$<

endif
endif
endif

DOCS += doc/rustpkg.html
doc/rustpkg.html: rustpkg.md doc/version_info.html doc/rust.css doc/manual.css
@$(call E, pandoc: $@)
Expand All @@ -95,13 +78,6 @@ doc/rustpkg.html: rustpkg.md doc/version_info.html doc/rust.css doc/manual.css
--include-before-body=doc/version_info.html \
--output=$@

######################################################################
# Node (tutorial related)
######################################################################
ifeq ($(CFG_NODE),)
$(info cfg: no node found, omitting doc/tutorial.html)
else

DOCS += doc/tutorial.html
doc/tutorial.html: tutorial.md doc/version_info.html doc/rust.css
@$(call E, pandoc: $@)
Expand Down Expand Up @@ -153,9 +129,28 @@ doc/tutorial-tasks.html: tutorial-tasks.md doc/version_info.html doc/rust.css
--include-before-body=doc/version_info.html \
--output=$@

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

doc/rust.pdf: doc/rust.tex
@$(call E, pdflatex: $@)
$(Q)$(CFG_PDFLATEX) \
-interaction=batchmode \
-output-directory=doc \
$<

endif
endif
endif
endif

endif # No pandoc / node

######################################################################
# LLnextgen (grammar analysis from refman)
Expand Down

0 comments on commit 34f7255

Please sign in to comment.