1# Makefile for Sphinx documentation
2#
3
4# You can set these variables from the command line.
5SPHINXOPTS    =
6SPHINXBUILD   = sphinx-build
7PAPER         =
8BUILDDIR      = build
9UTILS_REPO    = https://github.com/Percona-Lab/percona-doc-utils/archive/master.tar.gz
10UTILS_DIR     = percona-doc-utils-master
11
12# Internal variables.
13PAPEROPT_a4     = -D latex_paper_size=a4
14PAPEROPT_letter = -D latex_paper_size=letter
15ALLSPHINXOPTS   = -d $(BUILDDIR)/doctrees $(PAPEROPT_$(PAPER)) $(SPHINXOPTS) source
16
17.PHONY: help clean html dirhtml singlehtml pickle json htmlhelp qthelp devhelp epub latex latexpdf text man changes linkcheck doctest
18
19help:
20	@echo "Please use \`make <target>' where <target> is one of"
21	@echo "  html       to make standalone HTML files"
22	@echo "  dirhtml    to make HTML files named index.html in directories"
23	@echo "  offhtml    to make standalone HTML files without fetching the new theme files"
24	@echo "  singlehtml to make a single large HTML file"
25	@echo "  pickle     to make pickle files"
26	@echo "  json       to make JSON files"
27	@echo "  htmlhelp   to make HTML files and a HTML help project"
28	@echo "  qthelp     to make HTML files and a qthelp project"
29	@echo "  devhelp    to make HTML files and a Devhelp project"
30	@echo "  epub       to make an epub"
31	@echo "  latex      to make LaTeX files, you can set PAPER=a4 or PAPER=letter"
32	@echo "  latexpdf   to make LaTeX files and run them through pdflatex"
33	@echo "  text       to make text files"
34	@echo "  man        to make manual pages"
35	@echo "  changes    to make an overview of all changed/added/deprecated items"
36	@echo "  linkcheck  to check all external links for integrity"
37	@echo "  doctest    to run all doctests embedded in the documentation (if enabled)"
38
39clean:
40	-rm -rf $(BUILDDIR)/*
41
42ext:
43	@echo "Downloading Percona documentation utils from repository..."
44	@mkdir -p $(BUILDDIR) && wget -O - $(UTILS_REPO) | tar xz -C $(BUILDDIR) && cp -r $(BUILDDIR)/$(UTILS_DIR)/sphinx/ext source
45
46
47html: ext
48	@echo "Downloading percona-theme ..."
49	@wget -O percona-theme.tar.gz https://www.percona.com/docs/theme-1-4/percona-server/5.6
50	@echo "Extracting theme."
51	@tar -mzxf percona-theme.tar.gz
52	@rm -rf source/percona-theme
53	@mv percona-theme-1-4 source/percona-theme
54	@rm percona-theme.tar.gz
55	@echo "Building html doc"
56
57	$(SPHINXBUILD) -b html $(ALLSPHINXOPTS) $(BUILDDIR)/html
58	@echo
59	@echo "Build finished. The HTML pages are in $(BUILDDIR)/html."
60
61
62netlify:
63	$(SPHINXBUILD) -b html $(ALLSPHINXOPTS) -c source/conf-netlify $(BUILDDIR)/html
64	@echo
65	@echo "Netlify build finished. The HTML pages are in $(BUILDDIR)/html."
66
67dirhtml:
68	$(SPHINXBUILD) -b dirhtml $(ALLSPHINXOPTS) $(BUILDDIR)/dirhtml
69	@echo
70	@echo "Build finished. The HTML pages are in $(BUILDDIR)/dirhtml."
71
72offhtml:
73	$(SPHINXBUILD) -b html $(ALLSPHINXOPTS) $(BUILDDIR)/html
74	@echo
75	@echo "Build finished. The HTML pages are in $(BUILDDIR)/html."
76
77singlehtml:
78	$(SPHINXBUILD) -b singlehtml $(ALLSPHINXOPTS) $(BUILDDIR)/singlehtml
79	@echo
80	@echo "Build finished. The HTML page is in $(BUILDDIR)/singlehtml."
81
82pickle:
83	$(SPHINXBUILD) -b pickle $(ALLSPHINXOPTS) $(BUILDDIR)/pickle
84	@echo
85	@echo "Build finished; now you can process the pickle files."
86
87json:
88	$(SPHINXBUILD) -b json $(ALLSPHINXOPTS) $(BUILDDIR)/json
89	@echo
90	@echo "Build finished; now you can process the JSON files."
91
92htmlhelp:
93	$(SPHINXBUILD) -b htmlhelp $(ALLSPHINXOPTS) $(BUILDDIR)/htmlhelp
94	@echo
95	@echo "Build finished; now you can run HTML Help Workshop with the" \
96	      ".hhp project file in $(BUILDDIR)/htmlhelp."
97
98qthelp:
99	$(SPHINXBUILD) -b qthelp $(ALLSPHINXOPTS) $(BUILDDIR)/qthelp
100	@echo
101	@echo "Build finished; now you can run "qcollectiongenerator" with the" \
102	      ".qhcp project file in $(BUILDDIR)/qthelp, like this:"
103	@echo "# qcollectiongenerator $(BUILDDIR)/qthelp/PerconaServer.qhcp"
104	@echo "To view the help file:"
105	@echo "# assistant -collectionFile $(BUILDDIR)/qthelp/PerconaServer.qhc"
106
107devhelp:
108	$(SPHINXBUILD) -b devhelp $(ALLSPHINXOPTS) $(BUILDDIR)/devhelp
109	@echo
110	@echo "Build finished."
111	@echo "To view the help file:"
112	@echo "# mkdir -p $$HOME/.local/share/devhelp/PerconaServer"
113	@echo "# ln -s $(BUILDDIR)/devhelp $$HOME/.local/share/devhelp/PerconaServer"
114	@echo "# devhelp"
115
116epub:
117	$(SPHINXBUILD) -b epub $(ALLSPHINXOPTS) $(BUILDDIR)/epub
118	@echo
119	@echo "Build finished. The epub file is in $(BUILDDIR)/epub."
120
121latex:
122	$(SPHINXBUILD) -b latex $(ALLSPHINXOPTS) $(BUILDDIR)/latex
123	@echo
124	@echo "Build finished; the LaTeX files are in $(BUILDDIR)/latex."
125	@echo "Run \`make' in that directory to run these through (pdf)latex" \
126	      "(use \`make latexpdf' here to do that automatically)."
127
128latexpdf: ext
129	$(SPHINXBUILD) -b latex $(ALLSPHINXOPTS) $(BUILDDIR)/latex
130	@echo "Running LaTeX files through pdflatex..."
131	make -C $(BUILDDIR)/latex all-pdf
132	@echo "pdflatex finished; the PDF files are in $(BUILDDIR)/latex."
133
134text:
135	$(SPHINXBUILD) -b text $(ALLSPHINXOPTS) $(BUILDDIR)/text
136	@echo
137	@echo "Build finished. The text files are in $(BUILDDIR)/text."
138
139man:
140	$(SPHINXBUILD) -b man $(ALLSPHINXOPTS) $(BUILDDIR)/man
141	@echo
142	@echo "Build finished. The manual pages are in $(BUILDDIR)/man."
143
144changes:
145	$(SPHINXBUILD) -b changes $(ALLSPHINXOPTS) $(BUILDDIR)/changes
146	@echo
147	@echo "The overview file is in $(BUILDDIR)/changes."
148
149linkcheck:
150	$(SPHINXBUILD) -b linkcheck $(ALLSPHINXOPTS) $(BUILDDIR)/linkcheck
151	@echo
152	@echo "Link check complete; look for any errors in the above output " \
153	      "or in $(BUILDDIR)/linkcheck/output.txt."
154
155doctest:
156	$(SPHINXBUILD) -b doctest $(ALLSPHINXOPTS) $(BUILDDIR)/doctest
157	@echo "Testing of doctests in the sources finished, look at the " \
158	      "results in $(BUILDDIR)/doctest/output.txt."
159
160thtml:
161	@echo "Building themed html doc"
162	$(SPHINXBUILD) -D html_theme=alabaster -D html_theme_path='' -b html $(ALLSPHINXOPTS) $(BUILDDIR)/html
163	@echo
164	@echo "Build finished. The HTML pages are in $(BUILDDIR)/html."
165
166livehtml:
167	sphinx-autobuild $(ALLSPHINXOPTS) $(BUILDDIR) $(O)
168
169livethtml:
170	sphinx-autobuild -D html_theme=alabaster -D html_theme_path='' $(ALLSPHINXOPTS) $(BUILDDIR) $(O)
171