forked from MarkHoeber/sublime_sphinx_guide
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile
107 lines (90 loc) · 3.19 KB
/
Makefile
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
# Makefile for Sphinx documentation
#
# You can set these variables from the command line.
SPHINXOPTS =
SPHINXBUILD = sphinx-build
PAPER =
BUILDDIR = build/html
LINKSDIR = source/link
LINKCHECKDIR = build/linkcheck
SPHINXAUTOBUILD = sphinx-autobuild
# Internal variables.
PAPEROPT_a4 = -D latex_paper_size=a4
PAPEROPT_letter = -D latex_paper_size=letter
ALLSPHINXOPTS = -d $(BUILDDIR)/doctrees $(PAPEROPT_$(PAPER)) $(SPHINXOPTS) source
# the i18n builder cannot share the environment and doctrees with the others
I18NSPHINXOPTS = $(PAPEROPT_$(PAPER)) $(SPHINXOPTS) source
ALLSPHINXLIVEOPTS = $(ALLSPHINXOPTS) -q \
-p 0 \
-H 0.0.0.0 \
-B \
--delay 1 \
--ignore "*.swp" \
--ignore "*.pdf" \
--ignore "*.log" \
--ignore "*.out" \
--ignore "*.toc" \
--ignore "*.aux" \
--ignore "*.idx" \
--ignore "*.ind" \
--ignore "*.ilg" \
--ignore "*.tex" \
--watch source
.PHONY: help
help:
@echo "Please use \`make <target>' where <target> is one of"
@echo " html to make standalone HTML files"
@echo " latex to make LaTeX files, you can set PAPER=a4 or PAPER=letter"
@echo " latexpdf to make LaTeX files and run them through pdflatex"
.PHONY: clean
clean:
rm -rf $(BUILDDIR)/*
.PHONY: link
link:
@read -p "Enter a Unique Link Name: " link_name; \
read -p "Enter the link text the user sees: " link_text; \
read -p "Enter the URL: " link_url; \
read -p "Enter the .py file name (use_lower_case_and_underscore of link name): " file_name; \
echo "The link name is: " $$link_name; \
echo "The link text is: " $$link_text; \
echo "The URL is: " $$link_url; \
echo "Creating the file: " $(LINKSDIR)/$$file_name".py"; \
echo "Enter the link in content as :xref:\`"$$link_name"\`"; \
echo "The user will see:" $$link_text; \
echo "Make sure you build and test the link."; \
echo "import link\n\nen_us_user_text = \"$$link_text\" \n\n\
links.xref_links.update({\"$$link_name\": (en_us_user_text, \"$$link_url\")})" \
> $(LINKSDIR)/$$file_name".py" \
.PHONY: html
html:
$(SPHINXBUILD) -b html $(ALLSPHINXOPTS) $(BUILDDIR)
@echo
@echo "Build finished. The HTML pages are in $(BUILDDIR)."
.PHONY: livehtml
livehtml:
$(SPHINXAUTOBUILD) -b html $(ALLSPHINXLIVEOPTS) $(BUILDDIR)
@echo
@echo "Build finished. The HTML pages are in $(BUILDDIR)."
.PHONY: fasthtml
fasthtml:
$(SPHINXBUILD) -b html $(ALLSPHINXOPTS) $(BUILDDIR) -j 16
@echo
@echo "Build finished. The HTML pages are in $(BUILDDIR)."
.PHONY: checklinks
checklinks:
$(SPHINXBUILD) -b linkcheck $(ALLSPHINXOPTS) $(LINKCHECKDIR)
@echo
@echo "Check finished. Report is in $(LINKCHECKDIR)."
.PHONY: latex
latex:
$(SPHINXBUILD) -b latex $(ALLSPHINXOPTS) $(BUILDDIR)/latex
@echo
@echo "Build finished; the LaTeX files are in $(BUILDDIR)/latex."
@echo "Run \`make' in that directory to run these through (pdf)latex" \
"(use \`make latexpdf' here to do that automatically)."
.PHONY: latexpdf
latexpdf:
$(SPHINXBUILD) -b latex $(ALLSPHINXOPTS) $(BUILDDIR)/latex
@echo "Running LaTeX files through pdflatex..."
$(MAKE) -C $(BUILDDIR)/latex all-pdf
@echo "pdflatex finished; the PDF files are in $(BUILDDIR)/latex."