add TOC to individual chapter files
[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 images/cluster-nwdiag.svg \
127 images/node-nwdiag.svg \
128 pve-bibliography.adoc \
129 $(addsuffix .adoc, ${COMMAND_LIST}) \
130 $(addsuffix .adoc, ${SERVICE_LIST}) \
131 $(addsuffix .adoc, ${CONFIG_LIST}) \
132 GFDL.adoc \
deb7f2ea
DM
133 attributes.txt
134
135ADOC_STDARG= -a icons -a data-uri -a "date=$(shell date)"
bef0c1b4
DM
136ADOC_MAN1_HTML_ARGS=-a "manvolnum=1" ${ADOC_STDARG} -a "revnumber=${DOCRELEASE}"
137ADOC_MAN5_HTML_ARGS=-a "manvolnum=5" ${ADOC_STDARG} -a "revnumber=${DOCRELEASE}"
138ADOC_MAN8_HTML_ARGS=-a "manvolnum=8" ${ADOC_STDARG} -a "revnumber=${DOCRELEASE}"
deb7f2ea 139
fc1090ef 140BROWSER?=xdg-open
df41beec 141
56122987 142all: index.html
7b2c36ae 143
deb7f2ea
DM
144%-nwdiag.svg: %.nwdiag
145 nwdiag -T svg $*.nwdiag -o $@;
146
f96bdfd8 147chapter-%.html: %.adoc ${PVE_COMMON_DOC_SOURCES}
d01fa25d 148 asciidoc ${ADOC_STDARG} -a toc -o $@ $*.adoc
f96bdfd8
DM
149 test -n "$${NOVIEW}" || $(BROWSER) $@ &
150
bd88f9d9 151%.1.html: %.adoc %.1-synopsis.adoc ${PVE_COMMON_DOC_SOURCES}
deb7f2ea 152 asciidoc ${ADOC_MAN1_HTML_ARGS} -o $@ $*.adoc
9344ee0d 153 test -n "$${NOVIEW}" || $(BROWSER) $@ &
deb7f2ea
DM
154
155
7c40c631
DM
156pmxcfs.8.html: pmxcfs.adoc pmxcfs.8-cli.adoc ${PVE_COMMON_DOC_SOURCES}
157 asciidoc ${ADOC_MAN8_HTML_ARGS} -o $@ pmxcfs.adoc
158 test -n "$${NOVIEW}" || $(BROWSER) $@ &
deb7f2ea 159
7c40c631 160%.8.html: %.adoc %.8-synopsis.adoc ${PVE_COMMON_DOC_SOURCES}
deb7f2ea 161 asciidoc ${ADOC_MAN8_HTML_ARGS} -o $@ $*.adoc
9344ee0d 162 test -n "$${NOVIEW}" || $(BROWSER) $@ &
71e16346 163
7c40c631 164%.5.html: %.adoc %.5-opts.adoc ${PVE_COMMON_DOC_SOURCES}
c016ebb7 165 asciidoc ${ADOC_MAN5_HTML_ARGS} -o $@ $*.adoc
9344ee0d 166 test -n "$${NOVIEW}" || $(BROWSER) $@ &
c016ebb7 167
8ace7110
DM
168.PHONY: index
169index: index.html
170 test -n "$${NOVIEW}" || $(BROWSER) index.html &
171
356064f4 172index.html: index.adoc ${PVE_ADMIN_GUIDE_SOURCES} ${API_VIEWER_SOURCES}
deb7f2ea 173 $(MAKE) NOVIEW=1 pve-admin-guide.pdf pve-admin-guide.html pve-admin-guide.epub
672abac1 174 $(MAKE) NOVIEW=1 $(addsuffix .1.html, ${COMMAND_LIST}) $(addsuffix .8.html, ${SERVICE_LIST}) $(addsuffix .5.html, ${CONFIG_LIST})
f96bdfd8 175 $(MAKE) NOVIEW=1 $(addsuffix .html, $(addprefix chapter-, ${CHAPTER_LIST}))
bef0c1b4 176 asciidoc -a "date=$(shell date)" -a "revnumber=${DOCRELEASE}" index.adoc
deb7f2ea
DM
177
178pve-admin-guide.html: ${PVE_ADMIN_GUIDE_SOURCES}
bef0c1b4 179 asciidoc -a "revnumber=${DOCRELEASE}" -a "date=$(shell date)" pve-admin-guide.adoc
9344ee0d 180 test -n "$${NOVIEW}" || $(BROWSER) $@ &
deb7f2ea 181
59d89a51
DM
182pve-admin-guide.chunked: ${PVE_ADMIN_GUIDE_SOURCES}
183 rm -rf pve-admin-guide.chunked
184 a2x -a docinfo -a docinfo1 -a icons -f chunked pve-admin-guide.adoc
185 test -n "$${NOVIEW}" || $(BROWSER) $@/index.html &
186
2296c490 187pve-admin-guide.pdf: ${PVE_ADMIN_GUIDE_SOURCES} docinfo.xml pve-admin-guide-docinfo.xml
bef0c1b4 188 grep ">Release ${DOCRELEASE}<" pve-admin-guide-docinfo.xml || (echo "wrong release in pve-admin-guide-docinfo.xml" && false);
27125931 189 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 190 test -n "$${NOVIEW}" || $(BROWSER) $@ &
deb7f2ea
DM
191
192pve-admin-guide.epub: ${PVE_ADMIN_GUIDE_SOURCES}
193 a2x -f epub pve-admin-guide.adoc
9344ee0d
DM
194 test -n "$${NOVIEW}" || $(BROWSER) $@ &
195
356064f4 196api-viewer/apidata.js: extractapi.pl
61568a65
DM
197 ./extractapi.pl >$@
198
356064f4
DM
199api-viewer/apidoc.js: api-viewer/apidata.js api-viewer/PVEAPI.js
200 cat api-viewer/apidata.js api-viewer/PVEAPI.js >$@
61568a65 201
9344ee0d 202.PHONY: dinstall
f8866417
DM
203dinstall: ${GEN_DEB} ${DOC_DEB}
204 dpkg -i ${GEN_DEB} ${DOC_DEB}
9015f48f 205
9344ee0d
DM
206
207.PHONY: deb
9015f48f
DM
208deb:
209 rm -f ${GEN_DEB} ${DOC_DEB};
210 make ${GEN_DEB};
211 make ${DOC_DEB};
212
f96bdfd8
DM
213DOC_DEB_FILES= \
214 $(addsuffix .html, $(addprefix chapter-, ${CHAPTER_LIST})) \
215 $(addsuffix .1.html, ${COMMAND_LIST}) \
216 $(addsuffix .8.html, ${SERVICE_LIST}) \
217 $(addsuffix .5.html, ${CONFIG_LIST}) \
9015f48f
DM
218 pve-admin-guide.pdf \
219 pve-admin-guide.html \
220 pve-admin-guide.epub \
221 index.html
222
8ace7110 223${DOC_DEB}: index.html
9015f48f
DM
224 rm -rf build
225 mkdir build
226 rsync -a doc-debian/ build/debian
227 mkdir -p build/usr/share/${DOC_PACKAGE}
228 mkdir -p build/usr/share/doc/${DOC_PACKAGE}
229 echo "git clone git://git.proxmox.com/git/pve-docs.git\\ngit checkout ${GITVERSION}" > build/usr/share/doc/${DOC_PACKAGE}/SOURCE
230 # install doc files
231 install -m 0644 ${DOC_DEB_FILES} build/usr/share/${DOC_PACKAGE}
61568a65 232 # install api doc viewer
356064f4
DM
233 mkdir build/usr/share/${DOC_PACKAGE}/api-viewer
234 install -m 0644 ${API_VIEWER_SOURCES} build/usr/share/${DOC_PACKAGE}/api-viewer
9015f48f
DM
235 cd build; dpkg-buildpackage -rfakeroot -b -us -uc
236 lintian ${DOC_DEB}
237
238${GEN_DEB}: ${GEN_DEB_SOURCES}
9344ee0d
DM
239 rm -rf build
240 mkdir build
241 rsync -a debian/ build/debian
9015f48f
DM
242 mkdir -p build/usr/share/${GEN_PACKAGE}
243 mkdir -p build/usr/share/doc/${GEN_PACKAGE}
244 echo "git clone git://git.proxmox.com/git/pve-docs.git\\ngit checkout ${GITVERSION}" > build/usr/share/doc/${GEN_PACKAGE}/SOURCE
245 install -m 0644 ${GEN_DEB_SOURCES} build/usr/share/${GEN_PACKAGE}
246 install -m 0755 ${GEN_SCRIPTS} build/usr/share/${GEN_PACKAGE}
9344ee0d 247 cd build; dpkg-buildpackage -rfakeroot -b -us -uc
9015f48f 248 lintian ${GEN_DEB}
9344ee0d 249
89e93b38 250.PHONY: upload
9015f48f 251upload: ${GEN_DEB} ${DOC_DEB}
89e93b38
DM
252 umount /pve/${DOCRELEASE}; mount /pve/${DOCRELEASE} -o rw
253 mkdir -p /pve/${DOCRELEASE}/extra
9015f48f
DM
254 rm -f /pve/${DOCRELEASE}/extra/${GEN_PACKAGE}_*.deb
255 rm -f /pve/${DOCRELEASE}/extra/${DOC_PACKAGE}_*.deb
89e93b38 256 rm -f /pve/${DOCRELEASE}/extra/Packages*
9015f48f 257 cp ${GEN_DEB} ${DOC_DEB} /pve/${DOCRELEASE}/extra
89e93b38
DM
258 cd /pve/${DOCRELEASE}/extra; dpkg-scanpackages . /dev/null > Packages; gzip -9c Packages > Packages.gz
259 umount /pve/${DOCRELEASE}; mount /pve/${DOCRELEASE} -o ro
deb7f2ea 260
56122987 261.PHONY: update
c016ebb7 262update: clean
7aacca6f 263 rm -f *.5-opts.adoc *.1-synopsis.adoc *.8-synopsis.adoc
56122987 264 rm -f api-viewer/apidata.js
7aacca6f 265 rm -f pve-firewall-macros.adoc
c016ebb7 266 make all
deb7f2ea
DM
267
268clean:
56122987 269 rm -rf *.html *.pdf *.epub *.tmp *.1 *.5 *.8 *.deb *.changes build api-viewer/apidoc.js chapter-*.html pve-admin-guide.chunked
de9cbbd6 270 find . -name '*~' -exec rm {} ';'