bump version to 4.3-4
[pve-docs.git] / Makefile
1 DGDIR=.
2
3 include ./pve-doc-generator.mk
4
5 GEN_PACKAGE=pve-doc-generator
6 DOC_PACKAGE=pve-docs
7 MEDIAWIKI_PACKAGE=pve-docs-mediawiki
8
9 # also update debian/changelog
10 PKGREL=4
11
12 GITVERSION:=$(shell cat .git/refs/heads/master)
13
14 ARCH:=$(shell dpkg-architecture -qDEB_BUILD_ARCH)
15
16 GEN_DEB=${GEN_PACKAGE}_${DOCRELEASE}-${PKGREL}_${ARCH}.deb
17 DOC_DEB=${DOC_PACKAGE}_${DOCRELEASE}-${PKGREL}_all.deb
18 MEDIAWIKI_DEB=${MEDIAWIKI_PACKAGE}_${DOCRELEASE}-${PKGREL}_all.deb
19
20 CHAPTER_LIST= \
21 pve-installation \
22 sysadmin \
23 pvecm \
24 pmxcfs \
25 pvesm \
26 qm \
27 pve-firewall \
28 pveum \
29 pct \
30 ha-manager \
31 vzdump \
32 pve-faq \
33 pve-bibliography
34
35 STORAGE_TYPES= \
36 dir \
37 glusterfs \
38 iscsi \
39 iscsidirect \
40 lvm \
41 lvmthin \
42 nfs \
43 rbd \
44 zfspool
45
46 COMMAND_LIST= \
47 pvesubscription \
48 pvecm \
49 qm \
50 qmrestore \
51 pveceph \
52 pct \
53 pveam \
54 pvesm \
55 pveum \
56 vzdump \
57 ha-manager \
58 pveperf
59
60 SERVICE_LIST= \
61 pve-firewall \
62 pve-ha-crm \
63 pve-ha-lrm \
64 pvestatd \
65 pmxcfs \
66 pveproxy \
67 spiceproxy \
68 pvedaemon
69
70 CONFIG_LIST=datacenter.cfg qm.conf pct.conf
71
72 GEN_DEB_SOURCES= \
73 pve-doc-generator.mk \
74 attributes.txt \
75 $(addsuffix .adoc, ${COMMAND_LIST}) \
76 $(addsuffix .adoc, ${SERVICE_LIST}) \
77 $(addsuffix .adoc, ${CONFIG_LIST}) \
78 pve-storage-dir.adoc \
79 pve-storage-glusterfs.adoc \
80 pve-storage-iscsi.adoc \
81 pve-storage-iscsidirect.adoc \
82 pve-storage-lvm.adoc \
83 pve-storage-lvmthin.adoc \
84 pve-storage-nfs.adoc \
85 pve-storage-rbd.adoc \
86 pve-storage-zfspool.adoc \
87 pmxcfs.8-cli.adoc \
88 pve-copyright.adoc \
89 docinfo.xml
90
91 GEN_SCRIPTS= \
92 gen-datacenter.cfg.5-opts.pl \
93 gen-pct.conf.5-opts.pl \
94 gen-pct-network-opts.pl \
95 gen-pct-mountpoint-opts.pl \
96 gen-qm.conf.5-opts.pl \
97 gen-vzdump.conf.5-opts.pl \
98 gen-pve-firewall-cluster-opts.pl \
99 gen-pve-firewall-host-opts.pl \
100 gen-pve-firewall-macros-adoc.pl \
101 gen-pve-firewall-rules-opts.pl \
102 gen-pve-firewall-vm-opts.pl
103
104 INSTALLATION_SOURCES= \
105 pve-usbstick.adoc \
106 pve-system-requirements.adoc \
107 pve-installation.adoc
108
109 SYSADMIN_PARTS= \
110 pve-network \
111 pve-package-repos \
112 system-software-updates \
113 pve-disk-health-monitoring \
114 local-lvm \
115 local-zfs
116
117 SYSADMIN_SOURCES= \
118 $(addsuffix .adoc, ${SYSADMIN_PARTS}) \
119 sysadmin.adoc
120
121 API_VIEWER_SOURCES= \
122 api-viewer/index.html \
123 api-viewer/apidoc.js
124
125 PVE_ADMIN_GUIDE_SOURCES= \
126 ${DATACENTER_CONF_MAN5_SOURCES} \
127 ${QM_CONF_MAN5_SOURCES} \
128 ${PCT_CONF_MAN5_SOURCES} \
129 ${SYSADMIN_SOURCES} \
130 pve-admin-guide.adoc \
131 pve-intro.adoc \
132 getting-help.adoc \
133 ${INSTALLATION_SOURCES} \
134 pmxcfs.adoc \
135 pmxcfs.8-cli.adoc \
136 pve-faq.adoc \
137 ${PVE_FIREWALL_MAN8_SOURCES} \
138 ${PVESM_MAN1_SOURCES} \
139 ${PCT_MAN1_SOURCES} \
140 ${PVECM_MAN1_SOURCES} \
141 ${PVEUM_MAN1_SOURCES} \
142 ${QM_MAN1_SOURCES} \
143 ${QMRESTORE_MAN1_SOURCES} \
144 ${HA_MANAGER_MAN1_SOURCES} \
145 ${PVESTATD_MAN8_SOURCES} \
146 ${PVEDAEMON_MAN8_SOURCES} \
147 ${PVEPROXY_MAN8_SOURCES} \
148 ${SPICEPROXY_MAN8_SOURCES} \
149 ${PVE_HA_CRM_MAN8_SOURCES} \
150 ${PVE_HA_LRM_MAN8_SOURCES} \
151 ${VZDUMP_MAN1_SOURCES} \
152 ${PVEAM_MAN1_SOURCES} \
153 ${PVESUBSCRIPTION_MAN1_SOURCES} \
154 ${PVECEPH_MAN1_SOURCES} \
155 ${PVEPERF_MAN1_SOURCES} \
156 pve-bibliography.adoc \
157 $(addsuffix .adoc, ${COMMAND_LIST}) \
158 $(addsuffix .adoc, ${SERVICE_LIST}) \
159 $(addsuffix .adoc, ${CONFIG_LIST}) \
160 GFDL.adoc \
161 attributes.txt
162
163 link-refs.json: scan-adoc-refs ${PVE_ADMIN_GUIDE_SOURCES}
164 ./scan-adoc-refs ${PVE_ADMIN_GUIDE_SOURCES} >link-refs.json
165
166 asciidoc-pve: asciidoc-pve.in link-refs.json
167 cat asciidoc-pve.in link-refs.json >asciidoc-pve.tmp
168 chmod +x asciidoc-pve.tmp
169 mv asciidoc-pve.tmp asciidoc-pve
170
171 WIKI_IMPORTS= \
172 section-pve-usbstick-plain.html \
173 section-getting-help-plain.html \
174 section-pve-system-requirements-plain.html \
175 $(addsuffix -plain.html, $(addprefix sysadmin-, ${SYSADMIN_PARTS})) \
176 $(addsuffix -plain.html, $(addprefix chapter-, ${CHAPTER_LIST})) \
177 $(addsuffix .5-plain.html, ${CONFIG_LIST}) \
178 $(addsuffix -plain.html, $(addprefix pve-storage-, ${STORAGE_TYPES}))
179
180 INDEX_INCLUDES= \
181 pve-admin-guide.pdf \
182 pve-admin-guide.html \
183 pve-admin-guide.epub \
184 $(addsuffix .1.html, ${COMMAND_LIST}) \
185 $(addsuffix .8.html, ${SERVICE_LIST}) \
186 $(addsuffix .5.html, ${CONFIG_LIST}) \
187 $(addsuffix .html, $(addprefix chapter-, ${CHAPTER_LIST}))
188
189 ADOC_STDARG= -a icons -a data-uri -a "date=$(shell date)" -a "revnumber=${DOCRELEASE}"
190 ADOC_MAN1_HTML_ARGS=-a "manvolnum=1" ${ADOC_STDARG}
191 ADOC_MAN5_HTML_ARGS=-a "manvolnum=5" ${ADOC_STDARG}
192 ADOC_MAN8_HTML_ARGS=-a "manvolnum=8" ${ADOC_STDARG}
193
194 BROWSER?=xdg-open
195
196 all: index.html
197
198 %-nwdiag.svg: %.nwdiag
199 nwdiag -T svg $*.nwdiag -o $@;
200
201 sysadmin-%-plain.html: %.adoc
202 asciidoc -s -a wiki -a 'leveloffset=-1' ${ADOC_STDARG} -o $@ $*.adoc
203
204 section-%-plain.html: %.adoc
205 asciidoc -s -a wiki -a 'leveloffset=-1' ${ADOC_STDARG} -o $@ $*.adoc
206
207 chapter-sysadmin.html chapter-sysadmin-plain.html: ${SYSADMIN_SOURCES}
208
209 chapter-%.html: %.adoc ${PVE_COMMON_DOC_SOURCES}
210 asciidoc ${ADOC_STDARG} -a toc -o $@ $*.adoc
211
212 chapter-%-plain.html: %.adoc ${PVE_COMMON_DOC_SOURCES}
213 asciidoc -s -a wiki ${ADOC_STDARG} -o $@ $*.adoc
214
215 pve-storage-%-plain.html: pve-storage-%.adoc ${PVE_COMMON_DOC_SOURCES}
216 asciidoc -s -a wiki -a 'leveloffset=-1' ${ADOC_STDARG} -o $@ pve-storage-$*.adoc
217
218 %.1.html: %.adoc %.1-synopsis.adoc ${PVE_COMMON_DOC_SOURCES}
219 asciidoc ${ADOC_MAN1_HTML_ARGS} -o $@ $*.adoc
220
221 pmxcfs.8.html: pmxcfs.adoc pmxcfs.8-cli.adoc ${PVE_COMMON_DOC_SOURCES}
222 asciidoc ${ADOC_MAN8_HTML_ARGS} -o $@ pmxcfs.adoc
223
224 %.8.html: %.adoc %.8-synopsis.adoc ${PVE_COMMON_DOC_SOURCES}
225 asciidoc ${ADOC_MAN8_HTML_ARGS} -o $@ $*.adoc
226
227 %.5.html: %.adoc %.5-opts.adoc ${PVE_COMMON_DOC_SOURCES}
228 asciidoc ${ADOC_MAN5_HTML_ARGS} -o $@ $*.adoc
229
230 %.5-plain.html: %.adoc %.5-opts.adoc ${PVE_COMMON_DOC_SOURCES}
231 asciidoc -s ${ADOC_MAN5_HTML_ARGS} -o $@ $*.adoc
232
233 README.html: README.adoc
234 asciidoc ${ADOC_STDARG} -o $@ $<
235
236 .PHONY: index
237 index: index.html
238 $(BROWSER) index.html &
239
240 index.html: index.adoc ${API_VIEWER_SOURCES} ${INDEX_INCLUDES}
241 asciidoc -a "date=$(shell date)" -a "revnumber=${DOCRELEASE}" index.adoc
242
243 pve-admin-guide.html: ${PVE_ADMIN_GUIDE_SOURCES}
244 asciidoc -a pvelogo -a "revnumber=${DOCRELEASE}" -a "date=$(shell date)" pve-admin-guide.adoc
245
246 pve-admin-guide.chunked: ${PVE_ADMIN_GUIDE_SOURCES}
247 rm -rf pve-admin-guide.chunked
248 a2x -a docinfo -a docinfo1 -a icons -f chunked pve-admin-guide.adoc
249
250 pve-admin-guide.pdf: ${PVE_ADMIN_GUIDE_SOURCES} docinfo.xml pve-admin-guide-docinfo.xml
251 inkscape -z -D --export-pdf=proxmox-logo.pdf images/proxmox-logo.svg
252 inkscape -z -D --export-pdf=proxmox-ci-header.pdf images/proxmox-ci-header.svg
253 grep ">Release ${DOCRELEASE}<" pve-admin-guide-docinfo.xml || (echo "wrong release in pve-admin-guide-docinfo.xml" && false);
254 a2x -a docinfo -a docinfo1 -f pdf -L --dblatex-opts "-P latex.output.revhistory=0" --dblatex-opts "-P latex.class.options=12pt" --dblatex-opts "-P doc.section.depth=2 -P toc.section.depth=2" --dblatex-opts "-P doc.publisher.show=0 -s asciidoc-dblatex-custom.sty" pve-admin-guide.adoc
255 rm proxmox-logo.pdf proxmox-ci-header.pdf
256
257 pve-admin-guide.epub: ${PVE_ADMIN_GUIDE_SOURCES}
258 a2x -f epub pve-admin-guide.adoc
259
260 api-viewer/apidata.js: extractapi.pl
261 ./extractapi.pl >$@
262
263 api-viewer/apidoc.js: api-viewer/apidata.js api-viewer/PVEAPI.js
264 cat api-viewer/apidata.js api-viewer/PVEAPI.js >$@
265
266 .PHONY: dinstall
267 dinstall: ${GEN_DEB} ${DOC_DEB} ${MEDIAWIKI_DEB}
268 dpkg -i ${GEN_DEB} ${DOC_DEB} ${MEDIAWIKI_DEB}
269
270 .PHONY: deb
271 deb:
272 rm -f ${GEN_DEB} ${DOC_DEB} ${MEDIAWIKI_DEB};
273 make ${GEN_DEB} ${DOC_DEB} ${MEDIAWIKI_DEB};
274
275 ${GEN_DEB} ${DOC_DEB} ${MEDIAWIKI_DEB}: index.html ${INDEX_INCLUDES} ${WIKI_IMPORTS} ${API_VIEWER_SOURCES} ${GEN_DEB_SOURCES}
276 rm -rf build
277 mkdir build
278 rsync -a debian/ build/debian
279 echo "git clone git://git.proxmox.com/git/pve-docs.git\\ngit checkout ${GITVERSION}" > build/debian/SOURCE
280 # install files for pve-doc-generator package
281 mkdir -p build/usr/share/${GEN_PACKAGE}
282 mkdir -p build/usr/share/doc/${GEN_PACKAGE}
283 install -m 0644 ${GEN_DEB_SOURCES} build/usr/share/${GEN_PACKAGE}
284 install -m 0755 ${GEN_SCRIPTS} build/usr/share/${GEN_PACKAGE}
285 # install files for pvedocs package
286 mkdir -p build/usr/share/${DOC_PACKAGE}
287 mkdir -p build/usr/share/doc/${DOC_PACKAGE}
288 install -m 0644 index.html ${INDEX_INCLUDES} build/usr/share/${DOC_PACKAGE}
289 install -m 0644 ${WIKI_IMPORTS} build/usr/share/${DOC_PACKAGE}
290 # install api doc viewer
291 mkdir build/usr/share/${DOC_PACKAGE}/api-viewer
292 install -m 0644 ${API_VIEWER_SOURCES} build/usr/share/${DOC_PACKAGE}/api-viewer
293 # build Debian packages
294 cd build; dpkg-buildpackage -rfakeroot -b -us -uc
295 lintian ${GEN_DEB}
296 lintian ${DOC_DEB}
297 lintian ${MEDIAWIKI_DEB}
298
299 .PHONY: upload
300 upload: ${GEN_DEB} ${DOC_DEB} ${MEDIAWIKI_DEB}
301 tar cf - ${GEN_DEB} ${DOC_DEB} ${MEDIAWIKI_DEB} | ssh repoman@repo.proxmox.com upload
302
303 .PHONY: update
304 update: clean
305 rm -f *.5-opts.adoc *.1-synopsis.adoc *.8-synopsis.adoc
306 rm -f api-viewer/apidata.js
307 rm -f pve-firewall-macros.adoc pct-network-opts.adoc pct-mountpoint-opts.adoc
308 make all
309
310 clean:
311 rm -rf *.tmp.xml *.html *.pdf *.epub *.tmp *.1 *.5 *.8 *.deb *.changes build api-viewer/apidoc.js chapter-*.html chapter-*-plain.html chapter-*.html pve-admin-guide.chunked asciidoc-pve link-refs.json
312 find . -name '*~' -exec rm {} ';'