2 # $Id: run_make.sh,v 1.14 2014/04/06 17:50:57 tom Exp $
5 # do a test-compile on each of the ".c" files in the test-directory
7 BISON=`bison --version 2>/dev/null | head -n 1 | sed -e 's/^[^0-9.]*//' -e 's/[^0-9.]*$//'`
19 ifBTYACC=`fgrep -l 'define YYBTYACC' config.h > /dev/null; test $? != 0; echo $?`
21 if test $ifBTYACC = 0; then
22 REF_DIR=${TEST_DIR}/yacc
24 REF_DIR=${TEST_DIR}/btyacc
27 MY_MAKE="make -f $PROG_DIR/makefile srcdir=$PROG_DIR"
30 C_FILE=`basename "$1"`
31 O_FILE=`basename "$C_FILE" .c`.o
34 make -f $PROG_DIR/makefile srcdir=$PROG_DIR $O_FILE $*
35 test -f $O_FILE && rm $O_FILE
40 echo "** program is in $PROG_DIR"
41 echo "** test-files in $REF_DIR"
43 for input in ${REF_DIR}/*.c
51 test -f "$input" || continue
58 # DEFS="-DYYLEX_PARAM=flag -DYYLEX_PARAM_TYPE=int"
62 if test "x$DEFS" != "x"
64 run_make "$input" DEFINES="$DEFS"
70 echo "** compare with bison $BISON"
71 for input in ${TEST_DIR}/*.y
73 test -f "$input" || continue
79 # Bison does not support the btyacc []-action extension.
84 # Bison does not support pure-parser from command-line.
85 # Also, its support for %expect is generally broken.
86 # Work around these issues using a temporary file.
88 echo "... testing $input"
93 if test -z `fgrep -l '%pure-parser' $input`
95 echo "%pure-parser" >>run_make.y
100 sed -e '/^%expect/s,%expect.*,,' $input >>run_make.y
105 sed -e '/^#line/s,"run_make.y","'$input'",' y.tab.c >run_make.c
113 $MY_MAKE $object DEFINES='-DYYENABLE_NLS=0 -DYYLTYPE_IS_TRIVIAL=1 -DYYSTACK_USE_ALLOCA=0 -DYYMAXDEPTH=0'
115 echo "?? $input not found"
123 for name in /usr/ccs/bin/yacc
133 echo "** compare with $YACC"
134 for input in ${TEST_DIR}/*.y
136 test -f "$input" || continue
138 echo "... testing $input"
143 echo "... skipping $input"
147 if fgrep '%pure-parser' $input >/dev/null ||
148 fgrep '%parse-param' $input >/dev/null ||
149 fgrep '%lex-param' $input >/dev/null ||
150 fgrep 'YYLEX_PARAM' $input >/dev/null
152 echo "... skipping $input"
158 sed -e '/^%expect/s,%expect.*,,' $input >>run_make.y
163 sed -e '/^#line/s,"run_make.y","'$input'",' y.tab.c >run_make.c
173 echo "?? $input not found"