1e3928bd5d75370fc15631e87376930677b81dbd
[pve-docs.git] / pve-doc-generator.mk
1 # also update debian/changelog
2 DOCRELEASE=4.1
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-nfs.adoc            \
37         pve-storage-rbd.adoc            \
38         pve-storage-zfspool.adoc        \
39         ${PVE_COMMON_DOC_SOURCES}
40
41 VZDUMP_MAN1_SOURCES=                    \
42         vzdump.adoc                     \
43         vzdump.1-synopsis.adoc          \
44         ${PVE_COMMON_DOC_SOURCES}
45
46 PVESUBSCRIPTION_MAN1_SOURCES=           \
47         pvesubscription.adoc            \
48         pvesubscription.1-synopsis.adoc \
49         ${PVE_COMMON_DOC_SOURCES}
50
51 PCT_MAN1_SOURCES=                       \
52         pct.adoc                        \
53         pct.1-synopsis.adoc             \
54         ${PVE_COMMON_DOC_SOURCES}
55
56 PCT_CONF_MAN5_SOURCES=                  \
57         pct.conf.adoc                   \
58         pct.conf.5-opts.adoc            \
59         ${PVE_COMMON_DOC_SOURCES}
60
61 DATACENTER_CONF_MAN5_SOURCES=           \
62         datacenter.cfg.adoc             \
63         datacenter.cfg.5-opts.adoc      \
64         ${PVE_COMMON_DOC_SOURCES}
65
66 QM_MAN1_SOURCES=                        \
67         qm.adoc                         \
68         qm.1-synopsis.adoc              \
69         ${PVE_COMMON_DOC_SOURCES}
70
71 QM_CONF_MAN5_SOURCES=                   \
72         qm.conf.adoc                    \
73         qm.conf.5-opts.adoc             \
74         ${PVE_COMMON_DOC_SOURCES}
75
76 QMRESTORE_MAN1_SOURCES=                 \
77         qmrestore.adoc                  \
78         qmrestore.1-synopsis.adoc       \
79         ${PVE_COMMON_DOC_SOURCES}
80
81 PVEUM_MAN1_SOURCES=                     \
82         pveum.adoc                      \
83         pveum.1-synopsis.adoc           \
84         ${PVE_COMMON_DOC_SOURCES}
85
86 PVEAM_MAN1_SOURCES=                     \
87         pveam.adoc                      \
88         pveam.1-synopsis.adoc           \
89         ${PVE_COMMON_DOC_SOURCES}
90
91 HA_MANAGER_MAN1_SOURCES=                \
92         ha-manager.adoc                 \
93         ha-manager.1-synopsis.adoc      \
94         ${PVE_COMMON_DOC_SOURCES}
95
96 PVE_HA_CRM_MAN8_SOURCES=                \
97         pve-ha-crm.adoc                 \
98         pve-ha-crm.8-synopsis.adoc      \
99         ${PVE_COMMON_DOC_SOURCES}
100
101 PVE_HA_LRM_MAN8_SOURCES=                \
102         pve-ha-lrm.adoc                 \
103         pve-ha-lrm.8-synopsis.adoc      \
104         ${PVE_COMMON_DOC_SOURCES}
105
106 PVESTATD_MAN8_SOURCES=                  \
107         pvestatd.adoc                   \
108         pvestatd.8-synopsis.adoc        \
109         ${PVE_COMMON_DOC_SOURCES}
110
111 PVEDAEMON_MAN8_SOURCES=                 \
112         pvedaemon.adoc                  \
113         pvedaemon.8-synopsis.adoc       \
114         ${PVE_COMMON_DOC_SOURCES}
115
116 PVEPROXY_MAN8_SOURCES=                  \
117         pveproxy.adoc                   \
118         pveproxy.8-synopsis.adoc        \
119         ${PVE_COMMON_DOC_SOURCES}
120
121 SPICEPROXY_MAN8_SOURCES=                \
122         spiceproxy.adoc                 \
123         spiceproxy.8-synopsis.adoc      \
124         ${PVE_COMMON_DOC_SOURCES}
125
126 PMXCFS_MAN8_SOURCES=                    \
127         pmxcfs.adoc                     \
128         pmxcfs.8-cli.adoc               \
129         ${PVE_COMMON_DOC_SOURCES}
130
131 attributes.txt docinfo.xml:
132         cp ${DGDIR}/$@ $@.tmp
133         mv $@.tmp $@
134
135 %-opts.adoc: ${DGDIR}/gen-%-opts.pl
136         ${DGDIR}/gen-$*-opts.pl >$@.tmp
137         mv $@.tmp $@
138
139 %.adoc: ${DGDIR}/gen-%-adoc.pl
140         ${DGDIR}/gen-$*-adoc.pl >$@.tmp
141         mv $@.tmp $@
142
143 %.1-synopsis.adoc:
144         perl -I. -e "use PVE::CLI::$(subst -,_,$*);print PVE::CLI::$(subst -,_,$*)->generate_asciidoc_synopsys();" > $@.tmp
145         mv $@.tmp $@
146
147 %.8-synopsis.adoc:
148         perl -I. -e "use PVE::Service::$(subst -,_,$*);print PVE::Service::$(subst -,_,$*)->generate_asciidoc_synopsys();" > $@.tmp
149         mv $@.tmp $@
150
151 ifneq (${DGDIR},.)
152 %.adoc: ${DGDIR}/%.adoc
153         cp $< $@.tmp
154         mv $@.tmp $@
155 endif
156
157 A2X_MAN_COMMON_OPTIONS=-a docinfo1 -a "manversion=Release ${DOCRELEASE}" -f manpage
158 A2X_MAN1_OPTIONS=${A2X_MAN_COMMON_OPTIONS} -a "manvolnum=1"
159 A2X_MAN5_OPTIONS=${A2X_MAN_COMMON_OPTIONS} -a "manvolnum=5"
160 A2X_MAN8_OPTIONS=${A2X_MAN_COMMON_OPTIONS} -a "manvolnum=8"
161
162 pve-firewall.8: ${PVE_FIREWALL_MAN8_SOURCES}
163         a2x ${A2X_MAN8_OPTIONS} pve-firewall.adoc
164         test -n "$${NOVIEW}" || man -l $@
165
166 pvesm.1: ${PVESM_MAN1_SOURCES}
167         a2x ${A2X_MAN1_OPTIONS} pvesm.adoc
168         test -n "$${NOVIEW}" || man -l $@
169
170 pct.1: ${PCT_MAN1_SOURCES}
171         a2x ${A2X_MAN1_OPTIONS} pct.adoc
172         test -n "$${NOVIEW}" || man -l $@
173
174 vzdump.1: ${VZDUMP_MAN1_SOURCES}
175         a2x ${A2X_MAN1_OPTIONS} vzdump.adoc
176         test -n "$${NOVIEW}" || man -l $@
177
178 pvesubscription.1: ${PVESUBSCRIPTION_MAN1_SOURCES}
179         a2x ${A2X_MAN1_OPTIONS} pvesubscription.adoc
180         test -n "$${NOVIEW}" || man -l $@
181
182 qm.1: ${QM_MAN1_SOURCES}
183         a2x ${A2X_MAN1_OPTIONS} qm.adoc
184         test -n "$${NOVIEW}" || man -l $@
185
186 qmrestore.1: ${QMRESTORE_MAN1_SOURCES}
187         a2x ${A2X_MAN1_OPTIONS} qmrestore.adoc
188         test -n "$${NOVIEW}" || man -l $@
189
190 pvecm.1: ${PVECM_MAN1_SOURCES}
191         a2x ${A2X_MAN1_OPTIONS} pvecm.adoc
192         test -n "$${NOVIEW}" || man -l $@
193
194 pveum.1: ${PVEUM_MAN1_SOURCES}
195         a2x ${A2X_MAN1_OPTIONS} pveum.adoc
196         test -n "$${NOVIEW}" || man -l $@
197
198 pveam.1: ${PVEAM_MAN1_SOURCES}
199         a2x ${A2X_MAN1_OPTIONS} pveam.adoc
200         test -n "$${NOVIEW}" || man -l $@
201
202 ha-manager.1: ${HA_MANAGER_MAN1_SOURCES}
203         a2x ${A2X_MAN1_OPTIONS} ha-manager.adoc
204         test -n "$${NOVIEW}" || man -l $@
205
206 pve-ha-crm.8: ${PVE_HA_CRM_MAN8_SOURCES}
207         a2x ${A2X_MAN8_OPTIONS} manpage pve-ha-crm.adoc
208         test -n "$${NOVIEW}" || man -l $@
209
210 pve-ha-lrm.8: ${PVE_HA_LRM_MAN8_SOURCES}
211         a2x ${A2X_MAN8_OPTIONS} pve-ha-lrm.adoc
212         test -n "$${NOVIEW}" || man -l $@
213
214 pvestatd.8: ${PVESTATD_MAN8_SOURCES}
215         a2x ${A2X_MAN8_OPTIONS} pvestatd.adoc
216         test -n "$${NOVIEW}" || man -l $@
217
218 pvedaemon.8: ${PVEDAEMON_MAN8_SOURCES}
219         a2x ${A2X_MAN8_OPTIONS} pvedaemon.adoc
220         test -n "$${NOVIEW}" || man -l $@
221
222 pveproxy.8: ${PVEPROXY_MAN8_SOURCES}
223         a2x ${A2X_MAN8_OPTIONS} pveproxy.adoc
224         test -n "$${NOVIEW}" || man -l $@
225
226 spiceproxy.8: ${SPICEPROXY_MAN8_SOURCES}
227         a2x ${A2X_MAN8_OPTIONS} spiceproxy.adoc
228         test -n "$${NOVIEW}" || man -l $@
229
230 pmxcfs.8: ${PMXCFS_MAN8_SOURCES}
231         a2x ${A2X_MAN8_OPTIONS} pmxcfs.adoc
232         test -n "$${NOVIEW}" || man -l $@
233
234 qm.conf.5: ${QM_CONF_MAN5_SOURCES}
235
236 pct.conf.5: ${PCT_CONF_MAN5_SOURCES}
237
238 datacenter.cfg.5: ${DATACENTER_CONF_MAN5_SOURCES}
239
240 %.5: %.adoc %.5-opts.adoc ${PVE_COMMON_DOC_SOURCES}
241         a2x ${A2X_MAN5_OPTIONS} $*.adoc
242         test -n "$${NOVIEW}" || man -l $@
243
244 .PHONY: cleanup-docgen
245 cleanup-docgen:
246         rm -f *.1 *.5 *.8 *.adoc attributes.txt docinfo.xml