1
0

Makefile 9.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231
  1. # Makefile for Sphinx documentation
  2. #
  3. # You can set these variables from the command line.
  4. SPHINXOPTS =
  5. SPHINXBUILD = sphinx-build
  6. PAPER =
  7. BUILDDIR = _build
  8. SPHINXLANG =
  9. XELATEX = xelatex
  10. # ----- Translations Support ------------------------------------------------>
  11. # If language is set, also set translation options
  12. ifeq ($(shell [ "x$(SPHINXLANG)" != "x" ] && echo 0 || echo 1), 0)
  13. TRANSLATIONOPTS = -D language='$(SPHINXLANG)'
  14. else
  15. TRANSLATIONOPTS =
  16. endif
  17. # Reset settings if sphinx-intl is not available
  18. ifeq ($(shell which sphinx-intl >/dev/null 2>&1; echo $$?), 1)
  19. SPHINXLANG =
  20. TRANSLATIONOPTS =
  21. endif
  22. # <---- Translations Support -------------------------------------------------
  23. # Internal variables.
  24. PAPEROPT_a4 = -D latex_paper_size=a4
  25. PAPEROPT_letter = -D latex_paper_size=letter
  26. ALLSPHINXOPTS = -d $(BUILDDIR)/doctrees $(PAPEROPT_$(PAPER)) $(TRANSLATIONOPTS) $(SPHINXOPTS) .
  27. # the i18n builder cannot share the environment and doctrees with the others
  28. I18NSPHINXOPTS = $(PAPEROPT_$(PAPER)) $(SPHINXOPTS) .
  29. .PHONY: help clean check_sphinx-build html dirhtml singlehtml pickle json htmlhelp qthelp devhelp epub latex latexpdf text man changes linkcheck doctest gettext translations download-translations
  30. help:
  31. @echo "Please use \`make <target>' where <target> is one of"
  32. @echo " html to make standalone HTML files"
  33. @echo " dirhtml to make HTML files named index.html in directories"
  34. @echo " singlehtml to make a single large HTML file"
  35. @echo " pickle to make pickle files"
  36. @echo " json to make JSON files"
  37. @echo " htmlhelp to make HTML files and a HTML help project"
  38. @echo " qthelp to make HTML files and a qthelp project"
  39. @echo " devhelp to make HTML files and a Devhelp project"
  40. @echo " epub to make an epub"
  41. @echo " latex to make LaTeX files, you can set PAPER=a4 or PAPER=letter"
  42. @echo " pdf to make Salt-all.pdf and splitted pdf using xelatex"
  43. @echo " cheatsheet to create salt-cheatsheet.pdf"
  44. @echo " latexpdf to make LaTeX files and run them through pdflatex"
  45. @echo " latexpdfja to make LaTeX files and run them through platex/dvipdfmx"
  46. @echo " text to make text files"
  47. @echo " man to make manual pages"
  48. @echo " texinfo to make Texinfo files"
  49. @echo " info to make Texinfo files and run them through makeinfo"
  50. @echo " gettext to make PO message catalogs"
  51. @echo " changes to make an overview of all changed/added/deprecated items"
  52. @echo " xml to make Docutils-native XML files"
  53. @echo " pseudoxml to make pseudoxml-XML files for display purposes"
  54. @echo " linkcheck to check all external links for integrity"
  55. @echo " doctest to run all doctests embedded in the documentation (if enabled)"
  56. clean:
  57. rm -rf $(BUILDDIR)/*
  58. test -d 'locale' && find locale/ -name *.mo -exec rm {} \; || true
  59. # User-friendly check for sphinx-build
  60. check_sphinx-build:
  61. @which $(SPHINXBUILD) >/dev/null 2>&1 || (echo "The '$(SPHINXBUILD)' command was not found. Make sure you have Sphinx installed, then set the SPHINXBUILD environment variable to point to the full path of the '$(SPHINXBUILD)' executable. Alternatively you can add the directory with the executable to your PATH. If you don't have Sphinx installed, grab it from http://www.sphinx-doc.org/en/master/)" >&2; false)
  62. html: check_sphinx-build translations
  63. $(SPHINXBUILD) -b html $(ALLSPHINXOPTS) $(BUILDDIR)/html
  64. @echo
  65. @echo "Build finished. The HTML pages are in $(BUILDDIR)/html."
  66. dirhtml: check_sphinx-build translations
  67. $(SPHINXBUILD) -b dirhtml $(ALLSPHINXOPTS) $(BUILDDIR)/dirhtml
  68. @echo
  69. @echo "Build finished. The HTML pages are in $(BUILDDIR)/dirhtml."
  70. singlehtml: check_sphinx-build translations
  71. $(SPHINXBUILD) -b singlehtml $(ALLSPHINXOPTS) $(BUILDDIR)/singlehtml
  72. @echo
  73. @echo "Build finished. The HTML page is in $(BUILDDIR)/singlehtml."
  74. pickle: check_sphinx-build translations
  75. $(SPHINXBUILD) -b pickle $(ALLSPHINXOPTS) $(BUILDDIR)/pickle
  76. @echo
  77. @echo "Build finished; now you can process the pickle files."
  78. json: check_sphinx-build translations
  79. $(SPHINXBUILD) -b json $(ALLSPHINXOPTS) $(BUILDDIR)/json
  80. @echo
  81. @echo "Build finished; now you can process the JSON files."
  82. htmlhelp: check_sphinx-build translations
  83. $(SPHINXBUILD) -b htmlhelp $(ALLSPHINXOPTS) $(BUILDDIR)/htmlhelp
  84. @echo
  85. @echo "Build finished; now you can run HTML Help Workshop with the" \
  86. ".hhp project file in $(BUILDDIR)/htmlhelp."
  87. qthelp: check_sphinx-build translations
  88. $(SPHINXBUILD) -b qthelp $(ALLSPHINXOPTS) $(BUILDDIR)/qthelp
  89. @echo
  90. @echo "Build finished; now you can run "qcollectiongenerator" with the" \
  91. ".qhcp project file in $(BUILDDIR)/qthelp, like this:"
  92. @echo "# qcollectiongenerator $(BUILDDIR)/qthelp/Salt.qhcp"
  93. @echo "To view the help file:"
  94. @echo "# assistant -collectionFile $(BUILDDIR)/qthelp/Salt.qhc"
  95. devhelp: check_sphinx-build translations
  96. $(SPHINXBUILD) -b devhelp $(ALLSPHINXOPTS) $(BUILDDIR)/devhelp
  97. @echo
  98. @echo "Build finished."
  99. @echo "To view the help file:"
  100. @echo "# mkdir -p $$HOME/.local/share/devhelp/Salt"
  101. @echo "# ln -s $(BUILDDIR)/devhelp $$HOME/.local/share/devhelp/Salt"
  102. @echo "# devhelp"
  103. epub: check_sphinx-build translations
  104. $(SPHINXBUILD) -b epub $(ALLSPHINXOPTS) $(BUILDDIR)/epub
  105. @echo
  106. @echo "Build finished. The epub file is in $(BUILDDIR)/epub."
  107. latex: check_sphinx-build translations
  108. $(SPHINXBUILD) -b latex $(ALLSPHINXOPTS) $(BUILDDIR)/latex
  109. @echo
  110. @echo "Build finished; the LaTeX files are in $(BUILDDIR)/latex."
  111. @echo "Run \`make' in that directory to run these through (pdf)latex" \
  112. "(use \`make latexpdf' here to do that automatically)."
  113. latexpdf: check_sphinx-build translations
  114. $(SPHINXBUILD) -b latex $(ALLSPHINXOPTS) $(BUILDDIR)/latex
  115. @echo "Running LaTeX files through pdflatex..."
  116. $(MAKE) -C $(BUILDDIR)/latex all-pdf
  117. @echo "pdflatex finished; the PDF files are in $(BUILDDIR)/latex."
  118. latexpdfja: check_sphinx-build translations
  119. $(SPHINXBUILD) -b latex $(ALLSPHINXOPTS) $(BUILDDIR)/latex
  120. @echo "Running LaTeX files through platex and dvipdfmx..."
  121. $(MAKE) -C $(BUILDDIR)/latex all-pdf-ja
  122. @echo "pdflatex finished; the PDF files are in $(BUILDDIR)/latex."
  123. pdf: check_sphinx-build translations
  124. @if [ "$(XELATEX)" = "xelatex" ] || [ "x$(XELATEX)" = "x" ]; then \
  125. echo "The '$(XELATEX)' command was not found."; \
  126. fi
  127. $(SPHINXBUILD) -b latex $(ALLSPHINXOPTS) $(BUILDDIR)/latex
  128. @echo "Running LaTeX files through xelatex..."
  129. $(MAKE) -C $(BUILDDIR)/latex -i "PDFLATEX=latexmk" "LATEXMKOPTS=-xelatex -interaction=nonstopmode -f -quiet"
  130. @echo "xelatex finished; the PDF files are in $(BUILDDIR)/latex."
  131. cheatsheet: translations
  132. @echo "Running cheatsheet/salt.tex file through xelatex..."
  133. cd cheatsheet && xelatex salt.tex && cp salt.pdf ../salt-cheatsheet.pdf
  134. @echo "./salt-cheatsheet.pdf created."
  135. text: check_sphinx-build translations
  136. $(SPHINXBUILD) -b text $(ALLSPHINXOPTS) $(BUILDDIR)/text
  137. @echo
  138. @echo "Build finished. The text files are in $(BUILDDIR)/text."
  139. man: check_sphinx-build translations
  140. $(SPHINXBUILD) -b man $(ALLSPHINXOPTS) $(BUILDDIR)/man
  141. @echo
  142. @echo "Build finished. The manual pages are in $(BUILDDIR)/man."
  143. texinfo: check_sphinx-build translations
  144. $(SPHINXBUILD) -b texinfo $(ALLSPHINXOPTS) $(BUILDDIR)/texinfo
  145. @echo
  146. @echo "Build finished. The Texinfo files are in $(BUILDDIR)/texinfo."
  147. @echo "Run \`make' in that directory to run these through makeinfo" \
  148. "(use \`make info' here to do that automatically)."
  149. info: check_sphinx-build translations
  150. $(SPHINXBUILD) -b texinfo $(ALLSPHINXOPTS) $(BUILDDIR)/texinfo
  151. @echo "Running Texinfo files through makeinfo..."
  152. make -C $(BUILDDIR)/texinfo info
  153. @echo "makeinfo finished; the Info files are in $(BUILDDIR)/texinfo."
  154. gettext: check_sphinx-build
  155. $(SPHINXBUILD) -b gettext $(I18NSPHINXOPTS) $(BUILDDIR)/locale
  156. @echo
  157. @echo "Build finished. The message catalogs are in $(BUILDDIR)/locale"
  158. changes: check_sphinx-build translations
  159. $(SPHINXBUILD) -b changes $(ALLSPHINXOPTS) $(BUILDDIR)/changes
  160. @echo
  161. @echo "The overview file is in $(BUILDDIR)/changes."
  162. spelling: check_sphinx-build
  163. $(SPHINXBUILD) -b spelling $(ALLSPHINXOPTS) $(BUILDDIR)/spelling
  164. @echo
  165. @echo "Spell check complete; look for any errors in the above output " \
  166. "or in $(BUILDDIR)/spelling/output.txt."
  167. linkcheck: check_sphinx-build
  168. $(SPHINXBUILD) -b linkcheck $(ALLSPHINXOPTS) $(BUILDDIR)/linkcheck
  169. @echo
  170. @echo "Link check complete; look for any errors in the above output " \
  171. "or in $(BUILDDIR)/linkcheck/output.txt."
  172. doctest: check_sphinx-build
  173. $(SPHINXBUILD) -b doctest $(ALLSPHINXOPTS) $(BUILDDIR)/doctest
  174. @echo "Testing of doctests in the sources finished, look at the " \
  175. "results in $(BUILDDIR)/doctest/output.txt."
  176. xml: check_sphinx-build translations
  177. $(SPHINXBUILD) -b xml $(ALLSPHINXOPTS) $(BUILDDIR)/xml
  178. @echo
  179. @echo "Build finished. The XML files are in $(BUILDDIR)/xml."
  180. pseudoxml: check_sphinx-build translations
  181. $(SPHINXBUILD) -b pseudoxml $(ALLSPHINXOPTS) $(BUILDDIR)/pseudoxml
  182. @echo
  183. @echo "Build finished. The pseudo-XML files are in $(BUILDDIR)/pseudoxml."
  184. translations:
  185. @if [ "$(SPHINXLANG)" = "en" ] || [ "x$(SPHINXLANG)" = "x" ]; then \
  186. echo "No need to update translations. Skipping..."; \
  187. elif [ ! -d locale/$(SPHINXLANG) ]; then \
  188. echo "The locale directory for $(SPHINXLANG) does not exist"; \
  189. exit 1; \
  190. else \
  191. echo "Compiling exising message catalog for '$(SPHINXLANG)'"; \
  192. .scripts/compile-translation-catalogs; \
  193. fi
  194. download-translations:
  195. @echo "Downloading $(SPHINXLANG) translations"
  196. .scripts/download-translation-catalog $(SPHINXLANG)