14
14
#
15
15
# The DOCS variable is their names (with no file extension).
16
16
#
17
+ # PDF_DOCS lists the targets for which PDF documentation should be
18
+ # build.
19
+ #
17
20
# RUSTDOC_FLAGS_xyz variables are extra arguments to pass to the
18
21
# rustdoc invocation for xyz.
19
22
#
@@ -28,6 +31,8 @@ DOCS := index tutorial guide-ffi guide-macros guide-lifetimes \
28
31
complement-cheatsheet guide-runtime \
29
32
rust rustdoc
30
33
34
+ PDF_DOCS := tutorial rust
35
+
31
36
RUSTDOC_DEPS_rust := doc/full-toc.inc
32
37
RUSTDOC_FLAGS_rust := --markdown-in-header=doc/full-toc.inc
33
38
@@ -45,8 +50,6 @@ PANDOC_TEX_OPTS = $(PANDOC_BASE_OPTS) --include-before-body=doc/version.md \
45
50
--from=markdown --include-before-body=doc/footer.tex --to=latex
46
51
PANDOC_EPUB_OPTS = $(PANDOC_BASE_OPTS ) --to=epub
47
52
48
-
49
-
50
53
# The rustdoc executable...
51
54
RUSTDOC_EXE = $(HBIN2_H_$(CFG_BUILD ) ) /rustdoc$(X_$(CFG_BUILD ) )
52
55
# ...with rpath included in case --disable-rpath was provided to
@@ -146,6 +149,11 @@ doc/footer.tex: $(D)/footer.tex | doc/
146
149
147
150
# The (english) documentation for each doc item.
148
151
152
+ define DEF_SHOULD_BUILD_PDF_DOC
153
+ SHOULD_BUILD_PDF_DOC_$(1 ) = 1
154
+ endef
155
+ $(foreach docname,$(PDF_DOCS),$(eval $(call DEF_SHOULD_BUILD_PDF_DOC,$(docname))))
156
+
149
157
define DEF_DOC
150
158
151
159
# HTML (rustdoc)
@@ -171,13 +179,15 @@ doc/$(1).tex: $$(D)/$(1).md doc/footer.tex doc/version.md | doc/
171
179
$$(CFG_PANDOC ) $$(PANDOC_TEX_OPTS ) --output=$$@
172
180
173
181
ifneq ($(NO_PDF_DOCS ) ,1)
182
+ ifeq ($$(SHOULD_BUILD_PDF_DOC_$(1 ) ) ,1)
174
183
DOC_TARGETS += doc/$(1 ) .pdf
175
184
doc/$(1 ) .pdf : doc/$(1 ) .tex
176
185
@$$(call E, pdflatex: $$@ )
177
186
$$(Q )$$(CFG_PDFLATEX ) \
178
187
-interaction=batchmode \
179
188
-output-directory=doc \
180
189
$$<
190
+ endif # SHOULD_BUILD_PDF_DOCS_$(1)
181
191
endif # NO_PDF_DOCS
182
192
183
193
endif # ONLY_HTML_DOCS
0 commit comments