mediawiki-import: import important manual pages
[pve-docs.git] / Makefile
CommitLineData
bef0c1b4
DM
1DGDIR=.
2
3include ./pve-doc-generator.mk
deb7f2ea 4
9015f48f
DM
5GEN_PACKAGE=pve-doc-generator
6DOC_PACKAGE=pve-docs
9344ee0d
DM
7
8# also update debian/changelog
5bee3225
DM
9GEN_PKGREL=1
10# also update doc-debian/changelog
11DOC_PKGREL=2
9344ee0d 12
b4f3c18a
DM
13GITVERSION:=$(shell cat .git/refs/heads/master)
14
5bee3225
DM
15GEN_DEB=${GEN_PACKAGE}_${DOCRELEASE}-${GEN_PKGREL}_amd64.deb
16DOC_DEB=${DOC_PACKAGE}_${DOCRELEASE}-${DOC_PKGREL}_all.deb
9344ee0d 17
f96bdfd8
DM
18CHAPTER_LIST= \
19 sysadmin \
20 pvecm \
21 pmxcfs \
22 pvesm \
23 qm \
24 pve-firewall \
25 pveum \
26 pct \
27 ha-manager \
28 vzdump \
29 pve-faq \
30 pve-bibliography
31
32
ebd2a7fb
DM
33COMMAND_LIST= \
34 pvesubscription \
35 pvecm \
36 qm \
37 qmrestore \
0840a663 38 pveceph \
ebd2a7fb
DM
39 pct \
40 pveam \
41 pvesm \
42 pveum \
43 vzdump \
44 ha-manager
672abac1 45
96f2beeb
DM
46SERVICE_LIST= \
47 pve-firewall \
48 pve-ha-crm \
49 pve-ha-lrm \
50 pvestatd \
51 pmxcfs \
52 pveproxy \
2d8f1c92 53 spiceproxy \
96f2beeb 54 pvedaemon
672abac1
DM
55
56CONFIG_LIST=datacenter.cfg qm.conf pct.conf
57
9015f48f 58GEN_DEB_SOURCES= \
672abac1
DM
59 pve-doc-generator.mk \
60 attributes.txt \
61 $(addsuffix .adoc, ${COMMAND_LIST}) \
62 $(addsuffix .adoc, ${SERVICE_LIST}) \
63 $(addsuffix .adoc, ${CONFIG_LIST}) \
64 pve-storage-dir.adoc \
65 pve-storage-glusterfs.adoc \
66 pve-storage-iscsi.adoc \
67 pve-storage-iscsidirect.adoc \
68 pve-storage-lvm.adoc \
69 pve-storage-nfs.adoc \
70 pve-storage-rbd.adoc \
71 pve-storage-zfspool.adoc \
bd88f9d9 72 pmxcfs.8-cli.adoc \
672abac1 73 pve-copyright.adoc \
9344ee0d
DM
74 docinfo.xml
75
76GEN_SCRIPTS= \
f6b81378
DM
77 gen-datacenter.cfg.5-opts.pl \
78 gen-pct.conf.5-opts.pl \
9b4799ab 79 gen-qm.conf.5-opts.pl \
500f1e1f 80 gen-vzdump.conf.5-opts.pl \
9344ee0d
DM
81 gen-pve-firewall-cluster-opts.pl \
82 gen-pve-firewall-host-opts.pl \
83 gen-pve-firewall-macros-adoc.pl \
84 gen-pve-firewall-rules-opts.pl \
f6b81378 85 gen-pve-firewall-vm-opts.pl
9344ee0d 86
672abac1
DM
87SYSADMIN_SOURCES= \
88 getting-help.adoc \
89 pve-package-repos.adoc \
90 pve-installation.adoc \
91 system-software-updates.adoc \
d91f8c1e
DM
92 sysadmin.adoc
93
356064f4
DM
94API_VIEWER_SOURCES= \
95 api-viewer/index.html \
96 api-viewer/apidoc.js
97
672abac1
DM
98PVE_ADMIN_GUIDE_SOURCES= \
99 ${DATACENTER_CONF_MAN5_SOURCES} \
100 ${QM_CONF_MAN5_SOURCES} \
101 ${PCT_CONF_MAN5_SOURCES} \
102 ${SYSADMIN_SOURCES} \
103 pve-admin-guide.adoc \
104 pve-intro.adoc \
105 pmxcfs.adoc \
bd88f9d9 106 pmxcfs.8-cli.adoc \
672abac1
DM
107 pve-faq.adoc \
108 ${PVE_FIREWALL_MAN8_SOURCES} \
109 ${PVESM_MAN1_SOURCES} \
110 ${PCT_MAN1_SOURCES} \
111 ${PVECM_MAN1_SOURCES} \
112 ${PVEUM_MAN1_SOURCES} \
113 ${QM_MAN1_SOURCES} \
114 ${QMRESTORE_MAN1_SOURCES} \
115 ${HA_MANAGER_MAN1_SOURCES} \
2d8f1c92
DM
116 ${PVESTATD_MAN8_SOURCES} \
117 ${PVEDAEMON_MAN8_SOURCES} \
118 ${PVEPROXY_MAN8_SOURCES} \
119 ${SPICEPROXY_MAN8_SOURCES} \
672abac1
DM
120 ${PVE_HA_CRM_MAN8_SOURCES} \
121 ${PVE_HA_LRM_MAN8_SOURCES} \
6198e7c5
DM
122 ${VZDUMP_MAN1_SOURCES} \
123 ${PVEAM_MAN1_SOURCES} \
ebd2a7fb 124 ${PVESUBSCRIPTION_MAN1_SOURCES} \
0840a663 125 ${PVECEPH_MAN1_SOURCES} \
672abac1
DM
126 pve-bibliography.adoc \
127 $(addsuffix .adoc, ${COMMAND_LIST}) \
128 $(addsuffix .adoc, ${SERVICE_LIST}) \
129 $(addsuffix .adoc, ${CONFIG_LIST}) \
130 GFDL.adoc \
deb7f2ea
DM
131 attributes.txt
132
0e25828e
DM
133ADOC_STDARG= -a icons -a data-uri -a "date=$(shell date)" -a "revnumber=${DOCRELEASE}"
134ADOC_MAN1_HTML_ARGS=-a "manvolnum=1" ${ADOC_STDARG}
135ADOC_MAN5_HTML_ARGS=-a "manvolnum=5" ${ADOC_STDARG}
136ADOC_MAN8_HTML_ARGS=-a "manvolnum=8" ${ADOC_STDARG}
deb7f2ea 137
fc1090ef 138BROWSER?=xdg-open
df41beec 139
56122987 140all: index.html
7b2c36ae 141
deb7f2ea
DM
142%-nwdiag.svg: %.nwdiag
143 nwdiag -T svg $*.nwdiag -o $@;
144
f96bdfd8 145chapter-%.html: %.adoc ${PVE_COMMON_DOC_SOURCES}
d01fa25d 146 asciidoc ${ADOC_STDARG} -a toc -o $@ $*.adoc
f96bdfd8
DM
147 test -n "$${NOVIEW}" || $(BROWSER) $@ &
148
0e25828e
DM
149chapter-%-plain.html: %.adoc ${PVE_COMMON_DOC_SOURCES}
150 asciidoc -s ${ADOC_STDARG} -a toc -o chapter-$*-plain.html $*.adoc
151 test -n "$${NOVIEW}" || $(BROWSER) $@ &
152
bd88f9d9 153%.1.html: %.adoc %.1-synopsis.adoc ${PVE_COMMON_DOC_SOURCES}
deb7f2ea 154 asciidoc ${ADOC_MAN1_HTML_ARGS} -o $@ $*.adoc
9344ee0d 155 test -n "$${NOVIEW}" || $(BROWSER) $@ &
deb7f2ea
DM
156
157
7c40c631
DM
158pmxcfs.8.html: pmxcfs.adoc pmxcfs.8-cli.adoc ${PVE_COMMON_DOC_SOURCES}
159 asciidoc ${ADOC_MAN8_HTML_ARGS} -o $@ pmxcfs.adoc
160 test -n "$${NOVIEW}" || $(BROWSER) $@ &
deb7f2ea 161
7c40c631 162%.8.html: %.adoc %.8-synopsis.adoc ${PVE_COMMON_DOC_SOURCES}
deb7f2ea 163 asciidoc ${ADOC_MAN8_HTML_ARGS} -o $@ $*.adoc
9344ee0d 164 test -n "$${NOVIEW}" || $(BROWSER) $@ &
71e16346 165
7c40c631 166%.5.html: %.adoc %.5-opts.adoc ${PVE_COMMON_DOC_SOURCES}
c016ebb7 167 asciidoc ${ADOC_MAN5_HTML_ARGS} -o $@ $*.adoc
9344ee0d 168 test -n "$${NOVIEW}" || $(BROWSER) $@ &
c016ebb7 169
1496dbe5
DM
170%.5-plain.html: %.adoc %.5-opts.adoc ${PVE_COMMON_DOC_SOURCES}
171 asciidoc -s ${ADOC_MAN5_HTML_ARGS} -o $@ $*.adoc
172 test -n "$${NOVIEW}" || $(BROWSER) $@ &
173
8ace7110
DM
174.PHONY: index
175index: index.html
176 test -n "$${NOVIEW}" || $(BROWSER) index.html &
177
356064f4 178index.html: index.adoc ${PVE_ADMIN_GUIDE_SOURCES} ${API_VIEWER_SOURCES}
deb7f2ea 179 $(MAKE) NOVIEW=1 pve-admin-guide.pdf pve-admin-guide.html pve-admin-guide.epub
672abac1 180 $(MAKE) NOVIEW=1 $(addsuffix .1.html, ${COMMAND_LIST}) $(addsuffix .8.html, ${SERVICE_LIST}) $(addsuffix .5.html, ${CONFIG_LIST})
f96bdfd8 181 $(MAKE) NOVIEW=1 $(addsuffix .html, $(addprefix chapter-, ${CHAPTER_LIST}))
0e25828e 182 $(MAKE) NOVIEW=1 $(addsuffix -plain.html, $(addprefix chapter-, ${CHAPTER_LIST}))
1496dbe5 183 $(MAKE) NOVIEW=1 $(addsuffix .5-plain.html, ${CONFIG_LIST})
bef0c1b4 184 asciidoc -a "date=$(shell date)" -a "revnumber=${DOCRELEASE}" index.adoc
deb7f2ea
DM
185
186pve-admin-guide.html: ${PVE_ADMIN_GUIDE_SOURCES}
bef0c1b4 187 asciidoc -a "revnumber=${DOCRELEASE}" -a "date=$(shell date)" pve-admin-guide.adoc
9344ee0d 188 test -n "$${NOVIEW}" || $(BROWSER) $@ &
deb7f2ea 189
59d89a51
DM
190pve-admin-guide.chunked: ${PVE_ADMIN_GUIDE_SOURCES}
191 rm -rf pve-admin-guide.chunked
192 a2x -a docinfo -a docinfo1 -a icons -f chunked pve-admin-guide.adoc
193 test -n "$${NOVIEW}" || $(BROWSER) $@/index.html &
194
2296c490 195pve-admin-guide.pdf: ${PVE_ADMIN_GUIDE_SOURCES} docinfo.xml pve-admin-guide-docinfo.xml
bef0c1b4 196 grep ">Release ${DOCRELEASE}<" pve-admin-guide-docinfo.xml || (echo "wrong release in pve-admin-guide-docinfo.xml" && false);
27125931 197 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" pve-admin-guide.adoc
9344ee0d 198 test -n "$${NOVIEW}" || $(BROWSER) $@ &
deb7f2ea
DM
199
200pve-admin-guide.epub: ${PVE_ADMIN_GUIDE_SOURCES}
201 a2x -f epub pve-admin-guide.adoc
9344ee0d
DM
202 test -n "$${NOVIEW}" || $(BROWSER) $@ &
203
356064f4 204api-viewer/apidata.js: extractapi.pl
61568a65
DM
205 ./extractapi.pl >$@
206
356064f4
DM
207api-viewer/apidoc.js: api-viewer/apidata.js api-viewer/PVEAPI.js
208 cat api-viewer/apidata.js api-viewer/PVEAPI.js >$@
61568a65 209
9344ee0d 210.PHONY: dinstall
f8866417
DM
211dinstall: ${GEN_DEB} ${DOC_DEB}
212 dpkg -i ${GEN_DEB} ${DOC_DEB}
9015f48f 213
9344ee0d
DM
214
215.PHONY: deb
9015f48f
DM
216deb:
217 rm -f ${GEN_DEB} ${DOC_DEB};
218 make ${GEN_DEB};
219 make ${DOC_DEB};
220
0e25828e
DM
221DOC_DEB_FILES= \
222 $(addsuffix .html, $(addprefix chapter-, ${CHAPTER_LIST})) \
223 $(addsuffix -plain.html, $(addprefix chapter-, ${CHAPTER_LIST})) \
1496dbe5 224 $(addsuffix .5-plain.html, ${CONFIG_LIST}) \
0e25828e
DM
225 $(addsuffix .1.html, ${COMMAND_LIST}) \
226 $(addsuffix .8.html, ${SERVICE_LIST}) \
227 $(addsuffix .5.html, ${CONFIG_LIST}) \
228 pve-admin-guide.pdf \
229 pve-admin-guide.html \
230 pve-admin-guide.epub \
9015f48f
DM
231 index.html
232
8ace7110 233${DOC_DEB}: index.html
9015f48f
DM
234 rm -rf build
235 mkdir build
236 rsync -a doc-debian/ build/debian
237 mkdir -p build/usr/share/${DOC_PACKAGE}
238 mkdir -p build/usr/share/doc/${DOC_PACKAGE}
239 echo "git clone git://git.proxmox.com/git/pve-docs.git\\ngit checkout ${GITVERSION}" > build/usr/share/doc/${DOC_PACKAGE}/SOURCE
240 # install doc files
241 install -m 0644 ${DOC_DEB_FILES} build/usr/share/${DOC_PACKAGE}
61568a65 242 # install api doc viewer
356064f4
DM
243 mkdir build/usr/share/${DOC_PACKAGE}/api-viewer
244 install -m 0644 ${API_VIEWER_SOURCES} build/usr/share/${DOC_PACKAGE}/api-viewer
9015f48f
DM
245 cd build; dpkg-buildpackage -rfakeroot -b -us -uc
246 lintian ${DOC_DEB}
247
248${GEN_DEB}: ${GEN_DEB_SOURCES}
9344ee0d
DM
249 rm -rf build
250 mkdir build
251 rsync -a debian/ build/debian
9015f48f
DM
252 mkdir -p build/usr/share/${GEN_PACKAGE}
253 mkdir -p build/usr/share/doc/${GEN_PACKAGE}
254 echo "git clone git://git.proxmox.com/git/pve-docs.git\\ngit checkout ${GITVERSION}" > build/usr/share/doc/${GEN_PACKAGE}/SOURCE
255 install -m 0644 ${GEN_DEB_SOURCES} build/usr/share/${GEN_PACKAGE}
256 install -m 0755 ${GEN_SCRIPTS} build/usr/share/${GEN_PACKAGE}
9344ee0d 257 cd build; dpkg-buildpackage -rfakeroot -b -us -uc
9015f48f 258 lintian ${GEN_DEB}
9344ee0d 259
89e93b38 260.PHONY: upload
9015f48f 261upload: ${GEN_DEB} ${DOC_DEB}
89e93b38
DM
262 umount /pve/${DOCRELEASE}; mount /pve/${DOCRELEASE} -o rw
263 mkdir -p /pve/${DOCRELEASE}/extra
9015f48f
DM
264 rm -f /pve/${DOCRELEASE}/extra/${GEN_PACKAGE}_*.deb
265 rm -f /pve/${DOCRELEASE}/extra/${DOC_PACKAGE}_*.deb
89e93b38 266 rm -f /pve/${DOCRELEASE}/extra/Packages*
9015f48f 267 cp ${GEN_DEB} ${DOC_DEB} /pve/${DOCRELEASE}/extra
89e93b38
DM
268 cd /pve/${DOCRELEASE}/extra; dpkg-scanpackages . /dev/null > Packages; gzip -9c Packages > Packages.gz
269 umount /pve/${DOCRELEASE}; mount /pve/${DOCRELEASE} -o ro
deb7f2ea 270
56122987 271.PHONY: update
c016ebb7 272update: clean
7aacca6f 273 rm -f *.5-opts.adoc *.1-synopsis.adoc *.8-synopsis.adoc
56122987 274 rm -f api-viewer/apidata.js
7aacca6f 275 rm -f pve-firewall-macros.adoc
c016ebb7 276 make all
deb7f2ea
DM
277
278clean:
0e25828e 279 rm -rf *.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
de9cbbd6 280 find . -name '*~' -exec rm {} ';'