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