You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

Makefile 9.0KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246
  1. include /usr/share/dpkg/pkg-info.mk
  2. # overwriting below ensures that we can build without full PVE installed
  3. DGDIR=.
  4. ASCIIDOC_PVE=./asciidoc-pve
  5. GEN_PACKAGE=pve-doc-generator
  6. DOC_PACKAGE=pve-docs
  7. MEDIAWIKI_PACKAGE=pve-docs-mediawiki
  8. GITVERSION:=$(shell git rev-parse HEAD)
  9. ARCH:=$(shell dpkg-architecture -qDEB_BUILD_ARCH)
  10. GEN_DEB=${GEN_PACKAGE}_${DEB_VERSION_UPSTREAM_REVISION}_${ARCH}.deb
  11. DOC_DEB=${DOC_PACKAGE}_${DEB_VERSION_UPSTREAM_REVISION}_all.deb
  12. MEDIAWIKI_DEB=${MEDIAWIKI_PACKAGE}_${DEB_VERSION_UPSTREAM_REVISION}_all.deb
  13. export SOURCE_DATE_EPOCH ?= $(shell dpkg-parsechangelog -STimestamp)
  14. SOURCE_DATE_HUMAN := $(shell date -d "@${SOURCE_DATE_EPOCH}")
  15. all: index.html
  16. .PHONY: verify-images
  17. verify-images:
  18. for i in ./images/screenshot/*.png; do ./png-verify.pl $$i; done
  19. ADOC_SOURCES_GUESS=$(filter-out %-synopsis.adoc %-opts.adoc %-table.adoc, $(wildcard *.adoc))
  20. .pve-doc-depends link-refs.json: ${ADOC_SOURCES_GUESS} scan-adoc-refs
  21. ./scan-adoc-refs *.adoc --depends .pve-doc-depends.tmp > link-refs.json.tmp
  22. @cmp --quiet .pve-doc-depends .pve-doc-depends.tmp || mv .pve-doc-depends.tmp .pve-doc-depends
  23. @cmp --quiet link-refs.json link-refs.json.tmp || mv link-refs.json.tmp link-refs.json
  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. sed -i "s/@RELEASE@$$/${DEB_VERSION_UPSTREAM}/" $@.tmp
  27. mv $@.tmp $@
  28. -include ./pve-doc-generator.mk
  29. GEN_DEB_SOURCES= \
  30. pve-doc-generator.mk \
  31. ${MANUAL_SOURCES} \
  32. pmxcfs.8-synopsis.adoc \
  33. qmeventd.8-synopsis.adoc \
  34. docinfo.xml
  35. GEN_SCRIPTS= \
  36. gen-ha-groups-opts.pl \
  37. gen-ha-resources-opts.pl \
  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-qm-cloud-init-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. gen-output-format-opts.pl
  51. API_VIEWER_SOURCES= \
  52. api-viewer/index.html \
  53. api-viewer/apidoc.js
  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. pve-docs-mediawiki-import: pve-docs-mediawiki-import.in link-refs.json
  60. cat pve-docs-mediawiki-import.in link-refs.json > pve-docs-mediawiki-import.tmp
  61. chmod +x pve-docs-mediawiki-import.tmp
  62. mv pve-docs-mediawiki-import.tmp pve-docs-mediawiki-import
  63. INDEX_INCLUDES= \
  64. pve-admin-guide.pdf \
  65. pve-admin-guide.epub \
  66. chapter-index-table.adoc \
  67. man1-index-table.adoc \
  68. man5-index-table.adoc \
  69. man8-index-table.adoc \
  70. $(sort $(addsuffix .html, ${MANUAL_PAGES}) ${CHAPTER_LIST})
  71. ADOC_STDARG=-b $(shell pwd)/asciidoc/pve-html -f asciidoc/asciidoc-pve.conf -a icons -a data-uri -a "date=${SOURCE_DATE_HUMAN}" -a "revnumber=${DOCRELEASE}" -a footer-style=revdate
  72. BROWSER?=xdg-open
  73. README.html: README.adoc
  74. asciidoc -a toc ${ADOC_STDARG} -o $@ $<
  75. .PHONY: index
  76. index: index.html
  77. test -z "$${PVE_DOC_INSTANTVIEW}" || $(BROWSER) index.html &
  78. chapter-index-table.adoc: asciidoc-pve
  79. ./asciidoc-pve chapter-table >$@.tmp
  80. mv $@.tmp $@
  81. man1-index-table.adoc: asciidoc-pve
  82. ./asciidoc-pve man1page-table >$@.tmp
  83. mv $@.tmp $@
  84. man5-index-table.adoc: asciidoc-pve
  85. ./asciidoc-pve man5page-table >$@.tmp
  86. mv $@.tmp $@
  87. man8-index-table.adoc: asciidoc-pve
  88. ./asciidoc-pve man8page-table >$@.tmp
  89. mv $@.tmp $@
  90. index.html: index.adoc ${API_VIEWER_SOURCES} ${INDEX_INCLUDES}
  91. asciidoc ${ADOC_STDARG} -o $@ index.adoc
  92. pve-admin-guide.html: ${PVE_ADMIN_GUIDE_ADOCDEPENDS}
  93. asciidoc -a pvelogo ${ADOC_STDARG} -o $@ pve-admin-guide.adoc
  94. pve-admin-guide.chunked: ${PVE_ADMIN_GUIDE_ADOCDEPENDS}
  95. rm -rf $@.tmp $@
  96. mkdir $@.tmp
  97. a2x -D $@.tmp -a docinfo -a docinfo1 -a icons -f chunked pve-admin-guide.adoc
  98. mv $@.tmp/$@ $@
  99. PVE_DOCBOOK_CONF=-b $(shell pwd)/asciidoc/pve-docbook -f asciidoc/asciidoc-pve.conf
  100. PVE_DBLATEX_OPTS='-p ./asciidoc/pve-dblatex.xsl -s asciidoc/dblatex-custom.sty -c asciidoc/dblatex-export.conf'
  101. YEAR:=$(shell date '+%Y')
  102. pve-admin-guide-docinfo.xml: pve-admin-guide-docinfo.xml.in
  103. sed -e 's/@RELEASE@/${DOCRELEASE}/' -e 's/@YEAR@/${YEAR}/' <$< >$@
  104. pve-admin-guide.pdf: ${PVE_ADMIN_GUIDE_ADOCDEPENDS} docinfo.xml pve-admin-guide-docinfo.xml
  105. rsvg-convert -f pdf -o proxmox-logo.pdf images/proxmox-logo.svg
  106. rsvg-convert -f pdf -o proxmox-ci-header.pdf images/proxmox-ci-header.svg
  107. grep ">Release ${DOCRELEASE}<" pve-admin-guide-docinfo.xml || (echo "wrong release in pve-admin-guide-docinfo.xml" && false);
  108. a2x -a docinfo -a docinfo1 -f pdf -L --asciidoc-opts="${PVE_DOCBOOK_CONF}" --dblatex-opts ${PVE_DBLATEX_OPTS} pve-admin-guide.adoc
  109. rm proxmox-logo.pdf proxmox-ci-header.pdf
  110. pve-admin-guide.epub: ${PVE_ADMIN_GUIDE_ADOCDEPENDS}
  111. rm -rf $@.tmp $@
  112. mkdir $@.tmp
  113. a2x -D $@.tmp -f epub --asciidoc-opts="${PVE_DOCBOOK_CONF}" pve-admin-guide.adoc
  114. mv $@.tmp/$@ $@
  115. api-viewer/apidata.js: extractapi.pl
  116. ./extractapi.pl >$@
  117. api-viewer/apidoc.js: api-viewer/apidata.js api-viewer/PVEAPI.js
  118. cat api-viewer/apidata.js api-viewer/PVEAPI.js >$@
  119. .PHONY: dinstall
  120. dinstall: ${GEN_DEB} ${DOC_DEB} ${MEDIAWIKI_DEB}
  121. dpkg -i ${GEN_DEB} ${DOC_DEB} # ${MEDIAWIKI_DEB}
  122. .PHONY: deb
  123. deb: $(DOC_DEB)
  124. $(MEDIAWIKI_DEB) $(GEN_DEB): $(DOC_DEB)
  125. $(DOC_DEB):
  126. rm -f ${GEN_DEB} ${DOC_DEB} ${MEDIAWIKI_DEB}
  127. rm -rf build
  128. rsync -a * build/
  129. echo "git clone git://git.proxmox.com/git/pve-docs.git\\ngit checkout ${GITVERSION}" > build/debian/SOURCE
  130. cd build; dpkg-buildpackage -b -us -uc
  131. lintian $(DOC_DEB) $(GEN_DEB) $(MEDIAWIKI_DEB)
  132. .PHONY: clean-build
  133. clean-build:
  134. rm -rf build
  135. .PHONY: install
  136. install: gen-install doc-install mediawiki-install
  137. .PHONY: gen-install
  138. gen-install: $(GEN_DEB_SOURCES) asciidoc-pve asciidoc/mediawiki.conf
  139. install -dm755 $(DESTDIR)/usr/share/$(GEN_PACKAGE)
  140. install -dm755 $(DESTDIR)/usr/share/doc/$(GEN_PACKAGE)
  141. install -dm755 $(DESTDIR)/usr/bin
  142. # install files
  143. install -m 0644 ${GEN_DEB_SOURCES} $(DESTDIR)/usr/share/${GEN_PACKAGE}
  144. install -m 0755 ${GEN_SCRIPTS} $(DESTDIR)/usr/share/${GEN_PACKAGE}
  145. # install asciidoc-pve
  146. install -m 0755 asciidoc-pve $(DESTDIR)/usr/bin/
  147. install -D -m 0644 asciidoc/mediawiki.conf $(DESTDIR)/usr/share/${GEN_PACKAGE}/asciidoc/mediawiki.conf
  148. install -m 0644 asciidoc/asciidoc-pve.conf $(DESTDIR)/usr/share/${GEN_PACKAGE}/asciidoc/
  149. install -m 0644 asciidoc/pve-html.conf $(DESTDIR)/usr/share/${GEN_PACKAGE}/asciidoc/
  150. .PHONY: doc-install
  151. doc-install: index.html $(WIKI_IMPORTS) $(API_VIEWER_SOURCES) verify-images examples
  152. install -dm755 $(DESTDIR)/usr/share/$(DOC_PACKAGE)
  153. install -dm755 $(DESTDIR)/usr/share/doc/$(DOC_PACKAGE)
  154. # install files for pvedocs package
  155. install -dm755 $(DESTDIR)/usr/share/${DOC_PACKAGE}
  156. install -dm755 $(DESTDIR)/usr/share/doc/${DOC_PACKAGE}
  157. install -dm755 $(DESTDIR)/usr/share/${DOC_PACKAGE}/examples/
  158. install -m 755 examples/guest-example-hookscript.pl $(DESTDIR)/usr/share/${DOC_PACKAGE}/examples/
  159. install -m 0644 index.html ${INDEX_INCLUDES} $(DESTDIR)/usr/share/${DOC_PACKAGE}
  160. install -m 0644 ${WIKI_IMPORTS} $(DESTDIR)/usr/share/${DOC_PACKAGE}
  161. # install images
  162. make -C images install
  163. # install screenshot images
  164. install -dm755 $(DESTDIR)/usr/share/${DOC_PACKAGE}/images/screenshot
  165. install -m 0644 images/screenshot/*.png $(DESTDIR)/usr/share/${DOC_PACKAGE}/images/screenshot
  166. # install api doc viewer
  167. install -dm755 $(DESTDIR)/usr/share/${DOC_PACKAGE}/api-viewer
  168. install -m 0644 ${API_VIEWER_SOURCES} $(DESTDIR)/usr/share/${DOC_PACKAGE}/api-viewer
  169. .PHONY: mediawiki-install
  170. mediawiki-install: pve-docs-mediawiki-import
  171. install -dm755 $(DESTDIR)/usr/share/$(MEDIAWIKI_PACKAGE)
  172. install -dm755 $(DESTDIR)/usr/share/doc/$(MEDIAWIKI_PACKAGE)
  173. install -dm755 $(DESTDIR)/usr/bin
  174. install -dm755 $(DESTDIR)/usr/share/$(MEDIAWIKI_PACKAGE)
  175. install -dm755 $(DESTDIR)/usr/share/doc/$(MEDIAWIKI_PACKAGE)
  176. install -m 0755 pve-docs-mediawiki-import $(DESTDIR)/usr/bin/
  177. .PHONY: upload
  178. upload: ${GEN_DEB} ${DOC_DEB} ${MEDIAWIKI_DEB}
  179. tar cf - ${GEN_DEB} ${DOC_DEB} ${MEDIAWIKI_DEB} | ssh -X repoman@repo.proxmox.com -- upload --product pve --dist buster
  180. .PHONY: update
  181. update:
  182. make clean clean-static
  183. make update-static
  184. make all
  185. .PHONY: update-static
  186. update-static:
  187. make clean-static
  188. make $(filter %-synopsis.adoc %-opts.adoc, ${PVE_ADMIN_GUIDE_ADOCDEPENDS}) pve-firewall-macros.adoc api-viewer/apidata.js
  189. .PHONY: clean-static
  190. clean-static:
  191. find . -regex '.*-\(opts\|synopsis\)\.adoc' -not -name pmxcfs.8-synopsis.adoc -not -name qmeventd.8-synopsis.adoc -exec rm -f \{\} \;
  192. rm -f api-viewer/apidata.js
  193. rm -f pve-firewall-macros.adoc pct-network-opts.adoc pct-mountpoint-opts.adoc
  194. clean:
  195. rm -rf *.html *.pdf *.epub *.tmp *.1 *.5 *.8
  196. rm -f *.deb *.changes *.buildinfo
  197. rm -f 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
  198. rm -rf .pve-doc-depends
  199. rm -f pve-doc-generator.mk chapter-index-table.adoc man1-index-table.adoc man5-index-table.adoc man8-index-table.adoc pve-admin-guide-docinfo.xml
  200. rm -rf build