Index: ChangeLog
from Akim Demaille <[EMAIL PROTECTED]>
foo.yy should generate foo.cc and foo.hh, not foo.h.
* automake.in (output_yacc_build_rule): Don't pretend to use a
third argument.
Transform the generated header's suffix as you do for the
generated parser file.
(output_lex_build_rule): Register the `$c_suffix'.
* automake.texi (Yacc and Lex): Document.
Index: automake.in
===================================================================
RCS file: /cvs/automake/automake/automake.in,v
retrieving revision 1.782
diff -u -w -r1.782 automake.in
--- automake.in 2000/04/05 20:55:48 1.782
+++ automake.in 2000/04/20 14:06:52
@@ -1049,27 +1049,32 @@
# compiled with C or C++, depending on the extension of the YACC file.
sub output_yacc_build_rule
{
- local ($yacc_suffix, $use_ylwrap, $c_suffix) = @_;
+ local ($yacc_suffix, $use_ylwrap) = @_;
- local ($suffix);
- ($suffix = $yacc_suffix) =~ tr/y/c/;
- push (@suffixes, $yacc_suffix, $suffix);
+ local ($c_suffix, $h_suffix);
+ ($c_suffix = $yacc_suffix) =~ tr/y/c/;
+ ($h_suffix = $yacc_suffix) =~ tr/y/h/;
+ push (@suffixes, $yacc_suffix, $c_suffix, $h_suffix);
# Generate rule for c/c++.
- $output_rules .= "$yacc_suffix$suffix:\n\t";
+ $output_rules .= "$yacc_suffix$c_suffix:\n\t";
if ($use_ylwrap)
{
$output_rules .= ('$(SHELL) $(YLWRAP)'
- . ' "$(YACC)" $< y.tab.c $*' . $suffix
- . ' y.tab.h $*.h -- $(AM_YFLAGS) $(YFLAGS)');
+ . ' "$(YACC)" $< y.tab.c $*' . $c_suffix
+ . ' y.tab.h $*.' . $h_suffix
+ . ' -- $(AM_YFLAGS) $(YFLAGS)');
}
else
{
$output_rules .= ('$(YACC) $(AM_YFLAGS) $(YFLAGS) $< && mv y.tab.c $*'
- . $suffix . "\n"
+ . $c_suffix . "\n"
. "\tif test -f y.tab.h; then \\\n"
- . "\tif cmp -s y.tab.h \$*.h; then rm -f y.tab.h; else mv
y.tab.h \$*.h; fi; \\\n"
+ . "\tif cmp -s y.tab.h \$*" . $h_suffix . " then "
+ . "rm -f y.tab.h; "
+ . "else "
+ . "mv y.tab.h \$*.". $h_suffix . "; fi; \\\n"
. "\telse :; fi");
}
$output_rules .= "\n";
@@ -1078,10 +1083,10 @@
sub output_lex_build_rule
{
local ($lex_suffix, $use_ylwrap) = @_;
- local ($c_suffix);
+ local ($c_suffix);
($c_suffix = $lex_suffix) =~ tr/l/c/;
- push (@suffixes, $lex_suffix);
+ push (@suffixes, $lex_suffix, $c_suffix);
&define_configure_variable ('LEX_OUTPUT_ROOT');
&define_configure_variable ('LEXLIB');
$output_rules .= "$lex_suffix$c_suffix:\n\t";
Index: automake.texi
===================================================================
RCS file: /cvs/automake/automake/automake.texi,v
retrieving revision 1.180
diff -u -w -r1.180 automake.texi
--- automake.texi 2000/03/23 05:15:47 1.180
+++ automake.texi 2000/04/20 14:08:39
@@ -52,7 +52,7 @@
@page
@vskip 0pt plus 1filll
-Copyright @copyright{} 1995, 96 Free Software Foundation, Inc.
+Copyright @copyright{} 1995, 96, 2000 Free Software Foundation, Inc.
@sp 2
This is the first edition of the GNU Automake documentation,@*
and is consistent with GNU Automake @value{VERSION}.@*
@@ -1792,7 +1792,8 @@
of the resulting @samp{C} or @samp{C++} file. Files with the extension
@samp{.y} will be turned into @samp{.c} files; likewise, @samp{.yy} will
become @samp{.cc}; @samp{.y++}, @samp{c++}; and @samp{.yxx},
-@samp{.cxx}.
+@samp{.cxx}. If headers are generated, the same transformation applies
+(@samp{.yy} will become @samp{.hh} etc.).
Likewise, lex source files can be used to generate @samp{C} or
@samp{C++}; the extensions @samp{.l}, @samp{.ll}, @samp{.l++}, and
@@ -1806,11 +1807,16 @@
included in any distribution that is made. That way the user doesn't
need to have @code{yacc} or @code{lex}.
+@vindex YFLAGS
+@vindex LFLAGS
+
If a @code{yacc} source file is seen, then your @file{configure.in} must
define the variable @samp{YACC}. This is most easily done by invoking
the macro @samp{AC_PROG_YACC} (@pxref{Particular Programs, , Particular
-Program Checks, autoconf, The Autoconf Manual}).
+Program Checks, autoconf, The Autoconf Manual}). You may use
+@samp{YFLAGS} to pass additional flags to @code{yacc}.
+
Similarly, if a @code{lex} source file is seen, then your
@file{configure.in} must define the variable @samp{LEX}. You can use
@samp{AC_PROG_LEX} to do this (@pxref{Particular Programs, , Particular
@@ -1818,7 +1824,9 @@
support also requires that you use the @samp{AC_DECL_YYTEXT}
macro---automake needs to know the value of @samp{LEX_OUTPUT_ROOT}.
This is all handled for you if you use the @code{AM_PROG_LEX} macro
-(@pxref{Macros}).
+(@pxref{Macros}). You may use @samp{LFLAGS} to pass additional flags to
+@code{lex}.
+
@cindex ylwrap
@cindex yacc, multiple parsers