Commit 390b0955 authored by Roland Levillain's avatar Roland Levillain
Browse files

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.
parent c94f5179
2010-03-22 Roland Levillain <roland@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@lrde.epita.fr> 2010-03-22 Roland Levillain <roland@lrde.epita.fr>
   
Distribute doc/gen-split-outputs-mk. Distribute doc/gen-split-outputs-mk.
...@@ -85,9 +85,23 @@ backslashify() ...@@ -85,9 +85,23 @@ backslashify()
echo "$last_line" echo "$last_line"
} }
# Empty FIG_VARS. # List of generated figures.
fig_vars= 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 cat<<EOF
## Generated by $me. Do not edit by hand. ## Generated by $me. Do not edit by hand.
...@@ -107,32 +121,33 @@ for file in `inputs`; do ...@@ -107,32 +121,33 @@ for file in `inputs`; do
fi fi
if test -n "$figures"; then if test -n "$figures"; then
# FIXME: Programs of which sources are located in a subdirectory of
# FIXME: Programs of which sources are located in a subdirectory of # examples/ take the path as prefix of their name. This is a pain.
# 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.
# It'd be much simpler to have all sources in the same directory. canonical_name=`echo "$file" \
canonical_name=`echo "$file" \ | sed -e 's,examples/,,' \
| sed -e 's,examples/,,' \ -e 'y,/,_,' \
-e 'y,/,_,' \ -e 's,\.cc$,,'`
-e 's,\.cc$,,'` canonical_var=`canonicalize "$canonical_name"`
canonical_var=`canonicalize "$canonical_name"` fig_var="`upcase "$canonical_var"`_FIGURES"
fig_var="`upcase "$canonical_var"`_FIGURES"
# Populate the list of variables of figures. # Populate the list of variables of figures.
if test -z "$fig_vars"; then fig_vars="$fig_vars \$($fig_var)"
fig_vars="$fig_var"
else # Generate a Make variable for the figures produced by FILE.
fig_vars="$fig_vars $fig_var" {
fi echo "$fig_var ="
{ for figure in $figures; do
echo "$fig_var =" fig_path=" \$(srcdir)/figures/$figure"
for figure in $figures; do echo "$fig_path"
echo " \$(srcdir)/figures/$figure" done
done } | backslashify
} | backslashify
base=`basename "$file" .cc` # Generate a Make rule to regen the figures produced by FILE.
dir=`dirname "$file"` base=`basename "$file" .cc`
timestamp="\$(srcdir)/$dir/$base.stamp" dir=`dirname "$file"`
cat <<EOF timestamp="\$(srcdir)/$dir/$base.stamp"
cat <<EOF
\$($fig_var): $timestamp \$($fig_var): $timestamp
## Recover from the removal of \$@ ## Recover from the removal of \$@
@if test -f \$@; then :; else \\ @if test -f \$@; then :; else \\
...@@ -141,16 +156,10 @@ for file in `inputs`; do ...@@ -141,16 +156,10 @@ for file in `inputs`; do
fi fi
EOF EOF
fi fi
done done
# Output the list of figures. # Output the list of figures.
echo "# The list of all generated figures." echo "# The list of all generated figures."
{ gen_var FIGURES $fig_vars
echo "FIGURES ="
for v in $fig_vars; do
echo " \$($v)"
done
} | backslashify
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