help-flex
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: m4 and skeleton system


From: Tim Landscheidt
Subject: Re: m4 and skeleton system
Date: Tue, 08 Nov 2011 19:10:14 +0000
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/23.1 (gnu/linux)

I wrote:

> [...]
>   What I don't quite understand is the reasoning behind
> flex's skeleton system.  While Bison's is pretty straight
> forward, - CMIIW - flex processes the skeleton with m4 to a
> C array, then implements some "%if-..." control structures
> of its own and processes the result again with m4 (offering
> the user another set of control structures for his code).
> The only technical advantage to Bison's that I can see from
> a distance is that in this way the whole shebang is contain-
> ed in one binary.

>   So with regard to my goal, should I go for "%if-php-only",
> or would a patch to streamline the skeleton system first be
> met favourably?

Attached is an initial patch to remove the m4 preprocessing
(cf. <URI:https://github.com/scfc/flex/tree/m4-nopreproc>
for finer granularity).

  It should change the output only when "--tables-file" is
used in that the copyright notice (*1) is now reproduced
verbatim, i. e. the "``AS IS''" is no longer mangled to "`AS
IS'".

  It introduces a new option "--skeldir" which points to a
directory containing (for now) "flexint.h",
"tables_shared.c" and "tables_shared.h".

Tim

(*1)   I'd think that the "dnl" indicates that it shouldn't
       be reproduced at all, but I'm hesitant to remove it.
diff --git a/Makefile.am b/Makefile.am
index f4924b9..01626a2 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -114,6 +114,7 @@ BUILT_SOURCES = \
 
 SUBDIRS = \
        . \
+       data \
        doc \
        m4  \
        examples \
@@ -122,11 +123,11 @@ SUBDIRS = \
        tests
 
 localedir = $(datadir)/locale
-AM_CPPFLAGS = -DLOCALEDIR=\"$(localedir)\" -I$(top_srcdir)/intl
+AM_CPPFLAGS = -DPKGDATADIR=\"$(pkgdatadir)\" -DLOCALEDIR=\"$(localedir)\" 
-I$(top_srcdir)/intl
 LIBS = @LIBINTL@ @LIBS@
 
 skel.c: flex.skl mkskel.sh flexint.h tables_shared.h
-       sed 's/m4_/m4postproc_/g; s/m4preproc_/m4_/g' $(srcdir)/flex.skl | 
$(m4) -P -DFLEX_MAJOR_VERSION=`echo $(VERSION)|cut -f 1 -d .` 
-DFLEX_MINOR_VERSION=`echo $(VERSION)|cut -f 2 -d .` 
-DFLEX_SUBMINOR_VERSION=`echo $(VERSION)|cut -f 3 -d .` | sed 
's/m4postproc_/m4_/g' | $(SHELL) $(srcdir)/mkskel.sh  >skel.c
+       $(SHELL) $(srcdir)/mkskel.sh < $(srcdir)/flex.skl > skel.c
 
 # Explicitly describe dependencies.
 # You can recreate this with `gcc -I. -MM *.c'
diff --git a/configure.in b/configure.in
index a9e3038..117fc55 100644
--- a/configure.in
+++ b/configure.in
@@ -112,6 +112,7 @@ AC_CHECK_FUNCS([dup2 isascii memset pow regcomp setlocale 
strchr strtol])
 
 AC_CONFIG_FILES(
 Makefile
+data/Makefile
 doc/Makefile
 examples/Makefile
 examples/fastwc/Makefile
diff --git a/data/Makefile.am b/data/Makefile.am
new file mode 100644
index 0000000..e9bbf86
--- /dev/null
+++ b/data/Makefile.am
@@ -0,0 +1,28 @@
+# 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.
+
+dist_pkgdata_DATA = \
+  flexint.h         \
+  tables_shared.c   \
+  tables_shared.h
+
+$(dist_pkgdata_DATA): %: $(top_srcdir)/%
+       cp $< $@
diff --git a/flex.skl b/flex.skl
index 7b4127b..f6582a0 100644
--- a/flex.skl
+++ b/flex.skl
@@ -2,28 +2,20 @@
 %# This file is processed in several stages.
 %# Here are the stages, as best as I can describe:
 %#
-%#   1. flex.skl is processed through GNU m4 during the
-%#      pre-compilation stage of flex. Only macros starting
-%#      with `m4preproc_' are processed, and quoting is normal.
+%#   1. The skeleton is translated verbatim into a C array, saved as
+%#      "skel.c" and compiled into the flex binary.
 %#
-%#   2. The preprocessed skeleton is translated verbatim into a
-%#      C array, saved as "skel.c" and compiled into the flex binary.
+%#   2. At runtime, the skeleton is generated and filtered through m4.
+%#      Macros beginning with `m4_' will be processed. The quoting is
+%#      "[[" and "]]" so we don't interfere with user code.
 %#
-%#   3. At runtime, the skeleton is generated and filtered (again)
-%#      through m4. Macros beginning with `m4_' will be processed.
-%#      The quoting is "[[" and "]]" so we don't interfere with
-%#      user code.
-%# 
-%# All generate macros for the m4 stage contain the text "m4" or "M4"
+%# All generated macros for the m4 stage contain the text "m4" or "M4"
 %# in them. This is to distinguish them from CPP macros.
-%# The exception to this rule is YY_G, which is an m4 macro, 
+%# The exception to this rule is YY_G, which is an m4 macro,
 %# but it needs to be remain short because it is used everywhere.
 %#
 /* A lexical scanner generated by flex */
 
-%#  Macros for preproc stage.
-m4preproc_changecom
-
 %# Macros for runtime processing stage.
 m4_changecom
 m4_changequote
@@ -83,9 +75,9 @@ m4_ifelse(M4_YY_PREFIX,yy,,
 %ok-for-header
 
 #define FLEX_SCANNER
-#define YY_FLEX_MAJOR_VERSION FLEX_MAJOR_VERSION
-#define YY_FLEX_MINOR_VERSION FLEX_MINOR_VERSION
-#define YY_FLEX_SUBMINOR_VERSION FLEX_SUBMINOR_VERSION
+#define YY_FLEX_MAJOR_VERSION m4_patsubst(FLEX_VERSION, 
[[^\([0-9]+\)\.[0-9]+\.[0-9]+$]], [[\1]])
+#define YY_FLEX_MINOR_VERSION m4_patsubst(FLEX_VERSION, 
[[^[0-9]+\.\([0-9]+\)\.[0-9]+$]], [[\1]])
+#define YY_FLEX_SUBMINOR_VERSION m4_patsubst(FLEX_VERSION, 
[[^[0-9]+\.[0-9]+\.\([0-9]+\)$]], [[\1]])
 #if YY_FLEX_SUBMINOR_VERSION > 0
 #define FLEX_BETA
 #endif
@@ -105,8 +97,8 @@ m4_ifdef( [[M4_YY_REENTRANT]],  
[[m4_define([[M4_YY_HAS_START_STACK_VARS]])]])
 
 m4_ifdef( [[M4_YY_PREFIX]],, [[m4_define([[M4_YY_PREFIX]], [[yy]])]])
 
