call spell-corrected synopsis generator method
[pve-docs.git] / pve-doc-generator.mk
1 # also update debian/changelog
2 DOCRELEASE=4.3
3
4 DGDIR?=/usr/share/pve-doc-generator
5
6 all:
7
8 PVE_COMMON_DOC_SOURCES= \
9 attributes.txt \
10 pve-copyright.adoc \
11 docinfo.xml
12
13 PVECM_MAN1_SOURCES= \
14 pvecm.adoc \
15 pvecm.1-synopsis.adoc \
16 ${PVE_COMMON_DOC_SOURCES}
17
18 PVE_FIREWALL_MAN8_SOURCES= \
19 pve-firewall.adoc \
20 pve-firewall.8-synopsis.adoc \
21 pve-firewall-cluster-opts.adoc \
22 pve-firewall-host-opts.adoc \
23 pve-firewall-vm-opts.adoc \
24 pve-firewall-rules-opts.adoc \
25 pve-firewall-macros.adoc \
26 ${PVE_COMMON_DOC_SOURCES}
27
28 PVESM_MAN1_SOURCES= \
29 pvesm.adoc \
30 pvesm.1-synopsis.adoc \
31 pve-storage-dir.adoc \
32 pve-storage-glusterfs.adoc \
33 pve-storage-iscsi.adoc \
34 pve-storage-iscsidirect.adoc \
35 pve-storage-lvm.adoc \
36 pve-storage-lvmthin.adoc \
37 pve-storage-nfs.adoc \
38 pve-storage-rbd.adoc \
39 pve-storage-zfspool.adoc \
40 ${PVE_COMMON_DOC_SOURCES}
41
42 VZDUMP_MAN1_SOURCES= \
43 vzdump.adoc \
44 vzdump.1-synopsis.adoc \
45 vzdump.conf.5-opts.adoc \
46 ${PVE_COMMON_DOC_SOURCES}
47
48 PVESUBSCRIPTION_MAN1_SOURCES= \
49 pvesubscription.adoc \
50 pvesubscription.1-synopsis.adoc \
51 ${PVE_COMMON_DOC_SOURCES}
52
53 PVECEPH_MAN1_SOURCES= \
54 pveceph.adoc \
55 pveceph.1-synopsis.adoc \
56 ${PVE_COMMON_DOC_SOURCES}
57
58 PCT_MAN1_SOURCES= \
59 pct.adoc \
60 pct.1-synopsis.adoc \
61 pct.conf.5-opts.adoc \
62 pct-network-opts.adoc \
63 pct-mountpoint-opts.adoc \
64 ${PVE_COMMON_DOC_SOURCES}
65
66 PCT_CONF_MAN5_SOURCES= \
67 pct.conf.adoc \
68 pct.conf.5-opts.adoc \
69 ${PVE_COMMON_DOC_SOURCES}
70
71 DATACENTER_CONF_MAN5_SOURCES= \
72 datacenter.cfg.adoc \
73 datacenter.cfg.5-opts.adoc \
74 ${PVE_COMMON_DOC_SOURCES}
75
76 QM_MAN1_SOURCES= \
77 qm.adoc \
78 qm.1-synopsis.adoc \
79 qm.conf.5-opts.adoc \
80 ${PVE_COMMON_DOC_SOURCES}
81
82 QM_CONF_MAN5_SOURCES= \
83 qm.conf.adoc \
84 qm.conf.5-opts.adoc \
85 ${PVE_COMMON_DOC_SOURCES}
86
87 QMRESTORE_MAN1_SOURCES= \
88 qmrestore.adoc \
89 qmrestore.1-synopsis.adoc \
90 ${PVE_COMMON_DOC_SOURCES}
91
92 PVEUM_MAN1_SOURCES= \
93 pveum.adoc \
94 pveum.1-synopsis.adoc \
95 ${PVE_COMMON_DOC_SOURCES}
96
97 PVEAM_MAN1_SOURCES= \
98 pveam.adoc \
99 pveam.1-synopsis.adoc \
100 ${PVE_COMMON_DOC_SOURCES}
101
102 HA_MANAGER_MAN1_SOURCES= \
103 ha-manager.adoc \
104 ha-manager.1-synopsis.adoc \
105 ${PVE_COMMON_DOC_SOURCES}
106
107 PVE_HA_CRM_MAN8_SOURCES= \
108 pve-ha-crm.adoc \
109 pve-ha-crm.8-synopsis.adoc \
110 ${PVE_COMMON_DOC_SOURCES}
111
112 PVE_HA_LRM_MAN8_SOURCES= \
113 pve-ha-lrm.adoc \
114 pve-ha-lrm.8-synopsis.adoc \
115 ${PVE_COMMON_DOC_SOURCES}
116
117 PVESTATD_MAN8_SOURCES= \
118 pvestatd.adoc \
119 pvestatd.8-synopsis.adoc \
120 ${PVE_COMMON_DOC_SOURCES}
121
122 PVEDAEMON_MAN8_SOURCES= \
123 pvedaemon.adoc \
124 pvedaemon.8-synopsis.adoc \
125 ${PVE_COMMON_DOC_SOURCES}
126
127 PVEPROXY_MAN8_SOURCES= \
128 pveproxy.adoc \
129 pveproxy.8-synopsis.adoc \
130 ${PVE_COMMON_DOC_SOURCES}
131
132 SPICEPROXY_MAN8_SOURCES= \
133 spiceproxy.adoc \
134 spiceproxy.8-synopsis.adoc \
135 ${PVE_COMMON_DOC_SOURCES}
136
137 PMXCFS_MAN8_SOURCES= \
138 pmxcfs.adoc \
139 pmxcfs.8-cli.adoc \
140 ${PVE_COMMON_DOC_SOURCES}
141
142 attributes.txt docinfo.xml:
143 cp ${DGDIR}/$@ $@.tmp
144 mv $@.tmp $@
145
146 %-opts.adoc: ${DGDIR}/gen-%-opts.pl
147 ${DGDIR}/gen-$*-opts.pl >$@.tmp
148 mv $@.tmp $@
149
150 %.adoc: ${DGDIR}/gen-%-adoc.pl
151 ${DGDIR}/gen-$*-adoc.pl >$@.tmp
152 mv $@.tmp $@
153
154 %.1-synopsis.adoc:
155 perl -I. -e "use PVE::CLI::$(subst -,_,$*);print PVE::CLI::$(subst -,_,$*)->generate_asciidoc_synopsis();" > $@.tmp
156 mv $@.tmp $@
157
158 %.8-synopsis.adoc:
159 perl -I. -e "use PVE::Service::$(subst -,_,$*);print PVE::Service::$(subst -,_,$*)->generate_asciidoc_synopsis();" > $@.tmp
160 mv $@.tmp $@
161
162 ifneq (${DGDIR},.)
163 %.adoc: ${DGDIR}/%.adoc
164 cp $< $@.tmp
165 mv $@.tmp $@
166 endif
167
168 # asciidoc /etc/asciidoc/docbook-xsl/manpage.xsl skip REFERENCES section
169 # like footnotes, so we cannot use a2x. We use xmlto instead.
170 #A2MAN_COMMON=a2x -v -k -a docinfo1 -a "manversion=Release ${DOCRELEASE}" -f manpage
171 #A2MAN1=${A2MAN_COMMON} -a "manvolnum=1"
172 #A2MAN5=${A2MAN_COMMON} -a "manvolnum=5"
173 #A2MAN8=${A2MAN_COMMON} -a "manvolnum=8"
174
175 A2MAN_COMMON=asciidoc -dmanpage -bdocbook -a docinfo1
176
177 define A2MAN1
178 ${A2MAN_COMMON} -a "manvolnum=1" -o $1.tmp.xml $1.adoc
179 xmlto -v man $1.tmp.xml
180 @rm -f $1.tmp.xml
181 endef
182
183 define A2MAN5
184 ${A2MAN_COMMON} -a "manvolnum=5" -o $1.tmp.xml $1.adoc
185 xmlto -v man $1.tmp.xml
186 @rm -f $1.tmp.xml
187 endef
188
189 define A2MAN8
190 ${A2MAN_COMMON} -a "manvolnum=8" -o $1.tmp.xml $1.adoc
191 xmlto -v man $1.tmp.xml
192 @rm -f $1.tmp.xml
193 endef
194
195 pve-firewall.8: ${PVE_FIREWALL_MAN8_SOURCES}
196 $(call A2MAN8,pve-firewall)
197 test -n "$${NOVIEW}" || man -l $@
198
199 pvesm.1: ${PVESM_MAN1_SOURCES}
200 $(call A2MAN1,pvesm)
201 test -n "$${NOVIEW}" || man -l $@
202
203 pveceph.1: ${PVECEPH_MAN1_SOURCES}
204 $(call A2MAN1,pveceph)
205 test -n "$${NOVIEW}" || man -l $@
206
207 pct.1: ${PCT_MAN1_SOURCES}
208 $(call A2MAN1,pct)
209 test -n "$${NOVIEW}" || man -l $@
210
211 vzdump.1: ${VZDUMP_MAN1_SOURCES}
212 $(call A2MAN1,vzdump)
213 test -n "$${NOVIEW}" || man -l $@
214
215 pvesubscription.1: ${PVESUBSCRIPTION_MAN1_SOURCES}
216 $(call A2MAN1,pvesubscription)
217 test -n "$${NOVIEW}" || man -l $@
218
219 qm.1: ${QM_MAN1_SOURCES}
220 $(call A2MAN1,qm)
221 test -n "$${NOVIEW}" || man -l $@
222
223 qmrestore.1: ${QMRESTORE_MAN1_SOURCES}
224 $(call A2MAN1,qmrestore)
225 test -n "$${NOVIEW}" || man -l $@
226
227 pvecm.1: ${PVECM_MAN1_SOURCES}
228 $(call A2MAN1,pvecm)
229 test -n "$${NOVIEW}" || man -l $@
230
231 pveum.1: ${PVEUM_MAN1_SOURCES}
232 $(call A2MAN1,pveum)
233 test -n "$${NOVIEW}" || man -l $@
234
235 pveam.1: ${PVEAM_MAN1_SOURCES}
236 $(call A2MAN1,pveam)
237 test -n "$${NOVIEW}" || man -l $@
238
239 ha-manager.1: ${HA_MANAGER_MAN1_SOURCES}
240 $(call A2MAN1,ha-manager)
241 test -n "$${NOVIEW}" || man -l $@
242
243 pve-ha-crm.8: ${PVE_HA_CRM_MAN8_SOURCES}
244 $(call A2MAN8,pve-ha-crm)
245 test -n "$${NOVIEW}" || man -l $@
246
247 pve-ha-lrm.8: ${PVE_HA_LRM_MAN8_SOURCES}
248 $(call A2MAN8,pve-ha-lrm)
249 test -n "$${NOVIEW}" || man -l $@
250
251 pvestatd.8: ${PVESTATD_MAN8_SOURCES}
252 $(call A2MAN8,pvestatd)
253 test -n "$${NOVIEW}" || man -l $@
254
255 pvedaemon.8: ${PVEDAEMON_MAN8_SOURCES}
256 $(call A2MAN8,pvedaemon)
257 test -n "$${NOVIEW}" || man -l $@
258
259 pveproxy.8: ${PVEPROXY_MAN8_SOURCES}
260 $(call A2MAN8,pveproxy)
261 test -n "$${NOVIEW}" || man -l $@
262
263 spiceproxy.8: ${SPICEPROXY_MAN8_SOURCES}
264 $(call A2MAN8,spiceproxy)
265 test -n "$${NOVIEW}" || man -l $@
266
267 pmxcfs.8: ${PMXCFS_MAN8_SOURCES}
268 $(call A2MAN8,pmxcfs)
269 test -n "$${NOVIEW}" || man -l $@
270
271 qm.conf.5: ${QM_CONF_MAN5_SOURCES}
272
273 pct.conf.5: ${PCT_CONF_MAN5_SOURCES}
274
275 datacenter.cfg.5: ${DATACENTER_CONF_MAN5_SOURCES}
276
277 %.5: %.adoc %.5-opts.adoc ${PVE_COMMON_DOC_SOURCES}
278 $(call A2MAN5,$*)
279 test -n "$${NOVIEW}" || man -l $@
280
281 .PHONY: cleanup-docgen
282 cleanup-docgen:
283 rm -f *.tmp.xml *.1 *.5 *.8 *.adoc attributes.txt docinfo.xml