Skip to content

Commit 3d57b24

Browse files
committed
doc: tidy up makefile rules
1 parent 58aa18c commit 3d57b24

File tree

1 file changed

+20
-92
lines changed

1 file changed

+20
-92
lines changed

mk/docs.mk

+20-92
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,10 @@
1515
DOCS :=
1616
DOCS_L10N :=
1717

18+
BASE_DOC_OPTS := --from=markdown --standalone --toc --number-sections --include-before-body=doc/version_info.html
19+
HTML_OPTS = $(BASE_DOC_OPTS) --to=html5 --section-divs --css=rust.css --include-in-header=doc/favicon.inc
20+
TEX_OPTS = $(BASE_DOC_OPTS) --to=latex
21+
EPUB_OPTS = $(BASE_DOC_OPTS) --to=epub
1822

1923
######################################################################
2024
# Docs, from pandoc, rustdoc (which runs pandoc), and node
@@ -49,86 +53,45 @@ doc/rust.html: rust.md doc/version_info.html doc/rust.css doc/manual.inc \
4953
doc/favicon.inc
5054
@$(call E, pandoc: $@)
5155
$(Q)$(CFG_NODE) $(S)doc/prep.js --highlight $< | \
52-
"$(CFG_PANDOC)" \
53-
--standalone --toc \
54-
--section-divs \
55-
--number-sections \
56-
--from=markdown --to=html5 \
57-
--css=rust.css --include-in-header=doc/manual.inc \
58-
--include-in-header=doc/favicon.inc \
59-
--include-before-body=doc/version_info.html \
60-
--output=$@
56+
$(CFG_PANDOC) $(HTML_OPTS) --include-in-header=doc/manual.inc --output=$@
6157

6258
DOCS += doc/rust.tex
6359
doc/rust.tex: rust.md doc/version.md
6460
@$(call E, pandoc: $@)
6561
$(Q)$(CFG_NODE) $(S)doc/prep.js $< | \
66-
"$(CFG_PANDOC)" \
67-
--standalone --toc \
68-
--number-sections \
69-
--include-before-body=doc/version.md \
70-
--from=markdown --to=latex \
71-
--output=$@
62+
$(CFG_PANDOC) $(TEX_OPTS) --output=$@
7263

7364
DOCS += doc/rust.epub
74-
doc/rust.epub: rust.md doc/version_info.html doc/rust.css doc/manual.inc
65+
doc/rust.epub: rust.md doc/version_info.html doc/rust.css
7566
@$(call E, pandoc: $@)
7667
$(Q)$(CFG_NODE) $(S)doc/prep.js --highlight $< | \
77-
"$(CFG_PANDOC)" \
78-
--standalone --toc \
79-
--section-divs \
80-
--number-sections \
81-
--from=markdown --to=epub \
82-
--include-before-body=doc/version_info.html \
83-
--output=$@
68+
$(CFG_PANDOC) $(EPUB_OPTS) --output=$@
8469

8570
DOCS += doc/rustpkg.html
86-
doc/rustpkg.html: rustpkg.md doc/version_info.html doc/rust.css doc/manual.inc \
71+
doc/rustpkg.html: rustpkg.md doc/version_info.html doc/rust.css \
8772
doc/favicon.inc
8873
@$(call E, pandoc: $@)
8974
$(Q)$(CFG_NODE) $(S)doc/prep.js --highlight $< | \
90-
"$(CFG_PANDOC)" \
91-
--standalone --toc \
92-
--section-divs \
93-
--number-sections \
94-
--from=markdown --to=html5 \
95-
--css=rust.css --include-in-header=doc/manual.inc \
96-
--include-in-header=doc/favicon.inc \
97-
--include-before-body=doc/version_info.html \
98-
--output=$@
75+
$(CFG_PANDOC) $(HTML_OPTS) --output=$@
9976

10077
DOCS += doc/tutorial.html
10178
doc/tutorial.html: tutorial.md doc/version_info.html doc/rust.css \
10279
doc/favicon.inc
10380
@$(call E, pandoc: $@)
10481
$(Q)$(CFG_NODE) $(S)doc/prep.js --highlight $< | \
105-
$(CFG_PANDOC) --standalone --toc \
106-
--section-divs --number-sections \
107-
--from=markdown --to=html5 --css=rust.css \
108-
--include-in-header=doc/favicon.inc \
109-
--include-before-body=doc/version_info.html \
110-
--output=$@
82+
$(CFG_PANDOC) $(HTML_OPTS) --output=$@
11183

11284
DOCS += doc/tutorial.tex
11385
doc/tutorial.tex: tutorial.md doc/version.md
11486
@$(call E, pandoc: $@)
11587
$(Q)$(CFG_NODE) $(S)doc/prep.js $< | \
116-
"$(CFG_PANDOC)" \
117-
--standalone --toc \
118-
--number-sections \
119-
--include-before-body=doc/version.md \
120-
--from=markdown --to=latex \
121-
--output=$@
88+
$(CFG_PANDOC) $(TEX_OPTS) --output=$@
12289

12390
DOCS += doc/tutorial.epub
12491
doc/tutorial.epub: tutorial.md doc/version_info.html doc/rust.css
12592
@$(call E, pandoc: $@)
12693
$(Q)$(CFG_NODE) $(S)doc/prep.js --highlight $< | \
127-
$(CFG_PANDOC) --standalone --toc \
128-
--section-divs --number-sections \
129-
--from=markdown --to=epub \
130-
--include-before-body=doc/version_info.html \
131-
--output=$@
94+
$(CFG_PANDOC) $(EPUB_OPTS) --output=$@
13295

