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