a20e3a14e1d503e892e968c9a781cbf3ef632286
[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 PCT_MAN1_SOURCES= \
42 pct.adoc \
43 pct.1-synopsis.adoc \
44 ${PVE_COMMON_DOC_SOURCES}
45
46 PCT_CONF_MAN5_SOURCE= \
47 pct.conf.adoc \
48 pct.conf.5-opts.adoc \
49 ${PVE_COMMON_DOC_SOURCES}
50
51 QM_MAN1_SOURCES= \
52 qm.adoc \
53 qm.1-synopsis.adoc \
54 ${PVE_COMMON_DOC_SOURCES}
55
56 QM_CONF_MAN5_SOURCE= \
57 qm.conf.adoc \
58 qm.conf.5-opts.adoc \
59 ${PVE_COMMON_DOC_SOURCES}
60
61 QMRESTORE_MAN1_SOURCES= \
62 qmrestore.adoc \
63 qmrestore.1-synopsis.adoc \
64 ${PVE_COMMON_DOC_SOURCES}
65
66 PVEUM_MAN1_SOURCES= \
67 pveum.adoc \
68 pveum.1-synopsis.adoc \
69 ${PVE_COMMON_DOC_SOURCES}
70
71 HA_MANAGER_MAN1_SOURCES= \
72 ha-manager.adoc \
73 ha-manager.1-synopsis.adoc \
74 ${PVE_COMMON_DOC_SOURCES}
75
76 PVE_HA_CRM_MAN8_SOURCES= \
77 pve-ha-crm.adoc \
78 pve-ha-crm.8-synopsis.adoc \
79 ${PVE_COMMON_DOC_SOURCES}
80
81 PVE_HA_LRM_MAN8_SOURCES= \
82 pve-ha-lrm.adoc \
83 pve-ha-lrm.8-synopsis.adoc \
84 ${PVE_COMMON_DOC_SOURCES}
85
86 attributes.txt docinfo.xml:
87 cp ${DGDIR}/$@ $@.tmp
88 mv $@.tmp $@
89
90 %-opts.adoc: ${DGDIR}/gen-%-opts.pl
91 ${DGDIR}/gen-$*-opts.pl >$@.tmp
92 mv $@.tmp $@
93
94 %.adoc: ${DGDIR}/gen-%-adoc.pl
95 ${DGDIR}/gen-$*-adoc.pl >$@.tmp
96 mv $@.tmp $@
97
98 %.1-synopsis.adoc:
99 perl -I. -e "use PVE::CLI::$(subst -,_,$*);print PVE::CLI::$(subst -,_,$*)->generate_asciidoc_synopsys();" > $@.tmp
100 mv $@.tmp $@
101
102 %.8-synopsis.adoc:
103 perl -I. -e "use PVE::Service::$(subst -,_,$*);print PVE::Service::$(subst -,_,$*)->generate_asciidoc_synopsys();" > $@.tmp
104 mv $@.tmp $@
105
106 ifneq (${DGDIR},.)
107 %.adoc: ${DGDIR}/%.adoc
108 cp $< $@.tmp
109 mv $@.tmp $@
110 endif
111
112 A2X_MAN_COMMON_OPTIONS=-a docinfo1 -a "manversion=Release ${DOCRELEASE}" -f manpage
113 A2X_MAN1_OPTIONS=${A2X_MAN_COMMON_OPTIONS} -a "manvolnum=1"
114 A2X_MAN5_OPTIONS=${A2X_MAN_COMMON_OPTIONS} -a "manvolnum=5"
115 A2X_MAN8_OPTIONS=${A2X_MAN_COMMON_OPTIONS} -a "manvolnum=8"
116
117 pve-firewall.8: ${PVE_FIREWALL_MAN8_SOURCES}
118 a2x ${A2X_MAN8_OPTIONS} pve-firewall.adoc
119 test -n "$${NOVIEW}" || man -l $@
120
121 pvesm.1: ${PVESM_MAN1_SOURCES}
122 a2x ${A2X_MAN1_OPTIONS} pvesm.adoc
123 test -n "$${NOVIEW}" || man -l $@
124
125 pct.1: ${PCT_MAN1_SOURCES}
126 a2x ${A2X_MAN1_OPTIONS} pct.adoc
127 test -n "$${NOVIEW}" || man -l $@
128
129 qm.1: ${QM_MAN1_SOURCES}
130 a2x ${A2X_MAN1_OPTIONS} qm.adoc
131 test -n "$${NOVIEW}" || man -l $@
132
133 qmrestore.1: ${QMRESTORE_MAN1_SOURCES}
134 a2x ${A2X_MAN1_OPTIONS} qmrestore.adoc
135 test -n "$${NOVIEW}" || man -l $@
136
137 pvecm.1: ${PVECM_MAN1_SOURCES}
138 a2x ${A2X_MAN1_OPTIONS} pvecm.adoc
139 test -n "$${NOVIEW}" || man -l $@
140
141 pveum.1: ${PVEUM_MAN1_SOURCES}
142 a2x ${A2X_MAN1_OPTIONS} pveum.adoc
143 test -n "$${NOVIEW}" || man -l $@
144
145 ha-manager.1: ${HA_MANAGER_MAN1_SOURCES}
146 a2x ${A2X_MAN1_OPTIONS} ha-manager.adoc
147 test -n "$${NOVIEW}" || man -l $@
148
149 pve-ha-crm.8: ${PVE_HA_CRM_MAN8_SOURCES}
150 a2x ${A2X_MAN8_OPTIONS} manpage pve-ha-crm.adoc
151 test -n "$${NOVIEW}" || man -l $@
152
153 pve-ha-lrm.8: ${PVE_HA_LRM_MAN8_SOURCES}
154 a2x ${A2X_MAN8_OPTIONS} pve-ha-lrm.adoc
155 test -n "$${NOVIEW}" || man -l $@
156
157 qm.conf.5: ${QM_CONF_MAN5_SOURCE}
158
159 pct.conf.5: ${PCT_CONF_MAN5_SOURCE}
160
161 %.5: %.adoc %.5-opts.adoc ${PVE_COMMON_DOC_SOURCES}
162 a2x ${A2X_MAN5_OPTIONS} $*.adoc
163 test -n "$${NOVIEW}" || man -l $@
164
165 .PHONY: cleanup-docgen
166 cleanup-docgen:
167 rm -f *.1 *.8 *.adoc attributes.txt docinfo.xml