]> git.proxmox.com Git - pve-docs.git/blobdiff - Makefile
correctly remove temporary xml files
[pve-docs.git] / Makefile
index b4a2830b57db9b8f406773303e096e8ab4e6bf55..93af3ea97032e45a6718394e09c290507a02a61d 100644 (file)
--- a/Makefile
+++ b/Makefile
-RELEASE=4.1
-
-PVESM_SOURCES=attributes.txt pvesm.adoc pvesm.1-synopsis.adoc $(shell ls pve-storage-*.adoc)
-PVEUM_SOURCES=attributes.txt pveum.adoc pveum.1-synopsis.adoc
-VZDUMP_SOURCES=attributes.txt vzdump.adoc vzdump.1-synopsis.adoc
-PVEFW_SOURCES=attributes.txt pve-firewall.adoc pve-firewall-rules-opts.adoc pve-firewall-cluster-opts.adoc pve-firewall-host-opts.adoc pve-firewall-vm-opts.adoc pve-firewall-macros.adoc pve-firewall.8-synopsis.adoc
-QM_SOURCES=attributes.txt qm.adoc qm.1-synopsis.adoc
-PCT_SOURCES=attributes.txt pct.adoc pct.1-synopsis.adoc
-PVEAM_SOURCES=attributes.txt pveam.adoc pveam.1-synopsis.adoc
-HA_SOURCES=attributes.txt ha-manager.1-synopsis.adoc ha-manager.adoc
-
-SYSADMIN_SOURCES=                      \
-       getting-help.adoc               \
-       pve-package-repos.adoc          \
-       pve-installation.adoc           \
-       system-software-updates.adoc    \
-       sysadmin.adoc
+DGDIR=.
 
-PVE_ADMIN_GUIDE_SOURCES=               \
-       datacenter.cfg.adoc             \
-       datacenter.cfg.5-opts.adoc      \
-       vm.conf.adoc                    \
-       vm.conf.5-opts.adoc             \
-       pct.conf.adoc                   \
-       pct.conf.5-opts.adoc            \
-       ${SYSADMIN_SOURCES}             \
-       pve-admin-guide.adoc            \
-       pve-intro.adoc                  \
-       pmxcfs.adoc                     \
-       pve-faq.adoc                    \
-       ${QM_SOURCES}                   \
-       ${PCT_SOURCES}                  \
-       ${PVEAM_SOURCES}                \
-       ${PVEFW_SOURCES}                \
-       ${PVEUM_SOURCES}                \
-       ${PVESM_SOURCES}                \
-       ${VZDUMP_SOURCES}               \
-       ${HA_SOURCES}                   \
-       images/cluster-nwdiag.svg       \
-       images/node-nwdiag.svg          \
-       pve-bibliography.adoc           \
-       GFDL.adoc                       \
-       attributes.txt
+include ./pve-doc-generator.mk
 
-ADOC_STDARG= -a icons -a data-uri -a "date=$(shell date)"
-ADOC_MAN1_HTML_ARGS=-a "manvolnum=1" ${ADOC_STDARG} -a "revnumber=${RELEASE}"
-ADOC_MAN5_HTML_ARGS=-a "manvolnum=5" ${ADOC_STDARG} -a "revnumber=${RELEASE}"
-ADOC_MAN8_HTML_ARGS=-a "manvolnum=8" ${ADOC_STDARG} -a "revnumber=${RELEASE}"
+GEN_PACKAGE=pve-doc-generator
+DOC_PACKAGE=pve-docs
 
-BROWSER?=xdg-open
+# also update debian/changelog
+PKGREL=5
 
-all: pve-admin-guide.html
+GITVERSION:=$(shell cat .git/refs/heads/master)
 
-%-nwdiag.svg: %.nwdiag
-       nwdiag -T svg $*.nwdiag -o $@;
+GEN_DEB=${GEN_PACKAGE}_${DOCRELEASE}-${PKGREL}_amd64.deb
+DOC_DEB=${DOC_PACKAGE}_${DOCRELEASE}-${PKGREL}_all.deb
 
-%.1-synopsis.adoc:
-       perl -e "use PVE::CLI::$(subst -,_,$*);print PVE::CLI::$(subst -,_,$*)->generate_asciidoc_synopsys();" > $@.tmp
-       mv $@.tmp $@
+CHAPTER_LIST=          \
+       sysadmin        \
+       pvecm           \
+       pmxcfs          \
+       pvesm           \
+       qm              \
+       pve-firewall    \
+       pveum           \
+       pct             \
+       ha-manager      \
+       vzdump          \
+       pve-faq         \
+       pve-bibliography
 
