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.

pve-doc-generator.mk.in 3.1KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104
  1. DOCRELEASE=@RELEASE@
  2. DGDIR?=/usr/share/pve-doc-generator
  3. ASCIIDOC_PVE?=/usr/bin/asciidoc-pve
  4. PERL_DOC_ENV=PVE_GENERATING_DOCS=1
  5. PERL_DOC_INC_DIRS:=${PERL_DOC_INC_DIRS} .
  6. PERL_DOC_INC=$(foreach dir,${PERL_DOC_INC_DIRS},-I${dir})
  7. PVE_COMMON_DOC_SOURCES= \
  8. ${ASCIIDOC_PVE} \
  9. pve-copyright.adoc \
  10. docinfo.xml
  11. all:
  12. attributes.txt docinfo.xml pmxcfs.8-synopsis.adoc qmeventd.8-synopsis.adoc:
  13. cp ${DGDIR}/$@ $@.tmp
  14. mv $@.tmp $@
  15. %-opts.adoc: ${DGDIR}/gen-%-opts.pl
  16. $(PERL_DOC_ENV) perl ${PERL_DOC_INC} ${DGDIR}/gen-$*-opts.pl >$@.tmp
  17. mv $@.tmp $@
  18. %.adoc: ${DGDIR}/gen-%-adoc.pl
  19. $(PERL_DOC_ENV) perl ${PERL_DOC_INC} ${DGDIR}/gen-$*-adoc.pl >$@.tmp
  20. mv $@.tmp $@
  21. pveperf.1-synopsis.adoc:
  22. echo '*pveperf* `[PATH]`' > pveperf.1-synopsis.adoc
  23. %.1-synopsis.adoc:
  24. $(PERL_DOC_ENV) perl ${PERL_DOC_INC} -e "use PVE::CLI::$(subst -,_,$*);print PVE::CLI::$(subst -,_,$*)->generate_asciidoc_synopsis();" > $@.tmp
  25. mv $@.tmp $@
  26. %.8-synopsis.adoc:
  27. $(PERL_DOC_ENV) perl ${PERL_DOC_INC} -e "use PVE::Service::$(subst -,_,$*);print PVE::Service::$(subst -,_,$*)->generate_asciidoc_synopsis();" > $@.tmp
  28. mv $@.tmp $@
  29. ifneq (${DGDIR},.)
  30. %.adoc: ${DGDIR}/%.adoc
  31. cp $< $@.tmp
  32. mv $@.tmp $@
  33. endif
  34. %.service-bash-completion:
  35. perl ${PERL_DOC_INC} -T -e "use PVE::Service::$*; PVE::Service::$*->generate_bash_completions();" >$@.tmp
  36. mv $@.tmp $@
  37. %.bash-completion:
  38. perl ${PERL_DOC_INC} -T -e "use PVE::CLI::$*; PVE::CLI::$*->generate_bash_completions();" >$@.tmp
  39. mv $@.tmp $@
  40. %.service-zsh-completion:
  41. perl ${PERL_DOC_INC} -T -e "use PVE::Service::$*; PVE::Service::$*->generate_zsh_completions();" >$@.tmp
  42. mv $@.tmp $@
  43. %.zsh-completion:
  44. perl ${PERL_DOC_INC} -T -e "use PVE::CLI::$*; PVE::CLI::$*->generate_zsh_completions();" >$@.tmp
  45. mv $@.tmp $@
  46. %.service-api-verified:
  47. perl ${PERL_DOC_INC} -T -e "use PVE::Service::$*; PVE::Service::$*->verify_api();"
  48. touch $@
  49. %.api-verified:
  50. perl ${PERL_DOC_INC} -T -e "use PVE::CLI::$*; PVE::CLI::$*->verify_api();"
  51. touch $@
  52. %-plain.html: %.adoc ${PVE_COMMON_DOC_SOURCES}
  53. ${ASCIIDOC_PVE} compile-wiki -o $@ $*.adoc
  54. chapter-%.html: %.adoc ${PVE_COMMON_DOC_SOURCES}
  55. ${ASCIIDOC_PVE} compile-chapter -o $@ $*.adoc
  56. %.1: %.adoc %.1-synopsis.adoc ${PVE_COMMON_DOC_SOURCES}
  57. ${ASCIIDOC_PVE} compile-man -o $@ $*.adoc
  58. test -z "$${PVE_DOC_INSTANTVIEW}" || man -l $@
  59. %.1.html: %.adoc %.1-synopsis.adoc ${PVE_COMMON_DOC_SOURCES}
  60. ${ASCIIDOC_PVE} compile-man-html -o $@ $*.adoc
  61. %.8: %.adoc %.8-synopsis.adoc ${PVE_COMMON_DOC_SOURCES}
  62. ${ASCIIDOC_PVE} compile-man -o $@ $*.adoc
  63. test -z "$${PVE_DOC_INSTANTVIEW}" || man -l $@
  64. %.8.html: %.adoc %.8-synopsis.adoc ${PVE_COMMON_DOC_SOURCES}
  65. ${ASCIIDOC_PVE} compile-man-html -o $@ $*.adoc
  66. %.5: %.adoc %.5-opts.adoc ${PVE_COMMON_DOC_SOURCES}
  67. ${ASCIIDOC_PVE} compile-man -o $@ $*.adoc
  68. test -z "$${PVE_DOC_INSTANTVIEW}" || man -l $@
  69. %.5.html: %.adoc %.5-opts.adoc ${PVE_COMMON_DOC_SOURCES}
  70. ${ASCIIDOC_PVE} compile-man-html -o $@ $*.adoc
  71. %.5-plain.html: %.adoc %.5-opts.adoc ${PVE_COMMON_DOC_SOURCES}
  72. ${ASCIIDOC_PVE} compile-man-wiki -o $@ $*.adoc
  73. .PHONY: cleanup-docgen
  74. cleanup-docgen:
  75. rm -f *.xml.tmp *.1 *.5 *.8 *.adoc docinfo.xml