pydocs/sphinx.mk

50 lines
1.5 KiB
Makefile

# You can set these variables from the command line.
.ONESHELL:
SHELL = /usr/bin/bash
.SILENT:
SPHINXOPTS =
SPHINXBUILD = venv/bin/sphinx-build
SPHINXPRJ = $(shell basename `dirname \`pwd\``)
SOURCEDIR = .
BUILDDIR = _build
localhelp:
echo -e "Possible documentation options are:"
echo -e "\033[1;33m - html - Create a local documentation files\e[0m"
echo -e "\033[1;33m - view - Create a local documentation files and view them\e[0m"
echo -e "\033[1;33m - release - Create a local documentation files and movem them to the module\e[0m $(SPHINXPRJ)/_docs_"
conf.py: pydocs/templates/conf.py.tpl
cp pydocs/templates/conf.py.tpl conf.py
pydocs/replace.sh conf.py "<module_name>" "$(SPHINXPRJ)"
pydocs/replace.sh conf.py "<year>" "$$(date +%Y)"
pydocs/replace.sh conf.py "<author>" "Dirk Alders"
index.rst:
venv/bin/sphinx-apidoc -TMo . $(SPHINXPRJ)
mv $(SPHINXPRJ).rst index.rst
html: examples conf.py index.rst
echo -e "\e[1m * Generated html files...\e[0m"
$(SPHINXBUILD) -M $@ "$(SOURCEDIR)" "$(BUILDDIR)" $(SPHINXOPTS) $(O)
examples:
make -C $(SPHINXPRJ)/_examples_ all
localclean:
echo -e "\033[1;33mCleanung up docs...\033[00m"
echo -e "\e[1m * Sphix config files...\e[0m"
rm -vf conf.py *.rst
echo -e "\e[1m * Sphix build directory...\e[0m"
rm -rf $(BUILDDIR)
make --no-print-directory -kC $(SPHINXPRJ)/_examples_ clean
release: html
rm -rf $(SPHINXPRJ)/_docs_
mv $(BUILDDIR)/html $(SPHINXPRJ)/_docs_
view: html
xdg-open $(BUILDDIR)/html/index.html