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