11# Makefile for Sphinx documentation
2- #
2+ .DEFAULT_GOAL = help
3+ SHELL = bash
34
45# You can set these variables from the command line.
5- SPHINXOPTS =
6- SPHINXBUILD = sphinx-build
7- PAPER =
8- DOCS_DIR = ./docs/
9- BUILDDIR = ../_build/
6+ SPHINXOPTS ?=
7+ PAPER ?=
108
119# Internal variables.
10+ SPHINXBUILD = $(realpath bin/sphinx-build)
11+ SPHINXAUTOBUILD = $(realpath bin/sphinx-autobuild)
12+ DOCS_DIR = ./docs/
13+ BUILDDIR = ../_build/
1214PAPEROPT_a4 = -D latex_paper_size=a4
1315PAPEROPT_letter = -D latex_paper_size=letter
1416ALLSPHINXOPTS = -d $(BUILDDIR ) /doctrees $(PAPEROPT_$(PAPER ) ) $(SPHINXOPTS ) .
@@ -19,65 +21,74 @@ I18NSPHINXOPTS = $(PAPEROPT_$(PAPER)) $(SPHINXOPTS) .
1921# Add the following 'help' target to your Makefile
2022# And add help text after each target name starting with '\#\#'
2123.PHONY : help
22- help : # # This help message
24+ help : # This help message
2325 @grep -E ' ^[a-zA-Z_-]+:.*?## .*$$' $(MAKEFILE_LIST ) | sort | awk ' BEGIN {FS = ":.*?## "}; {printf "\033[36m%-30s\033[0m %s\n", $$1, $$2}'
2426
2527.PHONY : clean
26- clean : # # Clean build directory
27- cd $(DOCS_DIR ) && rm -rf $(BUILDDIR ) /*
28+ clean : # # Clean docs build directory
29+ cd $(DOCS_DIR ) && rm -rf $(BUILDDIR ) /
2830
29- .PHONY : build
30- build : # # Set up training: Install requirements
31+ .PHONY : distclean
32+ distclean : # # Clean docs build directory and Python virtual environment
33+ cd $(DOCS_DIR ) && rm -rf $(BUILDDIR ) /
34+ rm -rf ./bin/ ./lib/ ./lib64 ./include ./pyvenv.cfg
35+
36+ bin/python :
3137 python3 -m venv . || virtualenv --clear --python=python3 .
3238 bin/python -m pip install --upgrade pip
3339 bin/pip install -r requirements.txt
34- @echo
35- @echo " Please activate your Python virtual environment with"
36- @echo " source bin/activate"
40+
41+ docs/volto :
42+ git submodule init; \
43+ git submodule update; \
44+ ln -s ../submodules/volto/docs/source ./docs/volto
45+
46+ .PHONY : deps
47+ deps : bin/python docs/volto # # Create Python virtual environment, install requirements, pull in Volto submodule
3748
3849.PHONY : html
39- html : # # Build html
50+ html : deps # # Build html
4051 cd $(DOCS_DIR ) && $(SPHINXBUILD ) -b html $(ALLSPHINXOPTS ) $(BUILDDIR ) /html
4152 @echo
4253 @echo " Build finished. The HTML pages are in $( BUILDDIR) /html."
4354
4455.PHONY : manual
45- manual :
46- cd $(DOCS_DIR ) && $(SPHINXBUILD ) -b html -t manual . manual
56+ manual : deps
57+ cd $(DOCS_DIR ) && $(SPHINXBUILD ) -b html -t manual . $( BUILDDIR ) / manual
4758
4859.PHONY : dirhtml
49- dirhtml :
60+ dirhtml : deps
5061 cd $(DOCS_DIR ) && $(SPHINXBUILD ) -b dirhtml $(ALLSPHINXOPTS ) $(BUILDDIR ) /dirhtml
5162 @echo
5263 @echo " Build finished. The HTML pages are in $( BUILDDIR) /dirhtml."
5364
5465.PHONY : singlehtml
55- singlehtml :
66+ singlehtml : deps
5667 cd $(DOCS_DIR ) && $(SPHINXBUILD ) -b singlehtml $(ALLSPHINXOPTS ) $(BUILDDIR ) /singlehtml
5768 @echo
5869 @echo " Build finished. The HTML page is in $( BUILDDIR) /singlehtml."
5970
6071.PHONY : pickle
61- pickle :
72+ pickle : deps
6273 cd $(DOCS_DIR ) && $(SPHINXBUILD ) -b pickle $(ALLSPHINXOPTS ) $(BUILDDIR ) /pickle
6374 @echo
6475 @echo " Build finished; now you can process the pickle files."
6576
6677.PHONY : json
67- json :
78+ json : deps
6879 cd $(DOCS_DIR ) && $(SPHINXBUILD ) -b json $(ALLSPHINXOPTS ) $(BUILDDIR ) /json
6980 @echo
7081 @echo " Build finished; now you can process the JSON files."
7182
7283.PHONY : htmlhelp
73- htmlhelp :
84+ htmlhelp : deps
7485 cd $(DOCS_DIR ) && $(SPHINXBUILD ) -b htmlhelp $(ALLSPHINXOPTS ) $(BUILDDIR ) /htmlhelp
7586 @echo
7687 @echo " Build finished; now you can run HTML Help Workshop with the" \
7788 " .hhp project file in $( BUILDDIR) /htmlhelp."
7889
7990.PHONY : qthelp
80- qthelp :
91+ qthelp : deps
8192 cd $(DOCS_DIR ) && $(SPHINXBUILD ) -b qthelp $(ALLSPHINXOPTS ) $(BUILDDIR ) /qthelp
8293 @echo
8394 @echo " Build finished; now you can run " qcollectiongenerator" with the" \
@@ -87,7 +98,7 @@ qthelp:
8798 @echo " # assistant -collectionFile $( BUILDDIR) /qthelp/MasteringPlone.qhc"
8899
89100.PHONY : devhelp
90- devhelp :
101+ devhelp : deps
91102 cd $(DOCS_DIR ) && $(SPHINXBUILD ) -b devhelp $(ALLSPHINXOPTS ) $(BUILDDIR ) /devhelp
92103 @echo
93104 @echo " Build finished."
@@ -97,101 +108,109 @@ devhelp:
97108 @echo " # devhelp"
98109
99110.PHONY : epub
100- epub :
111+ epub : deps
101112 cd $(DOCS_DIR ) && $(SPHINXBUILD ) -b epub $(ALLSPHINXOPTS ) $(BUILDDIR ) /epub
102113 @echo
103114 @echo " Build finished. The epub file is in $( BUILDDIR) /epub."
104115
105116.PHONY : latex
106- latex :
117+ latex : deps
107118 cd $(DOCS_DIR ) && $(SPHINXBUILD ) -b latex $(ALLSPHINXOPTS ) $(BUILDDIR ) /latex
108119 @echo
109120 @echo " Build finished; the LaTeX files are in $( BUILDDIR) /latex."
110121 @echo " Run \` make' in that directory to run these through (pdf)latex" \
111122 " (use \` make latexpdf' here to do that automatically)."
112123
113124.PHONY : latexpdf
114- latexpdf :
125+ latexpdf : deps
115126 cd $(DOCS_DIR ) && $(SPHINXBUILD ) -b latex $(ALLSPHINXOPTS ) $(BUILDDIR ) /latex
116127 @echo " Running LaTeX files through pdflatex..."
117128 $(MAKE ) -C $(BUILDDIR ) /latex all-pdf
118129 @echo " pdflatex finished; the PDF files are in $( BUILDDIR) /latex."
119130
120131.PHONY : text
121- text :
132+ text : deps
122133 cd $(DOCS_DIR ) && $(SPHINXBUILD ) -b text $(ALLSPHINXOPTS ) $(BUILDDIR ) /text
123134 @echo
124135 @echo " Build finished. The text files are in $( BUILDDIR) /text."
125136
126137.PHONY : man
127- man :
138+ man : deps
128139 cd $(DOCS_DIR ) && $(SPHINXBUILD ) -b man $(ALLSPHINXOPTS ) $(BUILDDIR ) /man
129140 @echo
130141 @echo " Build finished. The manual pages are in $( BUILDDIR) /man."
131142
132143.PHONY : texinfo
133- texinfo :
144+ texinfo : deps
134145 cd $(DOCS_DIR ) && $(SPHINXBUILD ) -b texinfo $(ALLSPHINXOPTS ) $(BUILDDIR ) /texinfo
135146 @echo
136147 @echo " Build finished. The Texinfo files are in $( BUILDDIR) /texinfo."
137148 @echo " Run \` make' in that directory to run these through makeinfo" \
138149 " (use \` make info' here to do that automatically)."
139150
140151.PHONY : info
141- info :
152+ info : deps
142153 cd $(DOCS_DIR ) && $(SPHINXBUILD ) -b texinfo $(ALLSPHINXOPTS ) $(BUILDDIR ) /texinfo
143154 @echo " Running Texinfo files through makeinfo..."
144155 make -C $(BUILDDIR ) /texinfo info
145156 @echo " makeinfo finished; the Info files are in $( BUILDDIR) /texinfo."
146157
147158.PHONY : changes
148- changes :
159+ changes : deps
149160 cd $(DOCS_DIR ) && $(SPHINXBUILD ) -b changes $(ALLSPHINXOPTS ) $(BUILDDIR ) /changes
150161 @echo
151162 @echo " The overview file is in $( BUILDDIR) /changes."
152163
153164.PHONY : linkcheck
154- linkcheck : # # Run linkcheck
165+ linkcheck : deps # # Run linkcheck
155166 cd $(DOCS_DIR ) && $(SPHINXBUILD ) -b linkcheck $(ALLSPHINXOPTS ) $(BUILDDIR ) /linkcheck
156167 @echo
157168 @echo " Link check complete; look for any errors in the above output " \
158169 " or in $( BUILDDIR) /linkcheck/ ."
159170
160171.PHONY : linkcheckbroken
161- linkcheckbroken : # # Run linkcheck and show only broken links
172+ linkcheckbroken : deps # # Run linkcheck and show only broken links
162173 cd $(DOCS_DIR ) && $(SPHINXBUILD ) -b linkcheck $(ALLSPHINXOPTS ) $(BUILDDIR ) /linkcheck | GREP_COLORS=' 0;31' egrep -wi broken --color=auto
163174 @echo
164175 @echo " Link check complete; look for any errors in the above output " \
165176 " or in $( BUILDDIR) /linkcheck/ ."
166177
167178.PHONY : spellcheck
168- spellcheck : # # Run spellcheck
179+ spellcheck : deps # # Run spellcheck
169180 cd $(DOCS_DIR ) && LANGUAGE=$* $(SPHINXBUILD ) -b spelling -j 4 $(ALLSPHINXOPTS ) $(BUILDDIR ) /spellcheck/$*
170181 @echo
171182 @echo " Spellcheck is finished; look for any errors in the above output " \
172183 " or in $( BUILDDIR) /spellcheck/ ."
173184
174185.PHONY : html_meta
175- html_meta :
186+ html_meta : deps # # Add meta data headers to all Markdown pages
176187 python ./docs/addMetaData.py
177188
178189.PHONY : doctest
179- doctest :
190+ doctest : deps
180191 cd $(DOCS_DIR ) && $(SPHINXBUILD ) -b doctest $(ALLSPHINXOPTS ) $(BUILDDIR ) /doctest
181192 @echo " Testing of doctests in the sources finished, look at the " \
182193 " results in $( BUILDDIR) /doctest/output.txt."
183194
184195.PHONY : test
185- test : clean linkcheck spellcheck # # Run linkcheck, spellcheck
196+ test : clean linkcheck spellcheck # # Clean docs build, then run linkcheck, spellcheck
186197
187198.PHONY : deploy
188199deploy : clean html
189200
190201.PHONY : livehtml
191- livehtml : # # Rebuild Sphinx documentation on changes, with live-reload in the browser
192- cd " $( DOCS_DIR) " && sphinx-autobuild \
202+ livehtml : deps # # Rebuild Sphinx documentation on changes, with live-reload in the browser
203+ cd " $( DOCS_DIR) " && ${SPHINXAUTOBUILD} \
193204 --ignore " *.swp" \
194205 -b html . " $( BUILDDIR) /html" $(SPHINXOPTS ) $(O )
195206
207+ .PHONY : netlify
208+ netlify :
209+ pip install -r requirements.txt
210+ git submodule init; \
211+ git submodule update; \
212+ ln -s ../submodules/volto/docs/source ./docs/volto
213+ cd $(DOCS_DIR ) && sphinx-build -b html $(ALLSPHINXOPTS ) $(BUILDDIR ) /html
214+
196215.PHONY : all
197- all : clean spellcheck linkcheck html # # Run checks and build html
216+ all : clean spellcheck linkcheck html # # Clean docs build, then run linkcheck and spellcheck, and build html
0 commit comments