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