3
3
4
4
# You can set these variables from the command line.
5
5
PYTHON = python3
6
+ VENVDIR = ./venv
7
+ BUILDDIR = _build
6
8
SPHINXOPTS =
7
- SPHINXBUILD = ./venv /bin/sphinx-build
9
+ SPHINXBUILD = $( VENVDIR ) /bin/sphinx-build
8
10
PAPER =
9
- BUILDDIR = _build
10
11
11
12
# Internal variables.
12
13
PAPEROPT_a4 = -D latex_paper_size=a4
13
14
PAPEROPT_letter = -D latex_paper_size=letter
14
15
ALLSPHINXOPTS = -d $(BUILDDIR ) /doctrees $(PAPEROPT_$(PAPER ) ) $(SPHINXOPTS ) .
15
16
16
- .PHONY : help clean html dirhtml singlehtml pickle json htmlhelp qthelp \
17
+ .PHONY : help venv clean html dirhtml singlehtml pickle json htmlhelp qthelp \
17
18
devhelp epub latex latexpdf text man changes linkcheck doctest htmlview check
18
19
19
20
help :
20
21
@echo " Please use \` make <target>' where <target> is one of"
22
+ @echo " venv to create a venv with necessary tools"
21
23
@echo " html to make standalone HTML files"
22
24
@echo " htmlview to open the index page built by the html target in your browser"
25
+ @echo " clean to remove the venv and build files"
23
26
@echo " dirhtml to make HTML files named index.html in directories"
24
27
@echo " singlehtml to make a single large HTML file"
25
28
@echo " pickle to make pickle files"
@@ -37,13 +40,22 @@ help:
37
40
@echo " doctest to run all doctests embedded in the documentation (if enabled)"
38
41
@echo " check to run a check for frequent markup errors"
39
42
40
- clean :
43
+ clean : clean-venv
41
44
-rm -rf $(BUILDDIR ) /*
42
45
46
+ clean-venv :
47
+ rm -rf $(VENVDIR )
48
+
43
49
venv :
44
- $(PYTHON ) -m venv venv
45
- ./venv/bin/python3 -m pip install --upgrade pip
46
- ./venv/bin/python3 -m pip install -r requirements.txt
50
+ @if [ -d $( VENVDIR) ] ; then \
51
+ echo " venv already exists." ; \
52
+ echo " To recreate it, remove it first with \` make clean-venv'." ; \
53
+ else \
54
+ $(PYTHON ) -m venv $(VENVDIR ) ; \
55
+ $(VENVDIR ) /bin/python3 -m pip install --upgrade pip; \
56
+ $(VENVDIR ) /bin/python3 -m pip install -r requirements.txt; \
57
+ echo " The venv has been created in the $( VENVDIR) directory" ; \
58
+ fi
47
59
48
60
html : venv
49
61
$(SPHINXBUILD ) -b html $(ALLSPHINXOPTS ) $(BUILDDIR ) /html
0 commit comments