| 1 |
#! /bin/sh |
#! /bin/sh |
| 2 |
# ylwrap - wrapper for lex/yacc invocations. |
# ylwrap - wrapper for lex/yacc invocations. |
| 3 |
|
|
| 4 |
scriptversion=2009-04-28.21; # UTC |
scriptversion=2011-08-25.18; # UTC |
| 5 |
|
|
| 6 |
# Copyright (C) 1996, 1997, 1998, 1999, 2001, 2002, 2003, 2004, 2005, |
# Copyright (C) 1996, 1997, 1998, 1999, 2001, 2002, 2003, 2004, 2005, |
| 7 |
# 2007, 2009 Free Software Foundation, Inc. |
# 2007, 2009, 2010, 2011 Free Software Foundation, Inc. |
| 8 |
# |
# |
| 9 |
# Written by Tom Tromey <tromey@cygnus.com>. |
# Written by Tom Tromey <tromey@cygnus.com>. |
| 10 |
# |
# |
| 99 |
# FIXME: add hostname here for parallel makes that run commands on |
# FIXME: add hostname here for parallel makes that run commands on |
| 100 |
# other machines. But that might take us over the 14-char limit. |
# other machines. But that might take us over the 14-char limit. |
| 101 |
dirname=ylwrap$$ |
dirname=ylwrap$$ |
| 102 |
trap "cd '`pwd`'; rm -rf $dirname > /dev/null 2>&1" 1 2 3 15 |
do_exit="cd '`pwd`' && rm -rf $dirname > /dev/null 2>&1;"' (exit $ret); exit $ret' |
| 103 |
|
trap "ret=129; $do_exit" 1 |
| 104 |
|
trap "ret=130; $do_exit" 2 |
| 105 |
|
trap "ret=141; $do_exit" 13 |
| 106 |
|
trap "ret=143; $do_exit" 15 |
| 107 |
mkdir $dirname || exit 1 |
mkdir $dirname || exit 1 |
| 108 |
|
|
| 109 |
cd $dirname |
cd $dirname |
| 137 |
# Handle y_tab.c and y_tab.h output by DOS |
# Handle y_tab.c and y_tab.h output by DOS |
| 138 |
if test $y_tab_nodot = "yes"; then |
if test $y_tab_nodot = "yes"; then |
| 139 |
if test $from = "y.tab.c"; then |
if test $from = "y.tab.c"; then |
| 140 |
from="y_tab.c" |
from="y_tab.c" |
| 141 |
else |
else |
| 142 |
if test $from = "y.tab.h"; then |
if test $from = "y.tab.h"; then |
| 143 |
from="y_tab.h" |
from="y_tab.h" |
| 144 |
fi |
fi |
| 145 |
fi |
fi |
| 146 |
fi |
fi |
| 147 |
if test -f "$from"; then |
if test -f "$from"; then |
| 148 |
# If $2 is an absolute path name, then just use that, |
# If $2 is an absolute path name, then just use that, |
| 149 |
# otherwise prepend `../'. |
# otherwise prepend `../'. |
| 150 |
case "$2" in |
case "$2" in |
| 151 |
[\\/]* | ?:[\\/]*) target="$2";; |
[\\/]* | ?:[\\/]*) target="$2";; |
| 152 |
*) target="../$2";; |
*) target="../$2";; |
| 153 |
esac |
esac |
| 154 |
|
|
| 155 |
# We do not want to overwrite a header file if it hasn't |
# We do not want to overwrite a header file if it hasn't |
| 159 |
# Makefile. Divert the output of all other files to a temporary |
# Makefile. Divert the output of all other files to a temporary |
| 160 |
# file so we can compare them to existing versions. |
# file so we can compare them to existing versions. |
| 161 |
if test $first = no; then |
if test $first = no; then |
| 162 |
realtarget="$target" |
realtarget="$target" |
| 163 |
target="tmp-`echo $target | sed s/.*[\\/]//g`" |
target="tmp-`echo $target | sed s/.*[\\/]//g`" |
| 164 |
fi |
fi |
| 165 |
# Edit out `#line' or `#' directives. |
# Edit out `#line' or `#' directives. |
| 166 |
# |
# |
| 184 |
|
|
| 185 |
# Check whether header files must be updated. |
# Check whether header files must be updated. |
| 186 |
if test $first = no; then |
if test $first = no; then |
| 187 |
if test -f "$realtarget" && cmp -s "$realtarget" "$target"; then |
if test -f "$realtarget" && cmp -s "$realtarget" "$target"; then |
| 188 |
echo "$2" is unchanged |
echo "$2" is unchanged |
| 189 |
rm -f "$target" |
rm -f "$target" |
| 190 |
else |
else |
| 191 |
echo updating "$2" |
echo updating "$2" |
| 192 |
mv -f "$target" "$realtarget" |
mv -f "$target" "$realtarget" |
| 193 |
fi |
fi |