]>
Commit | Line | Data |
---|---|---|
1 | DGDIR=. | |
2 | ASCIIDOC_PVE=./asciidoc-pve | |
3 | ||
4 | GEN_PACKAGE=pve-doc-generator | |
5 | DOC_PACKAGE=pve-docs | |
6 | MEDIAWIKI_PACKAGE=pve-docs-mediawiki | |
7 | ||
8 | # also update debian/changelog | |
9 | PKGREL=16 | |
10 | ||
11 | GITVERSION:=$(shell cat .git/refs/heads/master) | |
12 | ||
13 | ARCH:=$(shell dpkg-architecture -qDEB_BUILD_ARCH) | |
14 | ||
15 | GEN_DEB=${GEN_PACKAGE}_${DOCRELEASE}-${PKGREL}_${ARCH}.deb | |
16 | DOC_DEB=${DOC_PACKAGE}_${DOCRELEASE}-${PKGREL}_all.deb | |
17 | MEDIAWIKI_DEB=${MEDIAWIKI_PACKAGE}_${DOCRELEASE}-${PKGREL}_all.deb | |
18 | DOC_BUILDDEPS := asciidoc-dblatex, source-highlight, librsvg2-bin | |
19 | ||
20 | ||
21 | all: index.html | |
22 | ||
23 | .PHONY: verify-images | |
24 | verify-images: | |
25 | for i in ./images/screenshot/*.png; do ./png-verify.pl $$i; done | |
26 | ||
27 | ADOC_SOURCES_GUESS=$(filter-out %-synopsis.adoc %-opts.adoc %-table.adoc, $(wildcard *.adoc)) | |
28 | .pve-doc-depends link-refs.json: ${ADOC_SOURCES_GUESS} scan-adoc-refs | |
29 | ./scan-adoc-refs *.adoc --depends .pve-doc-depends.tmp > link-refs.json.tmp | |
30 | @cmp --quiet .pve-doc-depends .pve-doc-depends.tmp || mv .pve-doc-depends.tmp .pve-doc-depends | |
31 | @cmp --quiet link-refs.json link-refs.json.tmp || mv link-refs.json.tmp link-refs.json | |
32 | ||
33 | pve-doc-generator.mk: .pve-doc-depends pve-doc-generator.mk.in | |
34 | cat pve-doc-generator.mk.in .pve-doc-depends > $@.tmp | |
35 | mv $@.tmp $@ | |
36 | ||
37 | include ./pve-doc-generator.mk | |
38 | ||
39 | GEN_DEB_SOURCES= \ | |
40 | pve-doc-generator.mk \ | |
41 | ${MANUAL_SOURCES} \ | |
42 | pmxcfs.8-synopsis.adoc \ | |
43 | docinfo.xml | |
44 | ||
45 | GEN_SCRIPTS= \ | |
46 | gen-ha-groups-opts.pl \ | |
47 | gen-ha-resources-opts.pl \ | |
48 | gen-datacenter.cfg.5-opts.pl \ | |
49 | gen-pct.conf.5-opts.pl \ | |
50 | gen-pct-network-opts.pl \ | |
51 | gen-pct-mountpoint-opts.pl \ | |
52 | gen-qm.conf.5-opts.pl \ | |
53 | gen-vzdump.conf.5-opts.pl \ | |
54 | gen-pve-firewall-cluster-opts.pl \ | |
55 | gen-pve-firewall-host-opts.pl \ | |
56 | gen-pve-firewall-macros-adoc.pl \ | |
57 | gen-pve-firewall-rules-opts.pl \ | |
58 | gen-pve-firewall-vm-opts.pl | |
59 | ||
60 | API_VIEWER_SOURCES= \ | |
61 | api-viewer/index.html \ | |
62 | api-viewer/apidoc.js | |
63 | ||
64 | asciidoc-pve: asciidoc-pve.in link-refs.json | |
65 | cat asciidoc-pve.in link-refs.json >asciidoc-pve.tmp | |
66 | sed -e s/@RELEASE@/${DOCRELEASE}/ -i asciidoc-pve.tmp | |
67 | chmod +x asciidoc-pve.tmp | |
68 | mv asciidoc-pve.tmp asciidoc-pve | |
69 | ||
70 | pve-docs-mediawiki-import: pve-docs-mediawiki-import.in link-refs.json | |
71 | cat pve-docs-mediawiki-import.in link-refs.json > pve-docs-mediawiki-import.tmp | |
72 | chmod +x pve-docs-mediawiki-import.tmp | |
73 | mv pve-docs-mediawiki-import.tmp pve-docs-mediawiki-import | |
74 | ||
75 | INDEX_INCLUDES= \ | |
76 | pve-admin-guide.pdf \ | |
77 | pve-admin-guide.epub \ | |
78 | chapter-index-table.adoc \ | |
79 | man1-index-table.adoc \ | |
80 | man5-index-table.adoc \ | |
81 | man8-index-table.adoc \ | |
82 | $(sort $(addsuffix .html, ${MANUAL_PAGES}) ${CHAPTER_LIST}) | |
83 | ||
84 | ADOC_STDARG=-b $(shell pwd)/asciidoc/pve-html -f asciidoc/asciidoc-pve.conf -a icons -a data-uri -a "date=$(shell date)" -a "revnumber=${DOCRELEASE}" | |
85 | ||
86 | BROWSER?=xdg-open | |
87 | ||
88 | ||
89 | %-nwdiag.svg: %.nwdiag | |
90 | nwdiag -T svg $*.nwdiag -o $@; | |
91 | ||
92 | README.html: README.adoc | |
93 | asciidoc -a toc ${ADOC_STDARG} -o $@ $< | |
94 | ||
95 | .PHONY: index | |
96 | index: index.html | |
97 | $(BROWSER) index.html & | |
98 | ||
99 | chapter-index-table.adoc: asciidoc-pve | |
100 | ./asciidoc-pve chapter-table >$@.tmp | |
101 | mv $@.tmp $@ | |
102 | ||
103 | man1-index-table.adoc: asciidoc-pve | |
104 | ./asciidoc-pve man1page-table >$@.tmp | |
105 | mv $@.tmp $@ | |
106 | ||
107 | man5-index-table.adoc: asciidoc-pve | |
108 | ./asciidoc-pve man5page-table >$@.tmp | |
109 | mv $@.tmp $@ | |
110 | ||
111 | man8-index-table.adoc: asciidoc-pve | |
112 | ./asciidoc-pve man8page-table >$@.tmp | |
113 | mv $@.tmp $@ | |
114 | ||
115 | index.html: index.adoc ${API_VIEWER_SOURCES} ${INDEX_INCLUDES} | |
116 | asciidoc ${ADOC_STDARG} -o $@ index.adoc | |
117 | ||
118 | pve-admin-guide.html: ${PVE_ADMIN_GUIDE_ADOCDEPENDS} | |
119 | asciidoc -a pvelogo ${ADOC_STDARG} -o $@ pve-admin-guide.adoc | |
120 | ||
121 | pve-admin-guide.chunked: ${PVE_ADMIN_GUIDE_ADOCDEPENDS} | |
122 | rm -rf pve-admin-guide.chunked | |
123 | a2x -a docinfo -a docinfo1 -a icons -f chunked pve-admin-guide.adoc | |
124 | ||
125 | PVE_DOCBOOK_CONF=-b $(shell pwd)/asciidoc/pve-docbook -f asciidoc/asciidoc-pve.conf | |
126 | PVE_DBLATEX_OPTS='-p ./asciidoc/pve-dblatex.xsl -s asciidoc/dblatex-custom.sty -c asciidoc/dblatex-export.conf' | |
127 | ||
128 | pve-admin-guide-docinfo.xml: pve-admin-guide-docinfo.xml.in | |
129 | sed -e 's/@RELEASE@/${DOCRELEASE}/' <$< >$@ | |
130 | ||
131 | pve-admin-guide.pdf: ${PVE_ADMIN_GUIDE_ADOCDEPENDS} docinfo.xml pve-admin-guide-docinfo.xml | |
132 | rsvg-convert -f pdf -o proxmox-logo.pdf images/proxmox-logo.svg | |
133 | rsvg-convert -f pdf -o proxmox-ci-header.pdf images/proxmox-ci-header.svg | |
134 | grep ">Release ${DOCRELEASE}<" pve-admin-guide-docinfo.xml || (echo "wrong release in pve-admin-guide-docinfo.xml" && false); | |
135 | a2x -a docinfo -a docinfo1 -f pdf -L --asciidoc-opts="${PVE_DOCBOOK_CONF}" --dblatex-opts ${PVE_DBLATEX_OPTS} pve-admin-guide.adoc | |
136 | rm proxmox-logo.pdf proxmox-ci-header.pdf | |
137 | ||
138 | pve-admin-guide.epub: ${PVE_ADMIN_GUIDE_ADOCDEPENDS} | |
139 | a2x -f epub --asciidoc-opts="${PVE_DOCBOOK_CONF}" pve-admin-guide.adoc | |
140 | ||
141 | api-viewer/apidata.js: extractapi.pl | |
142 | ./extractapi.pl >$@ | |
143 | ||
144 | api-viewer/apidoc.js: api-viewer/apidata.js api-viewer/PVEAPI.js | |
145 | cat api-viewer/apidata.js api-viewer/PVEAPI.js >$@ | |
146 | ||
147 | .PHONY: dinstall | |
148 | dinstall: ${GEN_DEB} ${DOC_DEB} ${MEDIAWIKI_DEB} | |
149 | dpkg -i ${GEN_DEB} ${DOC_DEB} ${MEDIAWIKI_DEB} | |
150 | ||
151 | .PHONY: deb | |
152 | deb: | |
153 | rm -f ${GEN_DEB} ${DOC_DEB} ${MEDIAWIKI_DEB} | |
154 | make all-debs | |
155 | ||
156 | .PHONY: all-debs | |
157 | all-debs: ${GEN_DEB} ${DOC_DEB} ${MEDIAWIKI_DEB} | |
158 | ||
159 | .PHONY: clean-build | |
160 | clean-build: | |
161 | rm -rf build | |
162 | ||
163 | define prepare_build | |
164 | rm -rf build-$1 | |
165 | mkdir build-$1 | |
166 | cp -a debian build-$1/debian | |
167 | mv build-$1/debian/control.in build-$1/debian/control | |
168 | echo >> build-$1/debian/control | |
169 | cat debian/$1.control >> build-$1/debian/control | |
170 | echo "git clone git://git.proxmox.com/git/pve-docs.git\\ngit checkout ${GITVERSION}" > build-$1/debian/SOURCE | |
171 | install -dm755 build-$1/usr/share/$1 | |
172 | install -dm755 build-$1/usr/share/doc/$1 | |
173 | endef | |
174 | ||
175 | .PHONY: gen-deb | |
176 | gen-deb: $(GEN_DEB) | |
177 | $(GEN_DEB): $(GEN_DEB_SOURCES) asciidoc-pve asciidoc/mediawiki.conf | |
178 | $(call prepare_build,$(GEN_PACKAGE)) | |
179 | install -dm755 build-$(GEN_PACKAGE)/usr/bin | |
180 | # install files | |
181 | install -m 0644 ${GEN_DEB_SOURCES} build-$(GEN_PACKAGE)/usr/share/${GEN_PACKAGE} | |
182 | install -m 0755 ${GEN_SCRIPTS} build-$(GEN_PACKAGE)/usr/share/${GEN_PACKAGE} | |
183 | # install asciidoc-pve | |
184 | install -m 0755 asciidoc-pve build-$(GEN_PACKAGE)/usr/bin/ | |
185 | install -D -m 0644 asciidoc/mediawiki.conf build-$(GEN_PACKAGE)/usr/share/${GEN_PACKAGE}/asciidoc/mediawiki.conf | |
186 | install -m 0644 asciidoc/asciidoc-pve.conf build-$(GEN_PACKAGE)/usr/share/${GEN_PACKAGE}/asciidoc/ | |
187 | install -m 0644 asciidoc/pve-html.conf build-$(GEN_PACKAGE)/usr/share/${GEN_PACKAGE}/asciidoc/ | |
188 | cd build-$(GEN_PACKAGE) && dpkg-buildpackage -rfakeroot -b -us -uc | |
189 | lintian ${GEN_DEB} | |
190 | ||
191 | .PHONY: doc-deb | |
192 | doc-deb: $(DOC_DEB) | |
193 | $(DOC_DEB): index.html $(WIKI_IMPORTS) $(API_VIEWER_SOURCES) verify-images | |
194 | $(call prepare_build,$(DOC_PACKAGE)) | |
195 | sed -i -e '/^Build-Depends/{s/$$/, $(DOC_BUILDDEPS)/}' build-$(DOC_PACKAGE)/debian/control | |
196 | # install files for pvedocs package | |
197 | install -dm755 build-$(DOC_PACKAGE)/usr/share/${DOC_PACKAGE} | |
198 | install -dm755 build-$(DOC_PACKAGE)/usr/share/doc/${DOC_PACKAGE} | |
199 | install -m 0644 index.html ${INDEX_INCLUDES} build-$(DOC_PACKAGE)/usr/share/${DOC_PACKAGE} | |
200 | install -m 0644 ${WIKI_IMPORTS} build-$(DOC_PACKAGE)/usr/share/${DOC_PACKAGE} | |
201 | # install screenshot images | |
202 | install -dm755 build-$(DOC_PACKAGE)/usr/share/${DOC_PACKAGE}/images/screenshot | |
203 | install -m 0644 images/screenshot/*.png build-$(DOC_PACKAGE)/usr/share/${DOC_PACKAGE}/images/screenshot | |
204 | # install api doc viewer | |
205 | install -dm755 build-$(DOC_PACKAGE)/usr/share/${DOC_PACKAGE}/api-viewer | |
206 | install -m 0644 ${API_VIEWER_SOURCES} build-$(DOC_PACKAGE)/usr/share/${DOC_PACKAGE}/api-viewer | |
207 | cd build-$(DOC_PACKAGE) && dpkg-buildpackage -rfakeroot -b -us -uc | |
208 | lintian ${DOC_DEB} | |
209 | ||
210 | .PHONY: mediawiki-deb | |
211 | mediawiki-deb: $(MEDIAWIKI_DEB) | |
212 | $(MEDIAWIKI_DEB): pve-docs-mediawiki-import | |
213 | $(call prepare_build,$(MEDIAWIKI_PACKAGE)) | |
214 | cp pve-docs-mediawiki-import build-$(MEDIAWIKI_PACKAGE)/debian/tree/pve-docs-mediawiki/pve-docs-mediawiki-import | |
215 | cd build-$(MEDIAWIKI_PACKAGE) && dpkg-buildpackage -rfakeroot -b -us -uc | |
216 | lintian ${MEDIAWIKI_DEB} | |
217 | ||
218 | .PHONY: upload | |
219 | upload: ${GEN_DEB} ${DOC_DEB} ${MEDIAWIKI_DEB} | |
220 | tar cf - ${GEN_DEB} ${DOC_DEB} ${MEDIAWIKI_DEB} | ssh -X repoman@repo.proxmox.com -- upload --product pve --dist stretch | |
221 | ||
222 | .PHONY: update | |
223 | update: clean clean-static | update-static | |
224 | make all | |
225 | ||
226 | .PHONY: update-static | |
227 | update-static: clean-static | $(filter %-synopsis.adoc %-opts.adoc, ${PVE_ADMIN_GUIDE_ADOCDEPENDS}) pve-firewall-macros.adoc api-viewer/apidata.js | |
228 | ||
229 | .PHONY: clean-static | |
230 | clean-static: | |
231 | find . -regex '.*-\(opts\|synopsis\)\.adoc' -not -name pmxcfs.8-synopsis.adoc -exec rm -f \{\} \; | |
232 | rm -f api-viewer/apidata.js | |
233 | rm -f pve-firewall-macros.adoc pct-network-opts.adoc pct-mountpoint-opts.adoc | |
234 | ||
235 | clean: | |
236 | rm -rf *.html *.pdf *.epub *.tmp *.1 *.5 *.8 | |
237 | rm -f *.deb *.changes *.buildinfo | |
238 | rm -f api-viewer/apidoc.js chapter-*.html *-plain.html chapter-*.html pve-admin-guide.chunked asciidoc-pve link-refs.json .asciidoc-pve-tmp_* pve-docs-mediawiki-import | |
239 | rm -rf .pve-doc-depends | |
240 | rm -f pve-doc-generator.mk chapter-index-table.adoc man1-index-table.adoc man5-index-table.adoc man8-index-table.adoc pve-admin-guide-docinfo.xml | |
241 | rm -rf build-* |