* doc/gen-figures-mk (gen_var): New function.
Use to factor the emission of the Make variable at the end of the
output.
Aesthetic changes.
---
milena/ChangeLog | 9 +++++
milena/doc/gen-figures-mk | 77 +++++++++++++++++++++++++--------------------
2 files changed, 52 insertions(+), 34 deletions(-)
diff --git a/milena/ChangeLog b/milena/ChangeLog
index d4633d1..d852efd 100644
--- a/milena/ChangeLog
+++ b/milena/ChangeLog
@@ -1,5 +1,14 @@
2010-03-22 Roland Levillain <roland(a)lrde.epita.fr>
+ Rework doc/gen-figures-mk a bit.
+
+ * doc/gen-figures-mk (gen_var): New function.
+ Use to factor the emission of the Make variable at the end of the
+ output.
+ Aesthetic changes.
+
+2010-03-22 Roland Levillain <roland(a)lrde.epita.fr>
+
Distribute doc/gen-split-outputs-mk.
* doc/Makefile.am (EXTRA_DIST): Add gen-split-outputs-mk.
diff --git a/milena/doc/gen-figures-mk b/milena/doc/gen-figures-mk
index cdbffbf..a566cee 100755
--- a/milena/doc/gen-figures-mk
+++ b/milena/doc/gen-figures-mk
@@ -85,9 +85,23 @@ backslashify()
echo "$last_line"
}
-# Empty FIG_VARS.
+# List of generated figures.
fig_vars=
+# gen_var VARIABLE [ITEMS...]
+# ---------------------------
+# Generate a Make variable named VARIABLE containing ITEMS.
+gen_var()
+{
+ local v
+ {
+ echo "$1 ="
+ shift
+ for v; do
+ echo " $v"
+ done
+ } | backslashify
+}
cat<<EOF
## Generated by $me. Do not edit by hand.
@@ -107,32 +121,33 @@ for file in `inputs`; do
fi
if test -n "$figures"; then
-
- # FIXME: Programs of which sources are located in a subdirectory of
- # examples/ take the path as prefix of their name. This is a pain.
- # It'd be much simpler to have all sources in the same directory.
- canonical_name=`echo "$file" \
- | sed -e 's,examples/,,' \
- -e 'y,/,_,' \
- -e 's,\.cc$,,'`
- canonical_var=`canonicalize "$canonical_name"`
- fig_var="`upcase "$canonical_var"`_FIGURES"
- # Populate the list of variables of figures.
- if test -z "$fig_vars"; then
- fig_vars="$fig_var"
- else
- fig_vars="$fig_vars $fig_var"
- fi
- {
- echo "$fig_var ="
- for figure in $figures; do
- echo " \$(srcdir)/figures/$figure"
- done
- } | backslashify
- base=`basename "$file" .cc`
- dir=`dirname "$file"`
- timestamp="\$(srcdir)/$dir/$base.stamp"
- cat <<EOF
+ # FIXME: Programs of which sources are located in a subdirectory of
+ # examples/ take the path as prefix of their name. This is a pain.
+ # It'd be much simpler to have all sources in the same directory.
+ canonical_name=`echo "$file" \
+ | sed -e 's,examples/,,' \
+ -e 'y,/,_,' \
+ -e 's,\.cc$,,'`
+ canonical_var=`canonicalize "$canonical_name"`
+ fig_var="`upcase "$canonical_var"`_FIGURES"
+
+ # Populate the list of variables of figures.
+ fig_vars="$fig_vars \$($fig_var)"
+
+ # Generate a Make variable for the figures produced by FILE.
+ {
+ echo "$fig_var ="
+ for figure in $figures; do
+ fig_path=" \$(srcdir)/figures/$figure"
+ echo "$fig_path"
+ done
+ } | backslashify
+
+ # Generate a Make rule to regen the figures produced by FILE.
+ base=`basename "$file" .cc`
+ dir=`dirname "$file"`
+ timestamp="\$(srcdir)/$dir/$base.stamp"
+ cat <<EOF
\$($fig_var): $timestamp
## Recover from the removal of \$@
@if test -f \$@; then :; else \\
@@ -141,16 +156,10 @@ for file in `inputs`; do
fi
EOF
-
fi
done
# Output the list of figures.
echo "# The list of all generated figures."
-{
- echo "FIGURES ="
- for v in $fig_vars; do
- echo " \$($v)"
- done
-} | backslashify
+gen_var FIGURES $fig_vars
--
1.5.6.5
Show replies by date