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