fatiando/rockhound

View on GitHub
doc/Makefile

Summary

Maintainability
Test Coverage
# Makefile for Sphinx documentation

# You can set these variables from the command line.
SPHINXOPTS    =
SPHINXBUILD   = sphinx-build
SPHINXAUTOGEN = sphinx-autogen
BUILDDIR      = _build

# Internal variables.
ALLSPHINXOPTS   = -d $(BUILDDIR)/doctrees  $(SPHINXOPTS) .
NOPLOTS = -D plot_gallery=0

.PHONY: help clean html linkcheck doctest api

all: html-noplot

help:
    @echo "Please use \`make <target>' where <target> is one of"
    @echo "  all           generate the complete webpage (without running gallery examples)"
    @echo "  html-noplot   make only the HTML files without running the gallery examples"
    @echo "  gallery       rerun gallery examples and generate the complete webpage"
    @echo "  linkcheck     check all external links for integrity"
    @echo "  doctest       run all doctests embedded in the documentation (if enabled)"

clean:
    rm -rf $(BUILDDIR)/html/*
    rm -rf $(BUILDDIR)/doctrees
    rm -rf $(BUILDDIR)/linkcheck
    rm -rf api/generated
    rm -rf tutorials
    rm -rf sample_data
    rm -rf .ipynb_checkpoints

clean-gallery:
    rm -rf $(BUILDDIR)/gallery

api:
    @echo
    @echo "Building API docs."
    @echo
    $(SPHINXAUTOGEN) -i -t _templates -o api/generated api/index.rst

html-noplot: api
    @echo
    @echo "Building HTML files (without running gallery examples)."
    @echo
    $(SPHINXBUILD) $(NOPLOTS) -b html $(ALLSPHINXOPTS) $(BUILDDIR)/html
    @echo
    @echo "Build finished. The HTML pages are in $(BUILDDIR)/html."

gallery: api
    @echo
    @echo "Rerunning gallery examples and building HTML files."
    @echo
    $(SPHINXBUILD) -b html $(ALLSPHINXOPTS) $(BUILDDIR)/html
    @echo
    @echo "Build finished. The HTML pages are in $(BUILDDIR)/html."

linkcheck: api
    $(SPHINXBUILD) -b linkcheck $(ALLSPHINXOPTS) $(BUILDDIR)/linkcheck
    @echo
    @echo "Link check complete; look for any errors in the above output " \
          "or in $(BUILDDIR)/linkcheck/output.txt."

doctest:
    $(SPHINXBUILD) -b doctest $(ALLSPHINXOPTS) $(BUILDDIR)/doctest
    @echo "Testing of doctests in the sources finished, look at the " \
          "results in $(BUILDDIR)/doctest/output.txt."

serve:
    cd $(BUILDDIR)/html && python -m http.server 8001