]>
Commit | Line | Data |
---|---|---|
bef0c1b4 | 1 | DGDIR=. |
c38115e9 | 2 | ASCIIDOC_PVE=./asciidoc-pve |
bef0c1b4 | 3 | |
9015f48f DM |
4 | GEN_PACKAGE=pve-doc-generator |
5 | DOC_PACKAGE=pve-docs | |
cfabc2e9 | 6 | MEDIAWIKI_PACKAGE=pve-docs-mediawiki |
9344ee0d DM |
7 | |
8 | # also update debian/changelog | |
4a859b7b | 9 | PKGREL=3 |
9344ee0d | 10 | |
b4f3c18a DM |
11 | GITVERSION:=$(shell cat .git/refs/heads/master) |
12 | ||
0a3c58e0 TL |
13 | ARCH:=$(shell dpkg-architecture -qDEB_BUILD_ARCH) |
14 | ||
15 | GEN_DEB=${GEN_PACKAGE}_${DOCRELEASE}-${PKGREL}_${ARCH}.deb | |
ceb4ea5b | 16 | DOC_DEB=${DOC_PACKAGE}_${DOCRELEASE}-${PKGREL}_all.deb |
cfabc2e9 | 17 | MEDIAWIKI_DEB=${MEDIAWIKI_PACKAGE}_${DOCRELEASE}-${PKGREL}_all.deb |
d757d194 | 18 | DOC_BUILDDEPS := asciidoc-dblatex, source-highlight, inkscape, imagemagick |
9344ee0d | 19 | |
516d1f2f | 20 | |
63a01806 DM |
21 | all: index.html |
22 | ||
7515acaf DM |
23 | .PHONY: verify-images |
24 | verify-images: | |
25 | for i in ./images/screenshot/*.png; do ./png-verify.pl $$i; done | |
516d1f2f DM |
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 | |
e6fc3b0c DM |
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 | |
63a01806 | 32 | |
1ed794c8 DM |
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 | |
672abac1 | 38 | |
9015f48f | 39 | GEN_DEB_SOURCES= \ |
672abac1 | 40 | pve-doc-generator.mk \ |
63a01806 | 41 | ${MANUAL_SOURCES} \ |
54079101 | 42 | pmxcfs.8-synopsis.adoc \ |
9344ee0d DM |
43 | docinfo.xml |
44 | ||
45 | GEN_SCRIPTS= \ | |
8942fab2 DM |
46 | gen-ha-groups-opts.pl \ |
47 | gen-ha-resources-opts.pl \ | |
f6b81378 DM |
48 | gen-datacenter.cfg.5-opts.pl \ |
49 | gen-pct.conf.5-opts.pl \ | |
bac8c385 | 50 | gen-pct-network-opts.pl \ |
fe154a4f | 51 | gen-pct-mountpoint-opts.pl \ |
9b4799ab | 52 | gen-qm.conf.5-opts.pl \ |
500f1e1f | 53 | gen-vzdump.conf.5-opts.pl \ |
9344ee0d DM |
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 \ | |
f6b81378 | 58 | gen-pve-firewall-vm-opts.pl |
9344ee0d | 59 | |
356064f4 DM |
60 | API_VIEWER_SOURCES= \ |
61 | api-viewer/index.html \ | |
62 | api-viewer/apidoc.js | |
63 | ||
aa99b349 DM |
64 | asciidoc-pve: asciidoc-pve.in link-refs.json |
65 | cat asciidoc-pve.in link-refs.json >asciidoc-pve.tmp | |
835dd63b | 66 | sed -e s/@RELEASE@/${DOCRELEASE}/ -i asciidoc-pve.tmp |
aa99b349 DM |
67 | chmod +x asciidoc-pve.tmp |
68 | mv asciidoc-pve.tmp asciidoc-pve | |
69 | ||
b489b02c DM |
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 | ||
f4defaeb DM |
75 | INDEX_INCLUDES= \ |
76 | pve-admin-guide.pdf \ | |
f4defaeb | 77 | pve-admin-guide.epub \ |
941ab9c7 DM |
78 | chapter-index-table.adoc \ |
79 | man1-index-table.adoc \ | |
80 | man5-index-table.adoc \ | |
81 | man8-index-table.adoc \ | |
63a01806 | 82 | $(sort $(addsuffix .html, ${MANUAL_PAGES}) ${CHAPTER_LIST}) |
f4defaeb | 83 | |
ae0ad291 | 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}" |
deb7f2ea | 85 | |
fc1090ef | 86 | BROWSER?=xdg-open |
df41beec | 87 | |
7b2c36ae | 88 | |
deb7f2ea DM |
89 | %-nwdiag.svg: %.nwdiag |
90 | nwdiag -T svg $*.nwdiag -o $@; | |
91 | ||
9d17dbac | 92 | README.html: README.adoc |
6b70c786 | 93 | asciidoc -a toc ${ADOC_STDARG} -o $@ $< |
9d17dbac | 94 | |
8ace7110 DM |
95 | .PHONY: index |
96 | index: index.html | |
3f559975 DM |
97 | $(BROWSER) index.html & |
98 | ||
fd02ab90 DM |
99 | chapter-index-table.adoc: asciidoc-pve |
100 | ./asciidoc-pve chapter-table >$@.tmp | |
941ab9c7 DM |
101 | mv $@.tmp $@ |
102 | ||
fd02ab90 DM |
103 | man1-index-table.adoc: asciidoc-pve |
104 | ./asciidoc-pve man1page-table >$@.tmp | |
941ab9c7 DM |
105 | mv $@.tmp $@ |
106 | ||
fd02ab90 DM |
107 | man5-index-table.adoc: asciidoc-pve |
108 | ./asciidoc-pve man5page-table >$@.tmp | |
941ab9c7 DM |
109 | mv $@.tmp $@ |
110 | ||
fd02ab90 DM |
111 | man8-index-table.adoc: asciidoc-pve |
112 | ./asciidoc-pve man8page-table >$@.tmp | |
941ab9c7 DM |
113 | mv $@.tmp $@ |
114 | ||
115 | index.html: index.adoc ${API_VIEWER_SOURCES} ${INDEX_INCLUDES} | |
c65b00e2 | 116 | asciidoc ${ADOC_STDARG} -o $@ index.adoc |
deb7f2ea | 117 | |
63a01806 | 118 | pve-admin-guide.html: ${PVE_ADMIN_GUIDE_ADOCDEPENDS} |
ae0ad291 | 119 | asciidoc -a pvelogo ${ADOC_STDARG} -o $@ pve-admin-guide.adoc |
deb7f2ea | 120 | |
63a01806 | 121 | pve-admin-guide.chunked: ${PVE_ADMIN_GUIDE_ADOCDEPENDS} |
59d89a51 DM |
122 | rm -rf pve-admin-guide.chunked |
123 | a2x -a docinfo -a docinfo1 -a icons -f chunked pve-admin-guide.adoc | |
59d89a51 | 124 | |
2522a624 DM |
125 | PVE_DOCBOOK_CONF=-b $(shell pwd)/asciidoc/pve-docbook -f asciidoc/asciidoc-pve.conf |
126 | ||
384871f2 DM |
127 | pve-admin-guide-docinfo.xml: pve-admin-guide-docinfo.xml.in |
128 | sed -e 's/@RELEASE@/${DOCRELEASE}/' <$< >$@ | |
129 | ||
63a01806 | 130 | pve-admin-guide.pdf: ${PVE_ADMIN_GUIDE_ADOCDEPENDS} docinfo.xml pve-admin-guide-docinfo.xml |
34ef065a | 131 | inkscape -z -D --export-pdf=proxmox-logo.pdf images/proxmox-logo.svg |
333a2f49 | 132 | inkscape -z -D --export-pdf=proxmox-ci-header.pdf images/proxmox-ci-header.svg |
bef0c1b4 | 133 | grep ">Release ${DOCRELEASE}<" pve-admin-guide-docinfo.xml || (echo "wrong release in pve-admin-guide-docinfo.xml" && false); |
2522a624 | 134 | a2x -a docinfo -a docinfo1 -f pdf -L --asciidoc-opts="${PVE_DOCBOOK_CONF}" --dblatex-opts "-p ./asciidoc/pve-dblatex.xsl -s asciidoc/dblatex-custom.sty" pve-admin-guide.adoc |
34ef065a | 135 | rm proxmox-logo.pdf proxmox-ci-header.pdf |
deb7f2ea | 136 | |
63a01806 | 137 | pve-admin-guide.epub: ${PVE_ADMIN_GUIDE_ADOCDEPENDS} |
2522a624 | 138 | a2x -f epub --asciidoc-opts="${PVE_DOCBOOK_CONF}" pve-admin-guide.adoc |
9344ee0d | 139 | |
356064f4 | 140 | api-viewer/apidata.js: extractapi.pl |
61568a65 DM |
141 | ./extractapi.pl >$@ |
142 | ||
356064f4 DM |
143 | api-viewer/apidoc.js: api-viewer/apidata.js api-viewer/PVEAPI.js |
144 | cat api-viewer/apidata.js api-viewer/PVEAPI.js >$@ | |
61568a65 | 145 | |
9344ee0d | 146 | .PHONY: dinstall |
cfabc2e9 DM |
147 | dinstall: ${GEN_DEB} ${DOC_DEB} ${MEDIAWIKI_DEB} |
148 | dpkg -i ${GEN_DEB} ${DOC_DEB} ${MEDIAWIKI_DEB} | |
9015f48f | 149 | |
9344ee0d | 150 | .PHONY: deb |
9015f48f | 151 | deb: |
c8bdafbd WB |
152 | rm -f ${GEN_DEB} ${DOC_DEB} ${MEDIAWIKI_DEB} |
153 | make all-debs | |
9015f48f | 154 | |
f0d25f0d WB |
155 | .PHONY: all-debs |
156 | all-debs: ${GEN_DEB} ${DOC_DEB} ${MEDIAWIKI_DEB} | |
157 | ||
c8bdafbd WB |
158 | .PHONY: clean-build |
159 | clean-build: | |
9015f48f | 160 | rm -rf build |
c8bdafbd WB |
161 | |
162 | define prepare_build | |
163 | rm -rf build-$1 | |
164 | mkdir build-$1 | |
165 | cp -a debian build-$1/debian | |
166 | mv build-$1/debian/control.in build-$1/debian/control | |
167 | echo >> build-$1/debian/control | |
168 | cat debian/$1.control >> build-$1/debian/control | |
169 | echo "git clone git://git.proxmox.com/git/pve-docs.git\\ngit checkout ${GITVERSION}" > build-$1/debian/SOURCE | |
170 | install -dm755 build-$1/usr/share/$1 | |
171 | install -dm755 build-$1/usr/share/doc/$1 | |
172 | endef | |
173 | ||
174 | .PHONY: gen-deb | |
175 | gen-deb: $(GEN_DEB) | |
176 | $(GEN_DEB): $(GEN_DEB_SOURCES) asciidoc-pve asciidoc/mediawiki.conf | |
177 | $(call prepare_build,$(GEN_PACKAGE)) | |
178 | install -dm755 build-$(GEN_PACKAGE)/usr/bin | |
179 | # install files | |
180 | install -m 0644 ${GEN_DEB_SOURCES} build-$(GEN_PACKAGE)/usr/share/${GEN_PACKAGE} | |
181 | install -m 0755 ${GEN_SCRIPTS} build-$(GEN_PACKAGE)/usr/share/${GEN_PACKAGE} | |
de7022fb | 182 | # install asciidoc-pve |
c8bdafbd WB |
183 | install -m 0755 asciidoc-pve build-$(GEN_PACKAGE)/usr/bin/ |
184 | install -D -m 0644 asciidoc/mediawiki.conf build-$(GEN_PACKAGE)/usr/share/${GEN_PACKAGE}/asciidoc/mediawiki.conf | |
185 | install -m 0644 asciidoc/asciidoc-pve.conf build-$(GEN_PACKAGE)/usr/share/${GEN_PACKAGE}/asciidoc/ | |
186 | install -m 0644 asciidoc/pve-html.conf build-$(GEN_PACKAGE)/usr/share/${GEN_PACKAGE}/asciidoc/ | |
187 | cd build-$(GEN_PACKAGE) && dpkg-buildpackage -rfakeroot -b -us -uc | |
188 | lintian ${GEN_DEB} | |
189 | ||
190 | .PHONY: doc-deb | |
191 | doc-deb: $(DOC_DEB) | |
192 | $(DOC_DEB): index.html $(WIKI_IMPORTS) $(API_VIEWER_SOURCES) verify-images | |
193 | $(call prepare_build,$(DOC_PACKAGE)) | |
421ad500 | 194 | sed -i -e '/^Build-Depends/{s/$$/, $(DOC_BUILDDEPS)/}' build-$(DOC_PACKAGE)/debian/control |
ceb4ea5b | 195 | # install files for pvedocs package |
c8bdafbd WB |
196 | install -dm755 build-$(DOC_PACKAGE)/usr/share/${DOC_PACKAGE} |
197 | install -dm755 build-$(DOC_PACKAGE)/usr/share/doc/${DOC_PACKAGE} | |
198 | install -m 0644 index.html ${INDEX_INCLUDES} build-$(DOC_PACKAGE)/usr/share/${DOC_PACKAGE} | |
199 | install -m 0644 ${WIKI_IMPORTS} build-$(DOC_PACKAGE)/usr/share/${DOC_PACKAGE} | |
8c8ae224 | 200 | # install screenshot images |
c8bdafbd WB |
201 | install -dm755 build-$(DOC_PACKAGE)/usr/share/${DOC_PACKAGE}/images/screenshot |
202 | install -m 0644 images/screenshot/*.png build-$(DOC_PACKAGE)/usr/share/${DOC_PACKAGE}/images/screenshot | |
61568a65 | 203 | # install api doc viewer |
c8bdafbd WB |
204 | install -dm755 build-$(DOC_PACKAGE)/usr/share/${DOC_PACKAGE}/api-viewer |
205 | install -m 0644 ${API_VIEWER_SOURCES} build-$(DOC_PACKAGE)/usr/share/${DOC_PACKAGE}/api-viewer | |
206 | cd build-$(DOC_PACKAGE) && dpkg-buildpackage -rfakeroot -b -us -uc | |
ceb4ea5b | 207 | lintian ${DOC_DEB} |
c8bdafbd WB |
208 | |
209 | .PHONY: mediawiki-deb | |
210 | mediawiki-deb: $(MEDIAWIKI_DEB) | |
211 | $(MEDIAWIKI_DEB): pve-docs-mediawiki-import | |
212 | $(call prepare_build,$(MEDIAWIKI_PACKAGE)) | |
213 | cp pve-docs-mediawiki-import build-$(MEDIAWIKI_PACKAGE)/debian/tree/pve-docs-mediawiki/pve-docs-mediawiki-import | |
214 | cd build-$(MEDIAWIKI_PACKAGE) && dpkg-buildpackage -rfakeroot -b -us -uc | |
cfabc2e9 | 215 | lintian ${MEDIAWIKI_DEB} |
9344ee0d | 216 | |
89e93b38 | 217 | .PHONY: upload |
cfabc2e9 | 218 | upload: ${GEN_DEB} ${DOC_DEB} ${MEDIAWIKI_DEB} |
821cf643 | 219 | tar cf - ${GEN_DEB} ${DOC_DEB} ${MEDIAWIKI_DEB} | ssh -X repoman@repo.proxmox.com -- upload --product pve --dist stretch |
deb7f2ea | 220 | |
56122987 | 221 | .PHONY: update |
c016ebb7 | 222 | update: clean |
5bf279bd | 223 | find . -regex '.*-\(opts\|synopsis\)\.adoc' -not -name pmxcfs.8-synopsis.adoc -exec rm -f \{\} \; |
56122987 | 224 | rm -f api-viewer/apidata.js |
fe154a4f | 225 | rm -f pve-firewall-macros.adoc pct-network-opts.adoc pct-mountpoint-opts.adoc |
c016ebb7 | 226 | make all |
deb7f2ea | 227 | |
bca311e4 | 228 | clean: |
f00afaef WB |
229 | rm -rf *.html *.pdf *.epub *.tmp *.1 *.5 *.8 |
230 | rm -f *.deb *.changes *.buildinfo | |
231 | 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 | |
232 | rm -rf .pve-doc-depends | |
233 | 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 | |
c8bdafbd | 234 | rm -rf build-* |