add api doc viewer (moved from package pve2-api-doc)
[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=1
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 COMMAND_LIST= \
17 pvesubscription \
18 pvecm \
19 qm \
20 qmrestore \
21 pveceph \
22 pct \
23 pveam \
24 pvesm \
25 pveum \
26 vzdump \
27 ha-manager
28
29 SERVICE_LIST= \
30 pve-firewall \
31 pve-ha-crm \
32 pve-ha-lrm \
33 pvestatd \
34 pmxcfs \
35 pveproxy \
36 spiceproxy \
37 pvedaemon
38
39 CONFIG_LIST=datacenter.cfg qm.conf pct.conf
40
41 GEN_DEB_SOURCES= \
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 \
55 pmxcfs.8-cli.adoc \
56 pve-copyright.adoc \
57 docinfo.xml
58
59 GEN_SCRIPTS= \
60 gen-datacenter.cfg.5-opts.pl \
61 gen-pct.conf.5-opts.pl \
62 gen-qm.conf.5-opts.pl \
63 gen-vzdump.conf.5-opts.pl \
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 \
68 gen-pve-firewall-vm-opts.pl
69
70 SYSADMIN_SOURCES= \
71 getting-help.adoc \
72 pve-package-repos.adoc \
73 pve-installation.adoc \
74 system-software-updates.adoc \
75 sysadmin.adoc
76
77 PVE_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 \
85 pmxcfs.8-cli.adoc \
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} \
95 ${PVESTATD_MAN8_SOURCES} \
96 ${PVEDAEMON_MAN8_SOURCES} \
97 ${PVEPROXY_MAN8_SOURCES} \
98 ${SPICEPROXY_MAN8_SOURCES} \
99 ${PVE_HA_CRM_MAN8_SOURCES} \
100 ${PVE_HA_LRM_MAN8_SOURCES} \
101 ${VZDUMP_MAN1_SOURCES} \
102 ${PVEAM_MAN1_SOURCES} \
103 ${PVESUBSCRIPTION_MAN1_SOURCES} \
104 ${PVECEPH_MAN1_SOURCES} \
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 \
112 attributes.txt
113
114 ADOC_STDARG= -a icons -a data-uri -a "date=$(shell date)"
115 ADOC_MAN1_HTML_ARGS=-a "manvolnum=1" ${ADOC_STDARG} -a "revnumber=${DOCRELEASE}"
116 ADOC_MAN5_HTML_ARGS=-a "manvolnum=5" ${ADOC_STDARG} -a "revnumber=${DOCRELEASE}"
117 ADOC_MAN8_HTML_ARGS=-a "manvolnum=8" ${ADOC_STDARG} -a "revnumber=${DOCRELEASE}"
118
119 BROWSER?=xdg-open
120
121 all: pve-admin-guide.html
122
123 %-nwdiag.svg: %.nwdiag
124 nwdiag -T svg $*.nwdiag -o $@;
125
126 %.1.html: %.adoc %.1-synopsis.adoc ${PVE_COMMON_DOC_SOURCES}
127 asciidoc ${ADOC_MAN1_HTML_ARGS} -o $@ $*.adoc
128 test -n "$${NOVIEW}" || $(BROWSER) $@ &
129
130
131 pmxcfs.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) $@ &
134
135 %.8.html: %.adoc %.8-synopsis.adoc ${PVE_COMMON_DOC_SOURCES}
136 asciidoc ${ADOC_MAN8_HTML_ARGS} -o $@ $*.adoc
137 test -n "$${NOVIEW}" || $(BROWSER) $@ &
138
139 %.5.html: %.adoc %.5-opts.adoc ${PVE_COMMON_DOC_SOURCES}
140 asciidoc ${ADOC_MAN5_HTML_ARGS} -o $@ $*.adoc
141 test -n "$${NOVIEW}" || $(BROWSER) $@ &
142
143 index.html: index.adoc ${PVE_ADMIN_GUIDE_SOURCES}
144 $(MAKE) NOVIEW=1 pve-admin-guide.pdf pve-admin-guide.html pve-admin-guide.epub
145 $(MAKE) NOVIEW=1 $(addsuffix .1.html, ${COMMAND_LIST}) $(addsuffix .8.html, ${SERVICE_LIST}) $(addsuffix .5.html, ${CONFIG_LIST})
146 asciidoc -a "date=$(shell date)" -a "revnumber=${DOCRELEASE}" index.adoc
147 test -n "$${NOVIEW}" || $(BROWSER) index.html &
148
149 pve-admin-guide.html: ${PVE_ADMIN_GUIDE_SOURCES}
150 asciidoc -a "revnumber=${DOCRELEASE}" -a "date=$(shell date)" pve-admin-guide.adoc
151 test -n "$${NOVIEW}" || $(BROWSER) $@ &
152
153 pve-admin-guide.pdf: ${PVE_ADMIN_GUIDE_SOURCES} docinfo.xml pve-admin-guide-docinfo.xml
154 grep ">Release ${DOCRELEASE}<" pve-admin-guide-docinfo.xml || (echo "wrong release in pve-admin-guide-docinfo.xml" && false);
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
156 test -n "$${NOVIEW}" || $(BROWSER) $@ &
157
158 pve-admin-guide.epub: ${PVE_ADMIN_GUIDE_SOURCES}
159 a2x -f epub pve-admin-guide.adoc
160 test -n "$${NOVIEW}" || $(BROWSER) $@ &
161
162 apidata.js: extractapi.pl
163 ./extractapi.pl >$@
164
165 apidoc.js: apidata.js PVEAPI.js
166 cat apidata.js PVEAPI.js >$@
167
168 .PHONY: dinstall
169 dinstall: ${GEN_DEB}
170 dpkg -i ${GEN_DEB}
171
172
173 .PHONY: deb
174 deb:
175 rm -f ${GEN_DEB} ${DOC_DEB};
176 make ${GEN_DEB};
177 make ${DOC_DEB};
178
179 DOC_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
188 ${DOC_DEB}: index.adoc ${PVE_ADMIN_GUIDE_SOURCES} apidoc.js apidoc.html
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}
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/
205 cd build; dpkg-buildpackage -rfakeroot -b -us -uc
206 lintian ${DOC_DEB}
207
208 ${GEN_DEB}: ${GEN_DEB_SOURCES}
209 rm -rf build
210 mkdir build
211 rsync -a debian/ build/debian
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}
217 cd build; dpkg-buildpackage -rfakeroot -b -us -uc
218 lintian ${GEN_DEB}
219
220 .PHONY: upload
221 upload: ${GEN_DEB} ${DOC_DEB}
222 umount /pve/${DOCRELEASE}; mount /pve/${DOCRELEASE} -o rw
223 mkdir -p /pve/${DOCRELEASE}/extra
224 rm -f /pve/${DOCRELEASE}/extra/${GEN_PACKAGE}_*.deb
225 rm -f /pve/${DOCRELEASE}/extra/${DOC_PACKAGE}_*.deb
226 rm -f /pve/${DOCRELEASE}/extra/Packages*
227 cp ${GEN_DEB} ${DOC_DEB} /pve/${DOCRELEASE}/extra
228 cd /pve/${DOCRELEASE}/extra; dpkg-scanpackages . /dev/null > Packages; gzip -9c Packages > Packages.gz
229 umount /pve/${DOCRELEASE}; mount /pve/${DOCRELEASE} -o ro
230
231 update: clean
232 rm -f *.5-opts.adoc .1-synopsis.adoc .8-synopsis.adoc
233 make all
234
235 clean:
236 rm -rf *~ *.html *.pdf *.epub *.tmp *.1 *.5 *.8 *.deb *.changes build apidata.js apidoc.js
237