1# Makefile for Sphinx documentation
2#
3
4# You can set these variables from the command line.
5SPHINXOPTS    =
6SPHINXBUILD   = sphinx-build
7PAPER         =
8BUILDDIR      = build
9VERSION       ?= unknown
10
11# Internal variables.
12PAPEROPT_a4     = -D latex_paper_size=a4
13PAPEROPT_letter = -D latex_paper_size=letter
14ALLSPHINXOPTS   = -d $(BUILDDIR)/doctrees $(PAPEROPT_$(PAPER)) -D version=$(VERSION) -D release=$(VERSION) $(SPHINXOPTS) source
15# the i18n builder cannot share the environment and doctrees with the others
16I18NSPHINXOPTS  = $(PAPEROPT_$(PAPER)) $(SPHINXOPTS) source
17
18.PHONY: help clean html dirhtml singlehtml pickle json htmlhelp qthelp devhelp epub latex latexpdf text man changes linkcheck doctest gettext
19
20help:
21	@echo "Please use \`make <target>' where <target> is one of"
22	@echo "  api        to autogenerate API documentation"
23	@echo "  html       to make standalone HTML files"
24	@echo "  dirhtml    to make HTML files named index.html in directories"
25	@echo "  singlehtml to make a single large HTML file"
26	@echo "  pickle     to make pickle files"
27	@echo "  json       to make JSON files"
28	@echo "  htmlhelp   to make HTML files and a HTML help project"
29	@echo "  qthelp     to make HTML files and a qthelp project"
30	@echo "  devhelp    to make HTML files and a Devhelp project"
31	@echo "  epub       to make an epub"
32	@echo "  latex      to make LaTeX files, you can set PAPER=a4 or PAPER=letter"
33	@echo "  latexpdf   to make LaTeX files and run them through pdflatex"
34	@echo "  text       to make text files"
35	@echo "  man        to make manual pages"
36	@echo "  texinfo    to make Texinfo files"
37	@echo "  info       to make Texinfo files and run them through makeinfo"
38	@echo "  gettext    to make PO message catalogs"
39	@echo "  changes    to make an overview of all changed/added/deprecated items"
40	@echo "  linkcheck  to check all external links for integrity"
41	@echo "  doctest    to run all doctests embedded in the documentation (if enabled)"
42
43clean:
44	$(eval NON_INDEX_FILES := $(filter-out source/index.rst, $(wildcard source/*.rst)))
45	-rm -rf $(BUILDDIR)
46	mkdir $(BUILDDIR)
47ifneq ($(NON_INDEX_FILES),)
48	rm $(NON_INDEX_FILES)
49endif
50
51api:
52	$(eval NON_INDEX_FILES := $(filter-out source/index.rst, $(wildcard source/*.rst)))
53ifneq ($(NON_INDEX_FILES),)
54	rm $(NON_INDEX_FILES)
55endif
56	sphinx-apidoc --no-toc -o source/ ..
57	rm source/test.rst
58	rm source/setup.rst
59	@echo
60	@echo "API gubbins generated in source directory for version $(VERSION)."
61
62html:
63	$(SPHINXBUILD) -b html $(ALLSPHINXOPTS) $(BUILDDIR)/html
64	@echo
65	@echo "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
72singlehtml:
73	$(SPHINXBUILD) -b singlehtml $(ALLSPHINXOPTS) $(BUILDDIR)/singlehtml
74	@echo
75	@echo "Build finished. The HTML page is in $(BUILDDIR)/singlehtml."
76
77pickle:
78	$(SPHINXBUILD) -b pickle $(ALLSPHINXOPTS) $(BUILDDIR)/pickle
79	@echo
80	@echo "Build finished; now you can process the pickle files."
81
82json:
83	$(SPHINXBUILD) -b json $(ALLSPHINXOPTS) $(BUILDDIR)/json
84	@echo
85	@echo "Build finished; now you can process the JSON files."
86
87htmlhelp:
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:
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/fast5_api.qhcp"
99	@echo "To view the help file:"
100	@echo "# assistant -collectionFile $(BUILDDIR)/qthelp/fast5_api.qhc"
101
102devhelp:
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/ont_fast5_api"
108	@echo "# ln -s $(BUILDDIR)/devhelp $$HOME/.local/share/devhelp/ont_fast5_api"
109	@echo "# devhelp"
110
111epub:
112	$(SPHINXBUILD) -b epub $(ALLSPHINXOPTS) $(BUILDDIR)/epub
113	@echo
114	@echo "Build finished. The epub file is in $(BUILDDIR)/epub."
115
116latex:
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:
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
129text:
130	$(SPHINXBUILD) -b text $(ALLSPHINXOPTS) $(BUILDDIR)/text
131	@echo
132	@echo "Build finished. The text files are in $(BUILDDIR)/text."
133
134man:
135	$(SPHINXBUILD) -b man $(ALLSPHINXOPTS) $(BUILDDIR)/man
136	@echo
137	@echo "Build finished. The manual pages are in $(BUILDDIR)/man."
138
139texinfo:
140	$(SPHINXBUILD) -b texinfo $(ALLSPHINXOPTS) $(BUILDDIR)/texinfo
141	@echo
142	@echo "Build finished. The Texinfo files are in $(BUILDDIR)/texinfo."
143	@echo "Run \`make' in that directory to run these through makeinfo" \
144	      "(use \`make info' here to do that automatically)."
145
146info:
147	$(SPHINXBUILD) -b texinfo $(ALLSPHINXOPTS) $(BUILDDIR)/texinfo
148	@echo "Running Texinfo files through makeinfo..."
149	make -C $(BUILDDIR)/texinfo info
150	@echo "makeinfo finished; the Info files are in $(BUILDDIR)/texinfo."
151
152gettext:
153	$(SPHINXBUILD) -b gettext $(I18NSPHINXOPTS) $(BUILDDIR)/locale
154	@echo
155	@echo "Build finished. The message catalogs are in $(BUILDDIR)/locale."
156
157changes:
158	$(SPHINXBUILD) -b changes $(ALLSPHINXOPTS) $(BUILDDIR)/changes
159	@echo
160	@echo "The overview file is in $(BUILDDIR)/changes."
161
162linkcheck:
163	$(SPHINXBUILD) -b linkcheck $(ALLSPHINXOPTS) $(BUILDDIR)/linkcheck
164	@echo
165	@echo "Link check complete; look for any errors in the above output " \
166	      "or in $(BUILDDIR)/linkcheck/output.txt."
167
168doctest:
169	$(SPHINXBUILD) -b doctest $(ALLSPHINXOPTS) $(BUILDDIR)/doctest
170	@echo "Testing of doctests in the sources finished, look at the " \
171	      "results in $(BUILDDIR)/doctest/output.txt."
172