summaryrefslogtreecommitdiffstats
path: root/documentation/Makefile
diff options
context:
space:
mode:
Diffstat (limited to 'documentation/Makefile')
-rw-r--r--documentation/Makefile29
1 files changed, 26 insertions, 3 deletions
diff --git a/documentation/Makefile b/documentation/Makefile
index 996f01b7d5..f015026562 100644
--- a/documentation/Makefile
+++ b/documentation/Makefile
@@ -6,8 +6,11 @@
6SPHINXOPTS ?= -W --keep-going -j auto 6SPHINXOPTS ?= -W --keep-going -j auto
7SPHINXBUILD ?= sphinx-build 7SPHINXBUILD ?= sphinx-build
8SOURCEDIR = . 8SOURCEDIR = .
9IMAGEDIRS = */svg
9BUILDDIR = _build 10BUILDDIR = _build
10DESTDIR = final 11DESTDIR = final
12SVG2PNG = inkscape
13SVG2PDF = inkscape
11 14
12ifeq ($(shell if which $(SPHINXBUILD) >/dev/null 2>&1; then echo 1; else echo 0; fi),0) 15ifeq ($(shell if which $(SPHINXBUILD) >/dev/null 2>&1; then echo 1; else echo 0; fi),0)
13$(error "The '$(SPHINXBUILD)' command was not found. Make sure you have Sphinx installed") 16$(error "The '$(SPHINXBUILD)' command was not found. Make sure you have Sphinx installed")
@@ -17,7 +20,7 @@ endif
17help: 20help:
18 @$(SPHINXBUILD) -M help "$(SOURCEDIR)" "$(BUILDDIR)" $(SPHINXOPTS) $(O) 21 @$(SPHINXBUILD) -M help "$(SOURCEDIR)" "$(BUILDDIR)" $(SPHINXOPTS) $(O)
19 22
20.PHONY: help Makefile clean publish 23.PHONY: help Makefile clean publish epub latexpdf
21 24
22publish: Makefile html singlehtml 25publish: Makefile html singlehtml
23 rm -rf $(BUILDDIR)/$(DESTDIR)/ 26 rm -rf $(BUILDDIR)/$(DESTDIR)/
@@ -26,10 +29,30 @@ publish: Makefile html singlehtml
26 cp $(BUILDDIR)/singlehtml/index.html $(BUILDDIR)/$(DESTDIR)/singleindex.html 29 cp $(BUILDDIR)/singlehtml/index.html $(BUILDDIR)/$(DESTDIR)/singleindex.html
27 sed -i -e 's@index.html#@singleindex.html#@g' $(BUILDDIR)/$(DESTDIR)/singleindex.html 30 sed -i -e 's@index.html#@singleindex.html#@g' $(BUILDDIR)/$(DESTDIR)/singleindex.html
28 31
32# Build a list of SVG files to convert to PDFs
33PDFs := $(foreach dir, $(IMAGEDIRS), $(patsubst %.svg,%.pdf,$(wildcard $(SOURCEDIR)/$(dir)/*.svg)))
34
35# Build a list of SVG files to convert to PNGs
36PNGs := $(foreach dir, $(IMAGEDIRS), $(patsubst %.svg,%.png,$(wildcard $(SOURCEDIR)/$(dir)/*.svg)))
37
38# Pattern rule for converting SVG to PDF
39%.pdf : %.svg
40 $(SVG2PDF) --export-filename=$@ $<
41
42# Pattern rule for converting SVG to PNG
43%.png : %.svg
44 $(SVG2PNG) --export-filename=$@ $<
45
29clean: 46clean:
30 @rm -rf $(BUILDDIR) 47 @rm -rf $(BUILDDIR) $(PNGs) $(PDFs)
48
49epub: $(PNGs)
50 @$(SPHINXBUILD) -M $@ "$(SOURCEDIR)" "$(BUILDDIR)" $(SPHINXOPTS) $(O)
51
52latexpdf: $(PDFs)
53 @$(SPHINXBUILD) -M $@ "$(SOURCEDIR)" "$(BUILDDIR)" $(SPHINXOPTS) $(O)
31 54
32# Catch-all target: route all unknown targets to Sphinx using the new 55# Catch-all target: route all unknown targets to Sphinx using the new
33# "make mode" option. $(O) is meant as a shortcut for $(SPHINXOPTS). 56# "make mode" option. $(O) is meant as a shortcut for $(SPHINXOPTS).
34%: Makefile 57%:
35 @$(SPHINXBUILD) -M $@ "$(SOURCEDIR)" "$(BUILDDIR)" $(SPHINXOPTS) $(O) 58 @$(SPHINXBUILD) -M $@ "$(SOURCEDIR)" "$(BUILDDIR)" $(SPHINXOPTS) $(O)