]> granicus.if.org Git - flex/commitdiff
test suite changes
authorWill Estes <wlestes@users.sourceforge.net>
Mon, 8 Apr 2002 13:13:13 +0000 (13:13 +0000)
committerWill Estes <wlestes@users.sourceforge.net>
Mon, 8 Apr 2002 13:13:13 +0000 (13:13 +0000)
26 files changed:
autogen.sh
configure.in
tests/.cvsignore
tests/Makefile.am [new file with mode: 0644]
tests/Makefile.in [deleted file]
tests/README
tests/TEMPLATE/.cvsignore
tests/TEMPLATE/Makefile.am [new file with mode: 0644]
tests/TEMPLATE/Makefile.in [deleted file]
tests/configure.in
tests/create-test [new file with mode: 0755]
tests/create-test.pl [deleted file]
tests/test-array-nr/Makefile.am [new file with mode: 0644]
tests/test-array-nr/Makefile.in [deleted file]
tests/test-array-r/Makefile.am [new file with mode: 0644]
tests/test-array-r/Makefile.in [deleted file]
tests/test-basic-nr/Makefile.am [new file with mode: 0644]
tests/test-basic-nr/Makefile.in [deleted file]
tests/test-basic-r/Makefile.am [new file with mode: 0644]
tests/test-basic-r/Makefile.in [deleted file]
tests/test-bison-yylloc/Makefile.am [new file with mode: 0644]
tests/test-bison-yylloc/Makefile.in [deleted file]
tests/test-c-cpp-nr/Makefile.am [new file with mode: 0644]
tests/test-c-cpp-nr/Makefile.in [deleted file]
tests/test-c-cpp-r/Makefile.am [new file with mode: 0644]
tests/test-c-cpp-r/Makefile.in [deleted file]

index c21056db6d8df0e271aa53932bb46ce20c320b30..00aeaa003676b927102e2aca62fc03480cb41445 100755 (executable)
 touch ChangeLog
 
 aclocal -I m4 && autoheader && automake -a && autoconf
-
-for i in tests
-do
-(    cd $i
-    aclocal && autoheader && autoconf
-)
-done
index 667f7136a35de64657fc9b1f2a8484a44ba1e3e6..15469b1fdcb72beaced10562b3cfa96817388791 100644 (file)
@@ -23,13 +23,18 @@ dnl PURPOSE.
 
 AC_INIT(scan.l)
 AM_INIT_AUTOMAKE(flex,2.5.6)
-AM_CONFIG_HEADER(config.h:conf.in)
+AM_CONFIG_HEADER(
+config.h:conf.in
+tests/config.h:tests/config.in
+)
           AM_GNU_GETTEXT([external])
 
-AC_LN_S
-AC_PROG_CC
 AC_PROG_YACC
+AC_CHECK_PROG(BISON, bison, bison)
 AM_PROG_LEX
+AC_LN_S
+AC_PROG_CC
+
 AC_PROG_RANLIB
 AC_PATH_PROG(HELP2MAN, help2man, $srcdir/missing)
 
@@ -38,8 +43,6 @@ AC_TYPE_SIZE_T
 AC_HEADER_STDC
 AC_HAVE_HEADERS(string.h malloc.h sys/types.h unistd.h)
 
-AC_CONFIG_SUBDIRS(tests)
-
 AC_OUTPUT(
 Makefile
 examples/Makefile
@@ -47,4 +50,26 @@ examples/fastwc/Makefile
 examples/manual/Makefile
 m4/Makefile
 po/Makefile.in
+tests/Makefile
+tests/TEMPLATE/Makefile
+tests/test-array-nr/Makefile
+tests/test-array-r/Makefile
+tests/test-basic-nr/Makefile
+tests/test-basic-r/Makefile
+tests/test-bison-yylloc/Makefile
+tests/test-bison-yylval/Makefile
+tests/test-c-cpp-nr/Makefile
+tests/test-c-cpp-r/Makefile
+tests/test-header-nr/Makefile
+tests/test-header-r/Makefile
+tests/test-include-by-buffer/Makefile
+tests/test-include-by-reentrant/Makefile
+tests/test-multiple-scanners-nr/Makefile
+tests/test-multiple-scanners-r/Makefile
+tests/test-prefix-nr/Makefile
+tests/test-prefix-r/Makefile
+tests/test-pthread/Makefile
+tests/test-string-nr/Makefile
+tests/test-string-r/Makefile
+tests/test-yyextra/Makefile
 )
index ff1f5c2878002a03c47e3c8991b3539c7615da7f..16bafe8be953df65d6d20d451248c3c5aa827ffb 100644 (file)
@@ -6,3 +6,6 @@ config.status
 config.h
 config.log
 Makefile