-%.1: %.adoc %.1-synopsis.adoc docinfo.xml
-       a2x -a docinfo1 -a "manvolnum=1" -a "manversion=Release ${RELEASE}" -f manpage $*.adoc
-       test -z "$${NOVIEW}" && man -l $@
+STORAGE_TYPES=         \
+       dir             \
+       glusterfs       \
+       iscsi           \
+       iscsidirect     \
+       lvm             \
+       lvmthin         \
+       nfs             \
+       rbd             \
+       zfspool
 
-%.1.html: %.adoc %.1-synopsis.adoc docinfo.xml
-       asciidoc ${ADOC_MAN1_HTML_ARGS} -o $@ $*.adoc
-       test -z "$${NOVIEW}" && $(BROWSER) $@ &
+COMMAND_LIST=          \
+       pvesubscription \
+       pvecm           \
+       qm              \
+       qmrestore       \
+       pveceph         \
+       pct             \
+       pveam           \
+       pvesm           \
+       pveum           \
+       vzdump          \
+       ha-manager
 
+SERVICE_LIST=          \
+       pve-firewall    \
+       pve-ha-crm      \
+       pve-ha-lrm      \
+       pvestatd        \
+       pmxcfs          \
+       pveproxy        \
+       spiceproxy      \
+       pvedaemon
 
-%.8-synopsis.adoc:
-       perl -e "use PVE::Service::$(subst -,_,$*);print PVE::Service::$(subst -,_,$*)->generate_asciidoc_synopsys();" > $@.tmp
-       mv $@.tmp $@
+CONFIG_LIST=datacenter.cfg qm.conf pct.conf
 
-%.8: %.adoc %.8-synopsis.adoc docinfo.xml
-       a2x -a docinfo1 -a "manvolnum=8" -a "manversion=Release ${RELEASE}" -f manpage $*.adoc
-       test -z "$${NOVIEW}" && man -l $@
+GEN_DEB_SOURCES=                               \
+       pve-doc-generator.mk                    \
+       attributes.txt                          \
+       $(addsuffix .adoc, ${COMMAND_LIST})     \
+       $(addsuffix .adoc, ${SERVICE_LIST})     \
+       $(addsuffix .adoc, ${CONFIG_LIST})      \
+       pve-storage-dir.adoc                    \
+       pve-storage-glusterfs.adoc              \
+       pve-storage-iscsi.adoc                  \
+       pve-storage-iscsidirect.adoc            \
+       pve-storage-lvm.adoc                    \
+       pve-storage-nfs.adoc                    \
+       pve-storage-rbd.adoc                    \
+       pve-storage-zfspool.adoc                \
+       pmxcfs.8-cli.adoc                       \
+       pve-copyright.adoc                      \
+       docinfo.xml
 
-%.8.html: %.adoc %.8-synopsis.adoc docinfo.xml
-       asciidoc ${ADOC_MAN8_HTML_ARGS} -o $@ $*.adoc
-       test -z "$${NOVIEW}" && $(BROWSER) $@ &
+GEN_SCRIPTS=                                   \
+       gen-datacenter.cfg.5-opts.pl            \
+       gen-pct.conf.5-opts.pl                  \
+       gen-pct-network-opts.pl                 \
+       gen-pct-mountpoint-opts.pl              \
+       gen-qm.conf.5-opts.pl                   \
+       gen-vzdump.conf.5-opts.pl               \
+       gen-pve-firewall-cluster-opts.pl        \
+       gen-pve-firewall-host-opts.pl           \
+       gen-pve-firewall-macros-adoc.pl         \
+       gen-pve-firewall-rules-opts.pl          \
+       gen-pve-firewall-vm-opts.pl
 
-pve-firewall-cluster-opts.adoc:
-       ./gen-pve-firewall-cluster-opts.pl >$@.tmp
-       mv $@.tmp $@
+SYSADMIN_SOURCES=                              \
+       getting-help.adoc                       \
+       pve-package-repos.adoc                  \
+       pve-installation.adoc                   \
+       system-software-updates.adoc            \
+       sysadmin.adoc
 
-pve-firewall-host-opts.adoc:
-       ./gen-pve-firewall-host-opts.pl >$@.tmp
-       mv $@.tmp $@
+API_VIEWER_SOURCES=                            \
+       api-viewer/index.html                   \
+       api-viewer/apidoc.js
 
