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