Skip to content

Commit 07df26a

Browse files
hugovkradarhere
andauthored
Refactor docs Makefile (#8933)
Co-authored-by: Andrew Murray <[email protected]>
1 parent e23f017 commit 07df26a

File tree

2 files changed

+18
-26
lines changed

2 files changed

+18
-26
lines changed

docs/Makefile

+18-24
Original file line numberDiff line numberDiff line change
@@ -3,17 +3,23 @@
33

44
# You can set these variables from the command line.
55
PYTHON = python3
6-
SPHINXOPTS =
76
SPHINXBUILD = $(PYTHON) -m sphinx.cmd.build
8-
PAPER =
7+
SPHINXOPTS = --fail-on-warning
98
BUILDDIR = _build
9+
BUILDER = html
10+
JOBS = auto
11+
PAPER =
1012

1113
# Internal variables.
1214
PAPEROPT_a4 = --define latex_paper_size=a4
1315
PAPEROPT_letter = --define latex_paper_size=letter
14-
ALLSPHINXOPTS = --doctree-dir $(BUILDDIR)/doctrees $(PAPEROPT_$(PAPER)) $(SPHINXOPTS) .
15-
# the i18n builder cannot share the environment and doctrees with the others
16-
I18NSPHINXOPTS = $(PAPEROPT_$(PAPER)) $(SPHINXOPTS) .
16+
17+
ALLSPHINXOPTS = --builder $(BUILDER) \
18+
--doctree-dir $(BUILDDIR)/doctrees \
19+
--jobs $(JOBS) \
20+
$(PAPEROPT_$(PAPER)) \
21+
$(SPHINXOPTS) \
22+
. $(BUILDDIR)/$(BUILDER)
1723

1824
.PHONY: help
1925
help:
@@ -36,31 +42,19 @@ install-sphinx:
3642
.PHONY: html
3743
html:
3844
$(MAKE) install-sphinx
39-
$(SPHINXBUILD) --builder html --fail-on-warning --keep-going $(ALLSPHINXOPTS) $(BUILDDIR)/html
40-
@echo
41-
@echo "Build finished. The HTML pages are in $(BUILDDIR)/html."
45+
$(SPHINXBUILD) $(ALLSPHINXOPTS)
4246

4347
.PHONY: dirhtml
44-
dirhtml:
45-
$(MAKE) install-sphinx
46-
$(SPHINXBUILD) --builder dirhtml $(ALLSPHINXOPTS) $(BUILDDIR)/dirhtml
47-
@echo
48-
@echo "Build finished. The HTML pages are in $(BUILDDIR)/dirhtml."
48+
dirhtml: BUILDER = dirhtml
49+
dirhtml: html
4950

5051
.PHONY: singlehtml
51-
singlehtml:
52-
$(MAKE) install-sphinx
53-
$(SPHINXBUILD) --builder singlehtml $(ALLSPHINXOPTS) $(BUILDDIR)/singlehtml
54-
@echo
55-
@echo "Build finished. The HTML page is in $(BUILDDIR)/singlehtml."
52+
singlehtml: BUILDER = singlehtml
53+
singlehtml: html
5654

5755
.PHONY: linkcheck
58-
linkcheck:
59-
$(MAKE) install-sphinx
60-
$(SPHINXBUILD) --builder linkcheck $(ALLSPHINXOPTS) $(BUILDDIR)/linkcheck -j auto
61-
@echo
62-
@echo "Link check complete; look for any errors in the above output " \
63-
"or in $(BUILDDIR)/linkcheck/output.txt."
56+
linkcheck: BUILDER = linkcheck
57+
linkcheck: html
6458

6559
.PHONY: htmlview
6660
htmlview: html

docs/make.bat

-2
Original file line numberDiff line numberDiff line change
@@ -7,10 +7,8 @@ if "%SPHINXBUILD%" == "" (
77
)
88
set BUILDDIR=_build
99
set ALLSPHINXOPTS=-d %BUILDDIR%/doctrees %SPHINXOPTS% .
10-
set I18NSPHINXOPTS=%SPHINXOPTS% .
1110
if NOT "%PAPER%" == "" (
1211
set ALLSPHINXOPTS=-D latex_paper_size=%PAPER% %ALLSPHINXOPTS%
13-
set I18NSPHINXOPTS=-D latex_paper_size=%PAPER% %I18NSPHINXOPTS%
1412
)
1513

1614
if "%1" == "" goto help

0 commit comments

Comments
 (0)