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