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