-m4preproc_define(`M4_GEN_PREFIX',
-    ``m4_define(yy[[$1]], 
[[M4_YY_PREFIX[[$1]]m4_ifelse($'`#,0,,[[($'`@)]])]])'')
+m4_define([[M4_GEN_PREFIX]],
+    [[m4_define([[yy$1]], [[M4_YY_PREFIX[[$1]]m4_ifelse($]][[#, [[0]], [[]], 
($]][[@))]])]])
 
 %if-c++-only
     /* The c++ scanner is a mess. The FlexLexer.h header file relies on the
@@ -119,78 +111,78 @@ m4preproc_define(`M4_GEN_PREFIX',
 %endif
 
 %if-c-only
-    M4_GEN_PREFIX(`_create_buffer')
-    M4_GEN_PREFIX(`_delete_buffer')
-    M4_GEN_PREFIX(`_scan_buffer')
-    M4_GEN_PREFIX(`_scan_string')
-    M4_GEN_PREFIX(`_scan_bytes')
-    M4_GEN_PREFIX(`_init_buffer')
-    M4_GEN_PREFIX(`_flush_buffer')
-    M4_GEN_PREFIX(`_load_buffer_state')
-    M4_GEN_PREFIX(`_switch_to_buffer')
-    M4_GEN_PREFIX(`push_buffer_state')
-    M4_GEN_PREFIX(`pop_buffer_state')
-    M4_GEN_PREFIX(`ensure_buffer_stack')
-    M4_GEN_PREFIX(`lex')
-    M4_GEN_PREFIX(`restart')
-    M4_GEN_PREFIX(`lex_init')
-    M4_GEN_PREFIX(`lex_init_extra')
-    M4_GEN_PREFIX(`lex_destroy')
-    M4_GEN_PREFIX(`get_debug')
-    M4_GEN_PREFIX(`set_debug')
-    M4_GEN_PREFIX(`get_extra')
-    M4_GEN_PREFIX(`set_extra')
-    M4_GEN_PREFIX(`get_in')
-    M4_GEN_PREFIX(`set_in')
-    M4_GEN_PREFIX(`get_out')
-    M4_GEN_PREFIX(`set_out')
-    M4_GEN_PREFIX(`get_leng')
-    M4_GEN_PREFIX(`get_text')
-    M4_GEN_PREFIX(`get_lineno')
-    M4_GEN_PREFIX(`set_lineno')
+    M4_GEN_PREFIX([[_create_buffer]])
+    M4_GEN_PREFIX([[_delete_buffer]])
+    M4_GEN_PREFIX([[_scan_buffer]])
+    M4_GEN_PREFIX([[_scan_string]])
+    M4_GEN_PREFIX([[_scan_bytes]])
+    M4_GEN_PREFIX([[_init_buffer]])
+    M4_GEN_PREFIX([[_flush_buffer]])
+    M4_GEN_PREFIX([[_load_buffer_state]])
+    M4_GEN_PREFIX([[_switch_to_buffer]])
+    M4_GEN_PREFIX([[push_buffer_state]])
+    M4_GEN_PREFIX([[pop_buffer_state]])
+    M4_GEN_PREFIX([[ensure_buffer_stack]])
+    M4_GEN_PREFIX([[lex]])
+    M4_GEN_PREFIX([[restart]])
+    M4_GEN_PREFIX([[lex_init]])
+    M4_GEN_PREFIX([[lex_init_extra]])
+    M4_GEN_PREFIX([[lex_destroy]])
+    M4_GEN_PREFIX([[get_debug]])
+    M4_GEN_PREFIX([[set_debug]])
+    M4_GEN_PREFIX([[get_extra]])
+    M4_GEN_PREFIX([[set_extra]])
+    M4_GEN_PREFIX([[get_in]])
+    M4_GEN_PREFIX([[set_in]])
+    M4_GEN_PREFIX([[get_out]])
+    M4_GEN_PREFIX([[set_out]])
+    M4_GEN_PREFIX([[get_leng]])
+    M4_GEN_PREFIX([[get_text]])
+    M4_GEN_PREFIX([[get_lineno]])
+    M4_GEN_PREFIX([[set_lineno]])
     m4_ifdef( [[M4_YY_REENTRANT]],
     [[
-        M4_GEN_PREFIX(`get_column')
-        M4_GEN_PREFIX(`set_column')
+        M4_GEN_PREFIX([[get_column]])
+        M4_GEN_PREFIX([[set_column]])
     ]])
-    M4_GEN_PREFIX(`wrap')
+    M4_GEN_PREFIX([[wrap]])
 %endif
 
 m4_ifdef( [[M4_YY_BISON_LVAL]],
 [[
-    M4_GEN_PREFIX(`get_lval')
-    M4_GEN_PREFIX(`set_lval')
+    M4_GEN_PREFIX([[get_lval]])
+    M4_GEN_PREFIX([[set_lval]])
 ]])
 
 m4_ifdef( [[<M4_YY_BISON_LLOC>]],
 [[
-    M4_GEN_PREFIX(`get_lloc')
-    M4_GEN_PREFIX(`set_lloc')
+    M4_GEN_PREFIX([[get_lloc]])
+    M4_GEN_PREFIX([[set_lloc]])
 ]])
 
 
-    M4_GEN_PREFIX(`alloc')
-    M4_GEN_PREFIX(`realloc')
-    M4_GEN_PREFIX(`free')
+    M4_GEN_PREFIX([[alloc]])
+    M4_GEN_PREFIX([[realloc]])
+    M4_GEN_PREFIX([[free]])
 
 %if-c-only
 m4_ifdef( [[M4_YY_NOT_REENTRANT]],
 [[
-    M4_GEN_PREFIX(`text')
-    M4_GEN_PREFIX(`leng')
-    M4_GEN_PREFIX(`in')
-    M4_GEN_PREFIX(`out')
-    M4_GEN_PREFIX(`_flex_debug')
-    M4_GEN_PREFIX(`lineno')
+    M4_GEN_PREFIX([[text]])
+    M4_GEN_PREFIX([[leng]])
+    M4_GEN_PREFIX([[in]])
+    M4_GEN_PREFIX([[out]])
+    M4_GEN_PREFIX([[_flex_debug]])
+    M4_GEN_PREFIX([[lineno]])
 ]])
 %endif
 
 
 m4_ifdef( [[M4_YY_TABLES_EXTERNAL]],
 [[
-    M4_GEN_PREFIX(`tables_fload')
-    M4_GEN_PREFIX(`tables_destroy')
-    M4_GEN_PREFIX(`TABLES_NAME')
+    M4_GEN_PREFIX([[tables_fload]])
+    M4_GEN_PREFIX([[tables_destroy]])
+    M4_GEN_PREFIX([[TABLES_NAME]])
 ]])
 
 /* First, we deal with  platform-specific or compiler-specific issues. */
@@ -210,7 +202,7 @@ m4_ifdef( [[M4_YY_TABLES_EXTERNAL]],
 /* end standard C headers. */
 
 %if-c-or-c++
-m4preproc_include(`flexint.h')
+m4_include([[flexint.h]])
 %endif
 
 %if-c++-only
@@ -1129,7 +1121,7 @@ m4_ifdef( [[M4_YY_NOT_IN_HEADER]],
 ]])
 
 %if-tables-serialization structures and prototypes
-m4preproc_include(`tables_shared.h')
+m4_include([[tables_shared.h]])
 
 /* Load the DFA tables from the given stream.  */
 int yytables_fload M4_YY_PARAMS(FILE * fp M4_YY_PROTO_LAST_ARG);
@@ -2997,7 +2989,7 @@ void yyfree YYFARGS1( void *,ptr)
 ]])
 
 %if-tables-serialization definitions
