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