f3981a6b093dfcd5f6efb859206874901503e921
[pve-docs.git] / Makefile
1 DGDIR=.
2
3 include ./pve-doc-generator.mk
4
5 PACKAGE=pve-doc-generator
6
7 # also update debian/changelog
8 PKGREL=1
9
10 DEB=${PACKAGE}_${DOCRELEASE}-${PKGREL}_amd64.deb
11
12
13 DEB_SOURCES=                    \
14         pve-doc-generator.mk    \
15         attributes.txt          \
16         pvesm.adoc              \
17         pve-storage-dir.adoc    \
18         pve-storage-glusterfs.adoc      \
19         pve-storage-iscsi.adoc          \
20         pve-storage-iscsidirect.adoc    \
21         pve-storage-lvm.adoc            \
22         pve-storage-nfs.adoc            \
23         pve-storage-rbd.adoc            \
24         pve-storage-zfspool.adoc        \
25         pveum.adoc              \
26         vzdump.adoc             \
27         pve-firewall.adoc       \
28         qm.adoc                 \
29         pct.adoc                \
30         pveam.adoc              \
31         ha-manager.adoc         \
32         pve-copyright.adoc      \
33         docinfo.xml
34
35 GEN_SCRIPTS=                                    \
36         gen-datacenter-cfg-opts-adoc.pl         \
37         gen-pct-conf-opts-adoc.pl               \
38         gen-pve-firewall-cluster-opts.pl        \
39         gen-pve-firewall-host-opts.pl           \
40         gen-pve-firewall-macros-adoc.pl         \
41         gen-pve-firewall-rules-opts.pl          \
42         gen-pve-firewall-vm-opts.pl             \
43         gen-vm-conf-opts-adoc.pl
44
45 PVEUM_SOURCES=attributes.txt pveum.adoc pveum.1-synopsis.adoc
46 VZDUMP_SOURCES=attributes.txt vzdump.adoc vzdump.1-synopsis.adoc
47 QM_SOURCES=attributes.txt qm.adoc qm.1-synopsis.adoc
48 PCT_SOURCES=attributes.txt pct.adoc pct.1-synopsis.adoc
49 PVEAM_SOURCES=attributes.txt pveam.adoc pveam.1-synopsis.adoc
50 HA_SOURCES=attributes.txt ha-manager.1-synopsis.adoc ha-manager.adoc
51
52 SYSADMIN_SOURCES=                       \
53         getting-help.adoc               \
54         pve-package-repos.adoc          \
55         pve-installation.adoc           \
56         system-software-updates.adoc    \
57         sysadmin.adoc
58
59 PVE_ADMIN_GUIDE_SOURCES=                \
60         datacenter.cfg.adoc             \
61         datacenter.cfg.5-opts.adoc      \
62         vm.conf.adoc                    \
63         vm.conf.5-opts.adoc             \
64         pct.conf.adoc                   \
65         pct.conf.5-opts.adoc            \
66         ${SYSADMIN_SOURCES}             \
67         pve-admin-guide.adoc            \
68         pve-intro.adoc                  \
69         pmxcfs.adoc                     \
70         pve-faq.adoc                    \
71         ${PVE_FIREWALL_MAN8_SOURCES}    \
72         ${PVESM_MAN1_SOURCES}           \
73         ${QM_SOURCES}                   \
74         ${PCT_SOURCES}                  \
75         ${PVEAM_SOURCES}                \
76         ${PVEUM_SOURCES}                \
77         ${VZDUMP_SOURCES}               \
78         ${HA_SOURCES}                   \
79         images/cluster-nwdiag.svg       \
80         images/node-nwdiag.svg          \
81         pve-bibliography.adoc           \
82         GFDL.adoc                       \
83         attributes.txt
84
85 ADOC_STDARG= -a icons -a data-uri -a "date=$(shell date)"
86 ADOC_MAN1_HTML_ARGS=-a "manvolnum=1" ${ADOC_STDARG} -a "revnumber=${DOCRELEASE}"
87 ADOC_MAN5_HTML_ARGS=-a "manvolnum=5" ${ADOC_STDARG} -a "revnumber=${DOCRELEASE}"
88 ADOC_MAN8_HTML_ARGS=-a "manvolnum=8" ${ADOC_STDARG} -a "revnumber=${DOCRELEASE}"
89
90 BROWSER?=xdg-open
91
92 all: pve-admin-guide.html
93
94 %-nwdiag.svg: %.nwdiag
95         nwdiag -T svg $*.nwdiag -o $@;
96
97 %.1: %.adoc %.1-synopsis.adoc docinfo.xml attributes.txt
98         a2x -a docinfo1 -a "manvolnum=1" -a "manversion=Release ${DOCRELEASE}" -f manpage $*.adoc
99         test -n "$${NOVIEW}" || man -l $@
100
101 %.1.html: %.adoc %.1-synopsis.adoc docinfo.xml attributes.txt
102         asciidoc ${ADOC_MAN1_HTML_ARGS} -o $@ $*.adoc
103         test -n "$${NOVIEW}" || $(BROWSER) $@ &
104
105
106 %.8-synopsis.adoc:
107         perl -e "use PVE::Service::$(subst -,_,$*);print PVE::Service::$(subst -,_,$*)->generate_asciidoc_synopsys();" > $@.tmp
108         mv $@.tmp $@
109
110 %.8: %.adoc %.8-synopsis.adoc docinfo.xml
111         a2x -a docinfo1 -a "manvolnum=8" -a "manversion=Release ${DOCRELEASE}" -f manpage $*.adoc
112         test -n "$${NOVIEW}" || man -l $@
113
114 %.8.html: %.adoc %.8-synopsis.adoc docinfo.xml
115         asciidoc ${ADOC_MAN8_HTML_ARGS} -o $@ $*.adoc
116         test -n "$${NOVIEW}" || $(BROWSER) $@ &
117
118 %.5: %.adoc %.5-opts.adoc docinfo.xml
119         a2x -a docinfo1 -a "manvolnum=5" -a "manversion=Release ${DOCRELEASE}" -f manpage $*.adoc
120         test -n "$${NOVIEW}" || man -l $@
121
122 %.5.html: %.adoc %.5-opts.adoc docinfo.xml
123         asciidoc ${ADOC_MAN5_HTML_ARGS} -o $@ $*.adoc
124         test -n "$${NOVIEW}" || $(BROWSER) $@ &
125
126 index.html: index.adoc ${PVE_ADMIN_GUIDE_SOURCES}
127         $(MAKE) NOVIEW=1 pve-admin-guide.pdf pve-admin-guide.html pve-admin-guide.epub
128         $(MAKE) NOVIEW=1 qm.1.html pct.1.html pveam.1.html pvesm.1.html pveum.1.html vzdump.1.html pve-firewall.8.html ha-manager.1.html datacenter.cfg.5.html vm.conf.5.html pct.conf.5.html
129         asciidoc -a "date=$(shell date)" -a "revnumber=${DOCRELEASE}" index.adoc
130         test -n "$${NOVIEW}" || $(BROWSER) index.html &
131
132 pve-admin-guide.html: ${PVE_ADMIN_GUIDE_SOURCES}
133         asciidoc -a "revnumber=${DOCRELEASE}" -a "date=$(shell date)" pve-admin-guide.adoc
134         test -n "$${NOVIEW}" || $(BROWSER) $@ &
135
136 pve-admin-guide.pdf: ${PVE_ADMIN_GUIDE_SOURCES} docinfo.xml pve-admin-guide-docinfo.xml
137         grep ">Release ${DOCRELEASE}<" pve-admin-guide-docinfo.xml || (echo "wrong release in  pve-admin-guide-docinfo.xml" && false);
138         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
139         test -n "$${NOVIEW}" || $(BROWSER) $@ &
140
141 pve-admin-guide.epub: ${PVE_ADMIN_GUIDE_SOURCES}
142         a2x -f epub pve-admin-guide.adoc
143         test -n "$${NOVIEW}" || $(BROWSER) $@ &
144
145 .PHONY: dinstall
146 dinstall: ${DEB}
147         dpkg -i ${DEB}
148
149 .PHONY: deb
150 ${DEB} deb:
151         rm -rf build
152         mkdir build
153         rsync -a debian/ build/debian
154         mkdir -p build/usr/share/${PACKAGE}
155         install -m 0644 ${DEB_SOURCES} build/usr/share/${PACKAGE}
156         install -m 0755 ${GEN_SCRIPTS} build/usr/share/${PACKAGE}
157         cd build; dpkg-buildpackage -rfakeroot -b -us -uc
158         lintian ${DEB}
159
160 .PHONY: upload
161 upload: ${DEB}
162         umount /pve/${DOCRELEASE}; mount /pve/${DOCRELEASE} -o rw
163         mkdir -p /pve/${DOCRELEASE}/extra
164         rm -f /pve/${DOCRELEASE}/extra/${PACKAGE}_*.deb
165         rm -f /pve/${DOCRELEASE}/extra/Packages*
166         cp ${DEB} /pve/${DOCRELEASE}/extra
167         cd /pve/${DOCRELEASE}/extra; dpkg-scanpackages . /dev/null > Packages; gzip -9c Packages > Packages.gz
168         umount /pve/${DOCRELEASE}; mount /pve/${DOCRELEASE} -o ro
169
170 update: clean
171         rm -f *.5-opts.adoc .1-synopsis.adoc .8-synopsis.adoc
172         make all
173
174 clean:
175         rm -rf *~ *.html *.pdf *.epub *.tmp *.1 *.5 *.8 *.deb *.changes build
176