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
|
# Makefile for Sphinx documentation
SPHINXOPTS ?=
SPHINXBUILD ?= sphinx-build
SPHINXGEN ?= sphinx-apidoc
NBCONVERT ?= jupyter
PYTHON ?= python
PIP ?= pip
BUILDDIR = built
TEMPLATESDIR = templates
# where to put generated RST files
GENDIR = generate
CONTENT = content
STATICDIR = static
example_notebooks := $(wildcard ../examples/*.ipynb)
example_notebooks := $(filter-out ../examples/save_image.ipynb, $(example_notebooks))
example_names = $(foreach path, $(example_notebooks), $(basename $(notdir $(path))))
example_rsts = $(foreach name, $(example_names), examples.$(name).rst)
html: conf.py $(CONTENT)/index.rst trimesh.rst README.rst $(example_rsts) examples.rst .deps
cp -R "$(STATICDIR)" "$(GENDIR)/static"
@$(SPHINXBUILD) -M html "$(GENDIR)" "$(BUILDDIR)" $(SPHINXOPTS) $(O)
echo "trimesh.org" > "$(BUILDDIR)/html/CNAME"
touch "$(BUILDDIR)/html/.nojekyll"
cp "$(STATICDIR)/favicon.ico" "$(BUILDDIR)/html/favicon.ico" || true
.deps: requirements.txt
$(PIP) install -r requirements.txt
$(PIP) freeze > .deps
mkdir -p $(GENDIR)
mkdir -p $(BUILDDIR)
cp conf.py $(CONTENT)/* $(GENDIR)
examples.%.rst : ../examples/%.ipynb .deps
$(NBCONVERT) nbconvert --execute --to rst --output-dir $(GENDIR) $<
examples.rst: .deps
$(PYTHON) examples.py --source=../examples --target=$(GENDIR)/examples.rst
trimesh.rst: .deps
$(SPHINXGEN) -eTf -t "$(TEMPLATESDIR)" -o "$(GENDIR)" ../trimesh
README.rst: ../README.md .deps
pandoc --from=gfm --to=rst --output="$(GENDIR)/README.rst" ../README.md
clean:
rm -rvf "$(BUILDDIR)" "$(GENDIR)" .deps
|