13396

13497
DOCS_L10N += doc/l10n/ja/tutorial.html
@@ -146,84 +109,49 @@ doc/tutorial-macros.html: tutorial-macros.md doc/version_info.html doc/rust.css
146109
doc/favicon.inc
147110
@$(call E, pandoc: $@)
148111
$(Q)$(CFG_NODE) $(S)doc/prep.js --highlight $< | \
149-
$(CFG_PANDOC) --standalone --toc \
150-
--section-divs --number-sections \
151-
--from=markdown --to=html5 --css=rust.css \
152-
--include-in-header=doc/favicon.inc \
153-
--include-before-body=doc/version_info.html \
154-
--output=$@
112+
$(CFG_PANDOC) $(HTML_OPTS) --output=$@
155113

156114
DOCS += doc/tutorial-container.html
157115
doc/tutorial-container.html: tutorial-container.md doc/version_info.html doc/rust.css \
158116
doc/favicon.inc
159117
@$(call E, pandoc: $@)
160118
$(Q)$(CFG_NODE) $(S)doc/prep.js --highlight $< | \
161-
$(CFG_PANDOC) --standalone --toc \
162-
--section-divs --number-sections \
163-
--from=markdown --to=html5 --css=rust.css \
164-
--include-in-header=doc/favicon.inc \
165-
--include-before-body=doc/version_info.html \
166-
--output=$@
119+
$(CFG_PANDOC) $(HTML_OPTS) --output=$@
167120

168121
DOCS += doc/tutorial-ffi.html
169122
doc/tutorial-ffi.html: tutorial-ffi.md doc/version_info.html doc/rust.css \
170123
doc/favicon.inc
171124
@$(call E, pandoc: $@)
172125
$(Q)$(CFG_NODE) $(S)doc/prep.js --highlight $< | \
173-
$(CFG_PANDOC) --standalone --toc \
174-
--section-divs --number-sections \
175-
--from=markdown --to=html5 --css=rust.css \
176-
--include-in-header=doc/favicon.inc \
177-
--include-before-body=doc/version_info.html \
178-
--output=$@
126+
$(CFG_PANDOC) $(HTML_OPTS) --output=$@
179127

180128
DOCS += doc/tutorial-borrowed-ptr.html
181129
doc/tutorial-borrowed-ptr.html: tutorial-borrowed-ptr.md doc/version_info.html doc/rust.css \
182130
doc/favicon.inc
183131
@$(call E, pandoc: $@)
184132
$(Q)$(CFG_NODE) $(S)doc/prep.js --highlight $< | \
185-
$(CFG_PANDOC) --standalone --toc \
186-
--section-divs --number-sections \
187-
--from=markdown --to=html5 --css=rust.css \
188-
--include-in-header=doc/favicon.inc \
189-
--include-before-body=doc/version_info.html \
190-
--output=$@
133+
$(CFG_PANDOC) $(HTML_OPTS) --output=$@
191134

192135
DOCS += doc/tutorial-tasks.html
193136
doc/tutorial-tasks.html: tutorial-tasks.md doc/version_info.html doc/rust.css \
194137
doc/favicon.inc
195138
@$(call E, pandoc: $@)
196139
$(Q)$(CFG_NODE) $(S)doc/prep.js --highlight $< | \
197-
$(CFG_PANDOC) --standalone --toc \
198-
--section-divs --number-sections \
199-
--from=markdown --to=html5 --css=rust.css \
200-
--include-in-header=doc/favicon.inc \
201-
--include-before-body=doc/version_info.html \
202-
--output=$@
140+
$(CFG_PANDOC) $(HTML_OPTS) --output=$@
203141

204142
DOCS += doc/tutorial-conditions.html
205143
doc/tutorial-conditions.html: tutorial-conditions.md doc/version_info.html doc/rust.css \
206144
doc/favicon.inc
207145
@$(call E, pandoc: $@)
208146
$(Q)$(CFG_NODE) $(S)doc/prep.js --highlight $< | \
209-
$(CFG_PANDOC) --standalone --toc \
210-
--section-divs --number-sections \
211-
--from=markdown --to=html5 --css=rust.css \
212-
--include-in-header=doc/favicon.inc \
213-
--include-before-body=doc/version_info.html \
214-
--output=$@
147+
$(CFG_PANDOC) $(HTML_OPTS) --output=$@
215148

216149
DOCS += doc/tutorial-rustpkg.html
217150
doc/tutorial-rustpkg.html: tutorial-rustpkg.md doc/version_info.html doc/rust.css \
218151
doc/favicon.inc
219152
@$(call E, pandoc: $@)
220153
$(Q)$(CFG_NODE) $(S)doc/prep.js --highlight $< | \
221-
$(CFG_PANDOC) --standalone --toc \
222-
--section-divs --number-sections \
223-
--from=markdown --to=html5 --css=rust.css \
224-
--include-in-header=doc/favicon.inc \
225-
--include-before-body=doc/version_info.html \
226-
--output=$@
154+
$(CFG_PANDOC) $(HTML_OPTS) --output=$@
227155

228156
ifeq ($(CFG_PDFLATEX),)
229157
$(info cfg: no pdflatex found, omitting doc/rust.pdf)

0 commit comments

Comments
 (0)