|
| 1 | +# Makefile for Sphinx documentation |
| 2 | +# |
| 3 | + |
| 4 | +# You can set these variables from the command line. |
| 5 | +SPHINXOPTS = |
| 6 | +SPHINXBUILD = sphinx-build |
| 7 | +PAPER = |
| 8 | +DOCS_DIR = ./docs/ |
| 9 | +BUILDDIR = ../_build/ |
| 10 | + |
| 11 | +# Internal variables. |
| 12 | +PAPEROPT_a4 = -D latex_paper_size=a4 |
| 13 | +PAPEROPT_letter = -D latex_paper_size=letter |
| 14 | +ALLSPHINXOPTS = -d $(BUILDDIR)/doctrees $(PAPEROPT_$(PAPER)) $(SPHINXOPTS) . |
| 15 | +# the i18n builder cannot share the environment and doctrees with the others |
| 16 | +I18NSPHINXOPTS = $(PAPEROPT_$(PAPER)) $(SPHINXOPTS) . |
| 17 | + |
| 18 | + |
| 19 | +# Add the following 'help' target to your Makefile |
| 20 | +# And add help text after each target name starting with '\#\#' |
| 21 | +.PHONY: help |
| 22 | +help: ## This help message |
| 23 | + @grep -E '^[a-zA-Z_-]+:.*?## .*$$' $(MAKEFILE_LIST) | sort | awk 'BEGIN {FS = ":.*?## "}; {printf "\033[36m%-30s\033[0m %s\n", $$1, $$2}' |
| 24 | + |
| 25 | +.PHONY: clean |
| 26 | +clean: ## Clean build directory |
| 27 | + cd $(DOCS_DIR) && rm -rf $(BUILDDIR)/* |
| 28 | + |
| 29 | +bin/python bin/pip: ## Create virtual Python environment |
| 30 | + python3 -m venv . || virtualenv --clear --python=python3 . |
| 31 | + |
| 32 | +.PHONY: build |
| 33 | +build: ## Set up training: Install requirements |
| 34 | + bin/python -m pip install --upgrade pip |
| 35 | + bin/pip install -r requirements.txt |
| 36 | + |
| 37 | +.PHONY: html |
| 38 | +html: ## Build html |
| 39 | + cd $(DOCS_DIR) && $(SPHINXBUILD) -b html $(ALLSPHINXOPTS) $(BUILDDIR)/html |
| 40 | + @echo |
| 41 | + @echo "Build finished. The HTML pages are in $(BUILDDIR)/html." |
| 42 | + |
| 43 | +.PHONY: manual |
| 44 | +manual: |
| 45 | + cd $(DOCS_DIR) && $(SPHINXBUILD) -b html -t manual . manual |
| 46 | + |
| 47 | +.PHONY: presentation |
| 48 | +presentation: ## Build html for presentation |
| 49 | + cd $(DOCS_DIR) && $(SPHINXBUILD) -b html -t presentation . $(BUILDDIR)/presentation |
| 50 | + |
| 51 | +.PHONY: dirhtml |
| 52 | +dirhtml: |
| 53 | + cd $(DOCS_DIR) && $(SPHINXBUILD) -b dirhtml $(ALLSPHINXOPTS) $(BUILDDIR)/dirhtml |
| 54 | + @echo |
| 55 | + @echo "Build finished. The HTML pages are in $(BUILDDIR)/dirhtml." |
| 56 | + |
| 57 | +.PHONY: singlehtml |
| 58 | +singlehtml: |
| 59 | + cd $(DOCS_DIR) && $(SPHINXBUILD) -b singlehtml $(ALLSPHINXOPTS) $(BUILDDIR)/singlehtml |
| 60 | + @echo |
| 61 | + @echo "Build finished. The HTML page is in $(BUILDDIR)/singlehtml." |
| 62 | + |
| 63 | +.PHONY: pickle |
| 64 | +pickle: |
| 65 | + cd $(DOCS_DIR) && $(SPHINXBUILD) -b pickle $(ALLSPHINXOPTS) $(BUILDDIR)/pickle |
| 66 | + @echo |
| 67 | + @echo "Build finished; now you can process the pickle files." |
| 68 | + |
| 69 | +.PHONY: json |
| 70 | +json: |
| 71 | + cd $(DOCS_DIR) && $(SPHINXBUILD) -b json $(ALLSPHINXOPTS) $(BUILDDIR)/json |
| 72 | + @echo |
| 73 | + @echo "Build finished; now you can process the JSON files." |
| 74 | + |
| 75 | +.PHONY: htmlhelp |
| 76 | +htmlhelp: |
| 77 | + cd $(DOCS_DIR) && $(SPHINXBUILD) -b htmlhelp $(ALLSPHINXOPTS) $(BUILDDIR)/htmlhelp |
| 78 | + @echo |
| 79 | + @echo "Build finished; now you can run HTML Help Workshop with the" \ |
| 80 | + ".hhp project file in $(BUILDDIR)/htmlhelp." |
| 81 | + |
| 82 | +.PHONY: qthelp |
| 83 | +qthelp: |
| 84 | + cd $(DOCS_DIR) && $(SPHINXBUILD) -b qthelp $(ALLSPHINXOPTS) $(BUILDDIR)/qthelp |
| 85 | + @echo |
| 86 | + @echo "Build finished; now you can run "qcollectiongenerator" with the" \ |
| 87 | + ".qhcp project file in $(BUILDDIR)/qthelp, like this:" |
| 88 | + @echo "# qcollectiongenerator $(BUILDDIR)/qthelp/MasteringPlone.qhcp" |
| 89 | + @echo "To view the help file:" |
| 90 | + @echo "# assistant -collectionFile $(BUILDDIR)/qthelp/MasteringPlone.qhc" |
| 91 | + |
| 92 | +.PHONY: devhelp |
| 93 | +devhelp: |
| 94 | + cd $(DOCS_DIR) && $(SPHINXBUILD) -b devhelp $(ALLSPHINXOPTS) $(BUILDDIR)/devhelp |
| 95 | + @echo |
| 96 | + @echo "Build finished." |
| 97 | + @echo "To view the help file:" |
| 98 | + @echo "# mkdir -p $$HOME/.local/share/devhelp/MasteringPlone" |
| 99 | + @echo "# ln -s $(BUILDDIR)/devhelp $$HOME/.local/share/devhelp/MasteringPlone" |
| 100 | + @echo "# devhelp" |
| 101 | + |
| 102 | +.PHONY: epub |
| 103 | +epub: |
| 104 | + cd $(DOCS_DIR) && $(SPHINXBUILD) -b epub $(ALLSPHINXOPTS) $(BUILDDIR)/epub |
| 105 | + @echo |
| 106 | + @echo "Build finished. The epub file is in $(BUILDDIR)/epub." |
| 107 | + |
| 108 | +.PHONY: latex |
| 109 | +latex: |
| 110 | + cd $(DOCS_DIR) && $(SPHINXBUILD) -b latex $(ALLSPHINXOPTS) $(BUILDDIR)/latex |
| 111 | + @echo |
| 112 | + @echo "Build finished; the LaTeX files are in $(BUILDDIR)/latex." |
| 113 | + @echo "Run \`make' in that directory to run these through (pdf)latex" \ |
| 114 | + "(use \`make latexpdf' here to do that automatically)." |
| 115 | + |
| 116 | +.PHONY: latexpdf |
| 117 | +latexpdf: |
| 118 | + cd $(DOCS_DIR) && $(SPHINXBUILD) -b latex $(ALLSPHINXOPTS) $(BUILDDIR)/latex |
| 119 | + @echo "Running LaTeX files through pdflatex..." |
| 120 | + $(MAKE) -C $(BUILDDIR)/latex all-pdf |
| 121 | + @echo "pdflatex finished; the PDF files are in $(BUILDDIR)/latex." |
| 122 | + |
| 123 | +.PHONY: text |
| 124 | +text: |
| 125 | + cd $(DOCS_DIR) && $(SPHINXBUILD) -b text $(ALLSPHINXOPTS) $(BUILDDIR)/text |
| 126 | + @echo |
| 127 | + @echo "Build finished. The text files are in $(BUILDDIR)/text." |
| 128 | + |
| 129 | +.PHONY: man |
| 130 | +man: |
| 131 | + cd $(DOCS_DIR) && $(SPHINXBUILD) -b man $(ALLSPHINXOPTS) $(BUILDDIR)/man |
| 132 | + @echo |
| 133 | + @echo "Build finished. The manual pages are in $(BUILDDIR)/man." |
| 134 | + |
| 135 | +.PHONY: texinfo |
| 136 | +texinfo: |
| 137 | + cd $(DOCS_DIR) && $(SPHINXBUILD) -b texinfo $(ALLSPHINXOPTS) $(BUILDDIR)/texinfo |
| 138 | + @echo |
| 139 | + @echo "Build finished. The Texinfo files are in $(BUILDDIR)/texinfo." |
| 140 | + @echo "Run \`make' in that directory to run these through makeinfo" \ |
| 141 | + "(use \`make info' here to do that automatically)." |
| 142 | + |
| 143 | +.PHONY: info |
| 144 | +info: |
| 145 | + cd $(DOCS_DIR) && $(SPHINXBUILD) -b texinfo $(ALLSPHINXOPTS) $(BUILDDIR)/texinfo |
| 146 | + @echo "Running Texinfo files through makeinfo..." |
| 147 | + make -C $(BUILDDIR)/texinfo info |
| 148 | + @echo "makeinfo finished; the Info files are in $(BUILDDIR)/texinfo." |
| 149 | + |
| 150 | +.PHONY: changes |
| 151 | +changes: |
| 152 | + cd $(DOCS_DIR) && $(SPHINXBUILD) -b changes $(ALLSPHINXOPTS) $(BUILDDIR)/changes |
| 153 | + @echo |
| 154 | + @echo "The overview file is in $(BUILDDIR)/changes." |
| 155 | + |
| 156 | +.PHONY: linkcheck |
| 157 | +linkcheck: ## Run linkcheck |
| 158 | + cd $(DOCS_DIR) && $(SPHINXBUILD) -b linkcheck $(ALLSPHINXOPTS) $(BUILDDIR)/linkcheck |
| 159 | + @echo |
| 160 | + @echo "Link check complete; look for any errors in the above output " \ |
| 161 | + "or in $(BUILDDIR)/linkcheck/ ." |
| 162 | + |
| 163 | +.PHONY: linkcheckbroken |
| 164 | +linkcheckbroken: ## Run linkcheck and show only broken links |
| 165 | + cd $(DOCS_DIR) && $(SPHINXBUILD) -b linkcheck $(ALLSPHINXOPTS) $(BUILDDIR)/linkcheck | GREP_COLORS='0;31' egrep -wi broken --color=auto |
| 166 | + @echo |
| 167 | + @echo "Link check complete; look for any errors in the above output " \ |
| 168 | + "or in $(BUILDDIR)/linkcheck/ ." |
| 169 | + |
| 170 | +.PHONY: spellcheck |
| 171 | +spellcheck: ## Run spellcheck |
| 172 | + cd $(DOCS_DIR) && LANGUAGE=$* $(SPHINXBUILD) -b spelling -j 4 $(ALLSPHINXOPTS) $(BUILDDIR)/spellcheck/$* |
| 173 | + @echo |
| 174 | + @echo "Spellcheck is finished; look for any errors in the above output " \ |
| 175 | + " or in $(BUILDDIR)/spellcheck/ ." |
| 176 | + |
| 177 | + |
| 178 | +.PHONY: html_meta |
| 179 | +html_meta: |
| 180 | + python ./docs/addMetaData.py |
| 181 | + |
| 182 | +.PHONY: doctest |
| 183 | +doctest: |
| 184 | + cd $(DOCS_DIR) && $(SPHINXBUILD) -b doctest $(ALLSPHINXOPTS) $(BUILDDIR)/doctest |
| 185 | + @echo "Testing of doctests in the sources finished, look at the " \ |
| 186 | + "results in $(BUILDDIR)/doctest/output.txt." |
| 187 | + |
| 188 | +.PHONY: test |
| 189 | +test: clean linkcheck spellcheck ## Run linkcheck, spellcheck |
| 190 | + |
| 191 | +.PHONY: test |
| 192 | +testlight: clean spellcheck ## Run spellcheck |
| 193 | + |
| 194 | +.PHONY: deploy |
| 195 | +deploy: clean html |
| 196 | + |
| 197 | +.PHONY: all |
| 198 | +all: clean spellcheck linkcheck html ## Run checks and build html |
0 commit comments