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