Forthcoming changes will make us iterate over the files in a different
order.
lib/ylwrap (first): Remove, replaced by...
(parser): this.
+# The parser itself, the first file, is the destination of the .y.c
+# rule in the Makefile.
+parser=$1
# The list of file to rename: FROM TO...
pairlist=
# A sed program to s/FROM/TO/g for all the FROM/TO so that, for
# The list of file to rename: FROM TO...
pairlist=
# A sed program to s/FROM/TO/g for all the FROM/TO so that, for
if test $ret -eq 0; then
set X $pairlist
shift
if test $ret -eq 0; then
set X $pairlist
shift
input_rx=`get_dirname "$input" | quote_for_sed`
input_rx=`get_dirname "$input" | quote_for_sed`
esac
# Do not overwrite unchanged header files to avoid useless
esac
# Do not overwrite unchanged header files to avoid useless
- # recompilations. Always update the parser itself (the first
- # file): it is the destination of the .y.c rule in the Makefile.
- # Divert the output of all other files to a temporary file so we
- # can compare them to existing versions.
- if test $first = no; then
+ # recompilations. Always update the parser itself: it is the
+ # destination of the .y.c rule in the Makefile. Divert the
+ # output of all other files to a temporary file so we can
+ # compare them to existing versions.
+ if test $from != $parser; then
realtarget="$target"
target=tmp-`printf '%s\n' "$target" | sed s/.*[\\/]//g`
fi
realtarget="$target"
target=tmp-`printf '%s\n' "$target" | sed s/.*[\\/]//g`
fi
sed -e "/^#/!b" -e "s|$input_rx|$input_sub_rx|" -e "$rename_sed" \
-e "s|$FROM|$TARGET|" "$from" >"$target" || ret=$?
sed -e "/^#/!b" -e "s|$input_rx|$input_sub_rx|" -e "$rename_sed" \
-e "s|$FROM|$TARGET|" "$from" >"$target" || ret=$?
- # Check whether header files must be updated.
- if test $first = no; then
+ # Check whether files must be updated.
+ if test "$from" != "$parser"; then
if test -f "$realtarget" && cmp -s "$realtarget" "$target"; then
echo "$to is unchanged"
rm -f "$target"
if test -f "$realtarget" && cmp -s "$realtarget" "$target"; then
echo "$to is unchanged"
rm -f "$target"
- # A missing file is only an error for the first file. This
- # is a blatant hack to let us support using "yacc -d". If -d
- # is not specified, we don't want an error when the header
- # file is "missing".
- if test $first = yes; then
+ # A missing file is only an error for the parser. This is a
+ # blatant hack to let us support using "yacc -d". If -d is not
+ # specified, don't fail when the header file is "missing".
+ if test "$from" = "$parser"; then