-
Notifications
You must be signed in to change notification settings - Fork 46
/
Copy pathMakefile
82 lines (65 loc) · 2.78 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
# Minimal makefile for Sphinx documentation
#
# You can set these variables from the command line, and also
# from the environment for the first two.
SPHINXBUILD = sphinx-build
SOURCEDIR = source
BUILDDIR = build
TEMPLATEDIR = "${SOURCEDIR}/_templates"
#DOCSDIR = ../docs
SCRIPTSDIR = "${SOURCEDIR}/scripts"
TUTORIALDIR = ../notebooks
#TUTORIALDIR = ${SOURCEDIR}/tutorial
#QS_TUTORIALDIR = "../../alpha-quickstart/tutorials"
TUTORIALBUILD = "${SCRIPTSDIR}/transform_notebook.py"
SPHINXOPTS =
SPHINXAPIDOCOPTS = -e -t ${TEMPLATEDIR} --no-toc -o $(SOURCEDIR)/api/ -f
# export SPHINX_APIDOC_OPTIONS = members,undoc-members,inherited-members,no-show-inheritance
# Put it first so that "make" without argument is like "make help".
help:
@$(SPHINXBUILD) -M help "$(SOURCEDIR)" "$(BUILDDIR)" $(SPHINXOPTS) $(O)
.PHONY: help Makefile
clean:
-rm -r "$(BUILDDIR)"
# -rm -r "$(SOURCEDIR)"/api
# -rm "$(SOURCEDIR)"/gamma.*.rst
# -rm "$(SOURCEDIR)"/*.automodsumm
apidoc:
sphinx-apidoc ${SPHINXAPIDOCOPTS} ../src
build:
# run the Sphinx build for html
@$(SPHINXBUILD) -M html "$(SOURCEDIR)" "$(BUILDDIR)" $(SPHINXOPTS) $(O)
# create a nojekyll file for gh-pages:
touch "$(BUILDDIR)"/html/.nojekyll
# clean up potentially pre-existing files in /docs and move build:
#if [ -d "${DOCSDIR}" ]; then \
# rm -rf "${DOCSDIR}"/*.html "${DOCSDIR}"/*.js "${DOCSDIR}"/*.inv "${DOCSDIR}"/_* \
# "${DOCSDIR}"/api "${DOCSDIR}"/tutorial; \
#fi
# move the last build into /docs
#if [ -d "../docs" ]; then mv "$(BUILDDIR)"/html/* ../docs/; fi
html: build # add apidoc as a dependence to generate separate files per package
tutorial:
# build the tutorial notebooks
@$(TUTORIALBUILD) "${TUTORIALDIR}"
mv "${TUTORIALDIR}/example-model-inspection.ipynb" "${TUTORIALDIR}/1-example-model-inspection.ipynb"
# mv "${QS_TUTORIALDIR}/sklearndf.ipynb" "${QS_TUTORIALDIR}/2-sklearndf.ipynb"
# mv "${QS_TUTORIALDIR}/model.ipynb" "${QS_TUTORIALDIR}/3-model.ipynb"
# mv "${QS_TUTORIALDIR}/simulation.ipynb" "${QS_TUTORIALDIR}/4-simulation.ipynb"
# maybe not needed?
html-gh-pages:
# target to generate github pages build on branch "gh-pages"
cd .. && \
git checkout gh-pages && \
rm -rf * && \
git checkout master sphinx data scripts && \
git reset HEAD && cd sphinx && make html && \
cd .. && \
mv -fv "./sphinx/$(BUILDDIR)"/html/* ./ && \
mkdir -p _static/notebooks && \
python scripts/transform_notebook.py ../notebooks/ _static/notebooks/ && \
rm -rf sphinx data scripts && git add -A
# Catch-all target: route all unknown targets to Sphinx using the new
# "make mode" option. $(O) is meant as a shortcut for $(SPHINXOPTS).
%: Makefile
@$(SPHINXBUILD) -M $@ "$(SOURCEDIR)" "$(BUILDDIR)" $(SPHINXOPTS) $(O)