]>
Commit | Line | Data |
---|---|---|
410dc2c9 DM |
1 | DGDIR=. |
2 | ASCIIDOC_PMG=./asciidoc-pmg | |
3 | ||
4 | GEN_PACKAGE=pmg-doc-generator | |
5 | DOC_PACKAGE=pmg-docs | |
6 | ||
7 | # also update debian/changelog | |
c901e5bd | 8 | PKGREL=4 |
410dc2c9 DM |
9 | |
10 | ARCH:=$(shell dpkg-architecture -qDEB_BUILD_ARCH) | |
11 | ||
12 | GEN_DEB=${GEN_PACKAGE}_${DOCRELEASE}-${PKGREL}_${ARCH}.deb | |
13 | DOC_DEB=${DOC_PACKAGE}_${DOCRELEASE}-${PKGREL}_all.deb | |
d4fe77a5 | 14 | DOC_BUILDDEPS := dblatex, source-highlight, imagemagick, librsvg2-bin |
410dc2c9 DM |
15 | |
16 | ||
17 | all: index.html | |
18 | ||
19 | .PHONY: verify-images | |
20 | verify-images: png-verify.pl | |
21 | for i in ./images/screenshot/*.png; do ./png-verify.pl $$i; done | |
22 | ||
23 | ADOC_SOURCES_GUESS=$(filter-out %-synopsis.adoc %-opts.adoc %-table.adoc, $(wildcard *.adoc)) | |
24 | .pmg-doc-depends link-refs.json: ${ADOC_SOURCES_GUESS} scan-adoc-refs | |
25 | ./scan-adoc-refs *.adoc --depends .pmg-doc-depends.tmp > link-refs.json.tmp | |
26 | @cmp --quiet .pmg-doc-depends .pmg-doc-depends.tmp || mv .pmg-doc-depends.tmp .pmg-doc-depends | |
27 | @cmp --quiet link-refs.json link-refs.json.tmp || mv link-refs.json.tmp link-refs.json | |
28 | ||
29 | pmg-doc-generator.mk: .pmg-doc-depends pmg-doc-generator.mk.in | |
30 | cat pmg-doc-generator.mk.in .pmg-doc-depends > $@.tmp | |
31 | mv $@.tmp $@ | |
32 | ||
33 | include ./pmg-doc-generator.mk | |
34 | ||
35 | GEN_DEB_SOURCES= \ | |
36 | pmg-doc-generator.mk \ | |
37 | ${MANUAL_SOURCES} \ | |
38 | docinfo.xml | |
39 | ||
f872534d | 40 | GEN_SCRIPTS= \ |
42117962 | 41 | gen-cluster.conf.5-opts.pl \ |
c9fa2593 DM |
42 | gen-fetchmail.conf.5-opts.pl \ |
43 | gen-ldap.conf.5-opts.pl \ | |
44 | gen-pmg.conf.5-opts.pl \ | |
45 | gen-user.conf.5-opts.pl | |
410dc2c9 DM |
46 | |
47 | API_VIEWER_SOURCES= \ | |
48 | api-viewer/index.html \ | |
49 | api-viewer/apidoc.js | |
50 | ||
51 | asciidoc-pmg: asciidoc-pmg.in link-refs.json | |
52 | cat asciidoc-pmg.in link-refs.json >asciidoc-pmg.tmp | |
53 | sed -e s/@RELEASE@/${DOCRELEASE}/ -i asciidoc-pmg.tmp | |
54 | chmod +x asciidoc-pmg.tmp | |
55 | mv asciidoc-pmg.tmp asciidoc-pmg | |
56 | ||
57 | INDEX_INCLUDES= \ | |
58 | pmg-admin-guide.pdf \ | |
59 | pmg-admin-guide.epub \ | |
60 | chapter-index-table.adoc \ | |
61 | man1-index-table.adoc \ | |
62 | man5-index-table.adoc \ | |
63 | man8-index-table.adoc \ | |
64 | $(sort $(addsuffix .html, ${MANUAL_PAGES}) ${CHAPTER_LIST}) | |
65 | ||
66 | ADOC_STDARG=-b $(shell pwd)/asciidoc/pmg-html -f asciidoc/asciidoc-pmg.conf -a icons -a data-uri -a "date=$(shell date)" -a "revnumber=${DOCRELEASE}" | |
67 | ||
68 | BROWSER?=xdg-open | |
69 | ||
70 | ||
71 | README.html: README.adoc | |
72 | asciidoc -a toc ${ADOC_STDARG} -o $@ $< | |
73 | ||
74 | .PHONY: index | |
75 | index: index.html | |
76 | $(BROWSER) index.html & | |
77 | ||
78 | chapter-index-table.adoc: asciidoc-pmg | |
79 | ./asciidoc-pmg chapter-table >$@.tmp | |
80 | mv $@.tmp $@ | |
81 | ||
82 | man1-index-table.adoc: asciidoc-pmg | |
83 | ./asciidoc-pmg man1page-table >$@.tmp | |
84 | mv $@.tmp $@ | |
85 | ||
86 | man5-index-table.adoc: asciidoc-pmg | |
87 | ./asciidoc-pmg man5page-table >$@.tmp | |
88 | mv $@.tmp $@ | |
89 | ||
90 | man8-index-table.adoc: asciidoc-pmg | |
91 | ./asciidoc-pmg man8page-table >$@.tmp | |
92 | mv $@.tmp $@ | |
93 | ||
94 | index.html: index.adoc ${API_VIEWER_SOURCES} ${INDEX_INCLUDES} | |
95 | asciidoc ${ADOC_STDARG} -o $@ index.adoc | |
96 | ||
97 | pmg-admin-guide.html: ${PMG_ADMIN_GUIDE_ADOCDEPENDS} | |
98 | asciidoc -a pmglogo ${ADOC_STDARG} -o $@ pmg-admin-guide.adoc | |
99 | ||
100 | pmg-admin-guide.chunked: ${PMG_ADMIN_GUIDE_ADOCDEPENDS} | |
101 | rm -rf pmg-admin-guide.chunked | |
102 | a2x -a docinfo -a docinfo1 -a icons -f chunked pmg-admin-guide.adoc | |
103 | ||
104 | PMG_DOCBOOK_CONF=-b $(shell pwd)/asciidoc/pmg-docbook -f asciidoc/asciidoc-pmg.conf | |
d4fe77a5 | 105 | PMG_DBLATEX_OPTS='-p ./asciidoc/pmg-dblatex.xsl -s asciidoc/dblatex-custom.sty -c asciidoc/dblatex-export.conf' |
410dc2c9 DM |
106 | |
107 | pmg-admin-guide-docinfo.xml: pmg-admin-guide-docinfo.xml.in | |
108 | sed -e 's/@RELEASE@/${DOCRELEASE}/' <$< >$@ | |
109 | ||
110 | pmg-admin-guide.pdf: ${PMG_ADMIN_GUIDE_ADOCDEPENDS} docinfo.xml pmg-admin-guide-docinfo.xml | |
d4fe77a5 RV |
111 | rsvg-convert -f pdf -o proxmox-logo.pdf images/proxmox-logo.svg |
112 | rsvg-convert -f pdf -o proxmox-ci-header.pdf images/proxmox-ci-header.svg | |
410dc2c9 | 113 | grep ">Release ${DOCRELEASE}<" pmg-admin-guide-docinfo.xml || (echo "wrong release in pmg-admin-guide-docinfo.xml" && false); |
d4fe77a5 | 114 | a2x -a docinfo -a docinfo1 -f pdf -L --asciidoc-opts="${PMG_DOCBOOK_CONF}" --dblatex-opts ${PMG_DBLATEX_OPTS} pmg-admin-guide.adoc |
410dc2c9 DM |
115 | rm proxmox-logo.pdf proxmox-ci-header.pdf |
116 | ||
117 | pmg-admin-guide.epub: ${PMG_ADMIN_GUIDE_ADOCDEPENDS} | |
118 | a2x -f epub --asciidoc-opts="${PMG_DOCBOOK_CONF}" pmg-admin-guide.adoc | |
119 | ||
120 | api-viewer/apidata.js: extractapi.pl | |
121 | ./extractapi.pl >$@ | |
122 | ||
123 | api-viewer/apidoc.js: api-viewer/apidata.js api-viewer/PMGAPI.js | |
124 | cat api-viewer/apidata.js api-viewer/PMGAPI.js >$@ | |
125 | ||
126 | .PHONY: dinstall | |
127 | dinstall: ${GEN_DEB} ${DOC_DEB} | |
128 | dpkg -i ${GEN_DEB} ${DOC_DEB} | |
129 | ||
130 | .PHONY: deb | |
131 | deb: | |
132 | rm -f ${GEN_DEB} ${DOC_DEB} | |
133 | make all-debs | |
134 | ||
135 | .PHONY: all-debs | |
136 | all-debs: ${GEN_DEB} ${DOC_DEB} | |
137 | ||
138 | .PHONY: clean-build | |
139 | clean-build: | |
140 | rm -rf build | |
141 | ||
142 | define prepare_build | |
143 | rm -rf build-$1 | |
144 | mkdir build-$1 | |
145 | cp -a debian build-$1/debian | |
146 | mv build-$1/debian/control.in build-$1/debian/control | |
147 | echo >> build-$1/debian/control | |
148 | cat debian/$1.control >> build-$1/debian/control | |
149 | install -dm755 build-$1/usr/share/$1 | |
150 | install -dm755 build-$1/usr/share/doc/$1 | |
151 | endef | |
152 | ||
153 | .PHONY: gen-deb | |
154 | gen-deb: $(GEN_DEB) | |
155 | $(GEN_DEB): $(GEN_DEB_SOURCES) asciidoc-pmg | |
156 | $(call prepare_build,$(GEN_PACKAGE)) | |
157 | install -dm755 build-$(GEN_PACKAGE)/usr/bin | |
158 | # install files | |
159 | install -m 0644 ${GEN_DEB_SOURCES} build-$(GEN_PACKAGE)/usr/share/${GEN_PACKAGE} | |
f872534d | 160 | install -m 0755 ${GEN_SCRIPTS} build-$(GEN_PACKAGE)/usr/share/${GEN_PACKAGE} |
410dc2c9 DM |
161 | # install asciidoc-pmg |
162 | install -m 0755 asciidoc-pmg build-$(GEN_PACKAGE)/usr/bin/ | |
163 | install -dm755 build-$(GEN_PACKAGE)/usr/share/${GEN_PACKAGE}/asciidoc/ | |
164 | install -m 0644 asciidoc/asciidoc-pmg.conf build-$(GEN_PACKAGE)/usr/share/${GEN_PACKAGE}/asciidoc/ | |
165 | install -m 0644 asciidoc/pmg-html.conf build-$(GEN_PACKAGE)/usr/share/${GEN_PACKAGE}/asciidoc/ | |
166 | cd build-$(GEN_PACKAGE) && dpkg-buildpackage -rfakeroot -b -us -uc | |
167 | lintian ${GEN_DEB} | |
168 | ||
169 | .PHONY: doc-deb | |
170 | doc-deb: $(DOC_DEB) | |
171 | $(DOC_DEB): index.html $(API_VIEWER_SOURCES) verify-images | |
172 | $(call prepare_build,$(DOC_PACKAGE)) | |
173 | sed -i -e '/^Build-Depends/{s/$$/, $(DOC_BUILDDEPS)/}' build-$(DOC_PACKAGE)/debian/control | |
174 | # install files for pmgdocs package | |
175 | install -dm755 build-$(DOC_PACKAGE)/usr/share/${DOC_PACKAGE} | |
176 | install -dm755 build-$(DOC_PACKAGE)/usr/share/doc/${DOC_PACKAGE} | |
177 | install -m 0644 index.html ${INDEX_INCLUDES} build-$(DOC_PACKAGE)/usr/share/${DOC_PACKAGE} | |
178 | # install screenshot images | |
179 | install -dm755 build-$(DOC_PACKAGE)/usr/share/${DOC_PACKAGE}/images/screenshot | |
180 | install -m 0644 images/screenshot/*.png build-$(DOC_PACKAGE)/usr/share/${DOC_PACKAGE}/images/screenshot | |
181 | # install api doc viewer | |
182 | install -dm755 build-$(DOC_PACKAGE)/usr/share/${DOC_PACKAGE}/api-viewer | |
183 | install -m 0644 ${API_VIEWER_SOURCES} build-$(DOC_PACKAGE)/usr/share/${DOC_PACKAGE}/api-viewer | |
184 | cd build-$(DOC_PACKAGE) && dpkg-buildpackage -rfakeroot -b -us -uc | |
185 | lintian ${DOC_DEB} | |
186 | ||
187 | .PHONY: upload | |
188 | upload: ${GEN_DEB} ${DOC_DEB} | |
59f4a7f9 | 189 | tar cf - ${GEN_DEB} ${DOC_DEB} | ssh -X repoman@repo.proxmox.com -- upload --product pmg --dist stretch |
410dc2c9 DM |
190 | |
191 | .PHONY: update | |
192 | update: clean | |
193 | find . -regex '.*-\(opts\|synopsis\)\.adoc' -exec rm -f \{\} \; | |
194 | rm -f api-viewer/apidata.js | |
195 | make all | |
196 | ||
197 | clean: | |
198 | find . -name '*~' -exec rm {} ';' | |
199 | rm -rf *.html *.pdf *.epub *.tmp *.1 *.5 *.8 | |
200 | rm -f *.deb *.changes *.buildinfo | |
93f5feff | 201 | rm -f api-viewer/apidoc.js chapter-*.html *-plain.html chapter-*.html pmg-admin-guide.chunked asciidoc-pmg link-refs.json .asciidoc-pmg-tmp_* pmg-smtp-filter.8-synopsis.adoc pmgpolicy.8-synopsis.adoc pmgsh.1-synopsis.adoc |
410dc2c9 DM |
202 | rm -rf .pmg-doc-depends |
203 | rm -f pmg-doc-generator.mk chapter-index-table.adoc man1-index-table.adoc man5-index-table.adoc man8-index-table.adoc pmg-admin-guide-docinfo.xml | |
204 | rm -rf build-* |