1313#
1414# The DOCS variable is their names (with no file extension).
1515#
16- # PDF_DOCS lists the targets for which PDF documentation should be
17- # build.
18- #
1916# RUSTDOC_FLAGS_xyz variables are extra arguments to pass to the
2017# rustdoc invocation for xyz.
2118#
@@ -35,8 +32,6 @@ DOCS += guide-crates guide-error-handling guide-ffi guide-macros guide \
3532 guide-testing
3633
3734
38- PDF_DOCS := reference
39-
4035RUSTDOC_DEPS_reference := doc/full-toc.inc
4136RUSTDOC_FLAGS_reference := --html-in-header=doc/full-toc.inc
4237
@@ -52,13 +47,6 @@ RUSTDOC_HTML_OPTS_NO_CSS = --html-before-content=doc/version_info.html \
5247
5348RUSTDOC_HTML_OPTS = $(RUSTDOC_HTML_OPTS_NO_CSS ) --markdown-css rust.css
5449
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-
6250# The rustdoc executable...
6351RUSTDOC_EXE = $(HBIN2_H_$(CFG_BUILD ) ) /rustdoc$(X_$(CFG_BUILD ) )
6452# ...with rpath included in case --disable-rpath was provided to
8977HTML_DEPS :=
9078endif
9179
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-
10880# #####################################################################
10981# Rust version
11082# #####################################################################
11183
112- doc/version.tex : $(MKFILE_DEPS ) $(wildcard $(D ) /* .* ) | doc/
113- @$(call E, version-stamp: $@ )
114- $(Q ) echo " $( CFG_VERSION) " > $@
115-
11684HTML_DEPS += doc/version_info.html
11785doc/version_info.html : $(D ) /version_info.html.template $(MKFILE_DEPS ) \
11886 $(wildcard $(D)/*.*) | doc/
@@ -121,10 +89,10 @@ doc/version_info.html: $(D)/version_info.html.template $(MKFILE_DEPS) \
12189 s/SHORT_HASH/$(CFG_SHORT_VER_HASH)/; \
12290 s/STAMP/$(CFG_VER_HASH)/;" $< >$@
12391
124- GENERATED += doc/version.tex doc/ version_info.html
92+ GENERATED += doc/version_info.html
12593
12694# #####################################################################
127- # Docs, from rustdoc and sometimes pandoc
95+ # Docs from rustdoc
12896# #####################################################################
12997
13098doc/ :
@@ -150,20 +118,6 @@ doc/footer.inc: $(D)/footer.inc | doc/
150118 $(Q ) cp -PRp $< $@ 2> /dev/null
151119
152120# 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)
167121DOC_TARGETS += doc/not_found.html
168122doc/not_found.html : $(D ) /not_found.md $(HTML_DEPS ) | doc/
169123 @$(call E, rustdoc: $@ )
@@ -179,47 +133,6 @@ doc/$(1).html: $$(D)/$(1).md $$(HTML_DEPS) $$(RUSTDOC_DEPS_$(1)) | doc/
179133 @$$(call E, rustdoc: $$@ )
180134 $$(Q )$$(RUSTDOC ) $$(RUSTDOC_HTML_OPTS ) $$(RUSTDOC_FLAGS_$(1 ) ) $$<
181135
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-
223136endef
224137
225138$(foreach docname,$(DOCS),$(eval $(call DEF_DOC,$(docname))))
0 commit comments