Skip to content

Commit cdc5fe8

Browse files
committed
updated Makefile to avoid regenerating figures unless needed
1 parent 1ed8817 commit cdc5fe8

2 files changed

Lines changed: 39 additions & 11 deletions

File tree

doc/.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1 +1,2 @@
11
*.fig.bak
2+
.docfigs

doc/Makefile

Lines changed: 38 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,17 @@
1-
# Minimal makefile for Sphinx documentation
2-
#
1+
# Makefile for python-control Sphinx documentation
2+
# RMM, 15 Jan 2025
3+
4+
FIGS = figures/classes.pdf
5+
RST_FIGS = figures/flatsys-steering-compare.png \
6+
figures/iosys-predprey-open.png \
7+
figures/timeplot-servomech-combined.png \
8+
figures/steering-optimal.png figures/ctrlplot-servomech.png \
9+
figures/phaseplot-dampedosc-default.png \
10+
figures/timeplot-mimo_step-default.png \
11+
figures/freqplot-siso_bode-default.png \
12+
figures/pzmap-siso_ctime-default.png \
13+
figures/rlocus-siso_ctime-default.png \
14+
figures/stochastic-whitenoise-response.png
315

416
# You can set these variables from the command line.
517
SPHINXOPTS =
@@ -12,18 +24,33 @@ BUILDDIR = _build
1224
help:
1325
@$(SPHINXBUILD) -M help "$(SOURCEDIR)" "$(BUILDDIR)" $(SPHINXOPTS) $(O)
1426

15-
.PHONY: help Makefile doctest
27+
.PHONY: help Makefile html latexpdf doctest clean distclean
1628

17-
# Catch-all target: route all unknown targets to Sphinx using the new
18-
# "make mode" option. $(O) is meant as a shortcut for $(SPHINXOPTS).
19-
html latexpdf: Makefile doctest
20-
make -C figures
21-
@$(SPHINXBUILD) -M $@ "$(SOURCEDIR)" "$(BUILDDIR)" $(SPHINXOPTS) $(O)
29+
# List of the first RST figure of each type in each file that is generated
30+
figures/flatsys-steering-compare.png: flatsys.rst
31+
figures/iosys-predprey-open.png: iosys.rst
32+
figures/timeplot-servomech-combined.png: nlsys.rst
33+
figures/steering-optimal.png: optimal.rst
34+
figures/phaseplot-dampedosc-default.png: phaseplot.rst
35+
figures/timeplot-mimo_step-default.png: response.rst
36+
figures/freqplot-siso_bode-default.png: response.rst
37+
figures/pzmap-siso_ctime-default.png: response.rst
38+
figures/rlocus-siso_ctime-default.png: response.rst
39+
figures/ctrlplot-servomech.png: response.rst
40+
figures/stochastic-whitenoise-response.png: stochastic.rst
2241

23-
doctest: Makefile
24-
@$(SPHINXBUILD) -M $@ "$(SOURCEDIR)" "$(BUILDDIR)" $(SPHINXOPTS) $(O)
42+
# Other figure rules
43+
figure/classes.pdf: figure/classes.fig
44+
make -C figures classes.pdf
45+
46+
# Rule to run `make doctest` once for all figures
47+
.docfigs: $(RST_FIGS)
48+
@$(SPHINXBUILD) -M doctest "$(SOURCEDIR)" "$(BUILDDIR)"
49+
touch $@
2550

26-
clean:
51+
# Catch-all target: route all unknown targets to Sphinx using the new
52+
# "make mode" option. $(O) is meant as a shortcut for $(SPHINXOPTS).
53+
html latexpdf doctest clean: Makefile .docfigs $(FIGS)
2754
@$(SPHINXBUILD) -M $@ "$(SOURCEDIR)" "$(BUILDDIR)" $(SPHINXOPTS) $(O)
2855

2956
distclean: clean

0 commit comments

Comments
 (0)