48c364df8c1464f1250dadcfec50cfb6ba7c25a2
[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 GEN_PKGREL=1
10 # also update doc-debian/changelog
11 DOC_PKGREL=2
12
13 GITVERSION:=$(shell cat .git/refs/heads/master)
14
15 GEN_DEB=${GEN_PACKAGE}_${DOCRELEASE}-${GEN_PKGREL}_amd64.deb
16 DOC_DEB=${DOC_PACKAGE}_${DOCRELEASE}-${DOC_PKGREL}_all.deb
17
18 CHAPTER_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
33 COMMAND_LIST= \
34 pvesubscription \
35 pvecm \
36 qm \
37 qmrestore \
38 pveceph \
39 pct \
40 pveam \
41 pvesm \
42 pveum \
43 vzdump \
44 ha-manager
45
46 SERVICE_LIST= \
47 pve-firewall \
48 pve-ha-crm \
49 pve-ha-lrm \
50 pvestatd \
51 pmxcfs \
52 pveproxy \
53 spiceproxy \
54 pvedaemon
55
56 CONFIG_LIST=datacenter.cfg qm.conf pct.conf
57
58 GEN_DEB_SOURCES= \
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 \
72 pmxcfs.8-cli.adoc \
73 pve-copyright.adoc \
74 docinfo.xml
75
76 GEN_SCRIPTS= \
77 gen-datacenter.cfg.5-opts.pl \
78 gen-pct.conf.5-opts.pl \
79 gen-qm.conf.5-opts.pl \
80 gen-vzdump.conf.5-opts.pl \
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 \
85 gen-pve-firewall-vm-opts.pl
86
87 SYSADMIN_SOURCES= \
88 getting-help.adoc \
89 pve-package-repos.adoc \
90 pve-installation.adoc \
91 system-software-updates.adoc \
92 sysadmin.adoc
93
94 API_VIEWER_SOURCES= \
95 api-viewer/index.html \
96 api-viewer/apidoc.js
97
98 PVE_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 \
106 pmxcfs.8-cli.adoc \
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} \
116 ${PVESTATD_MAN8_SOURCES} \
117 ${PVEDAEMON_MAN8_SOURCES} \
118 ${PVEPROXY_MAN8_SOURCES} \
119 ${SPICEPROXY_MAN8_SOURCES} \
120 ${PVE_HA_CRM_MAN8_SOURCES} \
121 ${PVE_HA_LRM_MAN8_SOURCES} \
122 ${VZDUMP_MAN1_SOURCES} \
123 ${PVEAM_MAN1_SOURCES} \
124 ${PVESUBSCRIPTION_MAN1_SOURCES} \
125 ${PVECEPH_MAN1_SOURCES} \
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 \
133 attributes.txt
134
135 ADOC_STDARG= -a icons -a data-uri -a "date=$(shell date)"
136 ADOC_MAN1_HTML_ARGS=-a "manvolnum=1" ${ADOC_STDARG} -a "revnumber=${DOCRELEASE}"
137 ADOC_MAN5_HTML_ARGS=-a "manvolnum=5" ${ADOC_STDARG} -a "revnumber=${DOCRELEASE}"
138 ADOC_MAN8_HTML_ARGS=-a "manvolnum=8" ${ADOC_STDARG} -a "revnumber=${DOCRELEASE}"
139
140 BROWSER?=xdg-open
141
142 all: index.html
143
144 %-nwdiag.svg: %.nwdiag
145 nwdiag -T svg $*.nwdiag -o $@;
146
147 chapter-%.html: %.adoc ${PVE_COMMON_DOC_SOURCES}
148 asciidoc ${ADOC_STDARG} -o $@ $*.adoc
149 test -n "$${NOVIEW}" || $(BROWSER) $@ &
150
151 %.1.html: %.adoc %.1-synopsis.adoc ${PVE_COMMON_DOC_SOURCES}
152 asciidoc ${ADOC_MAN1_HTML_ARGS} -o $@ $*.adoc
153 test -n "$${NOVIEW}" || $(BROWSER) $@ &
154
155
156 pmxcfs.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) $@ &
159
160 %.8.html: %.adoc %.8-synopsis.adoc ${PVE_COMMON_DOC_SOURCES}
161 asciidoc ${ADOC_MAN8_HTML_ARGS} -o $@ $*.adoc
162 test -n "$${NOVIEW}" || $(BROWSER) $@ &
163
164 %.5.html: %.adoc %.5-opts.adoc ${PVE_COMMON_DOC_SOURCES}
165 asciidoc ${ADOC_MAN5_HTML_ARGS} -o $@ $*.adoc
166 test -n "$${NOVIEW}" || $(BROWSER) $@ &
167
168 .PHONY: index
169 index: index.html
170 test -n "$${NOVIEW}" || $(BROWSER) index.html &
171
172 index.html: index.adoc ${PVE_ADMIN_GUIDE_SOURCES} ${API_VIEWER_SOURCES}
173 $(MAKE) NOVIEW=1 pve-admin-guide.pdf pve-admin-guide.html pve-admin-guide.epub
174 $(MAKE) NOVIEW=1 $(addsuffix .1.html, ${COMMAND_LIST}) $(addsuffix .8.html, ${SERVICE_LIST}) $(addsuffix .5.html, ${CONFIG_LIST})
175 $(MAKE) NOVIEW=1 $(addsuffix .html, $(addprefix chapter-, ${CHAPTER_LIST}))
176 asciidoc -a "date=$(shell date)" -a "revnumber=${DOCRELEASE}" index.adoc
177
178 pve-admin-guide.html: ${PVE_ADMIN_GUIDE_SOURCES}
179 asciidoc -a "revnumber=${DOCRELEASE}" -a "date=$(shell date)" pve-admin-guide.adoc
180 test -n "$${NOVIEW}" || $(BROWSER) $@ &
181
182 pve-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
187 pve-admin-guide.pdf: ${PVE_ADMIN_GUIDE_SOURCES} docinfo.xml pve-admin-guide-docinfo.xml
188 grep ">Release ${DOCRELEASE}<" pve-admin-guide-docinfo.xml || (echo "wrong release in pve-admin-guide-docinfo.xml" && false);
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
190 test -n "$${NOVIEW}" || $(BROWSER) $@ &
191
192 pve-admin-guide.epub: ${PVE_ADMIN_GUIDE_SOURCES}
193 a2x -f epub pve-admin-guide.adoc
194 test -n "$${NOVIEW}" || $(BROWSER) $@ &
195
196 api-viewer/apidata.js: extractapi.pl
197 ./extractapi.pl >$@
198
199 api-viewer/apidoc.js: api-viewer/apidata.js api-viewer/PVEAPI.js
200 cat api-viewer/apidata.js api-viewer/PVEAPI.js >$@
201
202 .PHONY: dinstall
203 dinstall: ${GEN_DEB} ${DOC_DEB}
204 dpkg -i ${GEN_DEB} ${DOC_DEB}
205
206
207 .PHONY: deb
208 deb:
209 rm -f ${GEN_DEB} ${DOC_DEB};
210 make ${GEN_DEB};
211 make ${DOC_DEB};
212
213 DOC_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}) \
218 pve-admin-guide.pdf \
219 pve-admin-guide.html \
220 pve-admin-guide.epub \
221 index.html
222
223 ${DOC_DEB}: index.html
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}
232 # install api doc viewer
233 mkdir build/usr/share/${DOC_PACKAGE}/api-viewer
234 install -m 0644 ${API_VIEWER_SOURCES} build/usr/share/${DOC_PACKAGE}/api-viewer
235 cd build; dpkg-buildpackage -rfakeroot -b -us -uc
236 lintian ${DOC_DEB}
237
238 ${GEN_DEB}: ${GEN_DEB_SOURCES}
239 rm -rf build
240 mkdir build
241 rsync -a debian/ build/debian
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}
247 cd build; dpkg-buildpackage -rfakeroot -b -us -uc
248 lintian ${GEN_DEB}
249
250 .PHONY: upload
251 upload: ${GEN_DEB} ${DOC_DEB}
252 umount /pve/${DOCRELEASE}; mount /pve/${DOCRELEASE} -o rw
253 mkdir -p /pve/${DOCRELEASE}/extra
254 rm -f /pve/${DOCRELEASE}/extra/${GEN_PACKAGE}_*.deb
255 rm -f /pve/${DOCRELEASE}/extra/${DOC_PACKAGE}_*.deb
256 rm -f /pve/${DOCRELEASE}/extra/Packages*
257 cp ${GEN_DEB} ${DOC_DEB} /pve/${DOCRELEASE}/extra
258 cd /pve/${DOCRELEASE}/extra; dpkg-scanpackages . /dev/null > Packages; gzip -9c Packages > Packages.gz
259 umount /pve/${DOCRELEASE}; mount /pve/${DOCRELEASE} -o ro
260
261 .PHONY: update
262 update: clean
263 rm -f *.5-opts.adoc *.1-synopsis.adoc *.8-synopsis.adoc
264 rm -f api-viewer/apidata.js
265 rm -f pve-firewall-macros.adoc
266 make all
267
268 clean:
269 rm -rf *.html *.pdf *.epub *.tmp *.1 *.5 *.8 *.deb *.changes build api-viewer/apidoc.js chapter-*.html pve-admin-guide.chunked
270 find . -name '*~' -exec rm {} ';'