-pve-firewall-vm-opts.adoc:
-       ./gen-pve-firewall-vm-opts.pl >$@.tmp
-       mv $@.tmp $@
+PVE_ADMIN_GUIDE_SOURCES=                       \
+       ${DATACENTER_CONF_MAN5_SOURCES}         \
+       ${QM_CONF_MAN5_SOURCES}                 \
+       ${PCT_CONF_MAN5_SOURCES}                \
+       ${SYSADMIN_SOURCES}                     \
+       pve-admin-guide.adoc                    \
+       pve-intro.adoc                          \
+       pmxcfs.adoc                             \
+       pmxcfs.8-cli.adoc                       \
+       pve-faq.adoc                            \
+       ${PVE_FIREWALL_MAN8_SOURCES}            \
+       ${PVESM_MAN1_SOURCES}                   \
+       ${PCT_MAN1_SOURCES}                     \
+       ${PVECM_MAN1_SOURCES}                   \
+       ${PVEUM_MAN1_SOURCES}                   \
+       ${QM_MAN1_SOURCES}                      \
+       ${QMRESTORE_MAN1_SOURCES}               \
+       ${HA_MANAGER_MAN1_SOURCES}              \
+       ${PVESTATD_MAN8_SOURCES}                \
+       ${PVEDAEMON_MAN8_SOURCES}               \
+       ${PVEPROXY_MAN8_SOURCES}                \
+       ${SPICEPROXY_MAN8_SOURCES}              \
+       ${PVE_HA_CRM_MAN8_SOURCES}              \
+       ${PVE_HA_LRM_MAN8_SOURCES}              \
+       ${VZDUMP_MAN1_SOURCES}                  \
+       ${PVEAM_MAN1_SOURCES}                   \
+       ${PVESUBSCRIPTION_MAN1_SOURCES}         \
+       ${PVECEPH_MAN1_SOURCES}                 \
+       pve-bibliography.adoc                   \
+       $(addsuffix .adoc, ${COMMAND_LIST})     \
+       $(addsuffix .adoc, ${SERVICE_LIST})     \
+       $(addsuffix .adoc, ${CONFIG_LIST})      \
+       GFDL.adoc                               \
+       attributes.txt
+
+WIKI_IMPORTS=                                                          \
+       $(addsuffix -plain.html, $(addprefix chapter-, ${CHAPTER_LIST}))\
+       $(addsuffix .5-plain.html, ${CONFIG_LIST})                      \
+       $(addsuffix -plain.html, $(addprefix pve-storage-, ${STORAGE_TYPES}))
 
-pve-firewall-rules-opts.adoc:
-       ./gen-pve-firewall-rules-opts-adoc.pl >$@.tmp
-       mv $@.tmp $@
+INDEX_INCLUDES=                                                                \
+       pve-admin-guide.pdf                                             \
+       pve-admin-guide.html                                            \
+       pve-admin-guide.epub                                            \
+       $(addsuffix .1.html, ${COMMAND_LIST})                           \
+       $(addsuffix .8.html, ${SERVICE_LIST})                           \
+       $(addsuffix .5.html, ${CONFIG_LIST})                            \
+       $(addsuffix .html, $(addprefix chapter-, ${CHAPTER_LIST}))
 
-pve-firewall-macros.adoc:
-       ./gen-pve-firewall-macros-adoc.pl >$@.tmp
-       mv $@.tmp $@
+ADOC_STDARG= -a icons -a data-uri -a "date=$(shell date)" -a "revnumber=${DOCRELEASE}"
+ADOC_MAN1_HTML_ARGS=-a "manvolnum=1" ${ADOC_STDARG}
+ADOC_MAN5_HTML_ARGS=-a "manvolnum=5" ${ADOC_STDARG}
+ADOC_MAN8_HTML_ARGS=-a "manvolnum=8" ${ADOC_STDARG}
+
+BROWSER?=xdg-open
 
-datacenter.cfg.5-opts.adoc:
-       ./gen-datacenter-cfg-opts-adoc.pl >$@.tmp
-       mv $@.tmp $@
+all: index.html
+
+%-nwdiag.svg: %.nwdiag
+       nwdiag -T svg $*.nwdiag -o $@;
 
-vm.conf.5-opts.adoc:
-       ./gen-vm-conf-opts-adoc.pl >$@.tmp
-       mv $@.tmp $@
+chapter-%.html: %.adoc ${PVE_COMMON_DOC_SOURCES}
+       asciidoc ${ADOC_STDARG} -a toc -o $@ $*.adoc
 
