33
44# You can set these variables from the command line.
55PYTHON = python3
6+ VENVDIR = ./venv
7+ BUILDDIR = _build
68SPHINXOPTS =
7- SPHINXBUILD = ./venv /bin/sphinx-build
9+ SPHINXBUILD = $( VENVDIR ) /bin/sphinx-build
810PAPER =
9- BUILDDIR = _build
1011
1112# Internal variables.
1213PAPEROPT_a4 = -D latex_paper_size=a4
1314PAPEROPT_letter = -D latex_paper_size=letter
1415ALLSPHINXOPTS = -d $(BUILDDIR ) /doctrees $(PAPEROPT_$(PAPER ) ) $(SPHINXOPTS ) .
1516
16- .PHONY : help clean html dirhtml singlehtml pickle json htmlhelp qthelp \
17+ .PHONY : help venv clean html dirhtml singlehtml pickle json htmlhelp qthelp \
1718 devhelp epub latex latexpdf text man changes linkcheck doctest htmlview check
1819
1920help :
2021 @echo " Please use \` make <target>' where <target> is one of"
22+ @echo " venv to create a venv with necessary tools"
2123 @echo " html to make standalone HTML files"
2224 @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"
2326 @echo " dirhtml to make HTML files named index.html in directories"
2427 @echo " singlehtml to make a single large HTML file"
2528 @echo " pickle to make pickle files"
@@ -37,13 +40,22 @@ help:
3740 @echo " doctest to run all doctests embedded in the documentation (if enabled)"
3841 @echo " check to run a check for frequent markup errors"
3942
40- clean :
43+ clean : clean-venv
4144 -rm -rf $(BUILDDIR ) /*
4245
46+ clean-venv :
47+ rm -rf $(VENVDIR )
48+
4349venv :
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
4759
4860html : venv
4961 $(SPHINXBUILD ) -b html $(ALLSPHINXOPTS ) $(BUILDDIR ) /html
0 commit comments