xref: /Universal-ctags/docs/Makefile (revision 33d0cc3d8ec9644cde43ef4520809ea85780d70d)
1# Makefile for Sphinx documentation
2#
3
4# You can set these variables from the command line.
5SPHINXOPTS    =
6SPHINXBUILD   = sphinx-build
7PAPER         =
8BUILDDIR      = _build
9EXTDIR        = _ext
10
11# Internal variables.
12PAPEROPT_a4     = -D latex_paper_size=a4
13PAPEROPT_letter = -D latex_paper_size=letter
14ALLSPHINXOPTS   = -d $(BUILDDIR)/doctrees $(PAPEROPT_$(PAPER)) $(SPHINXOPTS) .
15# the i18n builder cannot share the environment and doctrees with the others
16I18NSPHINXOPTS  = $(PAPEROPT_$(PAPER)) $(SPHINXOPTS) .
17
18.PHONY: help clean check-if-sphinx-build-is-installed html dirhtml singlehtml pickle json htmlhelp qthelp devhelp epub latex latexpdf text man changes linkcheck doctest gettext
19
20help:
21	@echo "\
22	Usage: make <TARGET>\n\n\
23	<TARGET> is one of following:\n\
24	help       show help infomation\n\
25	clean      detele cached files\n\
26	html       to make standalone HTML files\n\
27	dirhtml    to make HTML files named index.html in directories\n\
28	singlehtml to make a single large HTML file\n\
29	pickle     to make pickle files\n\
30	json       to make JSON files\n\
31	htmlhelp   to make HTML files and a HTML help project\n\
32	qthelp     to make HTML files and a qthelp project\n\
33	devhelp    to make HTML files and a Devhelp project\n\
34	epub       to make an epub\n\
35	latex      to make LaTeX files, you can set PAPER=a4 or PAPER=letter\n\
36	latexpdf   to make LaTeX files and run them through pdflatex\n\
37	latexpdfja to make LaTeX files and run them through platex/dvipdfmx\n\
38	text       to make text files\n\
39	man        to make manual pages\n\
40	texinfo    to make Texinfo files\n\
41	info       to make Texinfo files and run them through makeinfo\n\
42	gettext    to make PO message catalogs\n\
43	changes    to make an overview of all changed/added/deprecated items\n\
44	xml        to make Docutils-native XML files\n\
45	pseudoxml  to make pseudoxml-XML files for display purposes\n\
46	linkcheck  to check all external links for integrity\n\
47	doctest    to run all doctests embedded in the documentation (if enabled)"
48
49clean:
50	rm -rf $(BUILDDIR) $(EXTDIR)/__pycache__
51
52check-if-sphinx-build-is-installed:
53	@if [ -z "$(SPHINXBUILD)" ] ; then \
54		echo "The SPHINXBUILD variable must not be empty." ;\
55		exit 1 ;\
56	fi ; \
57	if ! command -v "$(SPHINXBUILD)" > /dev/null ; then \
58		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://sphinx-doc.org/)" ;\
59		exit 1 ;\
60	fi
61
62html: check-if-sphinx-build-is-installed
63	$(SPHINXBUILD) -b html $(ALLSPHINXOPTS) $(BUILDDIR)/html
64	@echo
65	@echo "Build finished. The HTML pages are in $(BUILDDIR)/html."
66
67dirhtml: check-if-sphinx-build-is-installed
68	$(SPHINXBUILD) -b dirhtml $(ALLSPHINXOPTS) $(BUILDDIR)/dirhtml
69	@echo
70	@echo "Build finished. The HTML pages are in $(BUILDDIR)/dirhtml."
71
72singlehtml: check-if-sphinx-build-is-installed
73	$(SPHINXBUILD) -b singlehtml $(ALLSPHINXOPTS) $(BUILDDIR)/singlehtml
74	@echo
75	@echo "Build finished. The HTML page is in $(BUILDDIR)/singlehtml."
76
77pickle: check-if-sphinx-build-is-installed
78	$(SPHINXBUILD) -b pickle $(ALLSPHINXOPTS) $(BUILDDIR)/pickle
79	@echo
80	@echo "Build finished; now you can process the pickle files."
81
82json: check-if-sphinx-build-is-installed
83	$(SPHINXBUILD) -b json $(ALLSPHINXOPTS) $(BUILDDIR)/json
84	@echo
85	@echo "Build finished; now you can process the JSON files."
86
87htmlhelp: check-if-sphinx-build-is-installed
88	$(SPHINXBUILD) -b htmlhelp $(ALLSPHINXOPTS) $(BUILDDIR)/htmlhelp
89	@echo
90	@echo "Build finished; now you can run HTML Help Workshop with the" \
91	      ".hhp project file in $(BUILDDIR)/htmlhelp."
92
93qthelp: check-if-sphinx-build-is-installed
94	$(SPHINXBUILD) -b qthelp $(ALLSPHINXOPTS) $(BUILDDIR)/qthelp
95	@echo
96	@echo "Build finished; now you can run "qcollectiongenerator" with the" \
97	      ".qhcp project file in $(BUILDDIR)/qthelp, like this:"
98	@echo "# qcollectiongenerator $(BUILDDIR)/qthelp/NppSnippets.qhcp"
99	@echo "To view the help file:"
100	@echo "# assistant -collectionFile $(BUILDDIR)/qthelp/NppSnippets.qhc"
101
102devhelp: check-if-sphinx-build-is-installed
103	$(SPHINXBUILD) -b devhelp $(ALLSPHINXOPTS) $(BUILDDIR)/devhelp
104	@echo
105	@echo "Build finished."
106	@echo "To view the help file:"
107	@echo "# mkdir -p $$HOME/.local/share/devhelp/NppSnippets"
108	@echo "# ln -s $(BUILDDIR)/devhelp $$HOME/.local/share/devhelp/NppSnippets"
109	@echo "# devhelp"
110
111epub: check-if-sphinx-build-is-installed
112	$(SPHINXBUILD) -b epub $(ALLSPHINXOPTS) $(BUILDDIR)/epub
113	@echo
114	@echo "Build finished. The epub file is in $(BUILDDIR)/epub."
115
116latex: check-if-sphinx-build-is-installed
117	$(SPHINXBUILD) -b latex $(ALLSPHINXOPTS) $(BUILDDIR)/latex
118	@echo
119	@echo "Build finished; the LaTeX files are in $(BUILDDIR)/latex."
120	@echo "Run \`make' in that directory to run these through (pdf)latex" \
121	      "(use \`make latexpdf' here to do that automatically)."
122
123latexpdf: check-if-sphinx-build-is-installed
124	$(SPHINXBUILD) -b latex $(ALLSPHINXOPTS) $(BUILDDIR)/latex
125	@echo "Running LaTeX files through pdflatex..."
126	$(MAKE) -C $(BUILDDIR)/latex all-pdf
127	@echo "pdflatex finished; the PDF files are in $(BUILDDIR)/latex."
128
129latexpdfja: check-if-sphinx-build-is-installed
130	$(SPHINXBUILD) -b latex $(ALLSPHINXOPTS) $(BUILDDIR)/latex
131	@echo "Running LaTeX files through platex and dvipdfmx..."
132	$(MAKE) -C $(BUILDDIR)/latex all-pdf-ja
133	@echo "pdflatex finished; the PDF files are in $(BUILDDIR)/latex."
134
135text: check-if-sphinx-build-is-installed
136	$(SPHINXBUILD) -b text $(ALLSPHINXOPTS) $(BUILDDIR)/text
137	@echo
138	@echo "Build finished. The text files are in $(BUILDDIR)/text."
139
140man: check-if-sphinx-build-is-installed
141	$(SPHINXBUILD) -b man $(ALLSPHINXOPTS) $(BUILDDIR)/man
142	@echo
143	@echo "Build finished. The manual pages are in $(BUILDDIR)/man."
144
145texinfo: check-if-sphinx-build-is-installed
146	$(SPHINXBUILD) -b texinfo $(ALLSPHINXOPTS) $(BUILDDIR)/texinfo
147	@echo
148	@echo "Build finished. The Texinfo files are in $(BUILDDIR)/texinfo."
149	@echo "Run \`make' in that directory to run these through makeinfo" \
150	      "(use \`make info' here to do that automatically)."
151
152info: check-if-sphinx-build-is-installed
153	$(SPHINXBUILD) -b texinfo $(ALLSPHINXOPTS) $(BUILDDIR)/texinfo
154	@echo "Running Texinfo files through makeinfo..."
155	make -C $(BUILDDIR)/texinfo info
156	@echo "makeinfo finished; the Info files are in $(BUILDDIR)/texinfo."
157
158gettext: check-if-sphinx-build-is-installed
159	$(SPHINXBUILD) -b gettext $(I18NSPHINXOPTS) $(BUILDDIR)/locale
160	@echo
161	@echo "Build finished. The message catalogs are in $(BUILDDIR)/locale."
162
163changes: check-if-sphinx-build-is-installed
164	$(SPHINXBUILD) -b changes $(ALLSPHINXOPTS) $(BUILDDIR)/changes
165	@echo
166	@echo "The overview file is in $(BUILDDIR)/changes."
167
168linkcheck: check-if-sphinx-build-is-installed
169	$(SPHINXBUILD) -b linkcheck $(ALLSPHINXOPTS) $(BUILDDIR)/linkcheck
170	@echo
171	@echo "Link check complete; look for any errors in the above output " \
172	      "or in $(BUILDDIR)/linkcheck/output.txt."
173
174doctest: check-if-sphinx-build-is-installed
175	$(SPHINXBUILD) -b doctest $(ALLSPHINXOPTS) $(BUILDDIR)/doctest
176	@echo "Testing of doctests in the sources finished, look at the " \
177	      "results in $(BUILDDIR)/doctest/output.txt."
178
179xml: check-if-sphinx-build-is-installed
180	$(SPHINXBUILD) -b xml $(ALLSPHINXOPTS) $(BUILDDIR)/xml
181	@echo
182	@echo "Build finished. The XML files are in $(BUILDDIR)/xml."
183
184pseudoxml: check-if-sphinx-build-is-installed
185	$(SPHINXBUILD) -b pseudoxml $(ALLSPHINXOPTS) $(BUILDDIR)/pseudoxml
186	@echo
187	@echo "Build finished. The pseudo-XML files are in $(BUILDDIR)/pseudoxml."
188