Skip to content

Commit 34f7255

Browse files
committed
mk: reorganize doc build to fix dependencies. #6042
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.
1 parent 354460e commit 34f7255

File tree

1 file changed

+33
-38
lines changed

1 file changed

+33
-38
lines changed

mk/docs.mk

+33-38
Original file line numberDiff line numberDiff line change
@@ -16,15 +16,8 @@ DOCS :=
1616

1717

1818
######################################################################
19-
# Pandoc (reference-manual related)
19+
# Docs, from pandoc, rustdoc (which runs pandoc), and node
2020
######################################################################
21-
ifeq ($(CFG_PANDOC),)
22-
$(info cfg: no pandoc found, omitting doc/rust.pdf)
23-
else
24-
25-
ifeq ($(CFG_NODE),)
26-
$(info cfg: no node found, omitting doc/tutorial.html)
27-
else
2821

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

30+
ifeq ($(CFG_PANDOC),)
31+
$(info cfg: no pandoc found, omitting docs)
32+
NO_DOCS = 1
33+
endif
34+
35+
ifeq ($(CFG_NODE),)
36+
$(info cfg: no node found, omitting docs)
37+
NO_DOCS = 1
38+
endif
39+
40+
ifneq ($(NO_DOCS),1)
41+
3742
DOCS += doc/rust.html
3843
doc/rust.html: rust.md doc/version_info.html doc/rust.css doc/manual.css
3944
@$(call E, pandoc: $@)
@@ -47,17 +52,6 @@ doc/rust.html: rust.md doc/version_info.html doc/rust.css doc/manual.css
4752
--css=manual.css \
4853
--include-before-body=doc/version_info.html \
4954
--output=$@
50-
endif
51-
52-
ifeq ($(CFG_PDFLATEX),)
53-
$(info cfg: no pdflatex found, omitting doc/rust.pdf)
54-
else
55-
ifeq ($(CFG_XETEX),)
56-
$(info cfg: no xetex found, disabling doc/rust.pdf)
57-
else
58-
ifeq ($(CFG_LUATEX),)
59-
$(info cfg: lacking luatex, disabling pdflatex)
60-
else
6155

6256
DOCS += doc/rust.pdf
6357
doc/rust.tex: rust.md doc/version.md
@@ -70,17 +64,6 @@ doc/rust.tex: rust.md doc/version.md
7064
--from=markdown --to=latex \
7165
--output=$@
7266

73-
doc/rust.pdf: doc/rust.tex
74-
@$(call E, pdflatex: $@)
75-
$(Q)$(CFG_PDFLATEX) \
76-
-interaction=batchmode \
77-
-output-directory=doc \
78-
$<
79-
80-
endif
81-
endif
82-
endif
83-
8467
DOCS += doc/rustpkg.html
8568
doc/rustpkg.html: rustpkg.md doc/version_info.html doc/rust.css doc/manual.css
8669
@$(call E, pandoc: $@)
@@ -95,13 +78,6 @@ doc/rustpkg.html: rustpkg.md doc/version_info.html doc/rust.css doc/manual.css
9578
--include-before-body=doc/version_info.html \
9679
--output=$@
9780

98-
######################################################################
99-
# Node (tutorial related)
100-
######################################################################
101-
ifeq ($(CFG_NODE),)
102-
$(info cfg: no node found, omitting doc/tutorial.html)
103-
else
104-
10581
DOCS += doc/tutorial.html
10682
doc/tutorial.html: tutorial.md doc/version_info.html doc/rust.css
10783
@$(call E, pandoc: $@)
@@ -153,9 +129,28 @@ doc/tutorial-tasks.html: tutorial-tasks.md doc/version_info.html doc/rust.css
153129
--include-before-body=doc/version_info.html \
154130
--output=$@
155131

132+
ifeq ($(CFG_PDFLATEX),)
133+
$(info cfg: no pdflatex found, omitting doc/rust.pdf)
134+
else
135+
ifeq ($(CFG_XETEX),)
136+
$(info cfg: no xetex found, disabling doc/rust.pdf)
137+
else
138+
ifeq ($(CFG_LUATEX),)
139+
$(info cfg: lacking luatex, disabling pdflatex)
140+
else
141+
142+
doc/rust.pdf: doc/rust.tex
143+
@$(call E, pdflatex: $@)
144+
$(Q)$(CFG_PDFLATEX) \
145+
-interaction=batchmode \
146+
-output-directory=doc \
147+
$<
148+
149+
endif
150+
endif
156151
endif
157-
endif
158152

153+
endif # No pandoc / node
159154

160155
######################################################################
161156
# LLnextgen (grammar analysis from refman)

0 commit comments

Comments
 (0)