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