-pct.conf.5-opts.adoc:
-       ./gen-pct-conf-opts-adoc.pl >$@.tmp
-       mv $@.tmp $@
+chapter-%-plain.html: %.adoc ${PVE_COMMON_DOC_SOURCES}
+       asciidoc -s -a wiki ${ADOC_STDARG} -o $@ $*.adoc
 
-%.5: %.adoc %.5-opts.adoc docinfo.xml
-       a2x -a docinfo1 -a "manvolnum=5" -a "manversion=Release ${RELEASE}" -f manpage $*.adoc
-       test -z "$${NOVIEW}" && man -l $@
+pve-storage-%-plain.html: pve-storage-%.adoc ${PVE_COMMON_DOC_SOURCES}
+       asciidoc -s -a wiki -a 'leveloffset=-1' ${ADOC_STDARG} -o $@ pve-storage-$*.adoc
 
-%.5.html: %.adoc %.5-opts.adoc docinfo.xml
+%.1.html: %.adoc %.1-synopsis.adoc ${PVE_COMMON_DOC_SOURCES}
+       asciidoc ${ADOC_MAN1_HTML_ARGS} -o $@ $*.adoc
+
+pmxcfs.8.html: pmxcfs.adoc pmxcfs.8-cli.adoc ${PVE_COMMON_DOC_SOURCES}
+       asciidoc ${ADOC_MAN8_HTML_ARGS} -o $@ pmxcfs.adoc
+
+%.8.html: %.adoc %.8-synopsis.adoc ${PVE_COMMON_DOC_SOURCES}
+       asciidoc ${ADOC_MAN8_HTML_ARGS} -o $@ $*.adoc
+
+%.5.html: %.adoc %.5-opts.adoc ${PVE_COMMON_DOC_SOURCES}
        asciidoc ${ADOC_MAN5_HTML_ARGS} -o $@ $*.adoc
-       test -z "$${NOVIEW}" && $(BROWSER) $@ &
 
-index.html: index.adoc ${PVE_ADMIN_GUIDE_SOURCES}
-       $(MAKE) NOVIEW=1 pve-admin-guide.pdf pve-admin-guide.html pve-admin-guide.epub
-       $(MAKE) NOVIEW=1 qm.1.html pct.1.html pveam.1.html pvesm.1.html pveum.1.html vzdump.1.html pve-firewall.8.html ha-manager.1.html datacenter.cfg.5.html vm.conf.5.html pct.conf.5.html
-       asciidoc -a "date=$(shell date)" -a "revnumber=${RELEASE}" index.adoc
+%.5-plain.html: %.adoc %.5-opts.adoc ${PVE_COMMON_DOC_SOURCES}
+       asciidoc -s ${ADOC_MAN5_HTML_ARGS} -o $@ $*.adoc
+
+.PHONY: index
+index: index.html
        $(BROWSER) index.html &
 
+index.html: index.adoc ${API_VIEWER_SOURCES} ${INDEX_INCLUDES} 
+       asciidoc -a "date=$(shell date)" -a "revnumber=${DOCRELEASE}" index.adoc
+
 pve-admin-guide.html: ${PVE_ADMIN_GUIDE_SOURCES}
-       asciidoc -a "revnumber=${RELEASE}" -a "date=$(shell date)" pve-admin-guide.adoc
-       test -z "$${NOVIEW}" && $(BROWSER) $@ &
+       asciidoc -a "revnumber=${DOCRELEASE}" -a "date=$(shell date)" pve-admin-guide.adoc
+
+pve-admin-guide.chunked: ${PVE_ADMIN_GUIDE_SOURCES}
+       rm -rf pve-admin-guide.chunked
+       a2x -a docinfo -a docinfo1 -a icons -f chunked pve-admin-guide.adoc
 
 pve-admin-guide.pdf: ${PVE_ADMIN_GUIDE_SOURCES} docinfo.xml pve-admin-guide-docinfo.xml
-       grep ">Release ${RELEASE}<" pve-admin-guide-docinfo.xml || (echo "wrong release in  pve-admin-guide-docinfo.xml" && false);
-       a2x -a docinfo -a docinfo1 -f pdf -L --dblatex-opts "-P latex.output.revhistory=0" --dblatex-opts "-P latex.class.options=12pt" pve-admin-guide.adoc
-       test -z "$${NOVIEW}" && $(BROWSER) $@ &
+       grep ">Release ${DOCRELEASE}<" pve-admin-guide-docinfo.xml || (echo "wrong release in  pve-admin-guide-docinfo.xml" && false);
+       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" pve-admin-guide.adoc
 
 pve-admin-guide.epub: ${PVE_ADMIN_GUIDE_SOURCES}
        a2x -f epub pve-admin-guide.adoc
