]> git.proxmox.com Git - pve-docs.git/blob - Makefile
mediawiki.conf: simplify footnote rendering (remove <br> tags)
[pve-docs.git] / Makefile
1 DGDIR=.
2 ASCIIDOC_PVE=./asciidoc-pve
3
4 GEN_PACKAGE=pve-doc-generator
5 DOC_PACKAGE=pve-docs
6 MEDIAWIKI_PACKAGE=pve-docs-mediawiki
7
8 # also update debian/changelog
9 PKGREL=10
10
11 GITVERSION:=$(shell cat .git/refs/heads/master)
12
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
17 MEDIAWIKI_DEB=${MEDIAWIKI_PACKAGE}_${DOCRELEASE}-${PKGREL}_all.deb
18
19 all: index.html
20
21 .pve-doc-depends link-refs.json: $(wildcard *.adoc) scan-adoc-refs
22 ./scan-adoc-refs *.adoc --depends .pve-doc-depends.tmp > link-refs.json.tmp
23 @cmp --quiet .pve-doc-depends .pve-doc-depends.tmp || mv .pve-doc-depends.tmp .pve-doc-depends
24 @cmp --quiet link-refs.json link-refs.json.tmp || mv link-refs.json.tmp link-refs.json
25
26 pve-doc-generator.mk: .pve-doc-depends pve-doc-generator.mk.in
27 cat pve-doc-generator.mk.in .pve-doc-depends > $@.tmp
28 mv $@.tmp $@
29
30 include ./pve-doc-generator.mk
31
32 GEN_DEB_SOURCES= \
33 pve-doc-generator.mk \
34 ${MANUAL_SOURCES} \
35 pmxcfs.8-synopsis.adoc \
36 docinfo.xml
37
38 GEN_SCRIPTS= \
39 gen-datacenter.cfg.5-opts.pl \
40 gen-pct.conf.5-opts.pl \
41 gen-pct-network-opts.pl \
42 gen-pct-mountpoint-opts.pl \
43 gen-qm.conf.5-opts.pl \
44 gen-vzdump.conf.5-opts.pl \
45 gen-pve-firewall-cluster-opts.pl \
46 gen-pve-firewall-host-opts.pl \
47 gen-pve-firewall-macros-adoc.pl \
48 gen-pve-firewall-rules-opts.pl \
49 gen-pve-firewall-vm-opts.pl
50
51 API_VIEWER_SOURCES= \
52 api-viewer/index.html \
53 api-viewer/apidoc.js
54
55 asciidoc-pve: asciidoc-pve.in link-refs.json
56 cat asciidoc-pve.in link-refs.json >asciidoc-pve.tmp
57 sed -e s/@RELEASE@/${DOCRELEASE}/ -i asciidoc-pve.tmp
58 chmod +x asciidoc-pve.tmp
59 mv asciidoc-pve.tmp asciidoc-pve
60
61 pve-docs-mediawiki-import: pve-docs-mediawiki-import.in link-refs.json
62 cat pve-docs-mediawiki-import.in link-refs.json > pve-docs-mediawiki-import.tmp
63 chmod +x pve-docs-mediawiki-import.tmp
64 mv pve-docs-mediawiki-import.tmp pve-docs-mediawiki-import
65
66 INDEX_INCLUDES= \
67 pve-admin-guide.pdf \
68 pve-admin-guide.epub \
69 $(sort $(addsuffix .html, ${MANUAL_PAGES}) ${CHAPTER_LIST})
70
71 ADOC_STDARG= -b html5 -a icons -a data-uri -a "date=$(shell date)" -a "revnumber=${DOCRELEASE}"
72
73 BROWSER?=xdg-open
74
75
76 %-nwdiag.svg: %.nwdiag
77 nwdiag -T svg $*.nwdiag -o $@;
78
79 README.html: README.adoc
80 asciidoc ${ADOC_STDARG} -o $@ $<
81
82 .PHONY: index
83 index: index.html
84 $(BROWSER) index.html &
85
86 index.html: index.adoc ${API_VIEWER_SOURCES} ${INDEX_INCLUDES}
87 asciidoc ${ADOC_STDARG} -o $@ index.adoc
88
89 pve-admin-guide.html: ${PVE_ADMIN_GUIDE_ADOCDEPENDS}
90 asciidoc -a pvelogo ${ADOC_STDARG} pve-admin-guide.adoc
91
92 pve-admin-guide.chunked: ${PVE_ADMIN_GUIDE_ADOCDEPENDS}
93 rm -rf pve-admin-guide.chunked
94 a2x -a docinfo -a docinfo1 -a icons -f chunked pve-admin-guide.adoc
95
96 pve-admin-guide.pdf: ${PVE_ADMIN_GUIDE_ADOCDEPENDS} docinfo.xml pve-admin-guide-docinfo.xml
97 inkscape -z -D --export-pdf=proxmox-logo.pdf images/proxmox-logo.svg
98 inkscape -z -D --export-pdf=proxmox-ci-header.pdf images/proxmox-ci-header.svg
99 grep ">Release ${DOCRELEASE}<" pve-admin-guide-docinfo.xml || (echo "wrong release in pve-admin-guide-docinfo.xml" && false);
100 a2x -a docinfo -a docinfo1 -f pdf -L --dblatex-opts "-P latex.output.revhistory=0" --dblatex-opts "-P latex.class.options=12pt" --dblatex-opts "-P doc.section.depth=2 -P toc.section.depth=2" --dblatex-opts "-P doc.publisher.show=0 -s asciidoc/dblatex-custom.sty" pve-admin-guide.adoc
101 rm proxmox-logo.pdf proxmox-ci-header.pdf
102
103 pve-admin-guide.epub: ${PVE_ADMIN_GUIDE_ADOCDEPENDS}
104 a2x -f epub pve-admin-guide.adoc
105
106 api-viewer/apidata.js: extractapi.pl
107 ./extractapi.pl >$@
108
109 api-viewer/apidoc.js: api-viewer/apidata.js api-viewer/PVEAPI.js
110 cat api-viewer/apidata.js api-viewer/PVEAPI.js >$@
111
112 .PHONY: dinstall
113 dinstall: ${GEN_DEB} ${DOC_DEB} ${MEDIAWIKI_DEB}
114 dpkg -i ${GEN_DEB} ${DOC_DEB} ${MEDIAWIKI_DEB}
115
116 .PHONY: deb
117 deb:
118 rm -f ${GEN_DEB} ${DOC_DEB} ${MEDIAWIKI_DEB};
119 make ${GEN_DEB} ${DOC_DEB} ${MEDIAWIKI_DEB};
120
121 ${GEN_DEB} ${DOC_DEB} ${MEDIAWIKI_DEB}: index.html ${INDEX_INCLUDES} ${WIKI_IMPORTS} ${API_VIEWER_SOURCES} ${GEN_DEB_SOURCES} asciidoc-pve pve-docs-mediawiki-import asciidoc/mediawiki.conf
122 rm -rf build
123 mkdir build
124 rsync -a debian/ build/debian
125 cp pve-docs-mediawiki-import build/debian/tree/pve-docs-mediawiki/pve-docs-mediawiki-import
126 echo "git clone git://git.proxmox.com/git/pve-docs.git\\ngit checkout ${GITVERSION}" > build/debian/SOURCE
127 # install files for pve-doc-generator package
128 mkdir -p build/usr/share/${GEN_PACKAGE}
129 mkdir -p build/usr/share/doc/${GEN_PACKAGE}
130 mkdir -p build/usr/bin
131 install -m 0644 ${GEN_DEB_SOURCES} build/usr/share/${GEN_PACKAGE}
132 install -m 0755 ${GEN_SCRIPTS} build/usr/share/${GEN_PACKAGE}
133 install -m 0755 asciidoc-pve build/usr/bin/
134 install -D -m 0644 asciidoc/mediawiki.conf build/etc/asciidoc/mediawiki.conf
135 # install files for pvedocs package
136 mkdir -p build/usr/share/${DOC_PACKAGE}
137 mkdir -p build/usr/share/doc/${DOC_PACKAGE}
138 install -m 0644 index.html ${INDEX_INCLUDES} build/usr/share/${DOC_PACKAGE}
139 install -m 0644 ${WIKI_IMPORTS} build/usr/share/${DOC_PACKAGE}
140 # install api doc viewer
141 mkdir build/usr/share/${DOC_PACKAGE}/api-viewer
142 install -m 0644 ${API_VIEWER_SOURCES} build/usr/share/${DOC_PACKAGE}/api-viewer
143 # build Debian packages
144 cd build; dpkg-buildpackage -rfakeroot -b -us -uc
145 lintian ${GEN_DEB}
146 lintian ${DOC_DEB}
147 lintian ${MEDIAWIKI_DEB}
148
149 .PHONY: upload
150 upload: ${GEN_DEB} ${DOC_DEB} ${MEDIAWIKI_DEB}
151 tar cf - ${GEN_DEB} ${DOC_DEB} ${MEDIAWIKI_DEB} | ssh repoman@repo.proxmox.com upload
152
153 .PHONY: update
154 update: clean
155 find . -regex '.*-\(opts\|synopsis\)\.adoc' -not -name pmxcfs.8-synopsis.adoc -exec rm -f \{\} \;
156 rm -f api-viewer/apidata.js
157 rm -f pve-firewall-macros.adoc pct-network-opts.adoc pct-mountpoint-opts.adoc
158 make all
159
160 clean:
161 rm -rf *.html *.pdf *.epub *.tmp *.1 *.5 *.8 *.deb *.changes build api-viewer/apidoc.js chapter-*.html *-plain.html chapter-*.html pve-admin-guide.chunked asciidoc-pve link-refs.json .asciidoc-pve-tmp_* pve-docs-mediawiki-import .pve-doc-depends pve-doc-generator.mk
162 find . -name '*~' -exec rm {} ';'