* gen-make-variable: New script.
* doc/Makefile.am: Include $(srcdir)/pbm-figures.mk,
($(srcdir)/pgm-figures.mk and $(srcdir)/ppm-figures.mk.
($(srcdir)/pbm-figures.mk)
($(srcdir)/pgm-figures.mk)
($(srcdir)/ppm-figures.mk):
New targets.
(EXTRA_DIST): Add $(PBM_FIGURES), $(PGM_FIGURES), $(PPM_FIGURES).
(regen-pbm-figures-mk)
(regen-pgm-figures-mk)
(regen-ppm-figures-mk):
New (phony target).
(regen-am): Remake regen-pbm-figures-mk, regen-pgm-figures-mk and
regen-ppm-figures-mk instead of calling generate_dist_files.sh to
convert figures.
($(srcdir)/headers.stamp): No longer call generate_dist_files.sh to
convert figures.
(convert_to_png): New variable.
(SUFFIXES): Add .pbm, .pgm, .ppm and .png.
(.pbm.png, .pgm.png, .ppm.png): New suffix rules.
(PNG_FIGURES): New variable.
(EXTRA_DIST, MAINTAINERCLEANFILES): Add $(PNG_FIGURES).
(refman_dependencies):
Remove $(srcdir)/figures.stamp.
Add $(PNG_FIGURES).
(technical_dependencies)
(tutorial_dependencies)
(ref_guide_dependencies):
Likewise.
No longer include $(srcdir)/figures/figures.mk.
($(srcdir)/figures/figures.mk, $(srcdir)/figures.stamp):
Remove rules.
(EXTRA_DIST, MAINTAINERCLEANFILES):
Remove $(srcdir)/figures.stamp.
(EXTRA_DIST): Add gen-make-variable.
* pbm-figures.mk, pgm-figures.mk, ppm-figures.mk:
New (generated) Make helpers.
* figures/figures.mk: Remove.
---
milena/ChangeLog | 43 ++++++
milena/doc/Makefile.am | 140 +++++++++++++++-----
milena/doc/figures/figures.mk | 41 ------
.../{gen-examples-outputs-mk => gen-make-variable} | 41 ++++--
milena/doc/pbm-figures.mk | 11 ++
milena/doc/pgm-figures.mk | 7 +
milena/doc/ppm-figures.mk | 30 ++++
7 files changed, 227 insertions(+), 86 deletions(-)
delete mode 100644 milena/doc/figures/figures.mk
copy milena/doc/{gen-examples-outputs-mk => gen-make-variable} (54%)
create mode 100644 milena/doc/pbm-figures.mk
create mode 100644 milena/doc/pgm-figures.mk
create mode 100644 milena/doc/ppm-figures.mk
diff --git a/milena/ChangeLog b/milena/ChangeLog
index 51f1159..d4178a6 100644
--- a/milena/ChangeLog
+++ b/milena/ChangeLog
@@ -1,3 +1,46 @@
+2010-03-16 Roland Levillain <roland(a)lrde.epita.fr>
+
+ Revamp the conversion of images in the documentation.
+
+ * gen-make-variable: New script.
+ * doc/Makefile.am: Include $(srcdir)/pbm-figures.mk,
+ ($(srcdir)/pgm-figures.mk and $(srcdir)/ppm-figures.mk.
+ ($(srcdir)/pbm-figures.mk)
+ ($(srcdir)/pgm-figures.mk)
+ ($(srcdir)/ppm-figures.mk):
+ New targets.
+ (EXTRA_DIST): Add $(PBM_FIGURES), $(PGM_FIGURES), $(PPM_FIGURES).
+ (regen-pbm-figures-mk)
+ (regen-pgm-figures-mk)
+ (regen-ppm-figures-mk):
+ New (phony target).
+ (regen-am): Remake regen-pbm-figures-mk, regen-pgm-figures-mk and
+ regen-ppm-figures-mk instead of calling generate_dist_files.sh to
+ convert figures.
+ ($(srcdir)/headers.stamp): No longer call generate_dist_files.sh to
+ convert figures.
+ (convert_to_png): New variable.
+ (SUFFIXES): Add .pbm, .pgm, .ppm and .png.
+ (.pbm.png, .pgm.png, .ppm.png): New suffix rules.
+ (PNG_FIGURES): New variable.
+ (EXTRA_DIST, MAINTAINERCLEANFILES): Add $(PNG_FIGURES).
+ (refman_dependencies):
+ Remove $(srcdir)/figures.stamp.
+ Add $(PNG_FIGURES).
+ (technical_dependencies)
+ (tutorial_dependencies)
+ (ref_guide_dependencies):
+ Likewise.
+ No longer include $(srcdir)/figures/figures.mk.
+ ($(srcdir)/figures/figures.mk, $(srcdir)/figures.stamp):
+ Remove rules.
+ (EXTRA_DIST, MAINTAINERCLEANFILES):
+ Remove $(srcdir)/figures.stamp.
+ (EXTRA_DIST): Add gen-make-variable.
+ * pbm-figures.mk, pgm-figures.mk, ppm-figures.mk:
+ New (generated) Make helpers.
+ * figures/figures.mk: Remove.
+
2010-03-17 Roland Levillain <roland(a)lrde.epita.fr>
Add a rule to forcefully regen doc/examples-outputs.mk.
diff --git a/milena/doc/Makefile.am b/milena/doc/Makefile.am
index e31ddc8..8f312a3 100644
--- a/milena/doc/Makefile.am
+++ b/milena/doc/Makefile.am
@@ -93,6 +93,104 @@ TEXI2DVI_FLAGS += -I $(DOC_SRCDIR)/white_paper
DOC_PACKAGES = $(srcdir)/doxyfuns.sty $(srcdir)/milena.sty
+## --------- ##
+## Figures. ##
+## --------- ##
+
+# ----- #
+# PBM. #
+# ----- #
+
+$(srcdir)/pbm-figures.mk: $(srcdir)/gen-make-variable
+ rm -f $@.tmp
+ $(srcdir)/gen-make-variable PBM_FIGURES \
+ `find $(srcdir)/figures/*.pbm | sed 's,^$(srcdir),\$$(srcdir),'` \
+ >$@.tmp
+ mv -f $@.tmp $@
+ chmod -w $@
+include $(srcdir)/pbm-figures.mk
+EXTRA_DIST += $(PBM_FIGURES)
+
+.PHONY: regen-pbm-figures-mk
+regen-pbm-figures-mk:
+ rm -f $(srcdir)/pbm-figures.mk.tmp
+ $(srcdir)/gen-make-variable PBM_FIGURES \
+ `find $(srcdir)/figures/*.pbm | sed 's,^$(srcdir),\$$(srcdir),'` \
+ >$(srcdir)/pbm-figures.mk.tmp
+ mv -f $(srcdir)/pbm-figures.mk.tmp $(srcdir)/pbm-figures.mk
+ chmod -w $(srcdir)/pbm-figures.mk
+
+# ----- #
+# PGM. #
+# ----- #
+
+$(srcdir)/pgm-figures.mk: $(srcdir)/gen-make-variable
+ rm -f $@.tmp
+ $(srcdir)/gen-make-variable PGM_FIGURES \
+ `find $(srcdir)/figures/*.pgm | sed 's,^$(srcdir),\$$(srcdir),'` \
+ >$@.tmp
+ mv -f $@.tmp $@
+ chmod -w $@
+include $(srcdir)/pgm-figures.mk
+EXTRA_DIST += $(PGM_FIGURES)
+
+.PHONY: regen-pgm-figures-mk
+regen-pgm-figures-mk:
+ rm -f $(srcdir)/pgm-figures.mk.tmp
+ $(srcdir)/gen-make-variable PGM_FIGURES \
+ `find $(srcdir)/figures/*.pgm | sed 's,^$(srcdir),\$$(srcdir),'` \
+ >$(srcdir)/pgm-figures.mk.tmp
+ mv -f $(srcdir)/pgm-figures.mk.tmp $(srcdir)/pgm-figures.mk
+ chmod -w $(srcdir)/pgm-figures.mk
+
+# ----- #
+# PPM. #
+# ----- #
+
+$(srcdir)/ppm-figures.mk: $(srcdir)/gen-make-variable
+ rm -f $@.tmp
+ $(srcdir)/gen-make-variable PPM_FIGURES \
+ `find $(srcdir)/figures/*.ppm | sed 's,^$(srcdir),\$$(srcdir),'` \
+ >$@.tmp
+ mv -f $@.tmp $@
+ chmod -w $@
+include $(srcdir)/ppm-figures.mk
+EXTRA_DIST += $(PPM_FIGURES)
+
+.PHONY: regen-ppm-figures-mk
+regen-ppm-figures-mk:
+ rm -f $(srcdir)/ppm-figures.mk.tmp
+ $(srcdir)/gen-make-variable PPM_FIGURES \
+ `find $(srcdir)/figures/*.ppm | sed 's,^$(srcdir),\$$(srcdir),'` \
+ >$(srcdir)/ppm-figures.mk.tmp
+ mv -f $(srcdir)/ppm-figures.mk.tmp $(srcdir)/ppm-figures.mk
+ chmod -w $(srcdir)/ppm-figures.mk
+
+# ----- #
+# PNG. #
+# ----- #
+
+convert_to_png = convert -scale 250 -bordercolor black -border 2x2
+
+SUFFIXES += .pbm .pgm .ppm .png
+
+.pbm.png:
+ $(convert_to_png) $< $@
+
+.pgm.png:
+ $(convert_to_png) $< $@
+
+.ppm.png:
+ $(convert_to_png) $< $@
+
+PNG_FIGURES = \
+ $(PBM_FIGURES:.pbm=.png) \
+ $(PGM_FIGURES:.pgm=.png) \
+ $(PPM_FIGURES:.ppm=.png)
+EXTRA_DIST += $(PNG_FIGURES)
+MAINTAINERCLEANFILES = $(PNG_FIGURES)
+
+
## ----------------------- ##
## Doxygen documentation. ##
## ----------------------- ##
@@ -104,7 +202,7 @@ DOC_PACKAGES = $(srcdir)/doxyfuns.sty $(srcdir)/milena.sty
refman_dependencies = \
$(srcdir)/split-examples.stamp \
$(srcdir)/split-outputs.stamp \
- $(srcdir)/figures.stamp \
+ $(PNG_FIGURES) \
$(srcdir)/tutorial/tutorial.hh \
$(srcdir)/ref_guide/ref_guide.hh
@@ -140,7 +238,7 @@ $(DOXYFILE_USER): $(srcdir)/$(DOXYFILE).in
Id=`grep '^\$$Id' $(top_srcdir)/milena/ChangeLog \
| sed -e 's/\\\$$//g'`; \
$(edit) $< >$@
-MAINTAINERCLEANFILES = $(DOXYFILE_USER)
+MAINTAINERCLEANFILES += $(DOXYFILE_USER)
## FIXME: Rename USER_REFMAN_PDF to something else?
USER_REFMAN_PDF = user-refman.pdf
@@ -293,7 +391,7 @@ technical_dir = $(doc_dir)/technical
# FIXME: Check these dependencies. And it'd be better to depend on
# actual files rather than timestamps corresponding to a bunch of
# files.
-technical_dependencies = $(doc_dir)/figures.stamp
+technical_dependencies = $(PNG_FIGURES)
# FIXME: As in milena/doc/Makefile.am, we should probably strip
# $(srcdir) prefixes from target variables, e.g. instead of:
@@ -400,7 +498,7 @@ tutorial_dir = $(doc_dir)/tutorial
tutorial_dependencies = \
$(doc_dir)/split-examples.stamp \
$(doc_dir)/split-outputs.stamp \
- $(doc_dir)/figures.stamp
+ $(PNG_FIGURES)
# FIXME: As in milena/doc/Makefile.am, we should probably strip
# $(srcdir) prefixes from target variables, e.g. instead of:
@@ -600,7 +698,7 @@ ref_guide_dir = $(doc_dir)/ref_guide
ref_guide_dependencies = \
$(doc_dir)/split-examples.stamp \
$(doc_dir)/split-outputs.stamp \
- $(doc_dir)/figures.stamp
+ $(PNG_FIGURES)
# FIXME: As in milena/doc/Makefile.am, we should probably strip
# $(srcdir) prefixes from target variables, e.g. instead of:
@@ -690,30 +788,6 @@ EXTRA_DIST += \
MAINTAINERCLEANFILES += $(REF_GUIDE_HH)
-## --------- ##
-## Figures. ##
-## --------- ##
-
-$(srcdir)/figures/figures.mk: $(srcdir)/headers.stamp
-include $(srcdir)/figures/figures.mk
-
-EXTRA_DIST += $(srcdir)/figures.stamp
-MAINTAINERCLEANFILES += $(srcdir)/figures.stamp
-$(srcdir)/figures.stamp: $(FIGURES_SRCDIR)/*.p*m
- rm -f $@.tmp
- touch $@.tmp
- failcom='exit 1'; \
- list="$(FIGURES_SRCDIR)/*.p*m"; for img in $$list; do \
- echo "Converting $$img to PNG"; \
- name=`basename $$img` \
- ext=`echo $$name | cut -d '.' -f 2`; \
- convert -scale 250 -bordercolor black -border 2x2 $$img \
- $(FIGURES_SRCDIR)/`basename $$img $$ext`png \
- || eval $$failcom; \
- done
- mv -f $@.tmp $@
-
-
## ---------- ##
## Examples. ##
## ---------- ##
@@ -1065,9 +1139,11 @@ include $(top_srcdir)/build-aux/regen-recursive.mk
regen-am:
@rm -f $(srcdir)/headers.stamp.tmp
@touch $(srcdir)/headers.stamp.tmp
+ $(MAKE) $(AM_MAKEFLAGS) regen-pbm-figures-mk
+ $(MAKE) $(AM_MAKEFLAGS) regen-pgm-figures-mk
+ $(MAKE) $(AM_MAKEFLAGS) regen-ppm-figures-mk
$(MAKE) $(AM_MAKEFLAGS) regen-examples-outputs-mk
@cd $(srcdir) && \
- ./generate_dist_files.sh figures 'p*m' && \
./generate_dist_files.sh outputs txt && \
./generate_dist_files.sh examples cc.raw
@mv -f $(srcdir)/headers.stamp.tmp $(srcdir)/headers.stamp
@@ -1080,7 +1156,6 @@ $(srcdir)/headers.stamp: $(srcdir)/generate_dist_files.sh
@rm -f $@.tmp
@touch $@.tmp
@cd $(srcdir) && \
- ./generate_dist_files.sh figures 'p*m' && \
./generate_dist_files.sh outputs txt && \
./generate_dist_files.sh examples cc.raw
@mv -f $@.tmp $@
@@ -1141,4 +1216,7 @@ EXTRA_DIST += \
tools/split_sample.sh \
tools/todoxygen.sh
+# Generate a Makefile helper containing a variable assignment.
+EXTRA_DIST += gen-make-variable
+# FIXME: Can't we implement this using `gen-make-variable'?
EXTRA_DIST += gen-examples-outputs-mk
diff --git a/milena/doc/figures/figures.mk b/milena/doc/figures/figures.mk
deleted file mode 100644
index 38fc1d1..0000000
--- a/milena/doc/figures/figures.mk
+++ /dev/null
@@ -1,41 +0,0 @@
-## Generated by ../generate_dist_files, do not modify.
-
-EXTRA_DIST += \
-figures/extend-1.ppm \
-figures/extend-2.ppm \
-figures/extend-3.ppm \
-figures/extend-4.ppm \
-figures/extend-5.ppm \
-figures/fill-1.ppm \
-figures/fill-2.ppm \
-figures/fill-imageif-cfun-1.ppm \
-figures/fill-subdomain-1.pbm \
-figures/fill-subdomain-2.ppm \
-figures/fill-subdomain-3.ppm \
-figures/fill-subdomain-4.ppm \
-figures/ima2d-rot-1.ppm \
-figures/ima2d-rot-2.ppm \
-figures/ima_save.pbm \
-figures/labeling-compute-1.pbm \
-figures/labeling-compute-2.ppm \
-figures/logical-not-1.pbm \
-figures/logical-not-2.pbm \
-figures/logical-not-3.pbm \
-figures/tuto2_first_image-1.pbm \
-figures/tuto3_colorize-1.pgm \
-figures/tuto3_colorize-2.ppm \
-figures/tuto3_rw_image-1.ppm \
-figures/tuto3_rw_image-2.ppm \
-figures/tuto3_rw_image-3.ppm \
-figures/tuto4_genericity_and_algorithms-1.ppm \
-figures/tuto4_genericity_and_algorithms-2.ppm \
-figures/tuto4_genericity_and_algorithms-3.pbm \
-figures/tuto4_genericity_and_algorithms-4.ppm \
-figures/tuto4_genericity_and_algorithms-5.ppm \
-figures/tuto4_genericity_and_algorithms-6.ppm \
-figures/tuto4_genericity_and_algorithms-7.pgm \
-figures/tuto4_genericity_and_algorithms-7.ppm \
-figures/tuto4_genericity_and_algorithms-8.pgm \
-figures/tuto4_genericity_and_algorithms-8.ppm \
-figures/tuto4_genericity_and_algorithms-9.pgm \
-figures/tuto4_genericity_and_algorithms-9.ppm
diff --git a/milena/doc/gen-examples-outputs-mk b/milena/doc/gen-make-variable
similarity index 54%
copy from milena/doc/gen-examples-outputs-mk
copy to milena/doc/gen-make-variable
index 10692a1..91403ae 100755
--- a/milena/doc/gen-examples-outputs-mk
+++ b/milena/doc/gen-make-variable
@@ -16,24 +16,37 @@
# You should have received a copy of the GNU General Public License
# along with Olena. If not, see <http://www.gnu.org/licenses/>.
-# To be used from milena/doc/'s source directory.
-
me=`basename $0`
-test $# -ne 0 || { echo "usage: $me PROGRAMS..."; exit 1; }
+# Use the C locale to have a deterministic sort.
+export LC_ALL=C
+
+test $# -gt 1 || { echo "usage: $me VARIABLE FILES..."; exit 1; }
+
+# backslashify
+# ------------
+# Read lines from the standard input and write them on the standard
+# output with an extra trailing backslash, except for the last line.
+backslashify()
+{
+ # Set IFS to nothing to prevent `read' from trimming spaces or tabs.
+ IFS= read last_line
+ while IFS= read line; do
+ echo "$last_line \\"
+ last_line=$line
+ done
+ echo "$last_line"
+}
cat<<EOF
## Generated by $me. Do not edit by hand.
EOF
-
-for program; do
-cat<<EOF
-\$(srcdir)/outputs/$program.txt: $program\$(EXEEXT)
- rm -f \$@.tmp
- ./\$< >\$@.tmp
- cp -f \$@.tmp \$@
- rm -f \$@.tmp
-
-EOF
-done
+{
+ echo "$1 ="
+ shift
+ for var; do
+ echo "$var"
+ shift
+ done | sort | sed 's/\(.*\)/ \1/'
+} | backslashify
diff --git a/milena/doc/pbm-figures.mk b/milena/doc/pbm-figures.mk
new file mode 100644
index 0000000..dd061a5
--- /dev/null
+++ b/milena/doc/pbm-figures.mk
@@ -0,0 +1,11 @@
+## Generated by gen-make-variable. Do not edit by hand.
+
+PBM_FIGURES = \
+ $(srcdir)/figures/fill-subdomain-1.pbm \
+ $(srcdir)/figures/ima_save.pbm \
+ $(srcdir)/figures/labeling-compute-1.pbm \
+ $(srcdir)/figures/logical-not-1.pbm \
+ $(srcdir)/figures/logical-not-2.pbm \
+ $(srcdir)/figures/logical-not-3.pbm \
+ $(srcdir)/figures/tuto2_first_image-1.pbm \
+ $(srcdir)/figures/tuto4_genericity_and_algorithms-3.pbm
diff --git a/milena/doc/pgm-figures.mk b/milena/doc/pgm-figures.mk
new file mode 100644
index 0000000..b65d78f
--- /dev/null
+++ b/milena/doc/pgm-figures.mk
@@ -0,0 +1,7 @@
+## Generated by gen-make-variable. Do not edit by hand.
+
+PGM_FIGURES = \
+ $(srcdir)/figures/tuto3_colorize-1.pgm \
+ $(srcdir)/figures/tuto4_genericity_and_algorithms-7.pgm \
+ $(srcdir)/figures/tuto4_genericity_and_algorithms-8.pgm \
+ $(srcdir)/figures/tuto4_genericity_and_algorithms-9.pgm
diff --git a/milena/doc/ppm-figures.mk b/milena/doc/ppm-figures.mk
new file mode 100644
index 0000000..835a32e
--- /dev/null
+++ b/milena/doc/ppm-figures.mk
@@ -0,0 +1,30 @@
+## Generated by gen-make-variable. Do not edit by hand.
+
+PPM_FIGURES = \
+ $(srcdir)/figures/extend-1.ppm \
+ $(srcdir)/figures/extend-2.ppm \
+ $(srcdir)/figures/extend-3.ppm \
+ $(srcdir)/figures/extend-4.ppm \
+ $(srcdir)/figures/extend-5.ppm \
+ $(srcdir)/figures/fill-1.ppm \
+ $(srcdir)/figures/fill-2.ppm \
+ $(srcdir)/figures/fill-imageif-cfun-1.ppm \
+ $(srcdir)/figures/fill-subdomain-2.ppm \
+ $(srcdir)/figures/fill-subdomain-3.ppm \
+ $(srcdir)/figures/fill-subdomain-4.ppm \
+ $(srcdir)/figures/fill-subimage-cfun-1.ppm \
+ $(srcdir)/figures/ima2d-rot-1.ppm \
+ $(srcdir)/figures/ima2d-rot-2.ppm \
+ $(srcdir)/figures/labeling-compute-2.ppm \
+ $(srcdir)/figures/tuto3_colorize-2.ppm \
+ $(srcdir)/figures/tuto3_rw_image-1.ppm \
+ $(srcdir)/figures/tuto3_rw_image-2.ppm \
+ $(srcdir)/figures/tuto3_rw_image-3.ppm \
+ $(srcdir)/figures/tuto4_genericity_and_algorithms-1.ppm \
+ $(srcdir)/figures/tuto4_genericity_and_algorithms-2.ppm \
+ $(srcdir)/figures/tuto4_genericity_and_algorithms-4.ppm \
+ $(srcdir)/figures/tuto4_genericity_and_algorithms-5.ppm \
+ $(srcdir)/figures/tuto4_genericity_and_algorithms-6.ppm \
+ $(srcdir)/figures/tuto4_genericity_and_algorithms-7.ppm \
+ $(srcdir)/figures/tuto4_genericity_and_algorithms-8.ppm \
+ $(srcdir)/figures/tuto4_genericity_and_algorithms-9.ppm
--
1.5.6.5