cca464b5ea56b42a65cb34bb57bc82205c0ce5fb
[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 QM_MAN1_SOURCES=                        \
47         qm.adoc                         \
48         qm.1-synopsis.adoc              \
49         ${PVE_COMMON_DOC_SOURCES}
50
51 PVEUM_MAN1_SOURCES=                     \
52         pveum.adoc                      \
53         pveum.1-synopsis.adoc           \
54         ${PVE_COMMON_DOC_SOURCES}
55
56 attributes.txt docinfo.xml:
57         cp ${DGDIR}/$@ $@.tmp
58         mv $@.tmp $@
59
60 %-opts.adoc: ${DGDIR}/gen-%-opts.pl
61         ${DGDIR}/gen-$*-opts.pl >$@.tmp
62         mv $@.tmp $@
63
64 %.adoc: ${DGDIR}/gen-%-adoc.pl
65         ${DGDIR}/gen-$*-adoc.pl >$@.tmp
66         mv $@.tmp $@
67
68 %.1-synopsis.adoc:
69         perl -I. -e "use PVE::CLI::$(subst -,_,$*);print PVE::CLI::$(subst -,_,$*)->generate_asciidoc_synopsys();" > $@.tmp
70         mv $@.tmp $@
71
72 %.8-synopsis.adoc:
73         perl -I. -e "use PVE::Service::$(subst -,_,$*);print PVE::Service::$(subst -,_,$*)->generate_asciidoc_synopsys();" > $@.tmp
74         mv $@.tmp $@
75
76 ifneq (${DGDIR},.)
77 %.adoc: ${DGDIR}/%.adoc
78         cp $< $@.tmp
79         mv $@.tmp $@
80 endif
81
82 pve-firewall.8: ${PVE_FIREWALL_MAN8_SOURCES}
83         a2x -a docinfo1 -a "manvolnum=8" -a "manversion=Release ${DOCRELEASE}" -f manpage pve-firewall.adoc
84         test -n "$${NOVIEW}" || man -l $@
85
86 pvesm.1: ${PVESM_MAN1_SOURCES}
87         a2x -a docinfo1 -a "manvolnum=1" -a "manversion=Release ${DOCRELEASE}" -f manpage pvesm.adoc
88         test -n "$${NOVIEW}" || man -l $@
89
90 pct.1: ${PCT_MAN1_SOURCES}
91         a2x -a docinfo1 -a "manvolnum=1" -a "manversion=Release ${DOCRELEASE}" -f manpage pct.adoc
92         test -n "$${NOVIEW}" || man -l $@
93
94 qm.1: ${QM_MAN1_SOURCES}
95         a2x -a docinfo1 -a "manvolnum=1" -a "manversion=Release ${DOCRELEASE}" -f manpage qm.adoc
96         test -n "$${NOVIEW}" || man -l $@
97
98 pvecm.1: ${PVECM_MAN1_SOURCES}
99         a2x -a docinfo1 -a "manvolnum=1" -a "manversion=Release ${DOCRELEASE}" -f manpage pvecm.adoc
100         test -n "$${NOVIEW}" || man -l $@
101
102 pveum.1: ${PVEUM_MAN1_SOURCES}
103         a2x -a docinfo1 -a "manvolnum=1" -a "manversion=Release ${DOCRELEASE}" -f manpage pveum.adoc
104         test -n "$${NOVIEW}" || man -l $@
105
106 %.5: %.adoc %.5-opts.adoc ${PVE_COMMON_DOC_SOURCES}
107         a2x -a docinfo1 -a "manvolnum=5" -a "manversion=Release ${DOCRELEASE}" -f manpage $*.adoc
108         test -n "$${NOVIEW}" || man -l $@
109
110 .PHONY: cleanup-docgen
111 cleanup-docgen:
112         rm -f *.1 *.8 *.adoc attributes.txt docinfo.xml