+aclocal.m4
+stamp-*
+Makefile.in
diff --git a/tests/Makefile.am b/tests/Makefile.am
new file mode 100644 (file)
index 0000000..9ffa150
--- /dev/null
@@ -0,0 +1,76 @@
+# This file is part of flex.
+
+# Redistribution and use in source and binary forms, with or without
+# modification, are permitted provided that the following conditions
+# are met:
+
+# 1. Redistributions of source code must retain the above copyright
+#    notice, this list of conditions and the following disclaimer.
+# 2. Redistributions in binary form must reproduce the above copyright
+#    notice, this list of conditions and the following disclaimer in the
+#    documentation and/or other materials provided with the distribution.
+
+# Neither the name of the University nor the names of its contributors
+# may be used to endorse or promote products derived from this software
+# without specific prior written permission.
+
+# THIS SOFTWARE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR
+# IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED
+# WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+# PURPOSE.
+
+EXTRA_DIST = \
+       README
+
+noinst_SCRIPTS = \
+       create-test
+
+SUBDIRS = \
+       TEMPLATE \
+       test-array-nr \
+       test-array-r \
+       test-basic-nr \
+       test-basic-r \
+       test-bison-yylloc \
+       test-bison-yylval \
+       test-c-cpp-nr \
+       test-c-cpp-r \
+       test-header-nr \
+       test-header-r \
+       test-include-by-buffer \
+       test-include-by-reentrant \
+       test-multiple-scanners-nr \
+       test-multiple-scanners-r \
+       test-prefix-nr \
+       test-prefix-r \
+       test-pthread \
+       test-string-nr \
+       test-string-r \
+       test-yyextra
+
+test:
+       NOK=;\
+       NFAIL=;\
+       NSKIP=;\
+       for dir in $(SUBDIRS) ; do \
+               echo Executing test "$$dir" ; \
+               ( cd "$$dir" && $(MAKE) test  > OUTPUT 2>&1 ) ; \
+               case $$? in \
+                       0 )  echo Test "$$DIR" succeeded.; \
+                               NOK=0$$NOK;\
+                               ;; \
+                       1 )  echo Test "$$DIR" FAILED. See "$$dir"/OUTPUT for details. ; \
+                               NFAIL=0$$NFAIL; \
+                               ;; \
+                       2 )  echo Test "$$DIR" was SKIPPED. See "$$dir"/OUTPUT for details.; \
+                               NSKIP=0$$NSKIP; \
+                               ;; \
+                       * )  echo Test "$$DIR" reported an unknown exit status. Assuming that means it failed. See "$$DIR"/OUTPUT for details.; \
+                               NFAIL=0$$NFAIL; \
+                               ;; \
+               esac; \
+       done ; \
+       echo Results: ; \
+       echo Tests succeeded: `echo @ECHO_N@ $$NOK@ECHO_C@|wc -c`; \
+       echo Tests SKIPPED: `echo @ECHO_N@ $$NSKIP@ECHO_C@|wc -c`; \
+       echo Tests FAILED: `echo @ECHO_N@ $$NFAIL@ECHO_C@|wc -c` ;
diff --git a/tests/Makefile.in b/tests/Makefile.in
deleted file mode 100644 (file)
index 57be4b8..0000000
+++ /dev/null
@@ -1,62 +0,0 @@
-
-@SET_MAKE@
-
-TESTDIRS= @TESTDIRS@
-
-srcdir= @srcdir@
-
-
-all: build
-
-build:
-       @for dir in $(TESTDIRS) ; do \
-       (cd "$$dir" && $(MAKE) ) ; \
-    done
-       @echo "Type '`basename $(MAKE)` check' to run all tests."
-
-check:
-       @nok=0;\
-    nfail=0;\
-    nskip=0;\
-    for dir in $(TESTDIRS) ; do \
-       echo -n Executing "$$dir" ; \
-       dot=$$(( 30 - $${#dir} )); \
-       while test $$dot -gt 0 ; do \
-           echo -n '.'; \
-           dot=$$(( $$dot - 1 )); \
-       done; \
-       ( cd "$$dir" && $(MAKE) check  > OUTPUT 2>&1 ) ; \
-       case $$? in \
-            0 )  echo OK.; \
-                 nok=$$(( $$nok + 1 )) ; \
-                 ;; \
-            1 )  echo "FAILED. See $$dir/OUTPUT for details." ; \
-                 nfail=$$(( $$nfail + 1 )) ; \
-                 ;; \
-            2 )  echo "SKIPPED. See $$dir/OUTPUT for details."; \
-                 nskip=$$(( $$nskip + 1 )) ; \
-                 ;; \
-            * )  echo "FAILED? Unknown exit status reported."; \
-                 nfail=$$(( $$nfail + 1 )) ; \
-                 ;; \
-       esac; \
-    done ; \
-    echo "Results: "; \
-    echo "    Tests OK:        $$nok"; \
-    echo "    Tests SKIPPED:   $$nskip"; \
-    echo "    Tests FAILED:    $$nfail" ;
-
-distclean: clean
-       @for dir in $(TESTDIRS) ; do \
-       if test -f "$$dir/Makefile" ; then \
-          (cd "$$dir" && $(MAKE) distclean ) ; \
-       fi; \
-    done
-       rm -f config.h config.status config.log Makefile
-
-clean:
-       @for dir in $(TESTDIRS) ; do \
-       if test -f "$$dir/Makefile" ; then \
-           (cd "$$dir" && $(MAKE) clean ) ; \
-       fi ; \
-    done
index 570c70b90c2a28487389b8f9cade831b61980145..36b7bf4b31cab769980a8081a08d510e198df053 100644 (file)
@@ -1,12 +1,12 @@
 This file describes the flex test suite.
 
-WHO SHOULD USE THE TEST SUITE?
+WHO SHOULD USE THE TEST SUITE?
 
 The test suite is intended to be used by flex developers, i.e., anyone hacking
 the flex distribution. If you are simply installing flex, then you can ignore
 this directory and its contents.
 
-STRUCTURE OF THE TEST SUITE
+STRUCTURE OF THE TEST SUITE
 
 The test suite consists of several directories, each containing a
 scanner known to work with the most recent version of flex. In
@@ -17,46 +17,62 @@ generates an error message, then your modifications *may* have broken
 a feature of flex. At a minimum, you'll want to investigate the
 failure and determine if it's truly significant.
 
-HOW TO RUN THE TEST SUITE
+HOW TO RUN THE TEST SUITE
 
 To build and execute all tests:
 
   $ cd tests/ # from the top level of the flex source tree
-  $ make check
+  $ make test
 
 To build and execute a single test:
 
   $ cd tests/ # from the top level of the flex tree.
   $ cd test-pthread-nr # for example
