pydocs/sphinx.mk

53 lines
1.6 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
test:
echo $(SPHINXPRJ)
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
cp pydocs/templates/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: pydocs/templates/index.rst
cp pydocs/templates/index.rst .
pydocs/replace.sh index.rst "<module_name>" "$(SPHINXPRJ)"
html: $(SPHINXPRJ) conf.py index.rst
echo -e "\e[1m * Generated html files...\e[0m"
$(SPHINXBUILD) -M $@ "$(SOURCEDIR)" "$(BUILDDIR)" $(SPHINXOPTS) $(O)
$(SPHINXPRJ):
make --no-print-directory -C $@/_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 index.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