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