13
13
#
14
14
# The DOCS variable is their names (with no file extension).
15
15
#
16
- # PDF_DOCS lists the targets for which PDF documentation should be
17
- # build.
18
- #
19
16
# RUSTDOC_FLAGS_xyz variables are extra arguments to pass to the
20
17
# rustdoc invocation for xyz.
21
18
#
@@ -35,8 +32,6 @@ DOCS += guide-crates guide-error-handling guide-ffi guide-macros guide \
35
32
guide-testing
36
33
37
34
38
- PDF_DOCS := reference
39
-
40
35
RUSTDOC_DEPS_reference := doc/full-toc.inc
41
36
RUSTDOC_FLAGS_reference := --html-in-header=doc/full-toc.inc
42
37
@@ -52,13 +47,6 @@ RUSTDOC_HTML_OPTS_NO_CSS = --html-before-content=doc/version_info.html \
52
47
53
48
RUSTDOC_HTML_OPTS = $(RUSTDOC_HTML_OPTS_NO_CSS ) --markdown-css rust.css
54
49
55
- PANDOC_BASE_OPTS := --standalone --toc --number-sections
56
- PANDOC_TEX_OPTS = $(PANDOC_BASE_OPTS ) --from=markdown --to=latex \
57
- --include-before-body=doc/version.tex \
58
- --include-before-body=doc/footer.tex \
59
- --include-in-header=doc/uptack.tex
60
- PANDOC_EPUB_OPTS = $(PANDOC_BASE_OPTS ) --to=epub
61
-
62
50
# The rustdoc executable...
63
51
RUSTDOC_EXE = $(HBIN2_H_$(CFG_BUILD ) ) /rustdoc$(X_$(CFG_BUILD ) )
64
52
# ...with rpath included in case --disable-rpath was provided to
89
77
HTML_DEPS :=
90
78
endif
91
79
92
- # Check for xelatex
93
-
94
- ifneq ($(CFG_XELATEX ) ,)
95
- CFG_LATEX := $(CFG_XELATEX )
96
- XELATEX = 1
97
- else
98
- $(info cfg : no xelatex found, disabling LaTeX docs)
99
- NO_PDF_DOCS = 1
100
- endif
101
-
102
- ifeq ($(CFG_PANDOC ) ,)
103
- $(info cfg : no pandoc found, omitting PDF and EPUB docs)
104
- ONLY_HTML_DOCS = 1
105
- endif
106
-
107
-
108
80
# #####################################################################
109
81
# Rust version
110
82
# #####################################################################
111
83
112
- doc/version.tex : $(MKFILE_DEPS ) $(wildcard $(D ) /* .* ) | doc/
113
- @$(call E, version-stamp: $@ )
114
- $(Q ) echo " $( CFG_VERSION) " > $@
115
-
116
84
HTML_DEPS += doc/version_info.html
117
85
doc/version_info.html : $(D ) /version_info.html.template $(MKFILE_DEPS ) \
118
86
$(wildcard $(D)/*.*) | doc/
@@ -121,10 +89,10 @@ doc/version_info.html: $(D)/version_info.html.template $(MKFILE_DEPS) \
121
89
s/SHORT_HASH/$(CFG_SHORT_VER_HASH)/; \
122
90
s/STAMP/$(CFG_VER_HASH)/;" $< >$@
123
91
124
- GENERATED += doc/version.tex doc/ version_info.html
92
+ GENERATED += doc/version_info.html
125
93
126
94
# #####################################################################
127
- # Docs, from rustdoc and sometimes pandoc
95
+ # Docs from rustdoc
128
96
# #####################################################################
129
97
130
98
doc/ :
@@ -150,20 +118,6 @@ doc/footer.inc: $(D)/footer.inc | doc/
150
118
$(Q ) cp -PRp $< $@ 2> /dev/null
151
119
152
120
# The (english) documentation for each doc item.
153
-
154
- define DEF_SHOULD_BUILD_PDF_DOC
155
- SHOULD_BUILD_PDF_DOC_$(1 ) = 1
156
- endef
157
- $(foreach docname,$(PDF_DOCS),$(eval $(call DEF_SHOULD_BUILD_PDF_DOC,$(docname))))
158
-
159
- doc/footer.tex : $(D ) /footer.inc | doc/
160
- @$(call E, pandoc: $@ )
161
- $(CFG_PANDOC ) --from=html --to=latex $< --output=$@
162
-
163
- doc/uptack.tex : $(D ) /uptack.tex | doc/
164
- $(Q ) cp $< $@
165
-
166
- # HTML (rustdoc)
167
121
DOC_TARGETS += doc/not_found.html
168
122
doc/not_found.html : $(D ) /not_found.md $(HTML_DEPS ) | doc/
169
123
@$(call E, rustdoc: $@ )
@@ -179,47 +133,6 @@ doc/$(1).html: $$(D)/$(1).md $$(HTML_DEPS) $$(RUSTDOC_DEPS_$(1)) | doc/
179
133
@$$(call E, rustdoc: $$@ )
180
134
$$(Q )$$(RUSTDOC ) $$(RUSTDOC_HTML_OPTS ) $$(RUSTDOC_FLAGS_$(1 ) ) $$<
181
135
182
- ifneq ($(ONLY_HTML_DOCS ) ,1)
183
-
184
- # EPUB (pandoc directly)
185
- DOC_TARGETS += doc/$(1 ) .epub
186
- doc/$(1 ) .epub : $$(D ) /$(1 ) .md | doc/
187
- @$$(call E, pandoc: $$@ )
188
- $$(CFG_PANDOC ) $$(PANDOC_EPUB_OPTS ) $$< --output=$$@
189
-
190
- # PDF (md =(pandoc)=> tex =(pdflatex)=> pdf)
191
- DOC_TARGETS += doc/$(1 ) .tex
192
- doc/$(1 ) .tex : $$(D ) /$(1 ) .md doc/uptack.tex doc/footer.tex doc/version.tex | doc/
193
- @$$(call E, pandoc: $$@ )
194
- $$(CFG_PANDOC ) $$(PANDOC_TEX_OPTS ) $$< --output=$$@
195
-
196
- ifneq ($(NO_PDF_DOCS ) ,1)
197
- ifeq ($$(SHOULD_BUILD_PDF_DOC_$(1 ) ) ,1)
198
- DOC_TARGETS += doc/$(1 ) .pdf
199
- ifneq ($(XELATEX ) ,1)
200
- doc/$(1 ) .pdf : doc/$(1 ) .tex
201
- @$$(call E, latex compiler: $$@ )
202
- $$(Q )$$(CFG_LATEX ) \
203
- -interaction=batchmode \
204
- -output-directory=doc \
205
- $$<
206
- else
207
- # The version of xelatex on the snap bots seemingly ingores -output-directory
208
- # So we'll output to . and move to the doc directory manually.
209
- # This will leave some intermediate files in the build directory.
210
- doc/$(1 ) .pdf : doc/$(1 ) .tex
211
- @$$(call E, latex compiler: $$@ )
212
- $$(Q )$$(CFG_LATEX ) \
213
- -interaction=batchmode \
214
- -output-directory=. \
215
- $$<
216
- $$(Q ) mv ./$(1 ) .pdf $$@
217
- endif # XELATEX
218
- endif # SHOULD_BUILD_PDF_DOCS_$(1)
219
- endif # NO_PDF_DOCS
220
-
221
- endif # ONLY_HTML_DOCS
222
-
223
136
endef
224
137
225
138
$(foreach docname,$(DOCS),$(eval $(call DEF_DOC,$(docname))))
0 commit comments