source: sasmodels/doc/Makefile @ 67cc0ff

Last change on this file since 67cc0ff was 2f63032, checked in by smk78, 9 years ago

Changes to improve doc build

  • Property mode set to 100644
File size: 4.5 KB
Line 
1# Makefile for Sphinx documentation
2#
3
4# You can set these variables from the command line.
5PYTHON       ?= python
6SPHINXOPTS    =
7SPHINXBUILD   = $(PYTHON) -m  sphinx.__init__
8PAPER        ?= letter
9BUILDDIR      = _build
10ifdef ComSpec
11    RMDIR   = rmdir /s/q
12    CPDIR   = xcopy /q/e/i
13    MKDIR   = mkdir
14    PATHSEP = $(strip \)
15    COPY    = copy
16else
17    RMDIR   = rm -rf
18    CPDIR   = cp -rp
19    MKDIR   = mkdir -p
20    PATHSEP = $(strip /)
21    COPY    = cp
22endif
23
24# Internal variables.
25PAPEROPT_a4     = -D latex_paper_size=a4
26PAPEROPT_letter = -D latex_paper_size=letter
27ALLSPHINXOPTS   = -d _build/doctrees $(PAPEROPT_$(PAPER)) $(SPHINXOPTS) .
28
29IMG_SOURCE = $(wildcard ../sasmodels/models/img/*)
30IMG_DEST = $(patsubst ../sasmodels/models/img/%,model/img/%,$(IMG_SOURCE))
31MODELS_PY = $(wildcard ../sasmodels/models/[a-z]*.py)
32MODELS_RST = $(patsubst ../sasmodels/models/%.py,model/%.rst,$(MODELS_PY))
33
34help:
35        @echo "Please use \`make <target>' where <target> is one of"
36        @echo "  html      to make standalone HTML files"
37        @echo "  dirhtml   to make HTML files named index.html in directories"
38        @echo "  pickle    to make pickle files"
39        @echo "  json      to make JSON files"
40        @echo "  htmlhelp  to make HTML files and a HTML help project"
41        @echo "  qthelp    to make HTML files and a qthelp project"
42        @echo "  latex     to make LaTeX files, you can set PAPER=a4 or PAPER=letter"
43        @echo "  changes   to make an overview of all changed/added/deprecated items"
44        @echo "  linkcheck to check all external links for integrity"
45        @echo "  doctest   to run all doctests embedded in the documentation (if enabled)"
46
47model/img/%: ../sasmodels/models/img/%
48ifdef ComSpec
49        $(COPY) $(subst /,\,$<) $(subst /,\,$@)
50else
51        $(COPY) $< $@
52endif
53
54model/%.rst: ../sasmodels/models/%.py
55        $(PYTHON) genmodel.py $< $@
56
57ref/models/index.rst: gentoc.py $(MODELS_PY)
58        $(PYTHON) gentoc.py $(MODELS_PY)
59
60.PHONY: help clean html dirhtml pickle json htmlhelp qthelp latex changes linkcheck doctest build
61
62api: genapi.py
63        -$(RMDIR) api
64        $(PYTHON) genapi.py
65
66model:
67        $(MKDIR) model
68ifdef ComSpec
69        $(MKDIR) model\img
70else
71        $(MKDIR) model/img
72endif
73
74build: model $(MODELS_RST) $(IMG_DEST) api ref/models/index.rst
75ifdef ComSpec
76        rem cd ..\..
77        rem python setup.py build
78else
79        #cd ../.. && python setup.py build
80endif
81
82upload:
83        scp -r _build/html/* reflectometry.org:web/danse/docs/sasmodels
84        scp _build/latex/SASModels.pdf reflectometry.org:web/danse/download
85
86clean:
87        -$(RMDIR) _build model api ref$(PATHSEP)models
88
89html: build
90        $(SPHINXBUILD) -b html $(ALLSPHINXOPTS) _build/html
91        @echo
92        @echo "Build finished. The HTML pages are in _build/html."
93
94dirhtml:
95        $(SPHINXBUILD) -b dirhtml $(ALLSPHINXOPTS) _build/dirhtml
96        @echo
97        @echo "Build finished. The HTML pages are in _build/dirhtml."
98
99pickle:
100        $(SPHINXBUILD) -b pickle $(ALLSPHINXOPTS) _build/pickle
101        @echo
102        @echo "Build finished; now you can process the pickle files."
103
104json:
105        $(SPHINXBUILD) -b json $(ALLSPHINXOPTS) _build/json
106        @echo
107        @echo "Build finished; now you can process the JSON files."
108
109htmlhelp:
110        $(SPHINXBUILD) -b htmlhelp $(ALLSPHINXOPTS) _build/htmlhelp
111        @echo
112        @echo "Build finished; now you can run HTML Help Workshop with the" \
113              ".hhp project file in _build/htmlhelp."
114
115qthelp:
116        $(SPHINXBUILD) -b qthelp $(ALLSPHINXOPTS) _build/qthelp
117        @echo
118        @echo "Build finished; now you can run "qcollectiongenerator" with the" \
119              ".qhcp project file in _build/qthelp, like this:"
120        @echo "# qcollectiongenerator _build/qthelp/Periodic Table.qhcp"
121        @echo "To view the help file:"
122        @echo "# assistant -collectionFile _build/qthelp/Periodic Table.qhc"
123
124latex: build
125        $(SPHINXBUILD) -b latex $(ALLSPHINXOPTS) _build/latex
126        @echo
127        @echo "Build finished; the LaTeX files are in _build/latex."
128        @echo "Run \`make all-pdf' or \`make all-ps' in that directory to" \
129              "run these through (pdf)latex."
130
131pdf: latex
132        $(MAKE) -C _build/latex all-pdf
133        $(COPY) _build/latex/SASModels.pdf _build/html
134
135changes:
136        $(SPHINXBUILD) -b changes $(ALLSPHINXOPTS) _build/changes
137        @echo
138        @echo "The overview file is in _build/changes."
139
140linkcheck:
141        $(SPHINXBUILD) -b linkcheck $(ALLSPHINXOPTS) _build/linkcheck
142        @echo
143        @echo "Link check complete; look for any errors in the above output " \
144              "or in _build/linkcheck/output.txt."
145
146doctest:
147        $(SPHINXBUILD) -b doctest $(ALLSPHINXOPTS) _build/doctest
148        @echo "Testing of doctests in the sources finished, look at the " \
149              "results in _build/doctest/output.txt."
Note: See TracBrowser for help on using the repository browser.