]> git.proxmox.com Git - proxmox-backup.git/blob - docs/Makefile
use xetex to generate pdf
[proxmox-backup.git] / docs / Makefile
1 include ../defines.mk
2
3 ifeq ($(BUILD_MODE), release)
4 COMPILEDIR := ../target/release
5 else
6 COMPILEDIR := ../target/debug
7 endif
8
9 GENERATED_SYNOPSIS := \
10 proxmox-backup-client/synopsis.rst \
11 proxmox-backup-client/catalog-shell-synopsis.rst \
12 proxmox-backup-manager/synopsis.rst \
13 pxar/synopsis.rst \
14 backup-protocol-api.rst \
15 reader-protocol-api.rst
16
17 MANUAL_PAGES := \
18 pxar.1 \
19 proxmox-backup-proxy.1 \
20 proxmox-backup-client.1 \
21 proxmox-backup-manager.1
22
23
24 # Sphinx documentation setup
25 SPHINXOPTS =
26 SPHINXBUILD = sphinx-build
27 BUILDDIR = output
28
29 # Sphinx internal variables.
30 ALLSPHINXOPTS = -d $(BUILDDIR)/doctrees $(SPHINXOPTS) .
31
32 all: ${MANUAL_PAGES}
33
34 # Extract backup protocol docs
35 backup-protocol-api.rst: ${COMPILEDIR}/dump-backup-api
36 ${COMPILEDIR}/dump-backup-api >$@
37
38 # Extract reader protocol docs
39 reader-protocol-api.rst: ${COMPILEDIR}/dump-reader-api
40 ${COMPILEDIR}/dump-backup-api >$@
41
42 # Build manual pages using rst2man
43
44 pxar/synopsis.rst: ${COMPILEDIR}/pxar
45 ${COMPILEDIR}/pxar printdoc > pxar/synopsis.rst
46
47 pxar.1: pxar/man1.rst pxar/description.rst pxar/synopsis.rst
48 rst2man $< >$@
49
50 proxmox-backup-client/synopsis.rst: ${COMPILEDIR}/proxmox-backup-client
51 ${COMPILEDIR}/proxmox-backup-client printdoc > proxmox-backup-client/synopsis.rst
52
53 proxmox-backup-client/catalog-shell-synopsis.rst: ${COMPILEDIR}/dump-catalog-shell-cli
54 ${COMPILEDIR}/dump-catalog-shell-cli > proxmox-backup-client/catalog-shell-synopsis.rst
55
56 proxmox-backup-client.1: proxmox-backup-client/man1.rst proxmox-backup-client/description.rst proxmox-backup-client/synopsis.rst proxmox-backup-client/catalog-shell-synopsis.rst
57 rst2man $< >$@
58
59 proxmox-backup-manager/synopsis.rst: ${COMPILEDIR}/proxmox-backup-manager
60 ${COMPILEDIR}/proxmox-backup-manager printdoc > proxmox-backup-manager/synopsis.rst
61
62 proxmox-backup-manager.1: proxmox-backup-manager/man1.rst proxmox-backup-manager/description.rst proxmox-backup-manager/synopsis.rst
63 rst2man $< >$@
64
65 proxmox-backup-proxy.1: proxmox-backup-proxy/man1.rst proxmox-backup-proxy/description.rst
66 rst2man $< >$@
67
68 .PHONY: html
69 html: ${GENERATED_SYNOPSIS}
70 $(SPHINXBUILD) -b html $(ALLSPHINXOPTS) $(BUILDDIR)/html
71 @echo
72 @echo "Build finished. The HTML pages are in $(BUILDDIR)/html."
73
74 .PHONY: latexpdf
75 latexpdf: ${GENERATED_SYNOPSIS}
76 @echo "Requires python3-sphinx, texlive-xetex and xindy"
77 $(SPHINXBUILD) -b latex $(ALLSPHINXOPTS) $(BUILDDIR)/latex
78 @echo "Running LaTeX files through xelatex..."
79 $(MAKE) -C $(BUILDDIR)/latex all-pdf
80 @echo "xelatex finished; the PDF files are in $(BUILDDIR)/latex."
81
82 .PHONY: epub3
83 epub3: ${GENERATED_SYNOPSIS}
84 $(SPHINXBUILD) -b epub3 $(ALLSPHINXOPTS) $(BUILDDIR)/epub3
85 @echo
86 @echo "Build finished. The epub3 file is in $(BUILDDIR)/epub3."
87
88 clean:
89 rm -r -f *~ *.1 ${BUILDDIR} ${GENERATED_SYNOPSIS}
90
91
92 install_manual_pages: ${MANUAL_PAGES}
93 install -dm755 $(DESTDIR)$(MAN1DIR)
94 for i in ${MANUAL_PAGES}; do install -m755 $$i $(DESTDIR)$(MAN1DIR)/ ; done
95
96 install_html: html
97 install -dm755 $(DESTDIR)$(DOCDIR)
98 rsync -a ${BUILDDIR}/html $(DESTDIR)$(DOCDIR)
99
100 install_pdf: latexpdf
101 install -dm755 $(DESTDIR)$(DOCDIR)
102 install -m 0644 output/latex/ProxmoxBackup.pdf $(DESTDIR)$(DOCDIR)/proxmox-backup.pdf
103
104 ifneq ($(filter nodoc,$(DEB_BUILD_PROFILES)),)
105
106 install: install_manual_pages
107
108 else
109
110 install: install_manual_pages install_html install_pdf
111
112 endif