]> git.proxmox.com Git - proxmox-backup.git/blob - docs/Makefile
docs: simplify list of ENV var alternative
[proxmox-backup.git] / docs / Makefile
1 include ../defines.mk
2
3 GENERATED_SYNOPSIS := \
4 proxmox-tape/synopsis.rst \
5 proxmox-backup-client/synopsis.rst \
6 proxmox-backup-client/catalog-shell-synopsis.rst \
7 proxmox-backup-manager/synopsis.rst \
8 proxmox-file-restore/synopsis.rst \
9 pxar/synopsis.rst \
10 pmtx/synopsis.rst \
11 pmt/synopsis.rst \
12 config/media-pool/config.rst \
13 config/tape/config.rst \
14 config/tape-job/config.rst \
15 config/user/config.rst \
16 config/remote/config.rst \
17 config/sync/config.rst \
18 config/verification/config.rst \
19 config/acl/roles.rst \
20 config/datastore/config.rst
21
22 MAN1_PAGES := \
23 pxar.1 \
24 pmtx.1 \
25 pmt.1 \
26 proxmox-tape.1 \
27 proxmox-backup-proxy.1 \
28 proxmox-backup-client.1 \
29 proxmox-backup-manager.1 \
30 proxmox-file-restore.1
31
32 MAN5_PAGES := \
33 media-pool.cfg.5 \
34 tape.cfg.5 \
35 tape-job.cfg.5 \
36 acl.cfg.5 \
37 user.cfg.5 \
38 remote.cfg.5 \
39 sync.cfg.5 \
40 verification.cfg.5 \
41 datastore.cfg.5
42
43 PRUNE_SIMULATOR_FILES := \
44 prune-simulator/index.html \
45 prune-simulator/documentation.html \
46 prune-simulator/clear-trigger.png \
47 prune-simulator/prune-simulator.js
48
49 PRUNE_SIMULATOR_JS_SOURCE := \
50 /usr/share/javascript/proxmox-widget-toolkit-dev/Toolkit.js \
51 prune-simulator/prune-simulator_source.js
52
53 LTO_BARCODE_JS_SOURCE := \
54 /usr/share/javascript/proxmox-widget-toolkit-dev/Toolkit.js \
55 lto-barcode/code39.js \
56 lto-barcode/prefix-field.js \
57 lto-barcode/label-style.js \
58 lto-barcode/tape-type.js \
59 lto-barcode/paper-size.js \
60 lto-barcode/page-layout.js \
61 lto-barcode/page-calibration.js \
62 lto-barcode/label-list.js \
63 lto-barcode/label-setup.js \
64 lto-barcode/lto-barcode.js
65
66 LTO_BARCODE_FILES := \
67 lto-barcode/index.html \
68 lto-barcode/lto-barcode-generator.js
69
70 API_VIEWER_SOURCES= \
71 api-viewer/index.html \
72 api-viewer/apidoc.js
73
74 API_VIEWER_FILES := \
75 api-viewer/apidata.js \
76 /usr/share/javascript/proxmox-widget-toolkit-dev/APIViewer.js \
77
78 # Sphinx documentation setup
79 SPHINXOPTS =
80 SPHINXBUILD = sphinx-build
81 BUILDDIR = output
82
83 ifeq ($(BUILD_MODE), release)
84 COMPILEDIR := ../target/release
85 SPHINXOPTS += -t release
86 else
87 COMPILEDIR := ../target/debug
88 SPHINXOPTS += -t devbuild
89 endif
90
91 # Sphinx internal variables.
92 ALLSPHINXOPTS = -d $(BUILDDIR)/doctrees $(SPHINXOPTS) .
93
94 all: ${MAN1_PAGES} ${MAN5_PAGES}
95
96 # Build manual pages using rst2man
97
98 pxar/synopsis.rst: ${COMPILEDIR}/pxar
99 ${COMPILEDIR}/pxar printdoc > pxar/synopsis.rst
100
101 pxar.1: pxar/man1.rst pxar/description.rst pxar/synopsis.rst
102 rst2man $< >$@
103
104
105 pmtx/synopsis.rst: ${COMPILEDIR}/pmtx
106 ${COMPILEDIR}/pmtx printdoc > pmtx/synopsis.rst
107
108 pmtx.1: pmtx/man1.rst pmtx/description.rst pmtx/synopsis.rst
109 rst2man $< >$@
110
111
112 pmt/synopsis.rst: ${COMPILEDIR}/pmt
113 ${COMPILEDIR}/pmt printdoc > pmt/synopsis.rst
114
115 pmt.1: pmt/man1.rst pmt/description.rst pmt/options.rst pmt/synopsis.rst
116 rst2man $< >$@
117
118 config/datastore/config.rst: ${COMPILEDIR}/docgen
119 ${COMPILEDIR}/docgen datastore.cfg >$@
120
121 datastore.cfg.5: config/datastore/man5.rst config/datastore/config.rst config/datastore/format.rst
122 rst2man $< >$@
123
124 config/user/config.rst: ${COMPILEDIR}/docgen
125 ${COMPILEDIR}/docgen user.cfg >$@
126
127 user.cfg.5: config/user/man5.rst config/user/config.rst config/user/format.rst
128 rst2man $< >$@
129
130 config/remote/config.rst: ${COMPILEDIR}/docgen
131 ${COMPILEDIR}/docgen remote.cfg >$@
132
133 remote.cfg.5: config/remote/man5.rst config/remote/config.rst config/remote/format.rst
134 rst2man $< >$@
135
136 config/sync/config.rst: ${COMPILEDIR}/docgen
137 ${COMPILEDIR}/docgen sync.cfg >$@
138
139 sync.cfg.5: config/sync/man5.rst config/sync/config.rst config/sync/format.rst
140 rst2man $< >$@
141
142 config/verification/config.rst: ${COMPILEDIR}/docgen
143 ${COMPILEDIR}/docgen verification.cfg >$@
144
145 verification.cfg.5: config/verification/man5.rst config/verification/config.rst config/verification/format.rst
146 rst2man $< >$@
147
148 config/acl/roles.rst: ${COMPILEDIR}/docgen
149 ${COMPILEDIR}/docgen "config::acl::Role" >$@
150
151 acl.cfg.5: config/acl/man5.rst config/acl/roles.rst config/acl/format.rst
152 rst2man $< >$@
153
154 config/media-pool/config.rst: ${COMPILEDIR}/docgen
155 ${COMPILEDIR}/docgen media-pool.cfg >$@
156
157 media-pool.cfg.5: config/media-pool/man5.rst config/media-pool/config.rst config/media-pool/format.rst
158 rst2man $< >$@
159
160 config/tape/config.rst: ${COMPILEDIR}/docgen
161 ${COMPILEDIR}/docgen tape.cfg >$@
162
163 tape.cfg.5: config/tape/man5.rst config/tape/config.rst config/tape/format.rst
164 rst2man $< >$@
165
166 config/tape-job/config.rst: ${COMPILEDIR}/docgen
167 ${COMPILEDIR}/docgen tape-job.cfg >$@
168
169 tape-job.cfg.5: config/tape-job/man5.rst config/tape-job/config.rst config/tape-job/format.rst
170 rst2man $< >$@
171
172 proxmox-tape/synopsis.rst: ${COMPILEDIR}/proxmox-tape
173 ${COMPILEDIR}/proxmox-tape printdoc > proxmox-tape/synopsis.rst
174
175 proxmox-tape.1: proxmox-tape/man1.rst proxmox-tape/description.rst proxmox-tape/synopsis.rst
176 rst2man $< >$@
177
178 proxmox-backup-client/synopsis.rst: ${COMPILEDIR}/proxmox-backup-client
179 ${COMPILEDIR}/proxmox-backup-client printdoc > proxmox-backup-client/synopsis.rst
180
181 proxmox-backup-client/catalog-shell-synopsis.rst: ${COMPILEDIR}/dump-catalog-shell-cli
182 ${COMPILEDIR}/dump-catalog-shell-cli > proxmox-backup-client/catalog-shell-synopsis.rst
183
184 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
185 rst2man $< >$@
186
187 proxmox-backup-manager/synopsis.rst: ${COMPILEDIR}/proxmox-backup-manager
188 ${COMPILEDIR}/proxmox-backup-manager printdoc > proxmox-backup-manager/synopsis.rst
189
190 proxmox-backup-manager.1: proxmox-backup-manager/man1.rst proxmox-backup-manager/description.rst proxmox-backup-manager/synopsis.rst
191 rst2man $< >$@
192
193 proxmox-backup-proxy.1: proxmox-backup-proxy/man1.rst proxmox-backup-proxy/description.rst
194 rst2man $< >$@
195
196 proxmox-file-restore/synopsis.rst: ${COMPILEDIR}/proxmox-file-restore
197 ${COMPILEDIR}/proxmox-file-restore printdoc > proxmox-file-restore/synopsis.rst
198
199 proxmox-file-restore.1: proxmox-file-restore/man1.rst proxmox-file-restore/description.rst proxmox-file-restore/synopsis.rst
200 rst2man $< >$@
201
202 .PHONY: onlinehelpinfo
203 onlinehelpinfo:
204 @echo "Generating OnlineHelpInfo.js..."
205 $(SPHINXBUILD) -b proxmox-scanrefs -Q $(ALLSPHINXOPTS) $(BUILDDIR)/scanrefs
206 @echo "Build finished. OnlineHelpInfo.js is in $(BUILDDIR)/scanrefs."
207
208 api-viewer/apidata.js: ${COMPILEDIR}/docgen
209 ${COMPILEDIR}/docgen apidata.js >$@
210
211 api-viewer/apidoc.js: ${API_VIEWER_FILES}
212 cat ${API_VIEWER_FILES} >$@.tmp
213 mv $@.tmp $@
214
215 prune-simulator/prune-simulator.js: ${PRUNE_SIMULATOR_JS_SOURCE}
216 cat ${PRUNE_SIMULATOR_JS_SOURCE} >$@.tmp
217 mv $@.tmp $@
218
219 lto-barcode/lto-barcode-generator.js: ${LTO_BARCODE_JS_SOURCE}
220 cat ${LTO_BARCODE_JS_SOURCE} >$@.tmp
221 mv $@.tmp $@
222
223 .PHONY: html
224 html: ${GENERATED_SYNOPSIS} images/proxmox-logo.svg custom.css conf.py ${PRUNE_SIMULATOR_FILES} ${LTO_BARCODE_FILES} ${API_VIEWER_SOURCES}
225 $(SPHINXBUILD) -b html $(ALLSPHINXOPTS) $(BUILDDIR)/html
226 install -m 0644 custom.js custom.css images/proxmox-logo.svg $(BUILDDIR)/html/_static/
227 install -dm 0755 $(BUILDDIR)/html/prune-simulator
228 install -m 0644 ${PRUNE_SIMULATOR_FILES} $(BUILDDIR)/html/prune-simulator
229 install -dm 0755 $(BUILDDIR)/html/lto-barcode
230 install -m 0644 ${LTO_BARCODE_FILES} $(BUILDDIR)/html/lto-barcode
231 install -dm 0755 $(BUILDDIR)/html/api-viewer
232 install -m 0644 ${API_VIEWER_SOURCES} $(BUILDDIR)/html/api-viewer
233 @echo
234 @echo "Build finished. The HTML pages are in $(BUILDDIR)/html."
235
236 .PHONY: latexpdf
237 latexpdf: ${GENERATED_SYNOPSIS}
238 @echo "Requires python3-sphinx, texlive-xetex, xindy and texlive-fonts-extra"
239 $(SPHINXBUILD) -b latex $(ALLSPHINXOPTS) $(BUILDDIR)/latex
240 @echo "Running LaTeX files through xelatex..."
241 $(MAKE) -C $(BUILDDIR)/latex all-pdf
242 @echo "xelatex finished; the PDF files are in $(BUILDDIR)/latex."
243
244 .PHONY: epub3
245 epub3: ${GENERATED_SYNOPSIS}
246 $(SPHINXBUILD) -b epub3 $(ALLSPHINXOPTS) $(BUILDDIR)/epub3
247 @echo
248 @echo "Build finished. The epub3 file is in $(BUILDDIR)/epub3."
249
250 clean:
251 rm -r -f *~ *.1 ${BUILDDIR} ${GENERATED_SYNOPSIS} api-viewer/apidata.js
252 rm -f api-viewer/apidoc.js lto-barcode/lto-barcode-generator.js prune-simulator/prune-simulator.js
253
254
255 install_manual_pages: ${MAN1_PAGES} ${MAN5_PAGES}
256 install -dm755 $(DESTDIR)$(MAN1DIR)
257 for i in ${MAN1_PAGES}; do install -m755 $$i $(DESTDIR)$(MAN1DIR)/ ; done
258 install -dm755 $(DESTDIR)$(MAN5DIR)
259 for i in ${MAN5_PAGES}; do install -m755 $$i $(DESTDIR)$(MAN5DIR)/ ; done
260
261 install_html: html
262 install -dm755 $(DESTDIR)$(DOCDIR)
263 rsync -a ${BUILDDIR}/html $(DESTDIR)$(DOCDIR)
264
265 install_pdf: latexpdf
266 install -dm755 $(DESTDIR)$(DOCDIR)
267 install -m 0644 output/latex/ProxmoxBackup.pdf $(DESTDIR)$(DOCDIR)/proxmox-backup.pdf
268
269 ifneq ($(filter nodoc,$(DEB_BUILD_PROFILES)),)
270
271 install: install_manual_pages
272
273 else
274
275 install: install_manual_pages install_html install_pdf
276
277 endif