[a84a0ca] | 1 | # Makefile for Sphinx documentation |
---|
| 2 | # |
---|
| 3 | |
---|
| 4 | # You can set these variables from the command line. |
---|
| 5 | PYTHON ?= python |
---|
| 6 | SPHINXOPTS = |
---|
| 7 | SPHINXBUILD = $(PYTHON) -m sphinx.__init__ |
---|
| 8 | PAPER ?= letter |
---|
| 9 | BUILDDIR = _build |
---|
| 10 | ifdef ComSpec |
---|
| 11 | RMDIR = rmdir /s/q |
---|
| 12 | CPDIR = xcopy /q/e/i |
---|
| 13 | MKDIR = mkdir |
---|
| 14 | PATHSEP = $(strip \) |
---|
| 15 | COPY = copy |
---|
| 16 | else |
---|
| 17 | RMDIR = rm -rf |
---|
| 18 | CPDIR = cp -rp |
---|
| 19 | MKDIR = mkdir -p |
---|
| 20 | PATHSEP = $(strip /) |
---|
| 21 | COPY = cp |
---|
| 22 | endif |
---|
| 23 | |
---|
| 24 | # Internal variables. |
---|
| 25 | PAPEROPT_a4 = -D latex_paper_size=a4 |
---|
| 26 | PAPEROPT_letter = -D latex_paper_size=letter |
---|
| 27 | ALLSPHINXOPTS = -d _build/doctrees $(PAPEROPT_$(PAPER)) $(SPHINXOPTS) . |
---|
| 28 | |
---|
| 29 | IMG_SOURCE = $(wildcard ../sasmodels/models/img/*) |
---|
| 30 | IMG_DEST = $(patsubst ../sasmodels/models/img/%,model/img/%,$(IMG_SOURCE)) |
---|
| 31 | MODELS_PY = $(wildcard ../sasmodels/models/[a-z]*.py) |
---|
| 32 | MODELS_RST = $(patsubst ../sasmodels/models/%.py,model/%.rst,$(MODELS_PY)) |
---|
| 33 | |
---|
| 34 | help: |
---|
| 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 | |
---|
| 47 | model/img/%: ../sasmodels/models/img/% |
---|
| 48 | ifdef ComSpec |
---|
| 49 | $(COPY) $(subst /,\,$<) $(subst /,\,$@) |
---|
| 50 | else |
---|
| 51 | $(COPY) $< $@ |
---|
| 52 | endif |
---|
| 53 | |
---|
| 54 | model/%.rst: ../sasmodels/models/%.py |
---|
| 55 | $(PYTHON) genmodel.py $< $@ |
---|
| 56 | |
---|
| 57 | ref/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 | |
---|
| 62 | api: genapi.py |
---|
| 63 | -$(RMDIR) api |
---|
| 64 | $(PYTHON) genapi.py |
---|
| 65 | |
---|
| 66 | model: |
---|
| 67 | $(MKDIR) model |
---|
| 68 | ifdef ComSpec |
---|
| 69 | $(MKDIR) model\img |
---|
| 70 | else |
---|
| 71 | $(MKDIR) model/img |
---|
| 72 | endif |
---|
| 73 | |
---|
| 74 | build: model $(MODELS_RST) $(IMG_DEST) api ref/models/index.rst |
---|
| 75 | ifdef ComSpec |
---|
| 76 | rem cd ..\.. |
---|
| 77 | rem python setup.py build |
---|
| 78 | else |
---|
| 79 | #cd ../.. && python setup.py build |
---|
| 80 | endif |
---|
| 81 | |
---|
| 82 | upload: |
---|
| 83 | scp -r _build/html/* reflectometry.org:web/danse/docs/sasmodels |
---|
| 84 | scp _build/latex/SASModels.pdf reflectometry.org:web/danse/download |
---|
| 85 | |
---|
| 86 | clean: |
---|
| 87 | -$(RMDIR) _build model api ref/models |
---|
| 88 | |
---|
| 89 | html: build |
---|
| 90 | $(SPHINXBUILD) -b html $(ALLSPHINXOPTS) _build/html |
---|
| 91 | @echo |
---|
| 92 | @echo "Build finished. The HTML pages are in _build/html." |
---|
| 93 | |
---|
| 94 | dirhtml: |
---|
| 95 | $(SPHINXBUILD) -b dirhtml $(ALLSPHINXOPTS) _build/dirhtml |
---|
| 96 | @echo |
---|
| 97 | @echo "Build finished. The HTML pages are in _build/dirhtml." |
---|
| 98 | |
---|
| 99 | pickle: |
---|
| 100 | $(SPHINXBUILD) -b pickle $(ALLSPHINXOPTS) _build/pickle |
---|
| 101 | @echo |
---|
| 102 | @echo "Build finished; now you can process the pickle files." |
---|
| 103 | |
---|
| 104 | json: |
---|
| 105 | $(SPHINXBUILD) -b json $(ALLSPHINXOPTS) _build/json |
---|
| 106 | @echo |
---|
| 107 | @echo "Build finished; now you can process the JSON files." |
---|
| 108 | |
---|
| 109 | htmlhelp: |
---|
| 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 | |
---|
| 115 | qthelp: |
---|
| 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 | |
---|
| 124 | latex: 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 | |
---|
| 131 | pdf: latex |
---|
| 132 | $(MAKE) -C _build/latex all-pdf |
---|
| 133 | $(COPY) _build/latex/SASModels.pdf _build/html |
---|
| 134 | |
---|
| 135 | changes: |
---|
| 136 | $(SPHINXBUILD) -b changes $(ALLSPHINXOPTS) _build/changes |
---|
| 137 | @echo |
---|
| 138 | @echo "The overview file is in _build/changes." |
---|
| 139 | |
---|
| 140 | linkcheck: |
---|
| 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 | |
---|
| 146 | doctest: |
---|
| 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." |
---|