doc: Use $(SED) where appropriate
[git-cola.git] / share / doc / git-cola / Makefile
blobfa854f4b7b37c18165aba73f46a9d208826b730a
1 prefix ?= $(CURDIR)
2 docdir ?= $(DESTDIR)$(prefix)/share/doc/git-cola
3 htmldir ?= $(docdir)/html
4 SED ?= sed
5 COLA_VERSION ?= $(shell sh -c "git tag | tail -1 | $(SED) -e s,^v,,")
6 COLA_RELEASE ?= $(shell sh -c "git describe --abbrev=4 --match='v*.*' | $(SED) -e s,^v,,")
7 RSYNC ?= rsync
8 # Makefile for Sphinx documentation
11 # You can set these variables from the command line.
12 SPHINXOPTS =
13 SPHINXBUILD = sphinx-build
14 PAPER =
16 # Internal variables.
17 PAPEROPT_a4 = -D latex_paper_size=a4
18 PAPEROPT_letter = -D latex_paper_size=letter
19 ALLSPHINXOPTS = -d _build/doctrees $(PAPEROPT_$(PAPER)) $(SPHINXOPTS) .
21 .PHONY: help clean html dirhtml pickle json htmlhelp qthelp latex changes linkcheck doctest
23 help:
24 @echo "Please use \`make <target>' where <target> is one of"
25 @echo " html to make standalone HTML files"
26 @echo " dirhtml to make HTML files named index.html in directories"
27 @echo " pickle to make pickle files"
28 @echo " json to make JSON files"
29 @echo " htmlhelp to make HTML files and a HTML help project"
30 @echo " qthelp to make HTML files and a qthelp project"
31 @echo " latex to make LaTeX files, you can set PAPER=a4 or PAPER=letter"
32 @echo " changes to make an overview of all changed/added/deprecated items"
33 @echo " linkcheck to check all external links for integrity"
34 @echo " doctest to run all doctests embedded in the documentation (if enabled)"
36 clean:
37 -rm -rf conf.py _build
38 $(MAKE) -f Makefile.asciidoc clean
40 conf.py: conf.py.in
41 $(SED) \
42 -e "s,@@VERSION@@,$(COLA_VERSION)," \
43 -e "s,@@RELEASE@@,$(COLA_RELEASE)," \
44 conf.py.in > conf.py
46 html: conf.py
47 $(SPHINXBUILD) -b html $(ALLSPHINXOPTS) _build/html
48 @echo
49 @echo "Build finished. The HTML pages are in _build/html."
51 dirhtml: conf.py
52 $(SPHINXBUILD) -b dirhtml $(ALLSPHINXOPTS) _build/dirhtml
53 @echo
54 @echo "Build finished. The HTML pages are in _build/dirhtml."
56 pickle: conf.py
57 $(SPHINXBUILD) -b pickle $(ALLSPHINXOPTS) _build/pickle
58 @echo
59 @echo "Build finished; now you can process the pickle files."
61 json: conf.py
62 $(SPHINXBUILD) -b json $(ALLSPHINXOPTS) _build/json
63 @echo
64 @echo "Build finished; now you can process the JSON files."
66 htmlhelp: conf.py
67 $(SPHINXBUILD) -b htmlhelp $(ALLSPHINXOPTS) _build/htmlhelp
68 @echo
69 @echo "Build finished; now you can run HTML Help Workshop with the" \
70 ".hhp project file in _build/htmlhelp."
72 qthelp: conf.py
73 $(SPHINXBUILD) -b qthelp $(ALLSPHINXOPTS) _build/qthelp
74 @echo
75 @echo "Build finished; now you can run "qcollectiongenerator" with the" \
76 ".qhcp project file in _build/qthelp, like this:"
77 @echo "# qcollectiongenerator _build/qthelp/git-cola.qhcp"
78 @echo "To view the help file:"
79 @echo "# assistant -collectionFile _build/qthelp/git-cola.qhc"
81 latex: conf.py
82 $(SPHINXBUILD) -b latex $(ALLSPHINXOPTS) _build/latex
83 @echo
84 @echo "Build finished; the LaTeX files are in _build/latex."
85 @echo "Run \`make all-pdf' or \`make all-ps' in that directory to" \
86 "run these through (pdf)latex."
88 changes: conf.py
89 $(SPHINXBUILD) -b changes $(ALLSPHINXOPTS) _build/changes
90 @echo
91 @echo "The overview file is in _build/changes."
93 linkcheck:
94 $(SPHINXBUILD) -b linkcheck $(ALLSPHINXOPTS) _build/linkcheck
95 @echo
96 @echo "Link check complete; look for any errors in the above output " \
97 "or in _build/linkcheck/output.txt."
99 doctest: conf.py
100 $(SPHINXBUILD) -b doctest $(ALLSPHINXOPTS) _build/doctest
101 @echo "Testing of doctests in the sources finished, look at the " \
102 "results in _build/doctest/output.txt."
104 all: html
105 $(MAKE) -f Makefile.asciidoc all
107 install: install-html install-man
108 cp git-cola.txt $(docdir)
110 install-html: html
111 test -d $(htmldir) || mkdir -p $(htmldir)
112 $(RSYNC) -ar --delete _build/html/ $(htmldir)/
113 $(MAKE) -f Makefile.asciidoc install-html
115 install-man:
116 $(MAKE) -f Makefile.asciidoc install
118 .PHONY: conf.py