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>
 
Distribute doc/gen-split-outputs-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,7 +121,6 @@ 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.
......@@ -117,18 +130,20 @@ for file in `inputs`; do
-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
fig_vars="$fig_vars \$($fig_var)"
# Generate a Make variable for the figures produced by FILE.
{
echo "$fig_var ="
for figure in $figures; do
echo " \$(srcdir)/figures/$figure"
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"
......@@ -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
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