From 8a771a2f4dd5399ab4673189b64ba8d7ed15ac25 Mon Sep 17 00:00:00 2001 From: Erez Zadok Date: Fri, 9 May 2014 22:43:03 -0400 Subject: [PATCH] update bootstrap and ylwrap --- bootstrap | 15 +++++++-------- ylwrap | 25 ++++++++++++++++++++++--- 2 files changed, 29 insertions(+), 11 deletions(-) diff --git a/bootstrap b/bootstrap index 80bf9b28..3cfc47ed 100755 --- a/bootstrap +++ b/bootstrap @@ -50,23 +50,22 @@ fi echo "AMU: Fixing ylwrap..." patch << \EOF ---- ylwrap.orig 2013-12-02 19:42:59.239979147 -0500 -+++ ylwrap 2013-12-02 19:42:36.559379132 -0500 -@@ -96,6 +96,23 @@ +--- ylwrap.orig 2014-05-08 21:18:30.000000000 -0400 ++++ ylwrap 2014-05-09 22:25:54.900240000 -0400 +@@ -153,6 +153,22 @@ *[\\/]*) prog="`pwd`/$prog" ;; esac -+set -x +prefix=`echo $input | sed \ + -e 's,^.*/,,g' \ + -e 's/_gram.[yl]$/_/g' \ + -e 's/_lex.[yl]$/_/g' \ + -e 's/_parse.[yl]$/_/g' \ -+ -e 's/_tok.[yl]$/_/g'` ++ -e 's/_tok.[yl]$/_/g'` + +case "$prog" in +*lex) -+ flags="-P $prefix" ++ flags="-P${prefix}" + out="mv lex.$prefix.c lex.yy.c" + ;; +yacc|bison) @@ -76,7 +75,7 @@ patch << \EOF # FIXME: add hostname here for parallel makes that run commands on # other machines. But that might take us over the 14-char limit. dirname=ylwrap$$ -@@ -105,10 +122,13 @@ +@@ -166,10 +182,13 @@ cd $dirname case $# in @@ -91,7 +90,7 @@ patch << \EOF +fi if test $ret -eq 0; then - set X $pairlist + for from in * EOF # save timestamp diff --git a/ylwrap b/ylwrap index 7befa46d..efa0027a 100755 --- a/ylwrap +++ b/ylwrap @@ -1,7 +1,7 @@ #! /bin/sh # ylwrap - wrapper for lex/yacc invocations. -scriptversion=2012-07-14.08; # UTC +scriptversion=2014-05-10.02; # UTC # Copyright (C) 1996-2012 Free Software Foundation, Inc. # @@ -153,6 +153,22 @@ case "$prog" in *[\\/]*) prog="`pwd`/$prog" ;; esac +prefix=`echo $input | sed \ + -e 's,^.*/,,g' \ + -e 's/_gram.[yl]$/_/g' \ + -e 's/_lex.[yl]$/_/g' \ + -e 's/_parse.[yl]$/_/g' \ + -e 's/_tok.[yl]$/_/g'` + +case "$prog" in +*lex) + flags="-P${prefix}" + out="mv lex.$prefix.c lex.yy.c" + ;; +yacc|bison) + flags="-p $prefix";; +esac + # FIXME: add hostname here for parallel makes that run commands on # other machines. But that might take us over the 14-char limit. dirname=ylwrap$$ @@ -166,10 +182,13 @@ mkdir $dirname || exit 1 cd $dirname case $# in - 0) "$prog" "$input" ;; - *) "$prog" "$@" "$input" ;; + 0) "$prog" $flags "$input" ;; + *) "$prog" $flags "$@" "$input" ;; esac ret=$? +if [ -n "$out" ]; then + eval $out +fi if test $ret -eq 0; then for from in * -- 2.34.1