1# Makefile for Sphinx documentation
2#
3PYTHON       = python
4RST2HTML     = rst2html
5
6# You can set these variables from the command line.
7SPHINXOPTS   =
8SPHINXVER    = 0.5
9SPHINXBUILD  = PYTHONPATH=..:$(PYTHONPATH) sphinx-build
10PAPER        =
11
12SVGFILES = $(wildcard src/modules/physics/vector/*.svg) $(wildcard src/modules/physics/mechanics/examples/*.svg) $(wildcard src/modules/vector/*.svg)
13PDFFILES = $(SVGFILES:%.svg=%.pdf)
14
15ALLSPHINXOPTS = -d _build/doctrees $(SPHINXOPTS) src
16ALLSPHINXOPTSapi = -d _build/doctrees-api $(SPHINXOPTS) api
17ALLSPHINXOPTSlatex = -d _build/doctrees-latex -D latex_paper_size=$(PAPER) \
18                $(SPHINXOPTS) src
19
20.PHONY: changes cheatsheet clean help html htmlapi htmlhelp info latex \
21        linkcheck livehtml texinfo web logo man
22
23.SUFFIXES: .pdf .svg
24
25help:
26	@echo "Please use \`make <target>' where <target> is one of"
27	@echo "  changes     to make an overview over all changed/added/deprecated items"
28	@echo "  cheatsheet  to make the Cheatsheet"
29	@echo "  clean       to remove generated files"
30	@echo "  html        to make standalone HTML files"
31	@echo "  htmlapi     to make HTML API docs"
32	@echo "  htmlhelp    to make HTML files and a HTML help project"
33	@echo "  info        to make Texinfo files and run them through makeinfo"
34	@echo "  latex       to make LaTeX files, you can set PAPER=a4 or PAPER=letter"
35	@echo "  linkcheck   to check all external links for integrity"
36	@echo "  livehtml    to use livereload to view the built html"
37	@echo "  texinfo     to make Texinfo files"
38	@echo "  web         to make files usable by Sphinx.web"
39	@echo "  logo        generate logos from src/logo/sympy.svg"
40	@echo "  man         build manpage"
41
42clean:
43	-rm -rf _build
44	-rm -rf sphinx
45	-rm -f $(PDFFILES)
46
47html: SPHINXOPTS += -W --keep-going
48html: _build/logo/sympy-notailtext-favicon.ico
49	mkdir -p src/.static
50	mkdir -p _build/html
51	mkdir -p _build/doctrees
52	mkdir -p src/modules
53	$(SPHINXBUILD) -b html $(ALLSPHINXOPTS) _build/html
54	cp -r src/pics _build/html/
55	@echo
56	@echo "Build finished. The HTML pages are in _build/html."
57
58htmlapi:
59	mkdir -p api/.static
60	mkdir -p api/modules
61	mkdir -p _build/api _build/doctreesapi
62	rm -f api/modules/sympy*.rst
63	$(SPHINXBUILD) -b html $(ALLSPHINXOPTSapi) _build/api
64	@echo
65	@echo "Build finished. The API docs pages are in _build/api."
66
67web:
68	mkdir -p _build/web _build/doctrees
69	$(SPHINXBUILD) -b web $(ALLSPHINXOPTS) _build/web
70	@echo
71	@echo "Build finished; now you can run"
72	@echo "  python -m sphinx.web _build/web"
73	@echo "to start the server."
74
75htmlhelp:
76	mkdir -p _build/htmlhelp _build/doctrees
77	$(SPHINXBUILD) -b htmlhelp $(ALLSPHINXOPTS) _build/htmlhelp
78	@echo
79	@echo "Build finished; now you can run HTML Help Workshop with the" \
80	      ".hhp project file in _build/htmlhelp."
81
82latex: $(PDFFILES)
83	mkdir -p _build/latex _build/doctrees
84	$(SPHINXBUILD) -b latex $(ALLSPHINXOPTSlatex) _build/latex
85	@echo
86	@echo "Build finished; the LaTeX files are in _build/latex."
87	@echo "Set the environment variable LATEXMKOPTS='-xelatex -silent'"
88	@echo "And run \`make all' in that directory to run these through xelatex."
89
90.svg.pdf:
91	inkscape --file=$< --export-area-drawing --without-gui --export-pdf=$@
92
93changes:
94	mkdir -p _build/changes _build/doctrees
95	$(SPHINXBUILD) -b changes $(ALLSPHINXOPTS) _build/changes
96	@echo
97	@echo "The overview file is in _build/changes."
98
99linkcheck:
100	mkdir -p _build/linkcheck _build/doctrees
101	$(SPHINXBUILD) -b linkcheck $(ALLSPHINXOPTS) _build/linkcheck
102	@echo
103	@echo "Link check complete; look for any errors in the above output " \
104	      "or in _build/linkcheck/output.txt."
105
106livehtml:
107	livereload _build/html
108
109cheatsheet: _build/cheatsheet/cheatsheet.pdf _build/cheatsheet/combinatoric_cheatsheet.pdf
110
111_build/cheatsheet/cheatsheet.pdf: cheatsheet/cheatsheet.tex
112	mkdir -p _build/cheatsheet
113	pdflatex -output-directory=_build/cheatsheet cheatsheet/cheatsheet.tex
114	pdflatex -output-directory=_build/cheatsheet cheatsheet/cheatsheet.tex
115
116_build/cheatsheet/combinatoric_cheatsheet.pdf: cheatsheet/combinatoric_cheatsheet.tex
117	mkdir -p _build/cheatsheet
118	pdflatex -output-directory=_build/cheatsheet cheatsheet/combinatoric_cheatsheet.tex
119	pdflatex -output-directory=_build/cheatsheet cheatsheet/combinatoric_cheatsheet.tex
120
121texinfo:
122	mkdir -p _build/texinfo
123	$(SPHINXBUILD) -b texinfo $(ALLSPHINXOPTS) _build/texinfo
124	@echo
125	@echo "Build finished. The Texinfo files are in _build/texinfo."
126	@echo "Run \`make' in that directory to run these through makeinfo" \
127	      "(use \`make info' here to do that automatically)."
128
129info:
130	mkdir -p _build/texinfo
131	$(SPHINXBUILD) -b texinfo $(ALLSPHINXOPTS) _build/texinfo
132	@echo "Running Texinfo files through makeinfo..."
133	make -C _build/texinfo info
134	@echo "makeinfo finished; the Info files are in _build/texinfo."
135
136man: man/isympy.xml
137	docbook2x-man --to-stdout $< > man/isympy.1
138
139_build/logo/sympy-notailtext-favicon.ico: logo
140
141logo: src/logo/sympy.svg
142	rm -rf _build/logo
143	mkdir -p _build/logo
144	$(PYTHON) ./generate_logos.py -d
145	@echo
146	@echo "Logo generated."
147