Commit 63aa7224 authored by Roland Levillain's avatar Roland Levillain
Browse files

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.
parent 42899043
2010-03-16 Roland Levillain <roland@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@lrde.epita.fr>
 
Add a rule to forcefully regen doc/examples-outputs.mk.
......@@ -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
## 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
#! /bin/sh
# Copyright (C) 2010 EPITA Research and Development Laboratory (LRDE).
#
# This file is part of Olena.
#
# Olena is free software: you can redistribute it and/or modify it under
# the terms of the GNU General Public License as published by the Free
# Software Foundation, version 2 of the License.
#
# Olena is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
# General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with Olena. If not, see <http://www.gnu.org/licenses/>.
me=`basename $0`
# 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
{
echo "$1 ="
shift
for var; do
echo "$var"
shift
done | sort | sed 's/\(.*\)/ \1/'
} | backslashify
## 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
## 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
## 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
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment