9d6d6fa10f625804457b6f3efbc6881ca6ec4382
[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 VZDUMP_SOURCES=attributes.txt vzdump.adoc vzdump.1-synopsis.adoc
57 PVEAM_SOURCES=attributes.txt pveam.adoc pveam.1-synopsis.adoc
58
59 SYSADMIN_SOURCES= \
60 getting-help.adoc \
61 pve-package-repos.adoc \
62 pve-installation.adoc \
63 system-software-updates.adoc \
64 sysadmin.adoc
65
66 PVE_ADMIN_GUIDE_SOURCES= \
67 ${DATACENTER_CONF_MAN5_SOURCES} \
68 ${QM_CONF_MAN5_SOURCES} \
69 ${PCT_CONF_MAN5_SOURCES} \
70 ${SYSADMIN_SOURCES} \
71 pve-admin-guide.adoc \
72 pve-intro.adoc \
73 pmxcfs.adoc \
74 pmxcfs.8-cli.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 ${PVESTATD_MAN8_SOURCES} \
85 ${PVEDAEMON_MAN8_SOURCES} \
86 ${PVEPROXY_MAN8_SOURCES} \
87 ${SPICEPROXY_MAN8_SOURCES} \
88 ${PVE_HA_CRM_MAN8_SOURCES} \
89 ${PVE_HA_LRM_MAN8_SOURCES} \
90 ${PVEAM_SOURCES} \
91 ${VZDUMP_SOURCES} \
92 images/cluster-nwdiag.svg \
93 images/node-nwdiag.svg \
94 pve-bibliography.adoc \
95 $(addsuffix .adoc, ${COMMAND_LIST}) \
96 $(addsuffix .adoc, ${SERVICE_LIST}) \
97 $(addsuffix .adoc, ${CONFIG_LIST}) \
98 GFDL.adoc \
99 attributes.txt
100
101 ADOC_STDARG= -a icons -a data-uri -a "date=$(shell date)"
102 ADOC_MAN1_HTML_ARGS=-a "manvolnum=1" ${ADOC_STDARG} -a "revnumber=${DOCRELEASE}"
103 ADOC_MAN5_HTML_ARGS=-a "manvolnum=5" ${ADOC_STDARG} -a "revnumber=${DOCRELEASE}"
104 ADOC_MAN8_HTML_ARGS=-a "manvolnum=8" ${ADOC_STDARG} -a "revnumber=${DOCRELEASE}"
105
106 BROWSER?=xdg-open
107
108 all: pve-admin-guide.html
109
110 %-nwdiag.svg: %.nwdiag
111 nwdiag -T svg $*.nwdiag -o $@;
112
113 %.1.html: %.adoc %.1-synopsis.adoc ${PVE_COMMON_DOC_SOURCES}
114 asciidoc ${ADOC_MAN1_HTML_ARGS} -o $@ $*.adoc
115 test -n "$${NOVIEW}" || $(BROWSER) $@ &
116
117
118 pmxcfs.8.html: pmxcfs.adoc pmxcfs.8-cli.adoc ${PVE_COMMON_DOC_SOURCES}
119 asciidoc ${ADOC_MAN8_HTML_ARGS} -o $@ pmxcfs.adoc
120 test -n "$${NOVIEW}" || $(BROWSER) $@ &
121
122 %.8.html: %.adoc %.8-synopsis.adoc ${PVE_COMMON_DOC_SOURCES}
123 asciidoc ${ADOC_MAN8_HTML_ARGS} -o $@ $*.adoc
124 test -n "$${NOVIEW}" || $(BROWSER) $@ &
125
126 %.5.html: %.adoc %.5-opts.adoc ${PVE_COMMON_DOC_SOURCES}
127 asciidoc ${ADOC_MAN5_HTML_ARGS} -o $@ $*.adoc
128 test -n "$${NOVIEW}" || $(BROWSER) $@ &
129
130 index.html: index.adoc ${PVE_ADMIN_GUIDE_SOURCES}
131 $(MAKE) NOVIEW=1 pve-admin-guide.pdf pve-admin-guide.html pve-admin-guide.epub
132 $(MAKE) NOVIEW=1 $(addsuffix .1.html, ${COMMAND_LIST}) $(addsuffix .8.html, ${SERVICE_LIST}) $(addsuffix .5.html, ${CONFIG_LIST})
133 asciidoc -a "date=$(shell date)" -a "revnumber=${DOCRELEASE}" index.adoc
134 test -n "$${NOVIEW}" || $(BROWSER) index.html &
135
136 pve-admin-guide.html: ${PVE_ADMIN_GUIDE_SOURCES}
137 asciidoc -a "revnumber=${DOCRELEASE}" -a "date=$(shell date)" pve-admin-guide.adoc
138 test -n "$${NOVIEW}" || $(BROWSER) $@ &
139
140 pve-admin-guide.pdf: ${PVE_ADMIN_GUIDE_SOURCES} docinfo.xml pve-admin-guide-docinfo.xml
141 grep ">Release ${DOCRELEASE}<" pve-admin-guide-docinfo.xml || (echo "wrong release in pve-admin-guide-docinfo.xml" && false);
142 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
143 test -n "$${NOVIEW}" || $(BROWSER) $@ &
144
145 pve-admin-guide.epub: ${PVE_ADMIN_GUIDE_SOURCES}
146 a2x -f epub pve-admin-guide.adoc
147 test -n "$${NOVIEW}" || $(BROWSER) $@ &
148
149 .PHONY: dinstall
150 dinstall: ${DEB}
151 dpkg -i ${DEB}
152
153 .PHONY: deb
154 ${DEB} deb:
155 rm -rf build
156 mkdir build
157 rsync -a debian/ build/debian
158 mkdir -p build/usr/share/${PACKAGE}
159 mkdir -p build/usr/share/doc/${PACKAGE}
160 echo "git clone git://git.proxmox.com/git/pve-docs.git\\ngit checkout ${GITVERSION}" > build/usr/share/doc/${PACKAGE}/SOURCE
161 install -m 0644 ${DEB_SOURCES} build/usr/share/${PACKAGE}
162 install -m 0755 ${GEN_SCRIPTS} build/usr/share/${PACKAGE}
163 cd build; dpkg-buildpackage -rfakeroot -b -us -uc
164 lintian ${DEB}
165
166 .PHONY: upload
167 upload: ${DEB}
168 umount /pve/${DOCRELEASE}; mount /pve/${DOCRELEASE} -o rw
169 mkdir -p /pve/${DOCRELEASE}/extra
170 rm -f /pve/${DOCRELEASE}/extra/${PACKAGE}_*.deb
171 rm -f /pve/${DOCRELEASE}/extra/Packages*
172 cp ${DEB} /pve/${DOCRELEASE}/extra
173 cd /pve/${DOCRELEASE}/extra; dpkg-scanpackages . /dev/null > Packages; gzip -9c Packages > Packages.gz
174 umount /pve/${DOCRELEASE}; mount /pve/${DOCRELEASE} -o ro
175
176 update: clean
177 rm -f *.5-opts.adoc .1-synopsis.adoc .8-synopsis.adoc
178 make all
179
180 clean:
181 rm -rf *~ *.html *.pdf *.epub *.tmp *.1 *.5 *.8 *.deb *.changes build
182