-       test -z "$${NOVIEW}" && $(BROWSER) $@ &
 
+api-viewer/apidata.js: extractapi.pl
+       ./extractapi.pl >$@
+
+api-viewer/apidoc.js: api-viewer/apidata.js api-viewer/PVEAPI.js
+       cat api-viewer/apidata.js api-viewer/PVEAPI.js >$@
+
+.PHONY: dinstall
+dinstall: ${GEN_DEB} ${DOC_DEB}
+       dpkg -i ${GEN_DEB} ${DOC_DEB}
+
+.PHONY: deb
+deb:
+       rm -f ${GEN_DEB} ${DOC_DEB};
+       make ${GEN_DEB};
+       make ${DOC_DEB};
+
+${GEN_DEB} ${DOC_DEB}: index.html ${INDEX_INCLUDES} ${WIKI_IMPORTS} ${API_VIEWER_SOURCES} ${GEN_DEB_SOURCES}
+       rm -rf build
+       mkdir build
+       rsync -a debian/ build/debian
+       echo "git clone git://git.proxmox.com/git/pve-docs.git\\ngit checkout ${GITVERSION}" > build/debian/SOURCE
+       # install files for pve-doc-generator package
+       mkdir -p build/usr/share/${GEN_PACKAGE}
+       mkdir -p build/usr/share/doc/${GEN_PACKAGE}
+       install -m 0644 ${GEN_DEB_SOURCES} build/usr/share/${GEN_PACKAGE}
+       install -m 0755 ${GEN_SCRIPTS} build/usr/share/${GEN_PACKAGE}
+       # install files for pvedocs package
+       mkdir -p build/usr/share/${DOC_PACKAGE}
+       mkdir -p build/usr/share/doc/${DOC_PACKAGE}
+       install -m 0644 index.html ${INDEX_INCLUDES} build/usr/share/${DOC_PACKAGE}
+       install -m 0644 ${WIKI_IMPORTS} build/usr/share/${DOC_PACKAGE}
+       # install api doc viewer
+       mkdir build/usr/share/${DOC_PACKAGE}/api-viewer
+       install -m 0644 ${API_VIEWER_SOURCES} build/usr/share/${DOC_PACKAGE}/api-viewer
+       # build debain package
+       cd build; dpkg-buildpackage -rfakeroot -b -us -uc
+       lintian ${GEN_DEB}
+       lintian ${DOC_DEB}
+
+.PHONY: upload
+upload: ${GEN_DEB} ${DOC_DEB}
+       umount /pve/${DOCRELEASE}; mount /pve/${DOCRELEASE} -o rw
+       mkdir -p /pve/${DOCRELEASE}/extra
+       rm -f /pve/${DOCRELEASE}/extra/${GEN_PACKAGE}_*.deb
+       rm -f /pve/${DOCRELEASE}/extra/${DOC_PACKAGE}_*.deb
+       rm -f /pve/${DOCRELEASE}/extra/Packages*
+       cp ${GEN_DEB} ${DOC_DEB} /pve/${DOCRELEASE}/extra
+       cd /pve/${DOCRELEASE}/extra; dpkg-scanpackages . /dev/null > Packages; gzip -9c Packages > Packages.gz
+       umount /pve/${DOCRELEASE}; mount /pve/${DOCRELEASE} -o ro
+
+.PHONY: update
 update: clean
-       rm -f *.5-opts.adoc .1-synopsis.adoc .8-synopsis.adoc
+       rm -f *.5-opts.adoc *.1-synopsis.adoc *.8-synopsis.adoc
+       rm -f api-viewer/apidata.js
+       rm -f pve-firewall-macros.adoc pct-network-opts.adoc pct-mountpoint-opts.adoc
        make all
 
-clean:
-       rm -rf *~ *.html *.pdf *.epub *.tmp *.1 *.5 *.8
+clean: 
+       rm -rf *.tmp.xml *.html *.pdf *.epub *.tmp *.1 *.5 *.8 *.deb *.changes build api-viewer/apidoc.js chapter-*.html chapter-*-plain.html chapter-*.html pve-admin-guide.chunked
+       find . -name '*~' -exec rm {} ';'