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