]> git.proxmox.com Git - pve-docs.git/blob - Makefile
create debian package with all sources to generate pve manual pages
[pve-docs.git] / Makefile
1 RELEASE=4.1
2
3 PACKAGE=pve-doc-generator
4
5 # also update debian/changelog
6 PKGREL=1
7
8 DEB=${PACKAGE}_${RELEASE}-${PKGREL}_amd64.deb
9
10 DGDIR=.
11
12 include ./pve-doc-generator.mk
13
14
15 DEB_SOURCES= \
16 pve-doc-generator.mk \
17 attributes.txt \
18 pvesm.adoc \
19 pveum.adoc \
20 vzdump.adoc \
21 pve-firewall.adoc \
22 qm.adoc \
23 pct.adoc \
24 pveam.adoc \
25 ha-manager.adoc \
26 pve-copyright.adoc \
27 docinfo.xml
28
29 GEN_SCRIPTS= \
30 gen-datacenter-cfg-opts-adoc.pl \
31 gen-pct-conf-opts-adoc.pl \
32 gen-pve-firewall-cluster-opts.pl \
33 gen-pve-firewall-host-opts.pl \
34 gen-pve-firewall-macros-adoc.pl \
35 gen-pve-firewall-rules-opts.pl \
36 gen-pve-firewall-vm-opts.pl \
37 gen-vm-conf-opts-adoc.pl
38
39 PVESM_SOURCES=attributes.txt pvesm.adoc pvesm.1-synopsis.adoc $(shell ls pve-storage-*.adoc)
40 PVEUM_SOURCES=attributes.txt pveum.adoc pveum.1-synopsis.adoc
41 VZDUMP_SOURCES=attributes.txt vzdump.adoc vzdump.1-synopsis.adoc
42 QM_SOURCES=attributes.txt qm.adoc qm.1-synopsis.adoc
43 PCT_SOURCES=attributes.txt pct.adoc pct.1-synopsis.adoc
44 PVEAM_SOURCES=attributes.txt pveam.adoc pveam.1-synopsis.adoc
45 HA_SOURCES=attributes.txt ha-manager.1-synopsis.adoc ha-manager.adoc
46
47 SYSADMIN_SOURCES= \
48 getting-help.adoc \
49 pve-package-repos.adoc \
50 pve-installation.adoc \
51 system-software-updates.adoc \
52 sysadmin.adoc
53
54 PVE_ADMIN_GUIDE_SOURCES= \
55 datacenter.cfg.adoc \
56 datacenter.cfg.5-opts.adoc \
57 vm.conf.adoc \
58 vm.conf.5-opts.adoc \
59 pct.conf.adoc \
60 pct.conf.5-opts.adoc \
61 ${SYSADMIN_SOURCES} \
62 pve-admin-guide.adoc \
63 pve-intro.adoc \
64 pmxcfs.adoc \
65 pve-faq.adoc \
66 ${PVE_FIREWALL_MAN8_SOURCES} \
67 ${QM_SOURCES} \
68 ${PCT_SOURCES} \
69 ${PVEAM_SOURCES} \
70 ${PVEUM_SOURCES} \
71 ${PVESM_SOURCES} \
72 ${VZDUMP_SOURCES} \
73 ${HA_SOURCES} \
74 images/cluster-nwdiag.svg \
75 images/node-nwdiag.svg \
76 pve-bibliography.adoc \
77 GFDL.adoc \
78 attributes.txt
79
80 ADOC_STDARG= -a icons -a data-uri -a "date=$(shell date)"
81 ADOC_MAN1_HTML_ARGS=-a "manvolnum=1" ${ADOC_STDARG} -a "revnumber=${RELEASE}"
82 ADOC_MAN5_HTML_ARGS=-a "manvolnum=5" ${ADOC_STDARG} -a "revnumber=${RELEASE}"
83 ADOC_MAN8_HTML_ARGS=-a "manvolnum=8" ${ADOC_STDARG} -a "revnumber=${RELEASE}"
84
85 BROWSER?=xdg-open
86
87 all: pve-admin-guide.html
88
89 %-nwdiag.svg: %.nwdiag
90 nwdiag -T svg $*.nwdiag -o $@;
91
92 %.1-synopsis.adoc:
93 perl -e "use PVE::CLI::$(subst -,_,$*);print PVE::CLI::$(subst -,_,$*)->generate_asciidoc_synopsys();" > $@.tmp
94 mv $@.tmp $@
95
96 %.1: %.adoc %.1-synopsis.adoc docinfo.xml
97 a2x -a docinfo1 -a "manvolnum=1" -a "manversion=Release ${RELEASE}" -f manpage $*.adoc
98 test -n "$${NOVIEW}" || man -l $@
99
100 %.1.html: %.adoc %.1-synopsis.adoc docinfo.xml
101 asciidoc ${ADOC_MAN1_HTML_ARGS} -o $@ $*.adoc
102 test -n "$${NOVIEW}" || $(BROWSER) $@ &
103
104
105 %.8-synopsis.adoc:
106 perl -e "use PVE::Service::$(subst -,_,$*);print PVE::Service::$(subst -,_,$*)->generate_asciidoc_synopsys();" > $@.tmp
107 mv $@.tmp $@
108
109 %.8: %.adoc %.8-synopsis.adoc docinfo.xml
110 a2x -a docinfo1 -a "manvolnum=8" -a "manversion=Release ${RELEASE}" -f manpage $*.adoc
111 test -n "$${NOVIEW}" || man -l $@
112
113 %.8.html: %.adoc %.8-synopsis.adoc docinfo.xml
114 asciidoc ${ADOC_MAN8_HTML_ARGS} -o $@ $*.adoc
115 test -n "$${NOVIEW}" || $(BROWSER) $@ &
116
117 %.5: %.adoc %.5-opts.adoc docinfo.xml
118 a2x -a docinfo1 -a "manvolnum=5" -a "manversion=Release ${RELEASE}" -f manpage $*.adoc
119 test -n "$${NOVIEW}" || man -l $@
120
121 %.5.html: %.adoc %.5-opts.adoc docinfo.xml
122 asciidoc ${ADOC_MAN5_HTML_ARGS} -o $@ $*.adoc
123 test -n "$${NOVIEW}" || $(BROWSER) $@ &
124
125 index.html: index.adoc ${PVE_ADMIN_GUIDE_SOURCES}
126 $(MAKE) NOVIEW=1 pve-admin-guide.pdf pve-admin-guide.html pve-admin-guide.epub
127 $(MAKE) NOVIEW=1 qm.1.html pct.1.html pveam.1.html pvesm.1.html pveum.1.html vzdump.1.html pve-firewall.8.html ha-manager.1.html datacenter.cfg.5.html vm.conf.5.html pct.conf.5.html
128 asciidoc -a "date=$(shell date)" -a "revnumber=${RELEASE}" index.adoc
129 test -n "$${NOVIEW}" || $(BROWSER) index.html &
130
131 pve-admin-guide.html: ${PVE_ADMIN_GUIDE_SOURCES}
132 asciidoc -a "revnumber=${RELEASE}" -a "date=$(shell date)" pve-admin-guide.adoc
133 test -n "$${NOVIEW}" || $(BROWSER) $@ &
134
135 pve-admin-guide.pdf: ${PVE_ADMIN_GUIDE_SOURCES} docinfo.xml pve-admin-guide-docinfo.xml
136 grep ">Release ${RELEASE}<" pve-admin-guide-docinfo.xml || (echo "wrong release in pve-admin-guide-docinfo.xml" && false);
137 a2x -a docinfo -a docinfo1 -f pdf -L --dblatex-opts "-P latex.output.revhistory=0" --dblatex-opts "-P latex.class.options=12pt" --dblatex-opts "-P doc.section.depth=2 -P toc.section.depth=2" pve-admin-guide.adoc
138 test -n "$${NOVIEW}" || $(BROWSER) $@ &
139
140 pve-admin-guide.epub: ${PVE_ADMIN_GUIDE_SOURCES}
141 a2x -f epub pve-admin-guide.adoc
142 test -n "$${NOVIEW}" || $(BROWSER) $@ &
143
144 .PHONY: dinstall
145 dinstall: ${DEB}
146 dpkg -i ${DEB}
147
148 .PHONY: deb
149 ${DEB} deb:
150 rm -rf build
151 mkdir build
152 rsync -a debian/ build/debian
153 mkdir -p build/usr/share/${PACKAGE}
154 install -m 0644 ${DEB_SOURCES} build/usr/share/${PACKAGE}
155 install -m 0755 ${GEN_SCRIPTS} build/usr/share/${PACKAGE}
156 cd build; dpkg-buildpackage -rfakeroot -b -us -uc
157 lintian ${DEB}
158
159
160 update: clean
161 rm -f *.5-opts.adoc .1-synopsis.adoc .8-synopsis.adoc
162 make all
163
164 clean:
165 rm -rf *~ *.html *.pdf *.epub *.tmp *.1 *.5 *.8 *.deb *.changes build
166