add new package to ship compiled docs
[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 .PHONY: dinstall
163 dinstall: ${GEN_DEB}
164 dpkg -i ${GEN_DEB}
165
166
167 .PHONY: deb
168 deb:
169 rm -f ${GEN_DEB} ${DOC_DEB};
170 make ${GEN_DEB};
171 make ${DOC_DEB};
172
173 DOC_DEB_FILES= \
174 $(addsuffix .1.html, ${COMMAND_LIST}) \
175 $(addsuffix .8.html, ${SERVICE_LIST}) \
176 $(addsuffix .5.html, ${CONFIG_LIST}) \
177 pve-admin-guide.pdf \
178 pve-admin-guide.html \
179 pve-admin-guide.epub \
180 index.html
181
182 ${DOC_DEB}: index.adoc ${PVE_ADMIN_GUIDE_SOURCES}
183 $(MAKE) NOVIEW=1 pve-admin-guide.pdf pve-admin-guide.html pve-admin-guide.epub
184 $(MAKE) NOVIEW=1 $(addsuffix .1.html, ${COMMAND_LIST}) $(addsuffix .8.html, ${SERVICE_LIST}) $(addsuffix .5.html, ${CONFIG_LIST})
185 asciidoc -a "date=$(shell date)" -a "revnumber=${DOCRELEASE}" index.adoc
186 rm -rf build
187 mkdir build
188 rsync -a doc-debian/ build/debian
189 mkdir -p build/usr/share/${DOC_PACKAGE}
190 mkdir -p build/usr/share/doc/${DOC_PACKAGE}
191 echo "git clone git://git.proxmox.com/git/pve-docs.git\\ngit checkout ${GITVERSION}" > build/usr/share/doc/${DOC_PACKAGE}/SOURCE
192 # install doc files
193 install -m 0644 ${DOC_DEB_FILES} build/usr/share/${DOC_PACKAGE}
194 install -m 0644 index.html build/usr/share/${DOC_PACKAGE}
195 cd build; dpkg-buildpackage -rfakeroot -b -us -uc
196 lintian ${DOC_DEB}
197
198 ${GEN_DEB}: ${GEN_DEB_SOURCES}
199 rm -rf build
200 mkdir build
201 rsync -a debian/ build/debian
202 mkdir -p build/usr/share/${GEN_PACKAGE}
203 mkdir -p build/usr/share/doc/${GEN_PACKAGE}
204 echo "git clone git://git.proxmox.com/git/pve-docs.git\\ngit checkout ${GITVERSION}" > build/usr/share/doc/${GEN_PACKAGE}/SOURCE
205 install -m 0644 ${GEN_DEB_SOURCES} build/usr/share/${GEN_PACKAGE}
206 install -m 0755 ${GEN_SCRIPTS} build/usr/share/${GEN_PACKAGE}
207 cd build; dpkg-buildpackage -rfakeroot -b -us -uc
208 lintian ${GEN_DEB}
209
210 .PHONY: upload
211 upload: ${GEN_DEB} ${DOC_DEB}
212 umount /pve/${DOCRELEASE}; mount /pve/${DOCRELEASE} -o rw
213 mkdir -p /pve/${DOCRELEASE}/extra
214 rm -f /pve/${DOCRELEASE}/extra/${GEN_PACKAGE}_*.deb
215 rm -f /pve/${DOCRELEASE}/extra/${DOC_PACKAGE}_*.deb
216 rm -f /pve/${DOCRELEASE}/extra/Packages*
217 cp ${GEN_DEB} ${DOC_DEB} /pve/${DOCRELEASE}/extra
218 cd /pve/${DOCRELEASE}/extra; dpkg-scanpackages . /dev/null > Packages; gzip -9c Packages > Packages.gz
219 umount /pve/${DOCRELEASE}; mount /pve/${DOCRELEASE} -o ro
220
221 update: clean
222 rm -f *.5-opts.adoc .1-synopsis.adoc .8-synopsis.adoc
223 make all
224
225 clean:
226 rm -rf *~ *.html *.pdf *.epub *.tmp *.1 *.5 *.8 *.deb *.changes build
227