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