1## SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
2#
3# Makefile for Sphinx documentation
4
5EXTRA_DIST = \
6abidiff.rst \
7abipkgdiff.rst \
8abicompat.rst \
9abidw.rst \
10abilint.rst \
11conf.py \
12index.rst \
13libabigail-concepts.rst \
14libabigail-overview.rst \
15libabigail-tools.rst \
16fedabipkgdiff.rst \
17kmidiff.rst
18
19# You can set these variables from the command line.
20SPHINXOPTS    =
21SPHINXBUILD   = sphinx-build
22PAPER         =
23BUILDDIR      = $(abs_builddir)
24SOURCEDIR     = $(abs_srcdir)
25
26# Internal variables.
27PAPEROPT_a4     = -D latex_paper_size=a4
28PAPEROPT_letter = -D latex_paper_size=letter
29ALLSPHINXOPTS   = -d $(BUILDDIR)/doctrees $(PAPEROPT_$(PAPER)) $(SPHINXOPTS) $(SOURCEDIR)
30# the i18n builder cannot share the environment and doctrees with the others
31I18NSPHINXOPTS  = $(PAPEROPT_$(PAPER)) $(SPHINXOPTS) .
32
33.PHONY: help clean html-local dirhtml singlehtml pickle json htmlhelp qthelp devhelp epub latex latexpdf text man changes linkcheck doctest gettext
34
35help:
36	@echo "Please use \`make <target>' where <target> is one of"
37	@echo "  html-doc   to make standalone HTML files"
38	@echo "  dirhtml    to make HTML files named index.html in directories"
39	@echo "  singlehtml to make a single large HTML file"
40	@echo "  pickle     to make pickle files"
41	@echo "  json       to make JSON files"
42	@echo "  htmlhelp   to make HTML files and a HTML help project"
43	@echo "  qthelp     to make HTML files and a qthelp project"
44	@echo "  devhelp    to make HTML files and a Devhelp project"
45	@echo "  epub       to make an epub"
46	@echo "  latex      to make LaTeX files, you can set PAPER=a4 or PAPER=letter"
47	@echo "  latexpdf   to make LaTeX files and run them through pdflatex"
48	@echo "  text       to make text files"
49	@echo "  man        to make manual pages"
50	@echo "  texinfo    to make Texinfo files"
51	@echo "  info       to make Texinfo files and run them through makeinfo"
52	@echo "  gettext    to make PO message catalogs"
53	@echo "  changes    to make an overview of all changed/added/deprecated items"
54	@echo "  linkcheck  to check all external links for integrity"
55	@echo "  doctest    to run all doctests embedded in the documentation (if enabled)"
56
57html-doc:
58	$(SPHINXBUILD) -b html $(ALLSPHINXOPTS) $(DESTDIR)$(BUILDDIR)/html
59	@echo
60	@echo "Build finished. The HTML pages are in $(BUILDDIR)/html."
61
62dirhtml:
63	$(SPHINXBUILD) -b dirhtml $(ALLSPHINXOPTS) $(BUILDDIR)/dirhtml
64	@echo
65	@echo "Build finished. The HTML pages are in $(BUILDDIR)/dirhtml."
66
67singlehtml:
68	$(SPHINXBUILD) -b singlehtml $(ALLSPHINXOPTS) $(BUILDDIR)/singlehtml
69	@echo
70	@echo "Build finished. The HTML page is in $(BUILDDIR)/singlehtml."
71
72pickle:
73	$(SPHINXBUILD) -b pickle $(ALLSPHINXOPTS) $(BUILDDIR)/pickle
74	@echo
75	@echo "Build finished; now you can process the pickle files."
76
77json:
78	$(SPHINXBUILD) -b json $(ALLSPHINXOPTS) $(BUILDDIR)/json
79	@echo
80	@echo "Build finished; now you can process the JSON files."
81
82htmlhelp:
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
88qthelp:
89	$(SPHINXBUILD) -b qthelp $(ALLSPHINXOPTS) $(BUILDDIR)/qthelp
90	@echo
91	@echo "Build finished; now you can run "qcollectiongenerator" with the" \
92	      ".qhcp project file in $(BUILDDIR)/qthelp, like this:"
93	@echo "# qcollectiongenerator $(BUILDDIR)/qthelp/Libabigailmanuals.qhcp"
94	@echo "To view the help file:"
95	@echo "# assistant -collectionFile $(BUILDDIR)/qthelp/Libabigailmanuals.qhc"
96
97devhelp:
98	$(SPHINXBUILD) -b devhelp $(ALLSPHINXOPTS) $(BUILDDIR)/devhelp
99	@echo
100	@echo "Build finished."
101	@echo "To view the help file:"
102	@echo "# mkdir -p $$HOME/.local/share/devhelp/Libabigailmanuals"
103	@echo "# ln -s $(BUILDDIR)/devhelp $$HOME/.local/share/devhelp/Libabigailmanuals"
104	@echo "# devhelp"
105
106epub:
107	$(SPHINXBUILD) -b epub $(ALLSPHINXOPTS) $(BUILDDIR)/epub
108	@echo
109	@echo "Build finished. The epub file is in $(BUILDDIR)/epub."
110
111latex:
112	$(SPHINXBUILD) -b latex $(ALLSPHINXOPTS) $(BUILDDIR)/latex
113	@echo
114	@echo "Build finished; the LaTeX files are in $(BUILDDIR)/latex."
115	@echo "Run \`make' in that directory to run these through (pdf)latex" \
116	      "(use \`make latexpdf' here to do that automatically)."
117
118latexpdf:
119	$(SPHINXBUILD) -b latex $(ALLSPHINXOPTS) $(BUILDDIR)/latex
120	@echo "Running LaTeX files through pdflatex..."
121	$(MAKE) -C $(BUILDDIR)/latex all-pdf
122	@echo "pdflatex finished; the PDF files are in $(BUILDDIR)/latex."
123
124text:
125	$(SPHINXBUILD) -b text $(ALLSPHINXOPTS) $(BUILDDIR)/text
126	@echo
127	@echo "Build finished. The text files are in $(BUILDDIR)/text."
128
129man:
130	$(SPHINXBUILD) -b man $(ALLSPHINXOPTS) $(BUILDDIR)/man
131	@echo
132	@echo "Build finished. The manual pages are in $(BUILDDIR)/man."
133
134texinfo:
135	$(SPHINXBUILD) -b texinfo $(ALLSPHINXOPTS) $(BUILDDIR)/texinfo
136	@echo
137	@echo "Build finished. The Texinfo files are in $(BUILDDIR)/texinfo."
138	@echo "Run \`make' in that directory to run these through makeinfo" \
139	      "(use \`make info' here to do that automatically)."
140
141info:
142	$(SPHINXBUILD) -b texinfo $(ALLSPHINXOPTS) $(BUILDDIR)/texinfo
143	@echo "Running Texinfo files through makeinfo..."
144	make -C $(BUILDDIR)/texinfo info
145	@echo "makeinfo finished; the Info files are in $(BUILDDIR)/texinfo."
146
147gettext:
148	$(SPHINXBUILD) -b gettext $(I18NSPHINXOPTS) $(BUILDDIR)/locale
149	@echo
150	@echo "Build finished. The message catalogs are in $(BUILDDIR)/locale."
151
152changes:
153	$(SPHINXBUILD) -b changes $(ALLSPHINXOPTS) $(BUILDDIR)/changes
154	@echo
155	@echo "The overview file is in $(BUILDDIR)/changes."
156
157linkcheck:
158	$(SPHINXBUILD) -b linkcheck $(ALLSPHINXOPTS) $(BUILDDIR)/linkcheck
159	@echo
160	@echo "Link check complete; look for any errors in the above output " \
161	      "or in $(BUILDDIR)/linkcheck/output.txt."
162
163doctest:
164	$(SPHINXBUILD) -b doctest $(ALLSPHINXOPTS) $(BUILDDIR)/doctest
165	@echo "Testing of doctests in the sources finished, look at the " \
166	      "results in $(BUILDDIR)/doctest/output.txt."
167
168section1_manpages =
169section7_manpages =
170manpages =
171texinfodocs =
172
173if ENABLE_MANUAL
174
175section1_manpages += abipkgdiff.1 abidiff.1 abidw.1 abilint.1 abicompat.1
176section7_manpages += libabigail.7
177manpages +=  $(section1_manpages) $(section7_manpages)
178texinfodocs += abigail.info
179
180install-html-doc: html-doc
181	test -d "$(DESTDIR)$(docdir)/manual" || $(mkinstalldirs) "$(DESTDIR)$(docdir)/manual"
182	cp -r "$(DESTDIR)$(BUILDDIR)/html" "$(DESTDIR)$(docdir)/manual"
183else
184
185install-html-doc:
186
187endif
188
189clean-local:
190	-rm -rf $(BUILDDIR)/html
191	-rm -rf $(BUILDDIR)/doctrees
192
193install-man-and-info-doc:
194	-test -f $(BUILDDIR)/man/abidiff.1 && $(mkinstalldirs) $(DESTDIR)$(mandir)/man1
195	-test -f $(BUILDDIR)/man/libabigail.7 && $(mkinstalldirs) $(DESTDIR)$(mandir)/man7
196	-for m in $(section1_manpages); do test -f $(BUILDDIR)/man/$$m && $(install_sh_DATA) $(BUILDDIR)/man/$$m $(DESTDIR)$(mandir)/man1; done;
197	-for m in $(section7_manpages); do test -f $(BUILDDIR)/man/$$m && $(install_sh_DATA) $(BUILDDIR)/man/$$m $(DESTDIR)$(mandir)/man7; done;
198
199	-test -f $(BUILDDIR)/texinfo/abigail.info && $(mkinstalldirs) $(DESTDIR)$(infodir)
200	-for i in $(texinfodocs); do test -f $(BUILDDIR)/texinfo/$$i && $(install_sh_DATA) $(BUILDDIR)/texinfo/$$i $(DESTDIR)$(infodir)/$$i; gzip -f $(DESTDIR)$(infodir)/$$i; done;
201
202uninstall-local: clean-local
203	-for i in $(section1_manpages); do rm -f $(DESTDIR)$(mandir)/man1/$$i; done
204	-for i in $(section7_manpages); do rm -f $(DESTDIR)$(mandir)/man7/$$i; done
205	-for i in $(texinfodocs); do rm -f $(DESTDIR)$(infodir)/$$i; done
206	-rm -rf $(DESTDIR)$(docdir)/manual/html
207