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