Skip to content

Commit df6c4b7

Browse files
committed
Add deps target, to be used by other targets
1 parent 04aedf5 commit df6c4b7

File tree

1 file changed

+38
-34
lines changed

1 file changed

+38
-34
lines changed

Makefile

Lines changed: 38 additions & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ SHELL=bash
77

88
# You can set these variables from the command line.
99
SPHINXOPTS =
10-
SPHINXBUILD = sphinx-build
10+
SPHINXBUILD = $(realpath bin/sphinx-build)
1111
PAPER =
1212
DOCS_DIR = ./docs/
1313
BUILDDIR = ../_build/
@@ -31,61 +31,70 @@ clean: ## Clean build directory
3131
cd $(DOCS_DIR) && rm -rf $(BUILDDIR)/*
3232

3333
.PHONY: build
34-
build: ## Set up training: Install requirements
34+
build: ## Set up training: Install requirements
3535
python3 -m venv . || virtualenv --clear --python=python3 .
3636
bin/python -m pip install --upgrade pip
3737
bin/pip install -r requirements.txt
3838
@echo
3939
@echo "Please activate your Python virtual environment with"
4040
@echo "source bin/activate"
4141

42-
bin/python: build
43-
@echo
42+
bin/python:
43+
python3 -m venv . || virtualenv --clear --python=python3 .
44+
bin/python -m pip install --upgrade pip
45+
bin/pip install -r requirements.txt
46+
47+
submodules/volto:
48+
# git submodule add [email protected]:plone/volto.git submodules/volto
49+
git submodule init
50+
ln -s ../submodules/volto/docs/source ./docs/volto
51+
52+
.PHONY: deps
53+
deps: bin/python submodules/volto
4454

4555
.PHONY: html
46-
html: submodules/volto bin/python # Build html
47-
source bin/activate; \
56+
html: deps # Build html
4857
cd $(DOCS_DIR) && $(SPHINXBUILD) -b html $(ALLSPHINXOPTS) $(BUILDDIR)/html
4958
@echo
5059
@echo "Build finished. The HTML pages are in $(BUILDDIR)/html."
5160

5261
.PHONY: manual
53-
manual:
62+
manual: deps
5463
cd $(DOCS_DIR) && $(SPHINXBUILD) -b html -t manual . manual
5564

5665
.PHONY: dirhtml
57-
dirhtml:
66+
dirhtml: deps
5867
cd $(DOCS_DIR) && $(SPHINXBUILD) -b dirhtml $(ALLSPHINXOPTS) $(BUILDDIR)/dirhtml
5968
@echo
6069
@echo "Build finished. The HTML pages are in $(BUILDDIR)/dirhtml."
6170

6271
.PHONY: singlehtml
63-
singlehtml:
72+
singlehtml: deps
6473
cd $(DOCS_DIR) && $(SPHINXBUILD) -b singlehtml $(ALLSPHINXOPTS) $(BUILDDIR)/singlehtml
6574
@echo
6675
@echo "Build finished. The HTML page is in $(BUILDDIR)/singlehtml."
6776

6877
.PHONY: pickle
69-
pickle:
78+
pickle: deps
7079
cd $(DOCS_DIR) && $(SPHINXBUILD) -b pickle $(ALLSPHINXOPTS) $(BUILDDIR)/pickle
7180
@echo
7281
@echo "Build finished; now you can process the pickle files."
7382

7483
.PHONY: json
75-
json:
84+
json: deps
7685
cd $(DOCS_DIR) && $(SPHINXBUILD) -b json $(ALLSPHINXOPTS) $(BUILDDIR)/json
7786
@echo
7887
@echo "Build finished; now you can process the JSON files."
7988

8089
.PHONY: htmlhelp
81-
htmlhelp:
90+
htmlhelp: deps
8291
cd $(DOCS_DIR) && $(SPHINXBUILD) -b htmlhelp $(ALLSPHINXOPTS) $(BUILDDIR)/htmlhelp
8392
@echo
8493
@echo "Build finished; now you can run HTML Help Workshop with the" \
8594
".hhp project file in $(BUILDDIR)/htmlhelp."
8695

8796
.PHONY: qthelp
88-
qthelp:
97+
qthelp: deps
8998
cd $(DOCS_DIR) && $(SPHINXBUILD) -b qthelp $(ALLSPHINXOPTS) $(BUILDDIR)/qthelp
9099
@echo
91100
@echo "Build finished; now you can run "qcollectiongenerator" with the" \
@@ -95,7 +104,7 @@ qthelp:
95104
@echo "# assistant -collectionFile $(BUILDDIR)/qthelp/MasteringPlone.qhc"
96105

97106
.PHONY: devhelp
98-
devhelp:
107+
devhelp: deps
99108
cd $(DOCS_DIR) && $(SPHINXBUILD) -b devhelp $(ALLSPHINXOPTS) $(BUILDDIR)/devhelp
100109
@echo
101110
@echo "Build finished."
@@ -105,86 +114,86 @@ devhelp:
105114
@echo "# devhelp"
106115

107116
.PHONY: epub
108-
epub:
117+
epub: deps
109118
cd $(DOCS_DIR) && $(SPHINXBUILD) -b epub $(ALLSPHINXOPTS) $(BUILDDIR)/epub
110119
@echo
111120
@echo "Build finished. The epub file is in $(BUILDDIR)/epub."
112121

113122
.PHONY: latex
114-
latex:
123+
latex: deps
115124
cd $(DOCS_DIR) && $(SPHINXBUILD) -b latex $(ALLSPHINXOPTS) $(BUILDDIR)/latex
116125
@echo
117126
@echo "Build finished; the LaTeX files are in $(BUILDDIR)/latex."
118127
@echo "Run \`make' in that directory to run these through (pdf)latex" \
119128
"(use \`make latexpdf' here to do that automatically)."
120129

121130
.PHONY: latexpdf
122-
latexpdf:
131+
latexpdf: deps
123132
cd $(DOCS_DIR) && $(SPHINXBUILD) -b latex $(ALLSPHINXOPTS) $(BUILDDIR)/latex
124133
@echo "Running LaTeX files through pdflatex..."
125134
$(MAKE) -C $(BUILDDIR)/latex all-pdf
126135
@echo "pdflatex finished; the PDF files are in $(BUILDDIR)/latex."
127136

128137
.PHONY: text
129-
text:
138+
text: deps
130139
cd $(DOCS_DIR) && $(SPHINXBUILD) -b text $(ALLSPHINXOPTS) $(BUILDDIR)/text
131140
@echo
132141
@echo "Build finished. The text files are in $(BUILDDIR)/text."
133142

134143
.PHONY: man
135-
man:
144+
man: deps
136145
cd $(DOCS_DIR) && $(SPHINXBUILD) -b man $(ALLSPHINXOPTS) $(BUILDDIR)/man
137146
@echo
138147
@echo "Build finished. The manual pages are in $(BUILDDIR)/man."
139148

140149
.PHONY: texinfo
141-
texinfo:
150+
texinfo: deps
142151
cd $(DOCS_DIR) && $(SPHINXBUILD) -b texinfo $(ALLSPHINXOPTS) $(BUILDDIR)/texinfo
143152
@echo
144153
@echo "Build finished. The Texinfo files are in $(BUILDDIR)/texinfo."
145154
@echo "Run \`make' in that directory to run these through makeinfo" \
146155
"(use \`make info' here to do that automatically)."
147156

148157
.PHONY: info
149-
info:
158+
info: deps
150159
cd $(DOCS_DIR) && $(SPHINXBUILD) -b texinfo $(ALLSPHINXOPTS) $(BUILDDIR)/texinfo
151160
@echo "Running Texinfo files through makeinfo..."
152161
make -C $(BUILDDIR)/texinfo info
153162
@echo "makeinfo finished; the Info files are in $(BUILDDIR)/texinfo."
154163

155164
.PHONY: changes
156-
changes:
165+
changes: deps
157166
cd $(DOCS_DIR) && $(SPHINXBUILD) -b changes $(ALLSPHINXOPTS) $(BUILDDIR)/changes
158167
@echo
159168
@echo "The overview file is in $(BUILDDIR)/changes."
160169

161170
.PHONY: linkcheck
162-
linkcheck: ## Run linkcheck
171+
linkcheck: deps ## Run linkcheck
163172
cd $(DOCS_DIR) && $(SPHINXBUILD) -b linkcheck $(ALLSPHINXOPTS) $(BUILDDIR)/linkcheck
164173
@echo
165174
@echo "Link check complete; look for any errors in the above output " \
166175
"or in $(BUILDDIR)/linkcheck/ ."
167176

168177
.PHONY: linkcheckbroken
169-
linkcheckbroken: ## Run linkcheck and show only broken links
178+
linkcheckbroken: deps ## Run linkcheck and show only broken links
170179
cd $(DOCS_DIR) && $(SPHINXBUILD) -b linkcheck $(ALLSPHINXOPTS) $(BUILDDIR)/linkcheck | GREP_COLORS='0;31' egrep -wi broken --color=auto
171180
@echo
172181
@echo "Link check complete; look for any errors in the above output " \
173182
"or in $(BUILDDIR)/linkcheck/ ."
174183

175184
.PHONY: spellcheck
176-
spellcheck: ## Run spellcheck
185+
spellcheck: deps ## Run spellcheck
177186
cd $(DOCS_DIR) && LANGUAGE=$* $(SPHINXBUILD) -b spelling -j 4 $(ALLSPHINXOPTS) $(BUILDDIR)/spellcheck/$*
178187
@echo
179188
@echo "Spellcheck is finished; look for any errors in the above output " \
180189
" or in $(BUILDDIR)/spellcheck/ ."
181190

182191
.PHONY: html_meta
183-
html_meta:
192+
html_meta: deps
184193
python ./docs/addMetaData.py
185194

186195
.PHONY: doctest
187-
doctest:
196+
doctest: deps
188197
cd $(DOCS_DIR) && $(SPHINXBUILD) -b doctest $(ALLSPHINXOPTS) $(BUILDDIR)/doctest
189198
@echo "Testing of doctests in the sources finished, look at the " \
190199
"results in $(BUILDDIR)/doctest/output.txt."
@@ -196,19 +205,14 @@ test: clean linkcheck spellcheck ## Run linkcheck, spellcheck
196205
deploy: clean html
197206

198207
.PHONY: livehtml
199-
livehtml: submodules/volto ## Rebuild Sphinx documentation on changes, with live-reload in the browser
208+
livehtml: deps ## Rebuild Sphinx documentation on changes, with live-reload in the browser
200209
cd "$(DOCS_DIR)" && sphinx-autobuild \
201210
--ignore "*.swp" \
202211
-b html . "$(BUILDDIR)/html" $(SPHINXOPTS) $(O)
203212

204213
.PHONY: all
205214
all: clean spellcheck linkcheck html ## Run checks and build html
206215

207-
submodules/volto:
208-
# git submodule add [email protected]:plone/volto.git submodules/volto
209-
git submodule init
210-
ln -s ../submodules/volto/docs/source ./docs/volto
211-
212216
.PHONY: serve-docs
213-
serve-docs: ## Start an HTTP server for docs
217+
serve-docs: html ## Start an HTTP server for docs
214218
python -m http.server --directory ./_build/html

0 commit comments

Comments
 (0)