Changeset View
Changeset View
Standalone View
Standalone View
Makefile.sphinx
| # Makefile to be included by other modules, from the TOPLEVEL/docs/ dir, to | # Makefile to be included by other modules, from the TOPLEVEL/docs/ dir, to | ||||
| # automatically build sphinx documentation. | # automatically build sphinx documentation. | ||||
| APIDOC_DIR = apidoc | APIDOC_DIR = apidoc | ||||
| APIDOC_OPTS = --ext-viewcode --separate | APIDOC_OPTS = --ext-viewcode --separate | ||||
| SPHINXBUILD = sphinx-build | SPHINXBUILD = sphinx-build | ||||
| SPHINXAPIDOC = sphinx-apidoc | SPHINXAPIDOC = sphinx-apidoc | ||||
| SPHINX_OPTS = | SPHINX_OPTS = | ||||
| SPHINX_BUILDDIR = _build | SPHINX_BUILDDIR = _build | ||||
| SPHINX_SRCDIR = . | SPHINX_SRCDIR = . | ||||
| # relative to docs/ dir. Hence "." exclude the docs/ dir itself | # relative to docs/ dir. Hence "." exclude the docs/ dir itself | ||||
| APIDOC_EXCLUDES = . ../setup.py ../conftest.py ../swh/*/conftest.py | APIDOC_EXCLUDES = conftest.py setup.py | ||||
| APIDOC_EXCLUDES += ../swh/*/tests ../swh/*/tests/* ../swh/*/*/tests/* ../swh/*/*/*/tests/* | APIDOC_EXCLUDES += */tests/* */migrations/* */wsgi.py */conftest.py | ||||
| APIDOC_EXCLUDES += ../swh/*/migrations ../swh/*/migrations/* ../swh/*/*/migrations/* ../swh/*/*/*/migrations/* | APIDOC_EXCLUDES += deposit/settings/* web/settings/* dataset/* | ||||
| APIDOC_EXCLUDES += ../bin ../dist ../utils ../node_modules | APIDOC_EXCLUDES += bin build dist utils node_modules | ||||
| APIDOC_SWH_EXCLUDES = $(patsubst %,"../%",$(APIDOC_EXCLUDES)) | |||||
| html: sphinx/html | html: sphinx/html | ||||
| help: sphinx/help | help: sphinx/help | ||||
| # allow to skip apidoc generation, for modules where the overall documentation | # allow to skip apidoc generation, for modules where the overall documentation | ||||
| # structure, table of contents, etc., is manually curated | # structure, table of contents, etc., is manually curated | ||||
| ifeq ($(SKIP_APIDOC),yes) | ifeq ($(SKIP_APIDOC),yes) | ||||
| apidoc_dep = | apidoc_dep = | ||||
| else | else | ||||
| apidoc_dep = apidoc-stamp | apidoc_dep = apidoc-stamp | ||||
| endif | endif | ||||
| sphinx/clean: | sphinx/clean: | ||||
| $(SPHINXBUILD) -M clean $(SPHINX_SRCDIR) $(SPHINX_BUILDDIR) $(SPHINXOPTS) | $(SPHINXBUILD) -M clean $(SPHINX_SRCDIR) $(SPHINX_BUILDDIR) $(SPHINX_OPTS) | ||||
| sphinx/%: $(apidoc_dep) | sphinx/%: $(apidoc_dep) | ||||
| $(SPHINXBUILD) -b $* $(SPHINX_SRCDIR) $(SPHINX_BUILDDIR)/$* $(SPHINXOPTS) | $(SPHINXBUILD) -b $* $(SPHINX_SRCDIR) $(SPHINX_BUILDDIR)/$* $(SPHINX_OPTS) | ||||
| apidoc: $(apidoc_dep) | apidoc: $(apidoc_dep) | ||||
| apidoc-stamp: | apidoc-stamp: | ||||
| $(SPHINXAPIDOC) $(APIDOC_OPTS) -o $(APIDOC_DIR) .. $(APIDOC_EXCLUDES) | $(SPHINXAPIDOC) $(APIDOC_OPTS) -o $(APIDOC_DIR) .. $(APIDOC_SWH_EXCLUDES) | ||||
| # to silent Sphinx warnings about apidoc documents not included in any toctree | # to silent Sphinx warnings about apidoc documents not included in any toctree | ||||
| find $(shell pwd)/apidoc -name "*.rst" | xargs sed -i '1i:orphan:\n' | find $(shell pwd)/apidoc -name "*.rst" | xargs sed -i '1i:orphan:\n' | ||||
| touch $@ | touch $@ | ||||
| assets: | assets: | ||||
| .PHONY: clean clean-apidoc | .PHONY: clean clean-apidoc | ||||
| clean: sphinx/clean clean-apidoc | clean: sphinx/clean clean-apidoc | ||||
| clean-apidoc: | clean-apidoc: | ||||
| rm -rf $(APIDOC_DIR) | rm -rf $(APIDOC_DIR) | ||||
| rm -f *-stamp | rm -f *-stamp | ||||
| # Local Variables: | # Local Variables: | ||||
| # mode: makefile | # mode: makefile | ||||
| # End: | # End: | ||||