-m4preproc_include(`tables_shared.c')
+m4_include([[tables_shared.c]])
 
 static int yytbl_read8 (void *v, struct yytbl_reader * rd)
 {
diff --git a/main.c b/main.c
index cec2d77..5570d2f 100644
--- a/main.c
+++ b/main.c
@@ -136,6 +136,7 @@ extern FILE* yyout;
 static char outfile_path[MAXLINE];
 static int outfile_created = 0;
 static char *skelname = NULL;
+static char *skeldir = NULL;
 static int _stdout_closed = 0; /* flag to prevent double-fclose() on stdout. */
 const char *escaped_qstart = "[[]]M4_YY_NOOP[M4_YY_NOOP[M4_YY_NOOP[[]]";
 const char *escaped_qend   = "[[]]M4_YY_NOOP]M4_YY_NOOP]M4_YY_NOOP[[]]";
@@ -367,7 +368,7 @@ void check_options ()
     output_chain = filter_create_int(NULL, filter_tee_header, headerfilename);
     if ( !(m4 = getenv("M4")))
         m4 = M4;
-    filter_create_ext(output_chain, m4, "-P", 0);
+    filter_create_ext(output_chain, m4, "-P", "-DFLEX_VERSION=" FLEX_VERSION, 
"-I", skeldir ? skeldir : PKGDATADIR, NULL);
     filter_create_int(output_chain, filter_fix_linedirs, NULL);
 
     /* For debugging, only run the requested number of filters. */
@@ -1154,6 +1155,10 @@ void flexinit (argc, argv)
                        skelname = arg;
                        break;
 
+               case OPT_SKELDIR:
+                       skeldir = arg;
+                       break;
+
                case OPT_DEFAULT:
                        spprdflt = false;
                        break;
@@ -1820,6 +1825,7 @@ void usage ()
                  "\n" "Files:\n"
                  "  -o, --outfile=FILE      specify output filename\n"
                  "  -S, --skel=FILE         specify skeleton file\n"
+                 "      --skeldir=DIR       specify skeletons directory\n"
                  "  -t, --stdout            write scanner on stdout instead of 
%s\n"
                  "      --yyclass=NAME      name of C++ class\n"
                  "      --header-file=FILE   create a C header file in 
addition to the scanner\n"
diff --git a/options.c b/options.c
index c673173..e6cbd4a 100644
--- a/options.c
+++ b/options.c
@@ -177,6 +177,8 @@ optspec_t flexopts[] = {
        ,
        {"--skel=FILE", OPT_SKEL, 0}
        ,                       /* Use skeleton from FILE */
+       {"--skeldir=DIR", OPT_SKELDIR, 0}
+       ,                       /* Use skeletons from DIR */
        {"--stack", OPT_STACK, 0}
        ,
        {"--stdinit", OPT_STDINIT, 0}
diff --git a/options.h b/options.h
index 1f3925b..e128bc9 100644
--- a/options.h
+++ b/options.h
@@ -113,6 +113,7 @@ enum flexopt_flag_t {
        OPT_REENTRANT,
        OPT_REJECT,
        OPT_SKEL,
+       OPT_SKELDIR,
        OPT_STACK,
        OPT_STDINIT,
        OPT_STDOUT,
diff --git a/tables_shared.h b/tables_shared.h
index bbf9910..29aeae5 100644
--- a/tables_shared.h
+++ b/tables_shared.h
@@ -134,11 +134,11 @@ struct yytbl_data {
 #endif
 
 #ifdef FLEX_SCANNER
-%not-for-header
+m4_ifdef( [[M4_YY_IN_HEADER]], [[]], [[
 #endif
 yyskel_static flex_int32_t yytbl_calc_total_len (const struct yytbl_data *tbl);
 #ifdef FLEX_SCANNER
-%ok-for-header
+]])
 #endif
 
 /* vim:set noexpandtab cindent tabstop=8 softtabstop=0 shiftwidth=8 
textwidth=0: */
diff --git a/tests/TEMPLATE/Makefile.am b/tests/TEMPLATE/Makefile.am
index 5495991..53f5511 100644
--- a/tests/TEMPLATE/Makefile.am
+++ b/tests/TEMPLATE/Makefile.am
@@ -35,7 +35,7 @@ AM_CPPFLAGS = -I$(srcdir) -I$(builddir) -I$(top_srcdir) 
-I$(top_builddir)
 testname = TEMPLATE
 
 scanner.c: $(srcdir)/scanner.l
-       $(FLEX) $(LFLAGS) $<
+       $(FLEX) --skeldir $(top_builddir)/data $(LFLAGS) $<
 
 parser.c: $(srcdir)/parser.y
        $(BISON) $(YFLAGS) $<
diff --git a/tests/test-alloc-extra/Makefile.am 
b/tests/test-alloc-extra/Makefile.am
index e149d0d..f972825 100644
--- a/tests/test-alloc-extra/Makefile.am
+++ b/tests/test-alloc-extra/Makefile.am
@@ -34,7 +34,7 @@ AM_CPPFLAGS = -I$(srcdir) -I$(top_srcdir) -I$(top_builddir)
 testname = test-alloc-extra
 
 scanner.c: $(srcdir)/scanner.l
-       $(FLEX) $(LFLAGS) $<
+       $(FLEX) --skeldir $(top_builddir)/data $(LFLAGS) $<
 
 parser.c: $(srcdir)/parser.y
        $(BISON) $(YFLAGS) $<
diff --git a/tests/test-array-nr/Makefile.am b/tests/test-array-nr/Makefile.am
index 80ce175..d93a956 100644
--- a/tests/test-array-nr/Makefile.am
+++ b/tests/test-array-nr/Makefile.am
@@ -33,7 +33,7 @@ AM_CPPFLAGS = -I$(srcdir) -I$(top_srcdir) -I$(top_builddir)
 testname = test-array-nr
 
 scanner.c: $(srcdir)/scanner.l
-       $(FLEX) $<
+       $(FLEX) --skeldir $(top_builddir)/data $<
 
 parser.c: $(srcdir)/parser.y
        $(BISON) $(YFLAGS) $<
diff --git a/tests/test-array-r/Makefile.am b/tests/test-array-r/Makefile.am
index ff06a98..c97eb2d 100644
--- a/tests/test-array-r/Makefile.am
+++ b/tests/test-array-r/Makefile.am
@@ -33,7 +33,7 @@ AM_CPPFLAGS = -I$(srcdir) -I$(top_srcdir) -I$(top_builddir)
 testname = test-array-r
 
 scanner.c: $(srcdir)/scanner.l
-       $(FLEX) $<
+       $(FLEX) --skeldir $(top_builddir)/data $<
 
 $(testname)$(EXEEXT): $(OBJS)
        $(CC) -o $@ $(LDFLAGS) $(OBJS) $(LOADLIBES)
diff --git a/tests/test-basic-nr/Makefile.am b/tests/test-basic-nr/Makefile.am
index 0563f4d..36c58d0 100644
--- a/tests/test-basic-nr/Makefile.am
+++ b/tests/test-basic-nr/Makefile.am
@@ -33,7 +33,7 @@ AM_CPPFLAGS = -I$(srcdir) -I$(top_srcdir) -I$(top_builddir)
 testname = test-basic-nr
 
 scanner.c: $(srcdir)/scanner.l
-       $(FLEX) $<
+       $(FLEX) --skeldir $(top_builddir)/data $<
 
 parser.c: $(srcdir)/parser.y
        $(BISON) $(YFLAGS) $<
diff --git a/tests/test-basic-r/Makefile.am b/tests/test-basic-r/Makefile.am
index 7137347..3c08d6c 100644
--- a/tests/test-basic-r/Makefile.am
+++ b/tests/test-basic-r/Makefile.am
@@ -33,7 +33,7 @@ AM_CPPFLAGS = -I$(srcdir) -I$(top_srcdir) -I$(top_builddir)
 testname = test-basic-r
 
 scanner.c: $(srcdir)/scanner.l
-       $(FLEX) $<
+       $(FLEX) --skeldir $(top_builddir)/data $<
 
 parser.c: $(srcdir)/parser.y
        $(BISON) $(YFLAGS) $<
diff --git a/tests/test-bison-nr/Makefile.am b/tests/test-bison-nr/Makefile.am
index b251572..50ba537 100644
--- a/tests/test-bison-nr/Makefile.am
+++ b/tests/test-bison-nr/Makefile.am
@@ -35,7 +35,7 @@ YFLAGS = --defines --output=parser.c --name-prefix="test"
 testname = test-bison-nr
 
 scanner.c: $(srcdir)/scanner.l
-       $(FLEX) $<
+       $(FLEX) --skeldir $(top_builddir)/data $<
 
 parser.c: $(srcdir)/parser.y
        $(BISON) $(YFLAGS) $<
diff --git a/tests/test-bison-yylloc/Makefile.am 
b/tests/test-bison-yylloc/Makefile.am
index 3be8907..48928ca 100644
--- a/tests/test-bison-yylloc/Makefile.am
+++ b/tests/test-bison-yylloc/Makefile.am
@@ -35,7 +35,7 @@ YFLAGS = --defines --output=parser.c --name-prefix="test"
 testname = test-bison-yylloc
 
 scanner.c: $(srcdir)/scanner.l
-       $(FLEX) $<
+       $(FLEX) --skeldir $(top_builddir)/data $<
 
 parser.c: $(srcdir)/parser.y
        $(BISON) $(YFLAGS) $<
diff --git a/tests/test-bison-yylval/Makefile.am 
b/tests/test-bison-yylval/Makefile.am
index e55e8a7..292da76 100644
--- a/tests/test-bison-yylval/Makefile.am
+++ b/tests/test-bison-yylval/Makefile.am
@@ -35,7 +35,7 @@ YFLAGS = --defines --output=parser.c --name-prefix="test"
 testname = test-bison-yylval
 
 scanner.c: $(srcdir)/scanner.l
-       $(FLEX) $<
+       $(FLEX) --skeldir $(top_builddir)/data $<
 
 parser.c: $(srcdir)/parser.y
        $(BISON) $(YFLAGS) $<
diff --git a/tests/test-c++-basic/Makefile.am b/tests/test-c++-basic/Makefile.am
index dcb76ed..999de7e 100644
--- a/tests/test-c++-basic/Makefile.am
+++ b/tests/test-c++-basic/Makefile.am
@@ -33,7 +33,7 @@ LFLAGS = -+
 testname = test-c++-basic
 
 scanner.cpp: $(srcdir)/scanner.l
-       $(FLEX) $(LFLAGS) $<
+       $(FLEX) --skeldir $(top_builddir)/data $(LFLAGS) $<
 
 $(testname)$(EXEEXT): $(OBJS)
        $(CXX) -o $@ $(LDFLAGS) $(OBJS) $(LOADLIBES)
diff --git a/tests/test-c++-multiple-scanners/Makefile.am 
b/tests/test-c++-multiple-scanners/Makefile.am
index 418e87a..031398d 100644
--- a/tests/test-c++-multiple-scanners/Makefile.am
+++ b/tests/test-c++-multiple-scanners/Makefile.am
@@ -34,10 +34,10 @@ AM_CXXFLAGS = -I$(srcdir) -I$(top_srcdir) -I$(top_builddir)
 testname = test-c++-multiple-scanners
 
 scanner-1.cpp: $(srcdir)/scanner-1.l
-       $(FLEX) -+ $(LFLAGS) $<
+       $(FLEX) --skeldir $(top_builddir)/data -+ $(LFLAGS) $<
 
 scanner-2.cpp: $(srcdir)/scanner-2.l
-       $(FLEX) -+ $(LFLAGS) $<
+       $(FLEX) --skeldir $(top_builddir)/data -+ $(LFLAGS) $<
 
 $(testname)$(EXEEXT): $(OBJS)
        $(CXX) -o $@ $(LDFLAGS) $(OBJS) $(LOADLIBES)
diff --git a/tests/test-c++-yywrap/Makefile.am 
b/tests/test-c++-yywrap/Makefile.am
index c79d102..db4c0c1 100644
--- a/tests/test-c++-yywrap/Makefile.am
+++ b/tests/test-c++-yywrap/Makefile.am
@@ -33,7 +33,7 @@ LFLAGS = -+
 testname = test-c++-yywrap
 
 scanner.cpp: $(srcdir)/scanner.l
-       $(FLEX) $(LFLAGS) $<
+       $(FLEX) --skeldir $(top_builddir)/data $(LFLAGS) $<
 
 $(testname)$(EXEEXT): $(OBJS)
        $(CXX) -o $@ $(LDFLAGS) $(OBJS)
diff --git a/tests/test-c-cpp-nr/Makefile.am b/tests/test-c-cpp-nr/Makefile.am
index 0aea014..3cd1662 100644
--- a/tests/test-c-cpp-nr/Makefile.am
+++ b/tests/test-c-cpp-nr/Makefile.am
@@ -33,7 +33,7 @@ AM_CPPFLAGS = -I$(srcdir) -I$(top_srcdir) -I$(top_builddir)
 testname = test-c-cpp-nr
 
 scanner.cpp: $(srcdir)/scanner.l
-       $(FLEX) $<
+       $(FLEX) --skeldir $(top_builddir)/data $<
 
 $(testname)$(EXEEXT): $(OBJS)
        $(CXX) -o $@ $(LDFLAGS) $(OBJS) $(LOADLIBES)
diff --git a/tests/test-c-cpp-r/Makefile.am b/tests/test-c-cpp-r/Makefile.am
index 0b53170..e4bda74 100644
--- a/tests/test-c-cpp-r/Makefile.am
+++ b/tests/test-c-cpp-r/Makefile.am
@@ -33,7 +33,7 @@ AM_CPPFLAGS = -I$(srcdir) -I$(top_srcdir) -I$(top_builddir)
 testname = test-c-cpp-r
 
 scanner.cpp: $(srcdir)/scanner.l
-       $(FLEX) $<
+       $(FLEX) --skeldir $(top_builddir)/data $<
 
 $(testname)$(EXEEXT): $(OBJS)
        $(CXX) -o $@ $(LDFLAGS) $(OBJS) $(LOADLIBES)
diff --git a/tests/test-ccl/Makefile.am b/tests/test-ccl/Makefile.am
index e78df6a..30ddfab 100644
--- a/tests/test-ccl/Makefile.am
+++ b/tests/test-ccl/Makefile.am
@@ -32,7 +32,7 @@ AM_CPPFLAGS = -I$(srcdir) -I$(builddir) -I$(top_srcdir) 
-I$(top_builddir)
 testname = test-ccl
 
 scanner.c: $(srcdir)/scanner.l
-       $(FLEX) $(LFLAGS) $<
+       $(FLEX) --skeldir $(top_builddir)/data $(LFLAGS) $<
 
 $(testname)$(EXEEXT): $(OBJS)
        $(CC) -o $@ $(LDFLAGS) $(OBJS) $(LOADLIBES)
diff --git a/tests/test-concatenated-options/Makefile.am 
b/tests/test-concatenated-options/Makefile.am
index e392073..fc455f1 100644
--- a/tests/test-concatenated-options/Makefile.am
+++ b/tests/test-concatenated-options/Makefile.am
@@ -30,4 +30,4 @@ CLEANFILES = OUTPUT
 # just that it runs successfully.
 
 test:
-       echo %% | $(FLEX) -cn -o /dev/null
+       echo %% | $(FLEX) --skeldir $(top_builddir)/data -cn -o /dev/null
diff --git a/tests/test-debug-nr/Makefile.am b/tests/test-debug-nr/Makefile.am
index c89f1fd..9325030 100644
--- a/tests/test-debug-nr/Makefile.am
+++ b/tests/test-debug-nr/Makefile.am
@@ -32,7 +32,7 @@ AM_CPPFLAGS = -I$(srcdir) -I$(top_srcdir) -I$(top_builddir)
 testname = test-debug-nr
 
 scanner.c: $(srcdir)/scanner.l
-       $(FLEX) $(LFLAGS) $<
+       $(FLEX) --skeldir $(top_builddir)/data $(LFLAGS) $<
 
 $(testname)$(EXEEXT): $(OBJS)
        $(CC) -o $@ $(LDFLAGS) $(OBJS) $(LOADLIBES)
diff --git a/tests/test-debug-r/Makefile.am b/tests/test-debug-r/Makefile.am
index a63b390..bb75521 100644
--- a/tests/test-debug-r/Makefile.am
+++ b/tests/test-debug-r/Makefile.am
@@ -32,7 +32,7 @@ AM_CPPFLAGS = -I$(srcdir) -I$(top_srcdir) -I$(top_builddir)
 testname = test-debug-r
 
 scanner.c: $(srcdir)/scanner.l
-       $(FLEX) $(LFLAGS) $<
+       $(FLEX) --skeldir $(top_builddir)/data $(LFLAGS) $<
 
 $(testname)$(EXEEXT): $(OBJS)
        $(CC) -o $@ $(LDFLAGS) $(OBJS) $(LOADLIBES)
diff --git a/tests/test-extended/Makefile.am b/tests/test-extended/Makefile.am
index 92841f0..da177d5 100644
--- a/tests/test-extended/Makefile.am
+++ b/tests/test-extended/Makefile.am
@@ -32,7 +32,7 @@ AM_CPPFLAGS = -I$(srcdir) -I$(builddir) -I$(top_srcdir) 
-I$(top_builddir)
 testname = test-extended
 
 scanner.c: $(srcdir)/scanner.l
-       $(FLEX) $(LFLAGS) $<
+       $(FLEX) --skeldir $(top_builddir)/data $(LFLAGS) $<
 
 $(testname)$(EXEEXT): $(OBJS)
        $(CC) -o $@ $(LDFLAGS) $(OBJS) $(LOADLIBES)
diff --git a/tests/test-header-nr/Makefile.am b/tests/test-header-nr/Makefile.am
index 2c12192..df87195 100644
--- a/tests/test-header-nr/Makefile.am
+++ b/tests/test-header-nr/Makefile.am
@@ -35,7 +35,7 @@ AM_CPPFLAGS = -I$(srcdir) -I$(top_srcdir) -I$(top_builddir) 
-I$(builddir)
 testname = test-header-nr
 
 scanner.c: $(srcdir)/scanner.l
-       $(FLEX) $<
+       $(FLEX) --skeldir $(top_builddir)/data $<
 
 parser.c: $(srcdir)/parser.y
        $(BISON) $(YFLAGS) $<
diff --git a/tests/test-header-r/Makefile.am b/tests/test-header-r/Makefile.am
index 106403f..bae1f3b 100644
--- a/tests/test-header-r/Makefile.am
+++ b/tests/test-header-r/Makefile.am
@@ -36,7 +36,7 @@ LFLAGS = --header="scanner.h"
 testname = test-header-r
 
 scanner.c: $(srcdir)/scanner.l
-       $(FLEX) $(LFLAGS) $<
+       $(FLEX) --skeldir $(top_builddir)/data $(LFLAGS) $<
 
 parser.c: $(srcdir)/parser.y
        $(BISON) $(YFLAGS) $<
diff --git a/tests/test-include-by-buffer/Makefile.am 
b/tests/test-include-by-buffer/Makefile.am
index aaaf7f3..2a67125 100644
--- a/tests/test-include-by-buffer/Makefile.am
+++ b/tests/test-include-by-buffer/Makefile.am
@@ -34,7 +34,7 @@ AM_CPPFLAGS = -I$(srcdir) -I$(top_srcdir) -I$(top_builddir)
 testname = test-include-by-buffer
 
 scanner.c: $(srcdir)/scanner.l
-       $(FLEX) $<
+       $(FLEX) --skeldir $(top_builddir)/data $<
 
 parser.c: $(srcdir)/parser.y
        $(BISON) $(YFLAGS) $<
diff --git a/tests/test-include-by-push/Makefile.am 
b/tests/test-include-by-push/Makefile.am
index bef63bc..d8f1ce6 100644
--- a/tests/test-include-by-push/Makefile.am
+++ b/tests/test-include-by-push/Makefile.am
@@ -34,7 +34,7 @@ AM_CPPFLAGS = -I$(srcdir) -I$(top_srcdir) -I$(top_builddir)
 testname = test-include-by-push
 
 scanner.c: $(srcdir)/scanner.l
-       $(FLEX) $<
+       $(FLEX) --skeldir $(top_builddir)/data $<
 
 parser.c: $(srcdir)/parser.y
        $(BISON) $(YFLAGS) $<
diff --git a/tests/test-include-by-reentrant/Makefile.am 
b/tests/test-include-by-reentrant/Makefile.am
index e5a4e63..6606d3b 100644
--- a/tests/test-include-by-reentrant/Makefile.am
+++ b/tests/test-include-by-reentrant/Makefile.am
@@ -34,7 +34,7 @@ AM_CPPFLAGS = -I$(srcdir) -I$(top_srcdir) -I$(top_builddir)
 testname = test-include-by-reentrant
 
 scanner.c: $(srcdir)/scanner.l
-       $(FLEX) $(LFLAGS) $<
+       $(FLEX) --skeldir $(top_builddir)/data $(LFLAGS) $<
 
 parser.c: $(srcdir)/parser.y
        $(BISON) $(YFLAGS) $<
diff --git a/tests/test-linedir-r/Makefile.am b/tests/test-linedir-r/Makefile.am
index c25df06..746328c 100644
--- a/tests/test-linedir-r/Makefile.am
+++ b/tests/test-linedir-r/Makefile.am
@@ -36,7 +36,7 @@ LFLAGS = --header="scanner.h"
 testname = test-linedir-r
 
 scanner.c: $(srcdir)/scanner.l
-       $(FLEX) $(LFLAGS) $<
+       $(FLEX) --skeldir $(top_builddir)/data $(LFLAGS) $<
 
 parser.c: $(srcdir)/parser.y
        $(BISON) $(YFLAGS) $<
diff --git a/tests/test-lineno-nr/Makefile.am b/tests/test-lineno-nr/Makefile.am
index 35b28dc..f009f31 100644
--- a/tests/test-lineno-nr/Makefile.am
+++ b/tests/test-lineno-nr/Makefile.am
@@ -31,7 +31,7 @@ AM_CPPFLAGS = -I$(srcdir) -I$(top_srcdir) -I$(top_builddir)
 testname = test-lineno-nr
 
 scanner.c: $(srcdir)/scanner.l
-       $(FLEX) $(LFLAGS) $<
+       $(FLEX) --skeldir $(top_builddir)/data $(LFLAGS) $<
 
 
 $(testname)$(EXEEXT): $(OBJS)
diff --git a/tests/test-lineno-r/Makefile.am b/tests/test-lineno-r/Makefile.am
index 3ee4980..77b4b67 100644
--- a/tests/test-lineno-r/Makefile.am
+++ b/tests/test-lineno-r/Makefile.am
@@ -31,7 +31,7 @@ AM_CPPFLAGS = -I$(srcdir) -I$(top_srcdir) -I$(top_builddir)
 testname = test-lineno-r
 
 scanner.c: $(srcdir)/scanner.l
-       $(FLEX) $(LFLAGS) $<
+       $(FLEX) --skeldir $(top_builddir)/data $(LFLAGS) $<
 
 
 $(testname)$(EXEEXT): $(OBJS)
diff --git a/tests/test-mem-nr/Makefile.am b/tests/test-mem-nr/Makefile.am
index 5d1f87d..7327d4c 100644
--- a/tests/test-mem-nr/Makefile.am
+++ b/tests/test-mem-nr/Makefile.am
@@ -32,7 +32,7 @@ AM_CPPFLAGS = -I$(srcdir) -I$(top_srcdir) -I$(top_builddir)
 testname = test-mem-nr
 
 scanner.c: $(srcdir)/scanner.l
-       $(FLEX) $(LFLAGS) $<
+       $(FLEX) --skeldir $(top_builddir)/data $(LFLAGS) $<
 
 $(testname)$(EXEEXT): $(OBJS)
        $(CC) -o $@ $(LDFLAGS) $(OBJS) $(LOADLIBES)
diff --git a/tests/test-mem-r/Makefile.am b/tests/test-mem-r/Makefile.am
index 91d55fd..7e04a01 100644
--- a/tests/test-mem-r/Makefile.am
+++ b/tests/test-mem-r/Makefile.am
@@ -32,7 +32,7 @@ AM_CPPFLAGS = -I$(srcdir) -I$(top_srcdir) -I$(top_builddir)
 testname = test-mem-r
 
 scanner.c: $(srcdir)/scanner.l
-       $(FLEX) $(LFLAGS) $<
+       $(FLEX) --skeldir $(top_builddir)/data $(LFLAGS) $<
 
 $(testname)$(EXEEXT): $(OBJS)
        $(CC) -o $@ $(LDFLAGS) $(OBJS) $(LOADLIBES)
diff --git a/tests/test-multiple-scanners-nr/Makefile.am 
b/tests/test-multiple-scanners-nr/Makefile.am
index 6299d6a..fa1106d 100644
--- a/tests/test-multiple-scanners-nr/Makefile.am
+++ b/tests/test-multiple-scanners-nr/Makefile.am
@@ -35,10 +35,10 @@ AM_CPPFLAGS = -I$(srcdir) -I$(top_srcdir) -I$(top_builddir) 
-I$(builddir)
 testname = test-multiple-scanners-nr
 
 scanner-1.c: $(srcdir)/scanner-1.l
-       $(FLEX) $(LFLAGS) --header=scanner-1.h $<
+       $(FLEX) --skeldir $(top_builddir)/data $(LFLAGS) --header=scanner-1.h $<
 
 scanner-2.c: $(srcdir)/scanner-2.l
-       $(FLEX) $(LFLAGS) --header=scanner-2.h $<
+       $(FLEX) --skeldir $(top_builddir)/data $(LFLAGS) --header=scanner-2.h $<
 
 $(testname)$(EXEEXT): $(OBJS)
        $(CC) -o $@ $(LDFLAGS) $(OBJS) $(LOADLIBES)
diff --git a/tests/test-multiple-scanners-r/Makefile.am 
b/tests/test-multiple-scanners-r/Makefile.am
index e2e777e..ef94cbc 100644
--- a/tests/test-multiple-scanners-r/Makefile.am
+++ b/tests/test-multiple-scanners-r/Makefile.am
@@ -37,10 +37,10 @@ AM_CPPFLAGS = -I$(srcdir) -I$(top_srcdir) -I$(top_builddir) 
-I$(builddir)
 testname = test-multiple-scanners-r
 
 scanner-1.c: $(srcdir)/scanner-1.l
-       $(FLEX) $(LFLAGS) --header=scanner-1.h $<
+       $(FLEX) --skeldir $(top_builddir)/data $(LFLAGS) --header=scanner-1.h $<
 
 scanner-2.c: $(srcdir)/scanner-2.l
-       $(FLEX) $(LFLAGS) --header=scanner-2.h $<
+       $(FLEX) --skeldir $(top_builddir)/data $(LFLAGS) --header=scanner-2.h $<
 
 $(testname)$(EXEEXT): $(OBJS)
        $(CC) -o $@ $(LDFLAGS) $(OBJS) $(LOADLIBES)
diff --git a/tests/test-noansi-nr/Makefile.am b/tests/test-noansi-nr/Makefile.am
index 39ee4a2..835d431 100644
--- a/tests/test-noansi-nr/Makefile.am
+++ b/tests/test-noansi-nr/Makefile.am
@@ -33,7 +33,7 @@ AM_CPPFLAGS = -I$(srcdir) -I$(top_srcdir) -I$(top_builddir)
 testname = test-noansi-nr
 
 scanner.c: $(srcdir)/scanner.l
-       $(FLEX) $<
+       $(FLEX) --skeldir $(top_builddir)/data $<
 
 parser.c: $(srcdir)/parser.y
        $(BISON) $(YFLAGS) $<
diff --git a/tests/test-noansi-r/Makefile.am b/tests/test-noansi-r/Makefile.am
index 9e44f4a..d9a0e59 100644
--- a/tests/test-noansi-r/Makefile.am
+++ b/tests/test-noansi-r/Makefile.am
@@ -33,7 +33,7 @@ AM_CPPFLAGS = -I$(srcdir) -I$(top_srcdir) -I$(top_builddir)
 testname = test-noansi-r
 
 scanner.c: $(srcdir)/scanner.l
-       $(FLEX) $<
+       $(FLEX) --skeldir $(top_builddir)/data $<
 
 parser.c: $(srcdir)/parser.y
        $(BISON) $(YFLAGS) $<
diff --git a/tests/test-posix/Makefile.am b/tests/test-posix/Makefile.am
index ef12c04..0bbddad 100644
--- a/tests/test-posix/Makefile.am
+++ b/tests/test-posix/Makefile.am
@@ -33,7 +33,7 @@ AM_CPPFLAGS = -I$(srcdir) -I$(top_srcdir) -I$(top_builddir)
 testname = test-posix
 
 scanner.c: $(srcdir)/scanner.l
-       $(FLEX) $(LFLAGS) $<
+       $(FLEX) --skeldir $(top_builddir)/data $(LFLAGS) $<
 
 $(testname)$(EXEEXT): $(OBJS)
        $(CC) -o $@ $(LDFLAGS) $(OBJS) $(LOADLIBES)
diff --git a/tests/test-posixly-correct/Makefile.am 
b/tests/test-posixly-correct/Makefile.am
index d8f4cce..c31a24b 100644
--- a/tests/test-posixly-correct/Makefile.am
+++ b/tests/test-posixly-correct/Makefile.am
@@ -33,7 +33,7 @@ AM_CPPFLAGS = -I$(srcdir) -I$(top_srcdir) -I$(top_builddir)
 testname = test-posixly-correct
 
 scanner.c: $(srcdir)/scanner.l
-       POSIXLY_CORRECT=1 $(FLEX) $(LFLAGS) $<
+       POSIXLY_CORRECT=1 $(FLEX) --skeldir $(top_builddir)/data $(LFLAGS) $<
 
 $(testname)$(EXEEXT): $(OBJS)
        $(CC) -o $@ $(LDFLAGS) $(OBJS) $(LOADLIBES)
diff --git a/tests/test-prefix-nr/Makefile.am b/tests/test-prefix-nr/Makefile.am
index 8b2d467..36301e6 100644
--- a/tests/test-prefix-nr/Makefile.am
+++ b/tests/test-prefix-nr/Makefile.am
@@ -34,7 +34,7 @@ AM_CPPFLAGS = -I$(srcdir) -I$(top_srcdir) -I$(top_builddir)
 testname = test-prefix-nr
 
 scanner.c: $(srcdir)/scanner.l
-       $(FLEX) $(LFLAGS) $<
+       $(FLEX) --skeldir $(top_builddir)/data $(LFLAGS) $<
 
 parser.c: $(srcdir)/parser.y
        $(BISON) $(YFLAGS) $<
diff --git a/tests/test-prefix-r/Makefile.am b/tests/test-prefix-r/Makefile.am
index 7e08ef6..9b8b611 100644
--- a/tests/test-prefix-r/Makefile.am
+++ b/tests/test-prefix-r/Makefile.am
@@ -34,7 +34,7 @@ AM_CPPFLAGS = -I$(srcdir) -I$(top_srcdir) -I$(top_builddir)
 testname = test-prefix-r
 
 scanner.c: $(srcdir)/scanner.l
-       $(FLEX) $(LFLAGS) $<
+       $(FLEX) --skeldir $(top_builddir)/data $(LFLAGS) $<
 
 parser.c: $(srcdir)/parser.y
        $(BISON) $(YFLAGS) $<
diff --git a/tests/test-pthread/Makefile.am b/tests/test-pthread/Makefile.am
index 87474f7..01dc50e 100644
--- a/tests/test-pthread/Makefile.am
+++ b/tests/test-pthread/Makefile.am
@@ -34,7 +34,7 @@ LIBS = -lpthread
 testname = test-pthread
 
 scanner.c: $(srcdir)/scanner.l
-       $(FLEX) $(LFLAGS) $<
+       $(FLEX) --skeldir $(top_builddir)/data $(LFLAGS) $<
 
 $(testname)$(EXEEXT): $(OBJS)
        $(CC) -o $@ $(LDFLAGS) $(OBJS) $(LIBS) $(LOADLIBES)
diff --git a/tests/test-quotes/Makefile.am b/tests/test-quotes/Makefile.am
index f726b7e..e1b7812 100644
--- a/tests/test-quotes/Makefile.am
+++ b/tests/test-quotes/Makefile.am
@@ -32,7 +32,7 @@ AM_CPPFLAGS = -I$(srcdir) -I$(builddir) -I$(top_srcdir) 
-I$(top_builddir)
 testname = test-quotes
 
 scanner.c: $(srcdir)/scanner.l
-       $(FLEX) $(LFLAGS) $<
+       $(FLEX) --skeldir $(top_builddir)/data $(LFLAGS) $<
 
 $(testname)$(EXEEXT): $(OBJS)
        $(CC) -o $@ $(LDFLAGS) $(OBJS) $(LOADLIBES)
diff --git a/tests/test-reject/Makefile.am b/tests/test-reject/Makefile.am
index 64de331..bbccb07 100644
--- a/tests/test-reject/Makefile.am
+++ b/tests/test-reject/Makefile.am
@@ -34,16 +34,16 @@ tests = test-reject-nr$(EXEEXT) test-reject-r$(EXEEXT) \
 testname = test-reject
 
 test-reject-nr.c: $(srcdir)/scanner.l
-       $(FLEX) -o $@ $(LFLAGS) $<
+       $(FLEX) --skeldir $(top_builddir)/data -o $@ $(LFLAGS) $<
 
 test-reject-ver.c: $(srcdir)/scanner.l
-       $(FLEX) -o $@  --tables-verify --tables-file=`basename $@ .c`.tables 
$(LFLAGS) $<
+       $(FLEX) --skeldir $(top_builddir)/data -o $@  --tables-verify 
--tables-file=`basename $@ .c`.tables $(LFLAGS) $<
 
 test-reject-ser.c: $(srcdir)/scanner.l
-       $(FLEX) -o $@ --tables-file=`basename $@ .c`.tables $(LFLAGS) $<
+       $(FLEX) --skeldir $(top_builddir)/data -o $@ --tables-file=`basename $@ 
.c`.tables $(LFLAGS) $<
 
 test-reject-r.c: $(srcdir)/scanner.l
-       $(FLEX) --reentrant -o $@ $(LFLAGS) $<
+       $(FLEX) --skeldir $(top_builddir)/data --reentrant -o $@ $(LFLAGS) $<
 
 test-reject-nr$(EXEEXT): test-reject-nr.o
        $(CC) -o $@ $(LDFLAGS) $< $(LOADLIBES)
diff --git a/tests/test-rescan-nr/Makefile.am b/tests/test-rescan-nr/Makefile.am
index 5e3b88e..330aedc 100644
--- a/tests/test-rescan-nr/Makefile.am
+++ b/tests/test-rescan-nr/Makefile.am
@@ -35,7 +35,7 @@ AM_CPPFLAGS = -I$(srcdir) -I$(builddir) -I$(top_srcdir) 
-I$(top_builddir)
 testname = test-rescan-nr
 
 scanner.c: $(srcdir)/scanner.l
-       $(FLEX) $(LFLAGS) $<
+       $(FLEX) --skeldir $(top_builddir)/data $(LFLAGS) $<
 
 $(testname)$(EXEEXT): $(OBJS)
        $(CC) -o $@ $(LDFLAGS) $(OBJS) $(LOADLIBES)
diff --git a/tests/test-rescan-r/Makefile.am b/tests/test-rescan-r/Makefile.am
index 2108512..52b178e 100644
--- a/tests/test-rescan-r/Makefile.am
+++ b/tests/test-rescan-r/Makefile.am
@@ -35,7 +35,7 @@ AM_CPPFLAGS = -I$(srcdir) -I$(builddir) -I$(top_srcdir) 
-I$(top_builddir)
 testname = test-rescan-r
 
 scanner.c: $(srcdir)/scanner.l
-       $(FLEX) $(LFLAGS) $<
+       $(FLEX) --skeldir $(top_builddir)/data $(LFLAGS) $<
 
 $(testname)$(EXEEXT): $(OBJS)
        $(CC) -o $@ $(LDFLAGS) $(OBJS) $(LOADLIBES)
diff --git a/tests/test-string-nr/Makefile.am b/tests/test-string-nr/Makefile.am
index dbf8e0f..7ce70c6 100644
--- a/tests/test-string-nr/Makefile.am
+++ b/tests/test-string-nr/Makefile.am
@@ -34,7 +34,7 @@ AM_CPPFLAGS = -I$(srcdir) -I$(top_srcdir) -I$(top_builddir)
 testname = test-string-nr
 
 scanner.c: $(srcdir)/scanner.l
-       $(FLEX) $(LFLAGS) $<
+       $(FLEX) --skeldir $(top_builddir)/data $(LFLAGS) $<
 
 $(testname)$(EXEEXT): $(OBJS)
        $(CC) -o $@ $(LDFLAGS) $(OBJS) $(LOADLIBES)
diff --git a/tests/test-string-r/Makefile.am b/tests/test-string-r/Makefile.am
index 2c93007..086f40e 100644
--- a/tests/test-string-r/Makefile.am
+++ b/tests/test-string-r/Makefile.am
@@ -34,7 +34,7 @@ AM_CPPFLAGS = -I$(srcdir) -I$(top_srcdir) -I$(top_builddir)
 testname = test-string-r
 
 scanner.c: $(srcdir)/scanner.l
-       $(FLEX) $(LFLAGS) $<
+       $(FLEX) --skeldir $(top_builddir)/data $(LFLAGS) $<
 
 $(testname)$(EXEEXT): $(OBJS)
        $(CC) -o $@ $(LDFLAGS) $(OBJS) $(LOADLIBES)
diff --git a/tests/test-table-opts/Makefile.am 
b/tests/test-table-opts/Makefile.am
index a52f617..4ceaf6c 100644
--- a/tests/test-table-opts/Makefile.am
+++ b/tests/test-table-opts/Makefile.am
@@ -69,22 +69,22 @@ AM_CPPFLAGS = -I$(srcdir) -I$(top_srcdir) -I$(top_builddir)
 test: test-opt test-ser test-ver test-mul
 
 test-opt-r%.c: $(srcdir)/scanner.l
-       $(FLEX) -L -P $(subst -,_,$(basename $(@F))) --reentrant $*  -o $@ $<
+       $(FLEX) --skeldir $(top_builddir)/data -L -P $(subst -,_,$(basename 
$(@F))) --reentrant $*  -o $@ $<
 
 test-opt-nr%.c: $(srcdir)/scanner.l
-       $(FLEX) -L -P $(subst -,_,$(basename $(@F))) $* -o $@ $<
+       $(FLEX) --skeldir $(top_builddir)/data -L -P $(subst -,_,$(basename 
$(@F))) $* -o $@ $<
 
 test-ser-r%.c: $(srcdir)/scanner.l
-       $(FLEX) -L -P $(subst -,_,$(basename $(@F))) -R 
--tables-file="test-ser-r$*.tables" $*  -o $@ $<
+       $(FLEX) --skeldir $(top_builddir)/data -L -P $(subst -,_,$(basename 
$(@F))) -R --tables-file="test-ser-r$*.tables" $*  -o $@ $<
 
 test-ser-nr%.c: $(srcdir)/scanner.l
-       $(FLEX) -L -P $(subst -,_,$(basename $(@F))) 
--tables-file="test-ser-nr$*.tables"  $* -o $@ $<
+       $(FLEX) --skeldir $(top_builddir)/data -L -P $(subst -,_,$(basename 
$(@F))) --tables-file="test-ser-nr$*.tables"  $* -o $@ $<
 
 test-ver-r%.c: $(srcdir)/scanner.l
-       $(FLEX) -L -P $(subst -,_,$(basename $(@F))) -R 
--tables-file="test-ver-r$*.tables" --tables-verify $*  -o $@ $<
+       $(FLEX) --skeldir $(top_builddir)/data -L -P $(subst -,_,$(basename 
$(@F))) -R --tables-file="test-ver-r$*.tables" --tables-verify $*  -o $@ $<
 
 test-ver-nr%.c: $(srcdir)/scanner.l
-       $(FLEX) -L -P $(subst -,_,$(basename $(@F))) 
--tables-file="test-ver-nr$*.tables" --tables-verify $* -o $@ $<
+       $(FLEX) --skeldir $(top_builddir)/data -L -P $(subst -,_,$(basename 
$(@F))) --tables-file="test-ver-nr$*.tables" --tables-verify $* -o $@ $<
 
 test-opt%$(EXEEXT): test-opt%.o
        $(CC) -o $@ $(LDFLAGS) $< $(LOADLIBES)
diff --git a/tests/test-top/Makefile.am b/tests/test-top/Makefile.am
index f855545..c71288b 100644
--- a/tests/test-top/Makefile.am
+++ b/tests/test-top/Makefile.am
@@ -36,7 +36,7 @@ LFLAGS = --header="scanner.h"
 testname = test-top
 
 scanner.c: $(srcdir)/scanner.l
-       $(FLEX) $(LFLAGS) $<
+       $(FLEX) --skeldir $(top_builddir)/data $(LFLAGS) $<
 
 parser.c: $(srcdir)/parser.y
        $(BISON) $(YFLAGS) $<
diff --git a/tests/test-yyextra/Makefile.am b/tests/test-yyextra/Makefile.am
index 96ec982..ed6751d 100644
--- a/tests/test-yyextra/Makefile.am
+++ b/tests/test-yyextra/Makefile.am
@@ -34,7 +34,7 @@ AM_CPPFLAGS = -I$(srcdir) -I$(top_srcdir) -I$(top_builddir)
 testname = test-yyextra
 
 scanner.c: $(srcdir)/scanner.l
-       $(FLEX) $(LFLAGS) $<
+       $(FLEX) --skeldir $(top_builddir)/data $(LFLAGS) $<
 
 parser.c: $(srcdir)/parser.y
        $(BISON) $(YFLAGS) $<

reply via email to

[Prev in Thread] Current Thread [Next in Thread]