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