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