1# Makefile for Sphinx documentation 2# 3# local vars: 4PROJECT_NAME := foundationdb-docs 5 6GIT_HEAD_REF := $(shell git rev-parse --short HEAD) 7GIT_BRANCH := $(shell git symbolic-ref --short HEAD) 8GIT_REPO_URL := $(shell git config --get remote.origin.url) 9 10# You can set these variables from the command line. 11SPHINXOPTS := -c . 12PAPER = 13ROOTDIR := $(CURDIR) 14BUILDDIR := $(ROOTDIR)/.out 15DISTDIR := $(ROOTDIR)/.dist 16VENVDIR := $(ROOTDIR)/.out/venv 17SPHINXBUILD = $(VENVDIR)/bin/sphinx-build 18SPHINXAUTOBUILD = $(VENVDIR)/bin/sphinx-autobuild 19TEMPLATEDIR = $(ROOTDIR)/_templates 20 21# virtualenv for sphinx-build 22VENV_VERSION ?= virtualenv-13.0.1 23VENV_URL_BASE ?= https://pypi.python.org 24VENV_URL ?= $(VENV_URL_BASE)/packages/source/v/virtualenv/$(VENV_VERSION).tar.gz 25 26# Internal variables. 27PAPEROPT_a4 = -D latex_paper_size=a4 28PAPEROPT_letter = -D latex_paper_size=letter 29ALLSPHINXOPTS = -d $(BUILDDIR)/doctrees $(PAPEROPT_$(PAPER)) $(SPHINXOPTS) source 30# the i18n builder cannot share the environment and doctrees with the others 31I18NSPHINXOPTS = $(PAPEROPT_$(PAPER)) $(SPHINXOPTS) source 32 33BUILDINFO = "<small><hr/><table><tr><th>Ref:</th><td><a href='$(GIT_REPO_URL)commit/%H'><em>%h</em></a></td></tr><tr><th>Updated:</th><td><em>%cd</em></td></tr><tr><th>Committer:</th><td><a href='mailto:%ce'>%cn</a></td></tr></table><br/><center><em><a href='$(GIT_REPO_URL)'>View on GitHub</a></em></center><hr/></small>" 34 35.PHONY: default help clean html dirhtml singlehtml pickle json htmlhelp qthelp devhelp epub latex latexpdf text man changes linkcheck doctest gettext buildsphinx publish uptodate 36 37default: html 38 39help: 40 @echo "Please use \`make <target>' where <target> is one of" 41 @echo " html to make standalone HTML files" 42 @echo " livehtml to launch a local webserver that auto-updates as changes are made" 43 @echo " publish to build the html and push it to GitHub pages" 44 @echo " dirhtml to make HTML files named index.html in directories" 45 @echo " singlehtml to make a single large HTML file" 46 @echo " pickle to make pickle files" 47 @echo " json to make JSON files" 48 @echo " htmlhelp to make HTML files and a HTML help project" 49 @echo " qthelp to make HTML files and a qthelp project" 50 @echo " devhelp to make HTML files and a Devhelp project" 51 @echo " epub to make an epub" 52 @echo " latex to make LaTeX files, you can set PAPER=a4 or PAPER=letter" 53 @echo " latexpdf to make LaTeX files and run them through pdflatex" 54 @echo " latexpdfja to make LaTeX files and run them through platex/dvipdfmx" 55 @echo " text to make text files" 56 @echo " man to make manual pages" 57 @echo " texinfo to make Texinfo files" 58 @echo " info to make Texinfo files and run them through makeinfo" 59 @echo " gettext to make PO message catalogs" 60 @echo " changes to make an overview of all changed/added/deprecated items" 61 @echo " xml to make Docutils-native XML files" 62 @echo " pseudoxml to make pseudoxml-XML files for display purposes" 63 @echo " linkcheck to check all external links for integrity" 64 @echo " doctest to run all doctests embedded in the documentation (if enabled)" 65 @echo " buildsphinx to install sphinx binary in virtualenv" 66 67buildsphinx: 68 if [ ! -e $(SPHINXBUILD) ]; then \ 69 mkdir $(BUILDDIR); \ 70 cd $(BUILDDIR); \ 71 curl -OL $(VENV_URL); \ 72 tar zxvf $(VENV_VERSION).tar.gz; \ 73 ./$(VENV_VERSION)/virtualenv.py venv; \ 74 fi 75 . $(VENVDIR)/bin/activate && \ 76 cp .pip.conf $(VENVDIR)/pip.conf && \ 77 pip install --upgrade pip && \ 78 pip install --upgrade -r $(ROOTDIR)/requirements.txt; 79 80clean: 81 rm -rf $(BUILDDIR) 82 83cleanhtml: 84 rm -rf $(BUILDDIR)/html 85 86cleanvirtualenv: 87 rm -rf $(VENVDIR) 88 89html: buildsphinx cleanhtml 90 $(SPHINXBUILD) -b html $(ALLSPHINXOPTS) $(BUILDDIR)/html 91 @echo 92 @echo "Build finished. The HTML pages are in $(BUILDDIR)/html." 93 94check: checkwarnings linkcheck 95 96checkwarnings: buildsphinx 97 $(SPHINXBUILD) -n -W -b html $(ALLSPHINXOPTS) $(BUILDDIR)/html 98 @echo "Check finished." 99 100livehtml: html 101 $(SPHINXAUTOBUILD) -b html $(ALLSPHINXOPTS) $(BUILDDIR)/html 102 103# removed html prerequisite because it is previously explictly invoked 104package: 105 mkdir -p $(DISTDIR) 106 rm -f $(DISTDIR)/$(PROJECT_NAME)-$(VERSION).tar.gz 107 cd $(BUILDDIR)/html && tar czf $(DISTDIR)/$(PROJECT_NAME)-$(VERSION).tar.gz . 108