-  $ make check
-
-HOW TO ADD A NEW TEST TO THE TEST SUITE
-
- - RUN the perl script `create-test.pl` found in this directory.
-   If it works, skip the next step.
-
- - Copy the tests/TEMPLATE directory, then modify the skeleton scanner
-   (and parser if necessary). If you are submitting a patch for
-   inclusion in the flex distribution, then move the file "cvsignore"
-   to .cvsignore in your new test-* subdirectory and add the name of
-   your directory on a line by itself at the end of the newly created
-   .cvsignore file. This will make it easier on the flex maintainer to
-   include your new test in the cvs tree.
-
- - On success, your test should return zero.
-
- - On error, your test should return 1 (one) and print a message
-   to stdout or stderr, which have been redirected to the file
-   named, "OUTPUT", in your test's directory.
-
- - If your test is skipped (e.g., bison not found), then the Makefile
-   rule should return 2 (two). See "test-bison-nr/Makefile.in" for details.
-
- - You must modify the last few lines of tests/configure.in
-   by adding your new test directory, and the Makefile target.
-   (This step is done automatically by `create-test.pl`.)
-
- - Each test assumes that the newly-built binary "flex" is in the 
-   directory above the tests directory.
-
- -  Add a description of your new test to the end of the file `descriptions'.
+  $ make test
+
+* HOW TO ADD A NEW TEST TO THE TEST SUITE
+
+**- RUN the script `create-test` found in this directory with a single
+argument of the name of the test you want to create.  If it fails with
+a message about a non-existent file `config.status', then run the
+configure script in the top-level directory and everything will be
+fine.  If it fails to work for you other than this, report it as a
+bug.
+
+** Modify the files in the newly created directory so that they test
+whatever feature of flex you are interested in.
+
+** On success, your test should return zero.
+
+** On error, your test should return 1 (one) and print a message to
+stderr, which will have been redirected to the file named, "OUTPUT",
+in your test's directory.
+
+** If your test is skipped (e.g., because bison was not found), then
+   the test should return 2 (two). See "test-bison-nr/Makefile.am" for
+   an example.
+
+** You must modify the last few lines of the top-level configure.in by
+   adding the Makefile for your test directory.  (This step is
+   done automatically by `create-test`.)
+
+** You must add the name of your test to the SUBDIRS variable in
+   tests/Makefile.am. (This is also done automatically for you by `create-test'.)
+
+** Add a description of your new test to the end of the file
+    `descriptions'. Remember to keep the description as brief as
+    possible, preferably to one line.
+
+** You will have to run the autogen.sh script in the top-level
+   directory as well as run the configure script in that
+   directory. (Note that running config.status may prove easier or
+   quicker.)
+
+** The easiest way for you to submit your new test to the flex
+   maintainers is by generating a patch. The flex maintainers only
+   need to have the Makefile.am, the flex input file, the test input
+   file (if there is one) and any other files necessary to compile the
+   test. You do not need to submit files generated by autoconf,
+   automake, configure etc. It would be helpful to include the file
+   .cvsignore which you will find in your test directory if you used
+   the `create-test' script.
index 8e768a68623415f5168dc1d5c3225fb2dfd94037..699370ba850c211ee7755cf8bae85a0bc26a7482 100644 (file)
@@ -1,6 +1,8 @@
 Makefile
+Makefile.in
 parser.c
 parser.h
 scanner.c
 TEMPLATE
 OUTPUT
+.deps
diff --git a/tests/TEMPLATE/Makefile.am b/tests/TEMPLATE/Makefile.am
new file mode 100644 (file)
index 0000000..ed99c98
--- /dev/null
@@ -0,0 +1,27 @@
+BISON = @BISON@
+FLEX = $(top_builddir)/flex
+
+EXTRA_DIST = scanner.l parser.y test.input
+CLEANFILES = scanner.c parser.c parser.h TEMPLATE
+OBJS = scanner.o # parser.o
+
+INCLUDES = -I $(srcdir) -I $(top_srcdir)/tests
+#LDFLAGS = $(top_srcdir)/libfl.a 
+#YFLAGS = --defines --output=parser.c
+
+testname = TEMPLATE
+
+scanner.c: $(srcdir)/scanner.l
+       $(FLEX) $<
+
+parser.c: $(srcdir)/parser.y
+       $(BISON) $(YFLAGS) $<
+
+$(testname)$(EXEEXT): $(OBJS)
+       $(CC) -o $@ $(OBJS) $(LDFLAGS)
+
+test: $(testname)$(EXEEXT)
+       $(srcdir)/$(testname)$(EXEEXT) < $(srcdir)/test.input
+
+.c.o:
+       $(CC) -c -o $@ $(INCLUDES) $<
diff --git a/tests/TEMPLATE/Makefile.in b/tests/TEMPLATE/Makefile.in
deleted file mode 100644 (file)
index 61ddc95..0000000
+++ /dev/null
@@ -1,66 +0,0 @@
-# Makefile.in for a single TEST.
-#
-# By default this Makefile will build the target "$(TESTNAME)"
-# from the sources "scanner.l" and "parser.y".
-#
-# $(TESTNAME) is supplied by the calling Makefile.
-# "parser.y"  is not necessary. You may delete this file
-#             if you do not require a parser.
-# "scanner.l" is necessary. It should build "scanner.c".
-#
-
-@SET_MAKE@
-
-CFLAGS = @CFLAGS@
-CPPFLAGS = @CPPFLAGS@ -I. -I"@srcdir@" -I..
-DEFS = @DEFS@
-LDFLAGS = @LDFLAGS@
-LIBS = @LIBS@
-SHELL = /bin/sh
-srcdir = @srcdir@
-VPATH = @srcdir@
-LN_S = @LN_S@
-YACC = @YACC@
-CC = @CC@
-CXX = @CXX@
-AR = ar
-RANLIB = @RANLIB@
-YACC = @YACC@
-
-# Edit these if necessary for your specific test.
-TESTNAME = TEMPLATE
-FLEX = ../../flex
-YFLAGS = --defines --output-file="parser.c" --name-prefix="test" 
-OBJS = scanner.o
-
-# Force YACC to be bison (autoconf generates 'bison -y')
-YACC = @BISON@
-
-all: $(TESTNAME)
-
-$(TESTNAME): $(OBJS)
-       $(CC) $(CFLAGS) -o $(TESTNAME) $(OBJS) $(LDFLAGS) $(LIBS)
-
-scanner.c: $(srcdir)/scanner.l
-       $(FLEX) $(srcdir)/scanner.l
-
-scanner.o: scanner.c 
-       $(CC) $(CPPFLAGS) $(CFLAGS) -c scanner.c
-
-parser.c: $(srcdir)/parser.y
-       $(YACC) $(YFLAGS) $(srcdir)/parser.y
-
-parser.o: parser.c
-       $(CC) $(CPPFLAGS) $(CFLAGS) -c parser.c
-
-test: check
-
-check: $(TESTNAME)
-       ./$(TESTNAME) < $(srcdir)/test.input 
-
-distclean: clean
-       rm -f Makefile
-
-clean:
-       rm -f scanner.o scanner.c parser.o parser.c parser.h  parser.h $(TESTNAME) OUTPUT
-
index 950ec7e1b65766dd756c79c2088b643327f555ad..22132f1efbb94b2b7af49e9d13f161c890b6b9a9 100644 (file)
@@ -1,59 +1,53 @@
 dnl Process this file with autoconf to produce a configure script.
-AC_INIT(TEMPLATE/parser.y)
+AC_INIT(README)
 
-AC_CONFIG_HEADER(config.h:config.in)
-
-dnl Checks for libraries.
-dnl Replace `main' with a function in -lpthread:
-AC_CHECK_LIB(pthread, pthread_create)
+AM_INIT_AUTOMAKE(flextestsuit, 0.1)
+AM_CONFIG_HEADER(config.h:config.in)
 
+AC_PROG_RANLIB
+AC_PROG_INSTALL
 AC_LN_S
 AC_PROG_YACC
 AC_PROG_CC
 AC_PROG_CXX
-AC_PROG_RANLIB
-AC_PROG_INSTALL
-AC_PROG_MAKE_SET
-AC_CONST
-AC_TYPE_SIZE_T
-AC_HEADER_STDC
-AC_HAVE_HEADERS(string.h malloc.h sys/types.h)
+
+LEX=${srcdir}/flex
+export LEX
 
 dnl Checks for header files.
+
+AC_CONST
+AC_TYPE_SIZE_T
 AC_HEADER_STDC
+AC_HAVE_HEADERS(string.h malloc.h sys/types.h unistd.h)
 AC_CHECK_HEADERS(malloc.h unistd.h)
 
+dnl Checks for libraries.
+dnl Replace `main' with a function in -lpthread:
+
+AC_CHECK_LIB(pthread, pthread_create)
 
-dnl The case statement is copied from the top directory.
-case "$YACC" in
-*bison*)
-  AC_ALLOCA
-  ;;
-esac
-
-dnl Some of the tests may want bison, not "bison -y". We try.
-AC_CHECK_PROG(BISON,bison,bison)
-if test -z "$BISON" ; then
-    BISON="$YACC"
-fi
-
-AC_SUBST(TESTDIRS)dnl
-TESTDIRS="test-string-r test-pthread \
-          test-bison-yylval test-include-by-reentrant \
-          TEMPLATE test-basic-nr test-basic-r \
-          test-include-by-buffer test-string-nr \
-          test-bison-yylloc test-yyextra test-prefix-nr \
-          test-prefix-r test-header-nr test-header-r \
-          test-multiple-scanners-nr test-multiple-scanners-r \
-          test-array-nr test-array-r test-c-cpp-nr test-c-cpp-r"
-
-AC_OUTPUT( Makefile test-string-r/Makefile test-pthread/Makefile
-           test-bison-yylval/Makefile test-include-by-reentrant/Makefile
-           TEMPLATE/Makefile test-basic-nr/Makefile test-basic-r/Makefile
-           test-include-by-buffer/Makefile test-string-nr/Makefile
-           test-bison-yylloc/Makefile test-yyextra/Makefile
-           test-prefix-nr/Makefile test-prefix-r/Makefile
-           test-header-nr/Makefile test-header-r/Makefile
-           test-multiple-scanners-nr/Makefile test-multiple-scanners-r/Makefile
-           test-array-nr/Makefile test-array-r/Makefile test-c-cpp-nr/Makefile
-           test-c-cpp-r/Makefile)
+AC_OUTPUT(
+Makefile
+TEMPLATE/Makefile
+test-array-nr/Makefile
+test-array-r/Makefile
+test-basic-nr/Makefile
+test-basic-r/Makefile
+test-bison-yylloc/Makefile
+test-bison-yylval/Makefile
+test-c-cpp-nr/Makefile
+test-c-cpp-r/Makefile
+test-header-nr/Makefile
+test-header-r/Makefile
+test-include-by-buffer/Makefile
+test-include-by-reentrant/Makefile
+test-multiple-scanners-nr/Makefile
+test-multiple-scanners-r/Makefile
+test-prefix-nr/Makefile
+test-prefix-r/Makefile
+test-pthread/Makefile
+test-string-nr/Makefile
+test-string-r/Makefile
+test-yyextra/Makefile
+)
diff --git a/tests/create-test b/tests/create-test
new file mode 100755 (executable)
index 0000000..40bbfdf
--- /dev/null
@@ -0,0 +1,25 @@
+#!/bin/sh
+
+TESTFILES="Makefile.am scanner.l parser.y .cvsignore test.input"
+
+if [ ! $# -eq 1 ] ; then
+   exit 1
+fi
+
+mkdir $1
+for i in $TESTFILES ; do
+    cp TEMPLATE/$i $1/$i
+done
+
+sed '$i\
+tests/'"$1"'/Makefile' < ../configure.in > configure.in.tmp
+
+mv configure.in.tmp ../configure.in
+
+sed '/^SUBDIRS/a\
+       '"$1"' \\' < Makefile.am > Makefile.am.tmp
+
+mv Makefile.am.tmp Makefile.am
+
+sed "s:TEMPLATE:$1:g" < "$1"/Makefile.am > "$1"/Makefile.am.tmp
+mv "$1"/Makefile.am.tmp "$1"/Makefile.am
diff --git a/tests/create-test.pl b/tests/create-test.pl
deleted file mode 100755 (executable)
index 635f3dc..0000000
+++ /dev/null
@@ -1,143 +0,0 @@
-#! /usr/bin/env perl
-# vim:set autoindent smartindent expandtab tabstop=4 softtabstop=4 shiftwidth=4 textwidth=0:
-# Author and scapegoat if this breaks: Millaway
-use Fcntl qw(:seek);
-use File::Copy;
-use strict;
-$^W = 1; # same as perl -w
-my $USAGE = q{
-    Usage:
-        create-test.pl [-p] [-+] TEST_NAME
-
-        Creates a new flex test named "TEST_NAME" in the directory
-        TEST_NAME/. Modifies configure.in.
-
-        OPTIONS:
-
-          -p  include a skeleton bison parser
-          -+  make a  C++ scanner
-
-};
-sub abort { print shift,"\n"; exit 1}
-
-my $skel= "TEMPLATE";
-my $testname = undef;
-my ($parser,$cplusplus) = (0,0);
-
-while(defined ($_=shift)){
-    /^-p$/  && do{ $parser = 1; next};
-    /^-\+$/ && do{ $cplusplus = 1; next};
-    /^-/    && abort "$0: Unrecognized option '$_'.\n$USAGE";
-    $testname = $_;
-    last;
-}
-
-abort($USAGE) unless @ARGV == 0 && defined $testname;
-
-# Some simple safe-guards.
-$testname =~ m/^test-\w+/ or abort "Testname must begin with 'test-'. Aborting.";
--e $testname              and abort "File '$testname' already exists. Refusing to overwrite.";
--e $skel && -d $skel      or abort "Can't find directory '$skel/'. Aborting.";
-
-# create the test dir
-print "mkdir $testname\n";
-mkdir $testname or abort "Unable to create directory '$testname/': $!";
-
-# shallow copy the skeleton directory, replacing special keywords here and there.
-opendir SKEL, $skel or abort "Could not read directory $skel: $!";
-
-foreach my $file ( grep { !/^\.+$/ && -f "$skel/$_" } readdir SKEL ){
-
-    next if $file eq 'parser.y' && !$parser;
-
-    print "cp  $skel/$file  $testname/$file\n";
-    open IN, "< $skel/$file" or abort "Unable to read file $skel/$file: $!";
-    open OUT, "> $testname/$file" or abort "Unable to write file $testname/$file: $!";
-    my $did_cpp_option=0;
-    my $did_parser_objs=0;
-
-    while(<IN>){
-        s/\bTEMPLATE\b/$testname/g;
-
-        # add %option c++
-        $cplusplus
-            && /^\%option\s+.+$/
-            && !$did_cpp_option
-            &&  do { $_ .= "\%option c++\n"; $did_cpp_option=1 };
-
-        $cplusplus && s/scanner\.c/scanner\.cc/g;
-
-        # change $(CC) to $(CXX)
-        BEGIN{ $::CC = qr/^(?<=\t)\$\(CC\)/;
-               $::CXX = quotemeta '$(CXX)';
-              }
-        $cplusplus && s/$::CC/$::CXX/o;
-
-        # fix the makefile to include the parser.
-        $parser
-            && !$did_parser_objs
-            && s/^(OBJS\s*=\s*scanner\.o)/$1 parser.o/
-            && ($did_parser_objs=1);
-
-        print OUT;
-    }
-
-    close IN;
-    close OUT;
-}
-closedir SKEL;
-
-if (-e "$testname/cvsignore" ){
-    print "mv $testname/cvsignore $testname/.cvsignore...\n";
-    move("$testname/cvsignore", "$testname/.cvsignore")
-        or abort "Could not rename $testname/.cvsignore";
-}
-
-# modify configure.in...
-print "Modifying configure.in (appending to TESTDIRS and AC_OUTPUT)...\n";
-
-# We slurp it all into memory. We can do this because configure.in is small.
-# If we move the tests/ dir to automake then revisit this.
-open CONF, "+< configure.in" or abort "Could not read 'configure.in': $!";
-my $entire_conf = do{ local $/; <CONF> };
-
-# - Add test-directory to "TESTDIRS" variable
-#   This is complex because we append to it, we avoid creating long lines, and we
-#   preserve indenting. Hey, that's what perl is for.
-#   Otherwise we could just do:  s/TESTDIRS="/$&$testname /;
-$entire_conf =~ s/(TESTDIRS\s*=\s*".+)             #  (everything up to last line)
-                  ^(\s*)((?:test-[\w-]+\s*)+)"     #  (indenting)(last line)
-                 /length("$2$3$testname") > 80
-                      ? qq($1$2$3 \\\n$2$testname")
-                      : qq($1$2$3 $testname")
-                 /xmsge;
-
-
-# - Add test-directory/Makefile to "AC_OUTPUT" variable
-#   This is complex. See above.
-$entire_conf =~ s/(AC_OUTPUT\s*\(.+)                      # (everything up to last line)
-                  ^(\s*)((?:test-[\w-]+\/Makefile\s*)+)\) # (indenting)(last line)
-                 /length("$2$3$testname\/Makefile") > 80
-                       ? "$1$2$3 \\\n$2$testname\/Makefile)"
-                       : "$1$2$3 $testname\/Makefile)"
-                 /xmsge;
-
-# rewind the file and save the changes
-seek CONF, 0, SEEK_SET;
-print CONF $entire_conf;
-close CONF;
-
-print <<MSG;
-
-*********************************************************************
-"$testname/" has been created. It contains a generic test.
-Now you must:
- 1. Edit "$testname/scanner.@{[$cplusplus?'cc':'c']}" to customize your test.
- 2. Make an entry in the README, describing your test.
- 3. Run 'autoconf' to rebuild 'configure'.
-*********************************************************************
-
-MSG
-
-__END__
-
diff --git a/tests/test-array-nr/Makefile.am b/tests/test-array-nr/Makefile.am
new file mode 100644 (file)
index 0000000..a6e9335
--- /dev/null
@@ -0,0 +1,27 @@
+BISON = @BISON@
+FLEX = $(top_builddir)/flex
+
+EXTRA_DIST = scanner.l test.input
+CLEANFILES = scanner.c parser.c parser.h test-array-nr
+OBJS = scanner.o # parser.o
+
+INCLUDES = -I $(srcdir) -I $(top_srcdir)/tests
+#LDFLAGS = $(top_srcdir)/libfl.a 
+#YFLAGS = --defines --output=parser.c
+
+testname = test-array-nr
+
+scanner.c: $(srcdir)/scanner.l
+       $(FLEX) $<
+
+parser.c: $(srcdir)/parser.y
+       $(BISON) $(YFLAGS) $<
+
+$(testname)$(EXEEXT): $(OBJS)
+       $(CC) -o $@ $(OBJS) $(LDFLAGS)
+
+test: $(testname)$(EXEEXT)
+       $(srcdir)/$(testname)$(EXEEXT) < $(srcdir)/test.input
+
+.c.o:
+       $(CC) -c -o $@ $(INCLUDES) $<
diff --git a/tests/test-array-nr/Makefile.in b/tests/test-array-nr/Makefile.in
deleted file mode 100644 (file)
index 6cf3155..0000000
+++ /dev/null
@@ -1,59 +0,0 @@
-# Makefile.in for a single TEST.
-#
-# By default this Makefile will build the target "$(TESTNAME)"
-# from the sources "scanner.l" and "parser.y".
-#
-# $(TESTNAME) is supplied by the calling Makefile.
-# "parser.y"  is not necessary. You may delete this file
-#             if you do not require a parser.
-# "scanner.l" is necessary. It should build "scanner.c".
-#
-
-@SET_MAKE@
-
-CFLAGS = @CFLAGS@
-CPPFLAGS = @CPPFLAGS@ -I. -I"@srcdir@" -I..
-DEFS = @DEFS@
-LDFLAGS = @LDFLAGS@
-LIBS = @LIBS@
-SHELL = /bin/sh
-srcdir = @srcdir@
-VPATH = @srcdir@
-LN_S = @LN_S@
-YACC = @YACC@
-CC = @CC@
-AR = ar
-RANLIB = @RANLIB@
-YACC = @YACC@
-
-# Edit these if necessary for your specific test.
-TESTNAME = test-array-nr
-FLEX = ../../flex
-YFLAGS = --defines --output-file="parser.c" --name-prefix="test" 
-OBJS = scanner.o # parser.o
-
-# Force YACC to be bison (autoconf generates 'bison -y')
-YACC = @BISON@
-
-all: $(TESTNAME)
-
-$(TESTNAME): $(OBJS)
-       $(CC) $(CFLAGS) -o $(TESTNAME) $(OBJS) $(LDFLAGS) $(LIBS)
-
-scanner.c: $(srcdir)/scanner.l
-       $(FLEX) $(srcdir)/scanner.l
-
-scanner.o: scanner.c 
-       $(CC) $(CPPFLAGS) $(CFLAGS) -c scanner.c
-
-test: check
-
-check: $(TESTNAME)
-       ./$(TESTNAME) < $(srcdir)/test.input 
-
-distclean: clean
-       rm -f Makefile
-
-clean:
-       rm -f scanner.o scanner.c parser.o parser.c parser.h  parser.h $(TESTNAME) OUTPUT
-
diff --git a/tests/test-array-r/Makefile.am b/tests/test-array-r/Makefile.am
new file mode 100644 (file)
index 0000000..dd731a6
--- /dev/null
@@ -0,0 +1,24 @@
+BISON = @BISON@
+FLEX = $(top_builddir)/flex
+
+EXTRA_DIST = scanner.l test.input
+ CLEANFILES = scanner.c test-array-r
+OBJS = scanner.o
+
+INCLUDES = -I $(srcdir) -I $(top_srcdir)/tests
+#LDFLAGS = $(top_srcdir)/libfl.a 
+#YFLAGS = --defines --output=parser.c
+
+testname = test-array-r
+
+scanner.c: $(srcdir)/scanner.l
+       $(FLEX) $<
+
+$(testname)$(EXEEXT): $(OBJS)
+       $(CC) -o $@ $(OBJS) $(LDFLAGS)
+
+test: $(testname)$(EXEEXT)
+       $(srcdir)/$(testname)$(EXEEXT) < $(srcdir)/test.input
+
+.c.o:
+       $(CC) -c -o $@ $(INCLUDES) $<
diff --git a/tests/test-array-r/Makefile.in b/tests/test-array-r/Makefile.in
deleted file mode 100644 (file)
index 2c5a706..0000000
+++ /dev/null
@@ -1,59 +0,0 @@
-# Makefile.in for a single TEST.
-#
-# By default this Makefile will build the target "$(TESTNAME)"
-# from the sources "scanner.l" and "parser.y".
-#
-# $(TESTNAME) is supplied by the calling Makefile.
-# "parser.y"  is not necessary. You may delete this file
-#             if you do not require a parser.
-# "scanner.l" is necessary. It should build "scanner.c".
-#
-
-@SET_MAKE@
-
-CFLAGS = @CFLAGS@
-CPPFLAGS = @CPPFLAGS@ -I. -I"@srcdir@" -I..
-DEFS = @DEFS@
-LDFLAGS = @LDFLAGS@
-LIBS = @LIBS@
-SHELL = /bin/sh
-srcdir = @srcdir@
-VPATH = @srcdir@
-LN_S = @LN_S@
-YACC = @YACC@
-CC = @CC@
-AR = ar
-RANLIB = @RANLIB@
-YACC = @YACC@
-
-# Edit these if necessary for your specific test.
-TESTNAME = test-array-r
-FLEX = ../../flex
-YFLAGS = --defines --output-file="parser.c" --name-prefix="test" 
-OBJS = scanner.o # parser.o
-
-# Force YACC to be bison (autoconf generates 'bison -y')
-YACC = @BISON@
-
-all: $(TESTNAME)
-
-$(TESTNAME): $(OBJS)
-       $(CC) $(CFLAGS) -o $(TESTNAME) $(OBJS) $(LDFLAGS) $(LIBS)
-
-scanner.c: $(srcdir)/scanner.l
-       $(FLEX) $(srcdir)/scanner.l
-
-scanner.o: scanner.c 
-       $(CC) $(CPPFLAGS) $(CFLAGS) -c scanner.c
-
-test: check
-
-check: $(TESTNAME)
-       ./$(TESTNAME) < $(srcdir)/test.input 
-
-distclean: clean
-       rm -f Makefile
-
-clean:
-       rm -f scanner.o scanner.c parser.o parser.c parser.h  parser.h $(TESTNAME) OUTPUT
-
diff --git a/tests/test-basic-nr/Makefile.am b/tests/test-basic-nr/Makefile.am
new file mode 100644 (file)
index 0000000..bc69c50
--- /dev/null
@@ -0,0 +1,27 @@
+BISON = @BISON@
+FLEX = $(top_builddir)/flex
+
+EXTRA_DIST = scanner.l test.input
+CLEANFILES = scanner.c parser.c parser.h test-basic-nr
+OBJS = scanner.o # parser.o
+
+INCLUDES = -I $(srcdir) -I $(top_srcdir)/tests
+#LDFLAGS = $(top_srcdir)/libfl.a 
+#YFLAGS = --defines --output=parser.c
+
+testname = test-basic-nr
+
+scanner.c: $(srcdir)/scanner.l
+       $(FLEX) $<
+
+parser.c: $(srcdir)/parser.y
+       $(BISON) $(YFLAGS) $<
+
+$(testname)$(EXEEXT): $(OBJS)
+       $(CC) -o $@ $(OBJS) $(LDFLAGS)
+
+test: $(testname)$(EXEEXT)
+       $(srcdir)/$(testname)$(EXEEXT) < $(srcdir)/test.input
+
+.c.o:
+       $(CC) -c -o $@ $(INCLUDES) $<
diff --git a/tests/test-basic-nr/Makefile.in b/tests/test-basic-nr/Makefile.in
deleted file mode 100644 (file)
index faf5b25..0000000
+++ /dev/null
@@ -1,66 +0,0 @@
-# Makefile.in for a single TEST.
-#
-# By default this Makefile will build the target "$(TESTNAME)"
-# from the sources "scanner.l" and "parser.y".
-#
-# $(TESTNAME) is supplied by the calling Makefile.
-# "parser.y"  is not necessary. You may delete this file
-#             if you do not require a parser.
-# "scanner.l" is necessary. It should build "scanner.c".
-#
-
-@SET_MAKE@
-
-CFLAGS = @CFLAGS@
-CPPFLAGS = @CPPFLAGS@ -I. -I"@srcdir@" -I..
-DEFS = @DEFS@
-LDFLAGS = @LDFLAGS@
-LIBS = @LIBS@
-SHELL = /bin/sh
-srcdir = @srcdir@
-VPATH = @srcdir@
-LN_S = @LN_S@
-YACC = @YACC@
-CC = @CC@
-AR = ar
-RANLIB = @RANLIB@
-YACC = @YACC@
-
-# Edit these if necessary for your specific test.
-FLEX = ../../flex
-YFLAGS = --defines --output-file="parser.c" --name-prefix="test" 
-OBJS = scanner.o # parser.o
-
-# Force YACC to be bison (autoconf generates 'bison -y')
-YACC = @BISON@
-
-TESTNAME = test-basic-nr
-all: $(TESTNAME)
-
-$(TESTNAME): $(OBJS)
-       $(CC) $(CFLAGS) -o $(TESTNAME) $(OBJS) $(LDFLAGS) $(LIBS)
-
-scanner.c: $(srcdir)/scanner.l
-       $(FLEX) $(srcdir)/scanner.l
-
-scanner.o: scanner.c
-       $(CC) $(CPPFLAGS) $(CFLAGS) -c scanner.c
-
-parser.c: $(srcdir)/parser.y
-       $(YACC) $(YFLAGS) $(srcdir)/parser.y
-
-parser.o: parser.c
-       $(CC) $(CPPFLAGS) $(CFLAGS) -c parser.c
-
-test: check
-
-check: $(TESTNAME)
-       ./$(TESTNAME) < $(srcdir)/test.input 
-
-clean:
-       rm -f scanner.o scanner.c parser.o parser.c  parser.h $(TESTNAME)
-
-
-distclean: clean
-       rm -f Makefile
-
diff --git a/tests/test-basic-r/Makefile.am b/tests/test-basic-r/Makefile.am
new file mode 100644 (file)
index 0000000..45ee61a
--- /dev/null
@@ -0,0 +1,27 @@
+BISON = @BISON@
+FLEX = $(top_builddir)/flex
+
+EXTRA_DIST = scanner.l test.input
+CLEANFILES = scanner.c parser.c parser.h test-basic-r
+OBJS = scanner.o # parser.o
+
+INCLUDES = -I $(srcdir) -I $(top_srcdir)/tests
+#LDFLAGS = $(top_srcdir)/libfl.a 
+#YFLAGS = --defines --output=parser.c
+
+testname = test-basic-r
+
+scanner.c: $(srcdir)/scanner.l
+       $(FLEX) $<
+
+parser.c: $(srcdir)/parser.y
+       $(BISON) $(YFLAGS) $<
+
+$(testname)$(EXEEXT): $(OBJS)
+       $(CC) -o $@ $(OBJS) $(LDFLAGS)
+
+test: $(testname)$(EXEEXT)
+       $(srcdir)/$(testname)$(EXEEXT) < $(srcdir)/test.input
+
+.c.o:
+       $(CC) -c -o $@ $(INCLUDES) $<
diff --git a/tests/test-basic-r/Makefile.in b/tests/test-basic-r/Makefile.in
deleted file mode 100644 (file)
index 730bd83..0000000
+++ /dev/null
@@ -1,66 +0,0 @@
-# Makefile.in for a single TEST.
-#
-# By default this Makefile will build the target "$(TESTNAME)"
-# from the sources "scanner.l" and "parser.y".
-#
-# $(TESTNAME) is supplied by the calling Makefile.
-# "parser.y"  is not necessary. You may delete this file
-#             if you do not require a parser.
-# "scanner.l" is necessary. It should build "scanner.c".
-#
-
-@SET_MAKE@
-
-CFLAGS = @CFLAGS@
-CPPFLAGS = @CPPFLAGS@ -I. -I"@srcdir@" -I..
-DEFS = @DEFS@
-LDFLAGS = @LDFLAGS@
-LIBS = @LIBS@
-SHELL = /bin/sh
-srcdir = @srcdir@
-VPATH = @srcdir@
-LN_S = @LN_S@
-YACC = @YACC@
-CC = @CC@
-AR = ar
-RANLIB = @RANLIB@
-YACC = @YACC@
-
-# Edit these if necessary for your specific test.
-FLEX = ../../flex
-YFLAGS = --defines --output-file="parser.c" --name-prefix="test" 
-OBJS = scanner.o # parser.o
-
-# Force YACC to be bison (autoconf generates 'bison -y')
-YACC = @BISON@
-
-TESTNAME = test-basic-r
-all: $(TESTNAME)
-
-$(TESTNAME): $(OBJS)
-       $(CC) $(CFLAGS) -o $(TESTNAME) $(OBJS) $(LDFLAGS) $(LIBS)
-
-scanner.c: $(srcdir)/scanner.l
-       $(FLEX) $(srcdir)/scanner.l
-
-scanner.o: scanner.c
-       $(CC) $(CPPFLAGS) $(CFLAGS) -c scanner.c
-
-parser.c: $(srcdir)/parser.y
-       $(YACC) $(YFLAGS) $(srcdir)/parser.y
-
-parser.o: parser.c
-       $(CC) $(CPPFLAGS) $(CFLAGS) -c parser.c
-
-test: check
-
-check: $(TESTNAME)
-       ./$(TESTNAME) < $(srcdir)/test.input 
-
-clean:
-       rm -f scanner.o scanner.c parser.o parser.c  parser.h $(TESTNAME)
-
-
-distclean: clean
-       rm -f Makefile
-
diff --git a/tests/test-bison-yylloc/Makefile.am b/tests/test-bison-yylloc/Makefile.am
new file mode 100644 (file)
index 0000000..c0dbc04
--- /dev/null
@@ -0,0 +1,27 @@
+BISON = @BISON@
+FLEX = $(top_builddir)/flex
+
+EXTRA_DIST = scanner.l parser.y test.input
+CLEANFILES = scanner.c parser.c parser.h test-bison-yylloc
+OBJS = scanner.o parser.o
+
+INCLUDES = -I $(srcdir) -I $(top_srcdir)/tests
+#LDFLAGS = $(top_srcdir)/libfl.a 
+YFLAGS = --defines --output=parser.c --name-prefix="test"
+
+testname = test-bison-yylloc
+
+scanner.c: $(srcdir)/scanner.l
+       $(FLEX) $<
+
+parser.c: $(srcdir)/parser.y
+       $(BISON) $(YFLAGS) $<
+
+$(testname)$(EXEEXT): $(OBJS)
+       $(CC) -o $@ $(OBJS) $(LDFLAGS)
+
+test: $(testname)$(EXEEXT)
+       $(srcdir)/$(testname)$(EXEEXT) < $(srcdir)/test.input
+
+.c.o:
+       $(CC) -c -o $@ $(INCLUDES) $<
diff --git a/tests/test-bison-yylloc/Makefile.in b/tests/test-bison-yylloc/Makefile.in
deleted file mode 100644 (file)
index 523ff8a..0000000
+++ /dev/null
@@ -1,66 +0,0 @@
-# Makefile.in for a single TEST.
-#
-# By default this Makefile will build the target "$(TESTNAME)"
-# from the sources "scanner.l" and "parser.y".
-#
-# $(TESTNAME) is supplied by the calling Makefile.
-# "parser.y"  is not necessary. You may delete this file
-#             if you do not require a parser.
-# "scanner.l" is necessary. It should build "scanner.c".
-#
-
-@SET_MAKE@
-
-CFLAGS = @CFLAGS@
-CPPFLAGS = @CPPFLAGS@ -I. -I"@srcdir@" -I..
-DEFS = @DEFS@
-LDFLAGS = @LDFLAGS@
-LIBS = @LIBS@
-SHELL = /bin/sh
-srcdir = @srcdir@
-VPATH = @srcdir@
-LN_S = @LN_S@
-YACC = @YACC@
-CC = @CC@
-AR = ar
-RANLIB = @RANLIB@
-YACC = @YACC@
-
-# Edit these if necessary for your specific test.
-FLEX = ../../flex
-YFLAGS = --defines --output-file="parser.c" --name-prefix="test" 
-
-# Force YACC to be bison (autoconf generates 'bison -y')
-YACC = @BISON@
-
-TESTNAME = test-bison-yylloc
-all: $(TESTNAME)
-
-$(TESTNAME): parser.y scanner.l 
-       if test "$(YACC)" = "bison" ; then \
-               $(FLEX) $(srcdir)/scanner.l ; \
-               $(YACC) $(YFLAGS) $(srcdir)/parser.y ; \
-               $(CC) $(CPPFLAGS) $(CFLAGS) -c scanner.c ; \
-               $(CC) $(CPPFLAGS) $(CFLAGS) -c parser.c ; \
-               $(CC) $(CPPFLAGS) $(CFLAGS) -c $(srcdir)/main.c ; \
-               $(CC) $(CFLAGS) -o $(TESTNAME) scanner.o parser.o main.o $(LDFLAGS) $(LIBS) ; \
-       fi
-
-test: check
-
-check: $(TESTNAME)
-       if test "$(YACC)" = "bison" ; then \
-        { ./$(TESTNAME) <$(srcdir)/test.input | ./$(TESTNAME) | \
-          diff $(srcdir)/test.input -  ; } ; \
-    else \
-        echo "Test skipped because GNU bison was not detected by configure." ; \
-        exit 2;\
-    fi
-
-clean:
-       rm -f scanner.o scanner.c main.o parser.o parser.c  parser.h $(TESTNAME) yyheader.h
-
-
-distclean: clean
-       rm -f Makefile
-
diff --git a/tests/test-c-cpp-nr/Makefile.am b/tests/test-c-cpp-nr/Makefile.am
new file mode 100644 (file)
index 0000000..671f15f
--- /dev/null
@@ -0,0 +1,26 @@
+BISON = @BISON@
+FLEX = $(top_builddir)/flex
+
+EXTRA_DIST = scanner.l parser.y test.input
+OBJS = $(srcdir)/scanner.o # $(srcdir)/parser.o
+
+INCLUDES = -I $(srcdir) -I $(top_srcdir)/tests
+#LDFLAGS = $(top_srcdir)/libfl.a 
+#YFLAGS = --defines --output=parser.c
+
+testname = test-c-cpp-nr
+
+scanner.c: $(srcdir)/scanner.l
+       $(FLEX) $<
+
+parser.c: $(srcdir)/parser.y
+       $(BISON) $(YFLAGS) $<
+
+$(testname)$(EXEEXT): $(OBJS)
+       $(CXX) -o $(testname)$(EXEEXT) $(OBJS) $(LDFLAGS)
+
+test: $(testname)$(EXEEXT)
+       $(srcdir)/$(testname)$(EXEEXT) < $(srcdir)/test.input
+
+.c.o:
+       $(CC) -c -o $@ $(INCLUDES) $<
diff --git a/tests/test-c-cpp-nr/Makefile.in b/tests/test-c-cpp-nr/Makefile.in
deleted file mode 100644 (file)
index 4275e5f..0000000
+++ /dev/null
@@ -1,60 +0,0 @@
-# Makefile.in for a single TEST.
-#
-# By default this Makefile will build the target "$(TESTNAME)"
-# from the sources "scanner.l" and "parser.y".
-#
-# $(TESTNAME) is supplied by the calling Makefile.
-# "parser.y"  is not necessary. You may delete this file
-#             if you do not require a parser.
-# "scanner.l" is necessary. It should build "scanner.c".
-#
-
-@SET_MAKE@
-
-CFLAGS = @CFLAGS@
-CPPFLAGS = @CPPFLAGS@ -I. -I"@srcdir@" -I..
-DEFS = @DEFS@
-LDFLAGS = @LDFLAGS@
-LIBS = @LIBS@
-SHELL = /bin/sh
-srcdir = @srcdir@
-VPATH = @srcdir@
-LN_S = @LN_S@
-YACC = @YACC@
-CC = @CC@
-CXX = @CXX@
-AR = ar
-RANLIB = @RANLIB@
-YACC = @YACC@
-
-# Edit these if necessary for your specific test.
-TESTNAME = test-c-cpp-nr
-FLEX = ../../flex
-YFLAGS = --defines --output-file="parser.c" --name-prefix="test" 
-OBJS = scanner.o # parser.o
-
-# Force YACC to be bison (autoconf generates 'bison -y')
-YACC = @BISON@
-
-all: $(TESTNAME)
-
-$(TESTNAME): $(OBJS)
-       $(CXX) $(CFLAGS) -o $(TESTNAME) $(OBJS) $(LDFLAGS) $(LIBS)
-
-scanner.c: $(srcdir)/scanner.l
-       $(FLEX) $(srcdir)/scanner.l
-
-scanner.o: scanner.c
-       $(CXX) $(CPPFLAGS) $(CFLAGS) -c scanner.c
-
-test: check
-
-check: $(TESTNAME)
-       ./$(TESTNAME) < $(srcdir)/test.input 
-
-distclean: clean
-       rm -f Makefile
-
-clean:
-       rm -f scanner.o scanner.c parser.o parser.c parser.h  parser.h $(TESTNAME) OUTPUT
-
diff --git a/tests/test-c-cpp-r/Makefile.am b/tests/test-c-cpp-r/Makefile.am
new file mode 100644 (file)
index 0000000..03bdf5c
--- /dev/null
@@ -0,0 +1,27 @@
+BISON = @BISON@
+FLEX = $(top_builddir)/flex
+
+EXTRA_DIST = scanner.l parser.y test.input
+CLEANFILES = scanner.c parser.c parser.h test-c-cpp-r
+OBJS = scanner.o # parser.o
+
+INCLUDES = -I $(srcdir) -I $(top_srcdir)/tests
+#LDFLAGS = $(top_srcdir)/libfl.a 
+#YFLAGS = --defines --output=parser.c
+
+testname = test-c-cpp-r
+
+scanner.c: $(srcdir)/scanner.l
+       $(FLEX) $<
+
+parser.c: $(srcdir)/parser.y
+       $(BISON) $(YFLAGS) $<
+
+$(testname)$(EXEEXT): $(OBJS)
+       $(CXX) -o $@ $(OBJS) $(LDFLAGS)
+
+test: $(testname)$(EXEEXT)
+       $(srcdir)/$(testname)$(EXEEXT) < $(srcdir)/test.input
+
+.c.o:
+       $(CC) -c -o $@ $(INCLUDES) $<
diff --git a/tests/test-c-cpp-r/Makefile.in b/tests/test-c-cpp-r/Makefile.in
deleted file mode 100644 (file)
index 50281f9..0000000
+++ /dev/null
@@ -1,61 +0,0 @@
-# Makefile.in for a single TEST.
-#
-# By default this Makefile will build the target "$(TESTNAME)"
-# from the sources "scanner.l" and "parser.y".
-#
-# $(TESTNAME) is supplied by the calling Makefile.
-# "parser.y"  is not necessary. You may delete this file
-#             if you do not require a parser.
-# "scanner.l" is necessary. It should build "scanner.c".
-#
-
-@SET_MAKE@
-
-CFLAGS = @CFLAGS@
-CPPFLAGS = @CPPFLAGS@ -I. -I"@srcdir@" -I..
-DEFS = @DEFS@
-LDFLAGS = @LDFLAGS@
-LIBS = @LIBS@
-SHELL = /bin/sh
-srcdir = @srcdir@
-VPATH = @srcdir@
-LN_S = @LN_S@
-YACC = @YACC@
-CC = @CC@
-CXX = @CXX@
-CXXFLAGS = @CXXFLAGS@ -I. -I"@srcdir@" -I..
-AR = ar
-RANLIB = @RANLIB@
-YACC = @YACC@
-
-# Edit these if necessary for your specific test.
-TESTNAME = test-c-cpp-r
-FLEX = ../../flex
-YFLAGS = --defines --output-file="parser.c" --name-prefix="test" 
-OBJS = scanner.o # parser.o
-
-# Force YACC to be bison (autoconf generates 'bison -y')
-YACC = @BISON@
-
-all: $(TESTNAME)
-
-$(TESTNAME): $(OBJS)
-       $(CXX) $(CXXFLAGS) -o $(TESTNAME) $(OBJS) $(LDFLAGS) $(LIBS)
-
-scanner.c: $(srcdir)/scanner.l
-       $(FLEX) $(srcdir)/scanner.l
-
-scanner.o: scanner.c
-       $(CXX) $(CXXFLAGS) -c scanner.c
-
-test: check
-
-check: $(TESTNAME)
-       ./$(TESTNAME) < $(srcdir)/test.input 
-
-distclean: clean
-       rm -f Makefile
-
-clean:
-       rm -f scanner.o scanner.c parser.o parser.c parser.h  parser.h $(TESTNAME) OUTPUT
-