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