## automake - create Makefile.in from Makefile.am
-## Copyright 2001 Free Software Foundation, Inc.
+## Copyright 2001 Free Software Foundation, Inc.
## This program is free software; you can redistribute it and/or modify
## it under the terms of the GNU General Public License as published by
## Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
## 02111-1307, USA.
+## FIXME: These two are to be removed once we trace Autoconf, since
+## they are AC_SUBST'ed.
LEX_OUTPUT_ROOT = @LEX_OUTPUT_ROOT@
LEXLIB = @LEXLIB@
if %?MORE-THAN-ONE%
$(SHELL) $(YLWRAP) %SOURCE% $(LEX_OUTPUT_ROOT).c %OBJ% -- %COMPILE%
else !%?MORE-THAN-ONE%
- %COMPILE% %SOURCE% && mv $(LEX_OUTPUT_ROOT).c %OBJ%
+ %COMPILE% %SOURCE%
+## Edit out `#line' or `#' directives.
+ sed '/^#/ s/$(LEX_OUTPUT_ROOT)\.c/%OBJ%/' $(LEX_OUTPUT_ROOT).c >%OBJ%
+ rm $(LEX_OUTPUT_ROOT).c
endif !%?MORE-THAN-ONE%
## automake - create Makefile.in from Makefile.am
-## Copyright 1998, 1999, 2001 Free Software Foundation, Inc.
+## Copyright 1998, 1999, 2001 Free Software Foundation, Inc.
## This program is free software; you can redistribute it and/or modify
## it under the terms of the GNU General Public License as published by
if %?MORE-THAN-ONE%
$(SHELL) $(YLWRAP) %SOURCE% y.tab.c %OBJ% y.tab.h %BASE%.h -- %COMPILE%
else !%?MORE-THAN-ONE%
- %COMPILE% %SOURCE% && mv y.tab.c %OBJ%
+ %COMPILE% %SOURCE%
+## Edit out `#line' or `#' directives.
+ sed '/^#/ s/y\.tab\.c/%OBJ%/' y.tab.c >%OBJ%
+ rm y.tab.c
+## Edit out Bison multiple inclusion guards. It may be BISON_Y_TAB_H,
+## or Y_TAB_H depending upon the version, that's why the regexp is
+## so loose.
if test -f y.tab.h; then \
- if cmp -s y.tab.h %BASE%.h; then \
- rm -f y.tab.h; \
+ to=`echo "%BASE%_H" | sed \
+ -e 'y/abcdefghijklmnopqrstuvwxyz/ABCDEFGHIJKLMNOPQRSTUVWXYZ/' \
+ -e 's/[^ABCDEFGHIJKLMNOPQRSTUVWXYZ]/_/g'`; \
+ sed "/^#/ s/Y_TAB_H/$$to/g" y.tab.h >%BASE%.ht; \
+ if cmp -s %BASE%.ht %BASE%.h; then \
+ rm %BASE%.ht ;\
else \
- mv y.tab.h %BASE%.h; \
+ mv %BASE%.ht %BASE%.h; \
fi; \
fi
endif !%?MORE-THAN-ONE%
#! /bin/sh
# ylwrap - wrapper for lex/yacc invocations.
-# Copyright 1996, 1997, 1998, 1999 Free Software Foundation, Inc.
+# Copyright 1996, 1997, 1998, 1999, 2001 Free Software Foundation, Inc.
# Written by Tom Tromey <tromey@cygnus.com>.
#
# This program is free software; you can redistribute it and/or modify
;;
esac
-# The directory holding the input.
-input_dir=`echo "$input" | sed -e 's,\([\\/]\)[^\\/]*$,\1,'`
-# Quote $INPUT_DIR so we can use it in a regexp.
-# FIXME: really we should care about more than `.' and `\'.
-input_rx=`echo "$input_dir" | sed -e 's,\\\\,\\\\\\\\,g' -e 's,\\.,\\\\.,g'`
-
-echo "got $input_rx"
-
pairlist=
while test "$#" -ne 0; do
if test "$1" = "--"; then
y_tab_nodot="yes"
fi
+ # The directory holding the input.
+ input_dir=`echo "$input" | sed -e 's,\([\\/]\)[^\\/]*$,\1,'`
+ # Quote $INPUT_DIR so we can use it in a regexp.
+ # FIXME: really we should care about more than `.' and `\'.
+ input_rx=`echo "$input_dir" | sed 's,\\\\,\\\\\\\\,g;s,\\.,\\\\.,g'`
+
while test "$#" -ne 0; do
from="$1"
# Handle y_tab.c and y_tab.h output by DOS
*) target="../$2";;
esac
- # Edit out `#line' or `#' directives. We don't want the
- # resulting debug information to point at an absolute srcdir;
- # it is better for it to just mention the .y file with no
- # path.
- sed -e "/^#/ s,$input_rx,," "$from" > "$target" || status=$?
+ # Edit out `#line' or `#' directives.
+ #
+ # We don't want the resulting debug information to point at
+ # an absolute srcdir; it is better for it to just mention the
+ # .y file with no path.
+ #
+ # We want to use the real output file name, not yy.lex.c for
+ # instance.
+ #
+ # We want the include guards to be adjusted too.
+ FROM=`echo "$from" | sed \
+ -e 'y/abcdefghijklmnopqrstuvwxyz/ABCDEFGHIJKLMNOPQRSTUVWXYZ/'\
+ -e 's/[^ABCDEFGHIJKLMNOPQRSTUVWXYZ]/_/g'`
+ TARGET=`echo "$2" | sed \
+ -e 'y/abcdefghijklmnopqrstuvwxyz/ABCDEFGHIJKLMNOPQRSTUVWXYZ/'\
+ -e 's/[^ABCDEFGHIJKLMNOPQRSTUVWXYZ]/_/g'`
+ sed "/^#/{s,$input_rx,,;s,$from,$2,;s,$FORM,$TO,;}" "$from" >"$target" ||
+ status=$?
else
# 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