-
Notifications
You must be signed in to change notification settings - Fork 16
/
pve-doc-generator.mk.in
104 lines (75 loc) · 3.09 KB
/
pve-doc-generator.mk.in
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
DOCRELEASE=@RELEASE@
DGDIR?=/usr/share/pve-doc-generator
ASCIIDOC_PVE?=/usr/bin/asciidoc-pve
PERL_DOC_ENV=PVE_GENERATING_DOCS=1
PERL_DOC_INC_DIRS:=${PERL_DOC_INC_DIRS} .
PERL_DOC_INC=$(foreach dir,${PERL_DOC_INC_DIRS},-I${dir})
PVE_COMMON_DOC_SOURCES= \
${ASCIIDOC_PVE} \
pve-copyright.adoc \
docinfo.xml
all:
attributes.txt docinfo.xml pmxcfs.8-synopsis.adoc qmeventd.8-synopsis.adoc:
cp ${DGDIR}/$@ [email protected]
mv [email protected] $@
%-opts.adoc: ${DGDIR}/gen-%-opts.pl
$(PERL_DOC_ENV) perl ${PERL_DOC_INC} ${DGDIR}/gen-$*-opts.pl >[email protected]
mv [email protected] $@
%.adoc: ${DGDIR}/gen-%-adoc.pl
$(PERL_DOC_ENV) perl ${PERL_DOC_INC} ${DGDIR}/gen-$*-adoc.pl >[email protected]
mv [email protected] $@
pveperf.1-synopsis.adoc:
echo '*pveperf* `[PATH]`' > pveperf.1-synopsis.adoc
%.1-synopsis.adoc:
$(PERL_DOC_ENV) perl ${PERL_DOC_INC} -e "use PVE::CLI::$(subst -,_,$*);print PVE::CLI::$(subst -,_,$*)->generate_asciidoc_synopsis();" > [email protected]
mv [email protected] $@
%.8-synopsis.adoc:
$(PERL_DOC_ENV) perl ${PERL_DOC_INC} -e "use PVE::Service::$(subst -,_,$*);print PVE::Service::$(subst -,_,$*)->generate_asciidoc_synopsis();" > [email protected]
mv [email protected] $@
ifneq (${DGDIR},.)
%.adoc: ${DGDIR}/%.adoc
cp $< [email protected]
mv [email protected] $@
endif
%.service-bash-completion:
perl ${PERL_DOC_INC} -T -e "use PVE::Service::$*; PVE::Service::$*->generate_bash_completions();" >[email protected]
mv [email protected] $@
%.bash-completion:
perl ${PERL_DOC_INC} -T -e "use PVE::CLI::$*; PVE::CLI::$*->generate_bash_completions();" >[email protected]
mv [email protected] $@
%.service-zsh-completion:
perl ${PERL_DOC_INC} -T -e "use PVE::Service::$*; PVE::Service::$*->generate_zsh_completions();" >[email protected]
mv [email protected] $@
%.zsh-completion:
perl ${PERL_DOC_INC} -T -e "use PVE::CLI::$*; PVE::CLI::$*->generate_zsh_completions();" >[email protected]
mv [email protected] $@
%.service-api-verified:
perl ${PERL_DOC_INC} -T -e "use PVE::Service::$*; PVE::Service::$*->verify_api();"
touch $@
%.api-verified:
perl ${PERL_DOC_INC} -T -e "use PVE::CLI::$*; PVE::CLI::$*->verify_api();"
touch $@
%-plain.html: %.adoc ${PVE_COMMON_DOC_SOURCES}
${ASCIIDOC_PVE} compile-wiki -o $@ $*.adoc
chapter-%.html: %.adoc ${PVE_COMMON_DOC_SOURCES}
${ASCIIDOC_PVE} compile-chapter -o $@ $*.adoc
%.1: %.adoc %.1-synopsis.adoc ${PVE_COMMON_DOC_SOURCES}
${ASCIIDOC_PVE} compile-man -o $@ $*.adoc
test -z "$${PVE_DOC_INSTANTVIEW}" || man -l $@
%.1.html: %.adoc %.1-synopsis.adoc ${PVE_COMMON_DOC_SOURCES}
${ASCIIDOC_PVE} compile-man-html -o $@ $*.adoc
%.8: %.adoc %.8-synopsis.adoc ${PVE_COMMON_DOC_SOURCES}
${ASCIIDOC_PVE} compile-man -o $@ $*.adoc
test -z "$${PVE_DOC_INSTANTVIEW}" || man -l $@
%.8.html: %.adoc %.8-synopsis.adoc ${PVE_COMMON_DOC_SOURCES}
${ASCIIDOC_PVE} compile-man-html -o $@ $*.adoc
%.5: %.adoc %.5-opts.adoc ${PVE_COMMON_DOC_SOURCES}
${ASCIIDOC_PVE} compile-man -o $@ $*.adoc
test -z "$${PVE_DOC_INSTANTVIEW}" || man -l $@
%.5.html: %.adoc %.5-opts.adoc ${PVE_COMMON_DOC_SOURCES}
${ASCIIDOC_PVE} compile-man-html -o $@ $*.adoc
%.5-plain.html: %.adoc %.5-opts.adoc ${PVE_COMMON_DOC_SOURCES}
${ASCIIDOC_PVE} compile-man-wiki -o $@ $*.adoc
.PHONY: cleanup-docgen
cleanup-docgen:
rm -f *.xml.tmp *.1 *.5 *.8 *.adoc docinfo.xml