docs_common.mk 8.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213
  1. # "Common" Makefile for Sphinx documentation
  2. #
  3. # (included from en/Makefile & zh_CN/Makefile
  4. #
  5. # NOTE: This makefile runs with cwd=either en or zh_CN subfolder, so this
  6. # (docs/) directory is '..' relative to it.
  7. # ************ IMPORTANT *****************
  8. #
  9. # ReadTheDocs DOES NOT USE THIS MAKEFILE,
  10. # so any behaviour additions must be
  11. # done via Sphinx Config not here
  12. #
  13. # ****************************************
  14. # You can set these variables from the command line.
  15. SPHINXOPTS =
  16. SPHINXBUILD = sphinx-build
  17. PAPER =
  18. BUILDDIR = _build
  19. # User-friendly check for sphinx-build
  20. ifeq ($(shell which $(SPHINXBUILD) >/dev/null 2>&1; echo $$?), 1)
  21. $(error 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://sphinx-doc.org/)
  22. endif
  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)) $(SPHINXOPTS) -w sphinx-warning-log.txt .
  27. # the i18n builder cannot share the environment and doctrees with the others
  28. I18NSPHINXOPTS = $(PAPEROPT_$(PAPER)) $(SPHINXOPTS) .
  29. .PHONY: help clean html dirhtml singlehtml pickle json htmlhelp qthelp devhelp epub latex latexpdf text man changes linkcheck doctest gettext dependencies version-specific-includes
  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 " latexpdf to make LaTeX files and run them through pdflatex"
  43. @echo " latexpdfja to make LaTeX files and run them through platex/dvipdfmx"
  44. @echo " text to make text files"
  45. @echo " man to make manual pages"
  46. @echo " texinfo to make Texinfo files"
  47. @echo " info to make Texinfo files and run them through makeinfo"
  48. @echo " gettext to make PO message catalogs"
  49. @echo " changes to make an overview of all changed/added/deprecated items"
  50. @echo " xml to make Docutils-native XML files"
  51. @echo " pseudoxml to make pseudoxml-XML files for display purposes"
  52. @echo " linkcheck to check all external links for integrity"
  53. @echo " doctest to run all doctests embedded in the documentation (if enabled) "
  54. clean:
  55. rm -rf $(BUILDDIR)/*
  56. html:
  57. $(SPHINXBUILD) -b html $(ALLSPHINXOPTS) $(BUILDDIR)/html
  58. @echo
  59. @echo "Build finished. The HTML pages are in $(BUILDDIR)/html."
  60. dirhtml:
  61. $(SPHINXBUILD) -b dirhtml $(ALLSPHINXOPTS) $(BUILDDIR)/dirhtml
  62. @echo
  63. @echo "Build finished. The HTML pages are in $(BUILDDIR)/dirhtml."
  64. singlehtml:
  65. $(SPHINXBUILD) -b singlehtml $(ALLSPHINXOPTS) $(BUILDDIR)/singlehtml
  66. @echo
  67. @echo "Build finished. The HTML page is in $(BUILDDIR)/singlehtml."
  68. pickle:
  69. $(SPHINXBUILD) -b pickle $(ALLSPHINXOPTS) $(BUILDDIR)/pickle
  70. @echo
  71. @echo "Build finished; now you can process the pickle files."
  72. json:
  73. $(SPHINXBUILD) -b json $(ALLSPHINXOPTS) $(BUILDDIR)/json
  74. @echo
  75. @echo "Build finished; now you can process the JSON files."
  76. htmlhelp:
  77. $(SPHINXBUILD) -b htmlhelp $(ALLSPHINXOPTS) $(BUILDDIR)/htmlhelp
  78. @echo
  79. @echo "Build finished; now you can run HTML Help Workshop with the" \
  80. ".hhp project file in $(BUILDDIR)/htmlhelp."
  81. qthelp:
  82. $(SPHINXBUILD) -b qthelp $(ALLSPHINXOPTS) $(BUILDDIR)/qthelp
  83. @echo
  84. @echo "Build finished; now you can run "qcollectiongenerator" with the" \
  85. ".qhcp project file in $(BUILDDIR)/qthelp, like this:"
  86. @echo "# qcollectiongenerator $(BUILDDIR)/qthelp/ReadtheDocsTemplate.qhcp"
  87. @echo "To view the help file:"
  88. @echo "# assistant -collectionFile $(BUILDDIR)/qthelp/ReadtheDocsTemplate.qhc"
  89. devhelp:
  90. $(SPHINXBUILD) -b devhelp $(ALLSPHINXOPTS) $(BUILDDIR)/devhelp
  91. @echo
  92. @echo "Build finished."
  93. @echo "To view the help file:"
  94. @echo "# mkdir -p $$HOME/.local/share/devhelp/ReadtheDocsTemplate"
  95. @echo "# ln -s $(BUILDDIR)/devhelp $$HOME/.local/share/devhelp/ReadtheDocsTemplate"
  96. @echo "# devhelp"
  97. epub:
  98. $(SPHINXBUILD) -b epub $(ALLSPHINXOPTS) $(BUILDDIR)/epub
  99. @echo
  100. @echo "Build finished. The epub file is in $(BUILDDIR)/epub."
  101. latex:
  102. $(SPHINXBUILD) -b latex $(ALLSPHINXOPTS) $(BUILDDIR)/latex
  103. @echo
  104. @echo "Build finished; the LaTeX files are in $(BUILDDIR)/latex."
  105. @echo "Run \`make' in that directory to run these through (pdf)latex" \
  106. "(use \`make latexpdf' here to do that automatically)."
  107. latexpdf:
  108. $(SPHINXBUILD) -b latex $(ALLSPHINXOPTS) $(BUILDDIR)/latex
  109. @echo "Running LaTeX files through pdflatex..."
  110. $(MAKE) -C $(BUILDDIR)/latex all-pdf
  111. @echo "pdflatex finished; the PDF files are in $(BUILDDIR)/latex."
  112. latexpdfja:
  113. $(SPHINXBUILD) -b latex $(ALLSPHINXOPTS) $(BUILDDIR)/latex
  114. @echo "Running LaTeX files through platex and dvipdfmx..."
  115. $(MAKE) -C $(BUILDDIR)/latex all-pdf-ja
  116. @echo "pdflatex finished; the PDF files are in $(BUILDDIR)/latex."
  117. text:
  118. $(SPHINXBUILD) -b text $(ALLSPHINXOPTS) $(BUILDDIR)/text
  119. @echo
  120. @echo "Build finished. The text files are in $(BUILDDIR)/text."
  121. man:
  122. $(SPHINXBUILD) -b man $(ALLSPHINXOPTS) $(BUILDDIR)/man
  123. @echo
  124. @echo "Build finished. The manual pages are in $(BUILDDIR)/man."
  125. texinfo:
  126. $(SPHINXBUILD) -b texinfo $(ALLSPHINXOPTS) $(BUILDDIR)/texinfo
  127. @echo
  128. @echo "Build finished. The Texinfo files are in $(BUILDDIR)/texinfo."
  129. @echo "Run \`make' in that directory to run these through makeinfo" \
  130. "(use \`make info' here to do that automatically)."
  131. info:
  132. $(SPHINXBUILD) -b texinfo $(ALLSPHINXOPTS) $(BUILDDIR)/texinfo
  133. @echo "Running Texinfo files through makeinfo..."
  134. make -C $(BUILDDIR)/texinfo info
  135. @echo "makeinfo finished; the Info files are in $(BUILDDIR)/texinfo."
  136. gettext:
  137. $(SPHINXBUILD) -b gettext $(I18NSPHINXOPTS) $(BUILDDIR)/locale
  138. @echo
  139. @echo "Build finished. The message catalogs are in $(BUILDDIR)/locale."
  140. changes:
  141. $(SPHINXBUILD) -b changes $(ALLSPHINXOPTS) $(BUILDDIR)/changes
  142. @echo
  143. @echo "The overview file is in $(BUILDDIR)/changes."
  144. linkcheck:
  145. $(SPHINXBUILD) -b linkcheck $(ALLSPHINXOPTS) $(BUILDDIR)/linkcheck
  146. @echo
  147. @echo "Link check complete; look for any errors in the above output " \
  148. "or in $(BUILDDIR)/linkcheck/output.txt."
  149. gh-linkcheck:
  150. @echo "Checking for hardcoded GitHub links"
  151. @if (find ../ -name '*.rst' | xargs grep \
  152. 'https://github.com/espressif/esp-idf/tree\|https://github.com/espressif/esp-idf/blob\|https://github.com/espressif/esp-idf/raw'\
  153. ); \
  154. then \
  155. echo "WARNINIG: Some .rst files contain hardcoded Github links."; \
  156. echo "Please check above output and replace links with one of the following:"; \
  157. echo "- :idf:\`dir\` - points to directory inside ESP-IDF"; \
  158. echo "- :idf_file:\`file\` - points to file inside ESP-IDF"; \
  159. echo "- :idf_raw:\`file\` - points to raw view of the file inside ESP-IDF"; \
  160. echo "- :component:\`dir\` - points to directory inside ESP-IDF components dir"; \
  161. echo "- :component_file:\`file\` - points to file inside ESP-IDF components dir"; \
  162. echo "- :component_raw:\`file\` - points to raw view of the file inside ESP-IDF"; \
  163. echo " components dir"; \
  164. echo "- :example:\`dir\` - points to directory inside ESP-IDF examples dir"; \
  165. echo "- :example_file:\`file\` - points to file inside ESP-IDF examples dir"; \
  166. echo "- :example_raw:\`file\` - points to raw view of the file inside ESP-IDF"; \
  167. echo " examples dir"; \
  168. echo "These link types will point to the correct GitHub version automatically"; \
  169. exit 1; \
  170. fi
  171. @echo "No hardcoded links found"
  172. doctest:
  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:
  177. $(SPHINXBUILD) -b xml $(ALLSPHINXOPTS) $(BUILDDIR)/xml
  178. @echo
  179. @echo "Build finished. The XML files are in $(BUILDDIR)/xml."
  180. pseudoxml:
  181. $(SPHINXBUILD) -b pseudoxml $(ALLSPHINXOPTS) $(BUILDDIR)/pseudoxml
  182. @echo
  183. @echo "Build finished. The pseudo-XML files are in $(BUILDDIR)/pseudoxml."