Skip to content
This repository was archived by the owner on Aug 5, 2024. It is now read-only.

Commit 10249ff

Browse files
committed
Replace .svg by .* and add Makefile rule
* replace .svg images by .* in order that `make latexpdf` not to fail. * while [sphinx-doc #2859](sphinx-doc/sphinx#2859 is merged, add rule in Makefile to generate pdfs from svgs. * `make latexpdf` will still fail if inkscape is not installed. The alternative will be to do not include the rule "images" in "latexpdf" and include the pdfs in git.
1 parent 6e6fc7d commit 10249ff

File tree

1 file changed

+17
-2
lines changed

1 file changed

+17
-2
lines changed

doc/Makefile

+17-2
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,11 @@ PAPEROPT_letter = -D latex_paper_size=letter
1313
ALLSPHINXOPTS = -d $(BUILDDIR)/doctrees $(PAPEROPT_$(PAPER)) $(SPHINXOPTS) .
1414
# the i18n builder cannot share the environment and doctrees with the others
1515
I18NSPHINXOPTS = $(PAPEROPT_$(PAPER)) $(SPHINXOPTS) .
16+
SOURCEDIR = .
17+
IMAGEDIRS = images
18+
# SVG to PDF conversion
19+
SVG2PDF = inkscape
20+
SVG2PDF_FLAGS =
1621

1722
.PHONY: help
1823
help:
@@ -44,9 +49,19 @@ help:
4449
@echo " coverage to run coverage check of the documentation (if enabled)"
4550
@echo " dummy to check syntax errors of document sources"
4651

52+
#
53+
# Pattern rule for converting SVG to PDF
54+
%.pdf : %.svg
55+
$(SVG2PDF) -f $< -A $@
56+
# Build a list of SVG files to convert to PDFs
57+
PDFs := $(foreach dir, $(IMAGEDIRS), $(patsubst %.svg,%.pdf,$(wildcard $(SOURCEDIR)/$(dir)/*.svg)))
58+
# Make a rule to build the PDFs
59+
images: $(PDFs)
60+
4761
.PHONY: clean
4862
clean:
4963
rm -rf $(BUILDDIR)/*
64+
rm $(PDFs)
5065

5166
.PHONY: html
5267
html:
@@ -127,15 +142,15 @@ epub3:
127142
@echo "Build finished. The epub3 file is in $(BUILDDIR)/epub3."
128143

129144
.PHONY: latex
130-
latex:
145+
latex: $(PDFs)
131146
$(SPHINXBUILD) -b latex $(ALLSPHINXOPTS) $(BUILDDIR)/latex
132147
@echo
133148
@echo "Build finished; the LaTeX files are in $(BUILDDIR)/latex."
134149
@echo "Run \`make' in that directory to run these through (pdf)latex" \
135150
"(use \`make latexpdf' here to do that automatically)."
136151

137152
.PHONY: latexpdf
138-
latexpdf:
153+
latexpdf: $(PDFs)
139154
$(SPHINXBUILD) -b latex $(ALLSPHINXOPTS) $(BUILDDIR)/latex
140155
@echo "Running LaTeX files through pdflatex..."
141156
$(MAKE) -C $(BUILDDIR)/latex all-pdf

0 commit comments

Comments
 (0)