>>>>> "Tom" == Tom Tromey <[EMAIL PROTECTED]> writes: Akim> I suppose it is now a matter of religion Tom> Yeah, basically. OK, so I've extracted the atheist part of my patch, maybe it's useful? Akim
Index: ChangeLog =================================================================== RCS file: /cvs/automake/automake/ChangeLog,v retrieving revision 1.864 diff -u -r1.864 ChangeLog --- ChangeLog 2000/04/15 09:13:49 1.864 +++ ChangeLog 2000/04/21 08:28:50 @@ -1,3 +1,10 @@ +2000-04-21 Akim Demaille <[EMAIL PROTECTED]> + + * automake.in (output_yacc_build_rule, output_lex_build_rule): Be + more alike. + * automake.texi (Yacc and Lex): Give details on the Yacc generated + headers, and on YFLAGS and LFLAGS. + 2000-04-13 Akim Demaille <[EMAIL PROTECTED]> * compile: Remove unnecessary double quotes in assignments. Index: automake.in =================================================================== RCS file: /cvs/automake/automake/automake.in,v retrieving revision 1.783 diff -u -r1.783 automake.in --- automake.in 2000/04/15 08:30:14 1.783 +++ automake.in 2000/04/21 08:31:56 @@ -1049,25 +1049,25 @@ # 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 ($c_suffix); - local ($suffix); - ($suffix = $yacc_suffix) =~ tr/y/c/; - push (@suffixes, $yacc_suffix, $suffix); + ($c_suffix = $yacc_suffix) =~ tr/y/c/; + push (@suffixes, $yacc_suffix, $c_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 + . ' "$(YACC)" $< y.tab.c $*' . $c_suffix . ' y.tab.h $*.h -- $(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" . "\telse :; fi"); @@ -1081,7 +1081,7 @@ 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 -r1.180 automake.texi --- automake.texi 2000/03/23 05:15:47 1.180 +++ automake.texi 2000/04/21 08:32:11 @@ -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}.@* @@ -131,8 +131,8 @@ * Extending:: Extending Automake * Distributing:: Distributing the Makefile.in * Future:: Some ideas for the future -* Macro and Variable Index:: -* General Index:: +* Macro and Variable Index:: +* General Index:: @end menu @end ifinfo @@ -680,7 +680,7 @@ @example bin_PROGRAMS = hello -hello_SOURCES = hello.c version.c getopt.c getopt1.c getopt.h system.h +hello_SOURCES = hello.c version.c getopt.c getopt1.c getopt.h system.h hello_LDADD = @@INTLLIBS@@ @@ALLOCA@@ localedir = $(datadir)/locale INCLUDES = -I../intl -DLOCALEDIR=\"$(localedir)\" @@ -1452,10 +1452,10 @@ * A Shared Library:: Building a Libtool library * Program variables:: Variables used when building a program * Yacc and Lex:: Yacc and Lex support -* C++ Support:: -* Fortran 77 Support:: +* C++ Support:: +* Fortran 77 Support:: * Java Support:: -* Support for Other Languages:: +* Support for Other Languages:: * ANSI:: Automatic de-ANSI-fication * Dependencies:: Automatic dependency tracking @end menu @@ -1488,7 +1488,7 @@ into an executable: @example -hello_SOURCES = hello.c version.c getopt.c getopt1.c getopt.h system.h +hello_SOURCES = hello.c version.c getopt.c getopt1.c getopt.h system.h @end example This causes each mentioned @samp{.c} file to be compiled into the @@ -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}. Please note that the extension of the generated headers +will always be @samp{.h}. 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 @@ -1851,13 +1859,13 @@ #define yylval c_lval #define yychar c_char #define yydebug c_debug -#define yypact c_pact -#define yyr1 c_r1 -#define yyr2 c_r2 -#define yydef c_def -#define yychk c_chk -#define yypgo c_pgo -#define yyact c_act +#define yypact c_pact +#define yyr1 c_r1 +#define yyr2 c_r2 +#define yydef c_def +#define yychk c_chk +#define yypgo c_pgo +#define yyact c_act #define yyexca c_exca #define yyerrflag c_errflag #define yynerrs c_nerrs @@ -1974,10 +1982,10 @@ These issues are covered in the following sections. @menu -* Preprocessing Fortran 77:: -* Compiling Fortran 77 Files:: -* Mixing Fortran 77 With C and C++:: -* Fortran 77 and Autoconf:: +* Preprocessing Fortran 77:: +* Compiling Fortran 77 Files:: +* Mixing Fortran 77 With C and C++:: +* Fortran 77 and Autoconf:: @end menu @@ -2103,7 +2111,7 @@ @page @menu -* How the Linker is Chosen:: +* How the Linker is Chosen:: @end menu @node How the Linker is Chosen, , Mixing Fortran 77 With C and C++, Mixing Fortran 77 With C and C++