pydocs/sphinx.mk

56 lines
1.7 KiB
Makefile

# You can set these variables from the command line.
.ONESHELL:
SHELL = /usr/bin/bash
.SILENT:
SPHINXBUILD = venv/bin/sphinx-build
SPHINXAPIDOC = venv/bin/sphinx-apidoc
SPHINXPRJ = $(shell basename `dirname \`pwd\``)
SOURCEDIR = pylibs
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_"
head:
echo -ne "\n\n\033[1;34m"
echo -e "╔══════╗"
echo -e "║ docs ║"
echo -e "╚══════╝\033[00m"
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"
$(SOURCEDIR)/$(SPHINXPRJ).rst:
$(SPHINXAPIDOC) -TMo $(SOURCEDIR) $(SOURCEDIR)/$(SPHINXPRJ)
html: head examples conf.py $(SOURCEDIR)/$(SPHINXPRJ).rst
echo -e "\e[1m * Generated html files...\e[0m"
$(SPHINXBUILD) --conf-dir . "$(SOURCEDIR)" "$(BUILDDIR)"
examples:
make -C pylibs/$(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 pylibs/*.rst
echo -e "\e[1m * Sphix build directory...\e[0m"
rm -rf $(BUILDDIR)
make --no-print-directory -kC pylibs/$(SPHINXPRJ)/_examples_ clean
release: html
rm -rf $(SPHINXPRJ)/_docs_
mv $(BUILDDIR)/html $(SPHINXPRJ)/_docs_
view: html
xdg-open $(BUILDDIR)/$(SPHINXPRJ).html