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