Enough with the unreadable yacc.am and lex.am, and all those bugs that showed the inline rules not to be in sync with ylwrap. Also, always using ylwrap will make it easier to adapt to the new parsers of bison.
2006-08-19 Alexandre Duret-Lutz <[EMAIL PROTECTED]> * lib/am/lex.am, lib/am/yacc.am: Drop the inline rules, always use ylwrap. Suggested by Akim Demaille long ago, to ease maintenance. * automake.in (handle_languages): Do not define MORE-THAN-ONE. (yacc_lex_finish_helper, lang_yacc_finish, lang_lex_finish): Always require ylwrap. * doc/automake.texi (Auxiliary Programs, Yacc and Lex): Update the documentation of ylwrap. * tests/lex.test, tests/lex4.test, tests/mmodely.test, tests/yacc.test, tests/yacc2.test, tests/yacc3.test, tests/yaccpp.test: Adjust. Index: NEWS =================================================================== RCS file: /cvs/automake/automake/NEWS,v retrieving revision 1.310 diff -u -r1.310 NEWS --- NEWS 19 Aug 2006 15:55:51 -0000 1.310 +++ NEWS 19 Aug 2006 18:27:28 -0000 @@ -133,6 +133,9 @@ $(MKDIR_P)) but should be considered obsolete. If you are using $(mkdir_p) in some of your rules, please plan to update them to $(MKDIR_P) at some point. + + - ylwrap is now always used for lex and yacc source files, + regardless of whether there is more than one source per-directory. New in 1.9: Index: automake.in =================================================================== RCS file: /cvs/automake/automake/automake.in,v retrieving revision 1.1627 diff -u -r1.1627 automake.in --- automake.in 14 Aug 2006 20:38:39 -0000 1.1627 +++ automake.in 19 Aug 2006 18:27:29 -0000 @@ -1223,8 +1223,6 @@ 'AMDEP' => $AMDEP, 'FASTDEP' => $FASTDEP, '-c' => $lang->compile_flag || '', - 'MORE-THAN-ONE' - => (count_files_for_language ($lang->name) > 1), # These are not used, but they need to be defined # so &transform do not complain. SUBDIROBJ => 0, @@ -5496,10 +5494,7 @@ return if defined $language_scratch{'lex-yacc-done'}; $language_scratch{'lex-yacc-done'} = 1; - # If there is more than one distinct yacc (resp lex) source file - # in a given directory, then the `ylwrap' program is required to - # allow parallel builds to work correctly. FIXME: for now, no - # line number. + # FIXME: for now, no line number. require_conf_file ($configure_ac, FOREIGN, 'ylwrap'); &define_variable ('YLWRAP', "$am_config_aux_dir/ylwrap", INTERNAL); } @@ -5511,8 +5506,7 @@ reject_var 'YACCFLAGS', "`YACCFLAGS' obsolete; use `YFLAGS' instead"; - &yacc_lex_finish_helper - if count_files_for_language ('yacc') > 1; + yacc_lex_finish_helper; } @@ -5521,8 +5515,7 @@ return if defined $language_scratch{'lex-done'}; $language_scratch{'lex-done'} = 1; - &yacc_lex_finish_helper - if count_files_for_language ('lex') > 1; + yacc_lex_finish_helper; } Index: doc/automake.texi =================================================================== RCS file: /cvs/automake/automake/doc/automake.texi,v retrieving revision 1.147 diff -u -r1.147 automake.texi --- doc/automake.texi 19 Aug 2006 16:18:21 -0000 1.147 +++ doc/automake.texi 19 Aug 2006 18:27:31 -0000 @@ -2116,9 +2116,10 @@ @url{http://www.gnu.org/software/texinfo/}. @item ylwrap -This program wraps @command{lex} and @command{yacc} and ensures that, -for instance, multiple @command{yacc} instances can be invoked in a -single directory in parallel. +This program wraps @command{lex} and @command{yacc} to rename their +output files. It also ensures that, for instance, multiple [EMAIL PROTECTED] instances can be invoked in a single directory in +parallel. @end table @@ -5953,26 +5954,21 @@ rebuild rule for distributed Yacc and Lex sources are only used when @code{maintainer-mode} is enabled, or when the files have been erased. - @cindex @command{ylwrap} @cindex @command{yacc}, multiple parsers @cindex Multiple @command{yacc} parsers @cindex Multiple @command{lex} lexers @cindex @command{lex}, multiple lexers - -Automake makes it possible to include multiple @command{yacc} (or [EMAIL PROTECTED]) source files in a single program. When there is more -than one distinct @command{yacc} (or @command{lex}) source file in a -directory, Automake uses a small program called @command{ylwrap} to run [EMAIL PROTECTED] (or @command{lex}) in a subdirectory. This is -necessary because yacc's output file name is fixed, and a parallel -make could conceivably invoke more than one instance of @command{yacc} -simultaneously. The @command{ylwrap} program is distributed with -Automake. It should appear in the directory specified by [EMAIL PROTECTED], or one of its default locations -(@pxref{Input, , Finding `configure' Input, autoconf, The Autoconf -Manual}). +When @command{lex} or @command{yacc} sources are used, @code{automake +-i} automatically installs an auxiliary program called [EMAIL PROTECTED] in your package (@pxref{Auxiliary Programs}). This +program is used by the build rules to rename the output of these +tools, and makes it possible to include multiple @command{yacc} (or [EMAIL PROTECTED]) source files in a single directory. (This is necessary +because yacc's output file name is fixed, and a parallel make could +conceivably invoke more than one instance of @command{yacc} +simultaneously.) For @command{yacc}, simply managing locking is insufficient. The output of @command{yacc} always uses the same symbol names internally, so it isn't Index: lib/am/lex.am =================================================================== RCS file: /cvs/automake/automake/lib/am/lex.am,v retrieving revision 1.13 diff -u -r1.13 lex.am --- lib/am/lex.am 14 May 2005 20:28:53 -0000 1.13 +++ lib/am/lex.am 19 Aug 2006 18:27:31 -0000 @@ -1,5 +1,5 @@ ## automake - create Makefile.in from Makefile.am -## Copyright (C) 2001, 2002, 2003, 2004 Free Software Foundation, Inc. +## Copyright (C) 2001, 2002, 2003, 2004, 2006 Free Software Foundation, Inc. ## This program is free software; you can redistribute it and/or modify ## it under the terms of the GNU General Public License as published by @@ -25,19 +25,7 @@ ?GENERIC?%EXT%%DERIVED-EXT%: ?!GENERIC?%OBJ%: %SOURCE% -if %?MORE-THAN-ONE% ?GENERIC? $(am__skiplex) $(SHELL) $(YLWRAP) %SOURCE% $(LEX_OUTPUT_ROOT).c %OBJ% -- %COMPILE% ?!GENERIC??DIST_SOURCE? $(am__skiplex) \ ## For non-suffix rules, we must emulate a VPATH search on %SOURCE%. ?!GENERIC? $(SHELL) $(YLWRAP) `test -f '%SOURCE%' || echo '$(srcdir)/'`%SOURCE% $(LEX_OUTPUT_ROOT).c %OBJ% -- %COMPILE% -else !%?MORE-THAN-ONE% -?GENERIC? $(am__skiplex) %COMPILE% %SOURCE% -?!GENERIC??DIST_SOURCE? $(am__skiplex) \ -## For non-suffix rules, we must emulate a VPATH search on %SOURCE%. -?!GENERIC? %COMPILE% `test -f %SOURCE% || echo '$(srcdir)/'`%SOURCE% -## Edit out `#line' or `#' directives. -?GENERIC? $(am__skiplex) \ -?!GENERIC??DIST_SOURCE? $(am__skiplex)\ - { sed '/^#/ s|$(LEX_OUTPUT_ROOT)\.c|%OBJ%|' $(LEX_OUTPUT_ROOT).c >%OBJ% && \ - rm -f $(LEX_OUTPUT_ROOT).c; } -endif !%?MORE-THAN-ONE% Index: lib/am/yacc.am =================================================================== RCS file: /cvs/automake/automake/lib/am/yacc.am,v retrieving revision 1.21 diff -u -r1.21 yacc.am --- lib/am/yacc.am 14 May 2005 20:28:53 -0000 1.21 +++ lib/am/yacc.am 19 Aug 2006 18:27:31 -0000 @@ -1,5 +1,5 @@ ## automake - create Makefile.in from Makefile.am -## Copyright (C) 1998, 1999, 2001, 2002, 2003, 2004 +## Copyright (C) 1998, 1999, 2001, 2002, 2003, 2004, 2006 ## Free Software Foundation, Inc. ## This program is free software; you can redistribute it and/or modify @@ -28,7 +28,7 @@ ## Point #4 is because parsers listed in nodist_*_SOURCES are always ## built on the user's side, so it makes no sense to disable them. ## -## Points #1, #2, #3 are solved by unconditionally prefixing the rules +## Points #1, #2, #3 are solved by unconditionally prefixing the rule ## with $(am__skipyacc) defined below only when needed. ## ## Point #4 requires a condition on whether parser.y/parser.c are @@ -43,42 +43,7 @@ ?GENERIC?%EXT%%DERIVED-EXT%: ?!GENERIC?%OBJ%: %SOURCE% -if %?MORE-THAN-ONE% ?GENERIC? $(am__skipyacc) $(SHELL) $(YLWRAP) %SOURCE% y.tab.c %OBJ% y.tab.h %BASE%.h y.output %BASE%.output -- %COMPILE% ?!GENERIC??DIST_SOURCE? $(am__skipyacc) \ ## For non-suffix rules, we must emulate a VPATH search on %SOURCE%. ?!GENERIC? $(SHELL) $(YLWRAP) `test -f '%SOURCE%' || echo '$(srcdir)/'`%SOURCE% y.tab.c %OBJ% y.tab.h %BASE%.h y.output %BASE%.output -- %COMPILE% -else !%?MORE-THAN-ONE% -?GENERIC? $(am__skipyacc) %COMPILE% %SOURCE% -?!GENERIC??DIST_SOURCE? $(am__skipyacc) \ -## For non-suffix rules, we must emulate a VPATH search on %SOURCE%. -?!GENERIC? %COMPILE% `test -f '%SOURCE%' || echo '$(srcdir)/'`%SOURCE% -## Edit out Bison multiple inclusion guards. It may be BISON_Y_TAB_H, -## or Y_TAB_H depending upon the version, that's why the regexp is -## so loose. -?GENERIC? $(am__skipyacc) \ -?!GENERIC??DIST_SOURCE? $(am__skipyacc) \ - if test -f y.tab.h; then \ - to=`echo "%BASE%_H" | sed \ - -e 'y/abcdefghijklmnopqrstuvwxyz/ABCDEFGHIJKLMNOPQRSTUVWXYZ/' \ - -e 's/[^ABCDEFGHIJKLMNOPQRSTUVWXYZ]/_/g'`; \ - sed -e "/^#/!b" -e "s/Y_TAB_H/$$to/g" -e "s|y\.tab\.h|%BASE%.h|" \ - y.tab.h >%BASE%.ht; \ - rm -f y.tab.h; \ - if cmp -s %BASE%.ht %BASE%.h; then \ - rm -f %BASE%.ht ;\ - else \ - mv %BASE%.ht %BASE%.h; \ - fi; \ - fi -?GENERIC? $(am__skipyacc) \ -?!GENERIC??DIST_SOURCE? $(am__skipyacc) \ - if test -f y.output; then \ - mv y.output %BASE%.output; \ - fi -?GENERIC? $(am__skipyacc) \ -?!GENERIC??DIST_SOURCE? $(am__skipyacc) \ -## Edit out `#line' or `#' directives. - { sed '/^#/ s|y\.tab\.c|%OBJ%|' y.tab.c >%OBJ%t && mv %OBJ%t %OBJ% && \ - rm -f y.tab.c; } -endif !%?MORE-THAN-ONE% Index: tests/lex.test =================================================================== RCS file: /cvs/automake/automake/tests/lex.test,v retrieving revision 1.12 diff -u -r1.12 lex.test --- tests/lex.test 14 May 2005 20:28:55 -0000 1.12 +++ tests/lex.test 19 Aug 2006 18:27:31 -0000 @@ -1,5 +1,5 @@ #! /bin/sh -# Copyright (C) 1996, 1998, 2001, 2002 Free Software Foundation, Inc. +# Copyright (C) 1996, 1998, 2001, 2002, 2006 Free Software Foundation, Inc. # # This file is part of GNU Automake. # @@ -20,6 +20,8 @@ . ./defs || exit 1 +set -e + cat >> configure.in << 'END' AC_PROG_CC AM_PROG_LEX @@ -33,17 +35,17 @@ : > joe.l -$ACLOCAL || exit 1 -$AUTOMAKE || exit 1 +$ACLOCAL +$AUTOMAKE -a # Test to make sure that lex source generates correct target. -$FGREP '$(LEX)' Makefile.in || exit 1 +$FGREP '$(LEX)' Makefile.in # Test to make sure that lex source generates correct clean rule. # From Ralf Corsepius. $FGREP joel Makefile.in && exit 1 -exit 0 +: Index: tests/lex4.test =================================================================== RCS file: /cvs/automake/automake/tests/lex4.test,v retrieving revision 1.6 diff -u -r1.6 lex4.test --- tests/lex4.test 14 May 2005 20:28:55 -0000 1.6 +++ tests/lex4.test 19 Aug 2006 18:27:31 -0000 @@ -1,5 +1,5 @@ #! /bin/sh -# Copyright (C) 1999, 2001, 2002 Free Software Foundation, Inc. +# Copyright (C) 1999, 2001, 2002, 2006 Free Software Foundation, Inc. # # This file is part of GNU Automake. # @@ -23,6 +23,8 @@ . ./defs || exit 1 +set -e + cat >> configure.in << 'END' AC_PROG_CC AC_PROG_CXX @@ -36,7 +38,7 @@ : > joe.ll -$ACLOCAL || exit 1 -$AUTOMAKE || exit 1 +$ACLOCAL +$AUTOMAKE -a $FGREP joe.Po Makefile.in Index: tests/mmodely.test =================================================================== RCS file: /cvs/automake/automake/tests/mmodely.test,v retrieving revision 1.4 diff -u -r1.4 mmodely.test --- tests/mmodely.test 24 Mar 2006 18:14:43 -0000 1.4 +++ tests/mmodely.test 19 Aug 2006 18:27:31 -0000 @@ -65,16 +65,19 @@ $ACLOCAL $AUTOCONF -$AUTOMAKE +$AUTOMAKE -a ./configure $MAKE +echo 'echo "$@" >y.tab.c' > myyacc.sh +echo 'echo "$@" >lex.yy.c' > mylex.sh + # make maintainer-clean; ./configure; make should always work, # per GNU Standard. $MAKE maintainer-clean ./configure -YACC='echo>y.tab.c' LEX='echo>lex.yy.c' LEX_OUTPUT_ROOT='lex.yy' \ - $MAKE -e zardoz.c joe.c +YACC="$SHELL `pwd`/myyacc.sh" LEX="$SHELL `pwd`/mylex.sh" \ + LEX_OUTPUT_ROOT='lex.yy' $MAKE -e zardoz.c joe.c grep zardoz.y zardoz.c grep joe.l joe.c Index: tests/yacc.test =================================================================== RCS file: /cvs/automake/automake/tests/yacc.test,v retrieving revision 1.8 diff -u -r1.8 yacc.test --- tests/yacc.test 14 May 2005 20:28:56 -0000 1.8 +++ tests/yacc.test 19 Aug 2006 18:27:31 -0000 @@ -1,5 +1,5 @@ #! /bin/sh -# Copyright (C) 1996, 2001, 2002 Free Software Foundation, Inc. +# Copyright (C) 1996, 2001, 2002, 2006 Free Software Foundation, Inc. # # This file is part of GNU Automake. # @@ -23,6 +23,8 @@ . ./defs || exit 1 +set -e + cat >> configure.in << 'END' AC_PROG_CC AC_PROG_YACC @@ -33,7 +35,7 @@ zardoz_SOURCES = zardoz.y END -$ACLOCAL || exit 1 -$AUTOMAKE || exit 1 +$ACLOCAL +$AUTOMAKE -a grep 'zardoz.c' Makefile.in Index: tests/yacc2.test =================================================================== RCS file: /cvs/automake/automake/tests/yacc2.test,v retrieving revision 1.7 diff -u -r1.7 yacc2.test --- tests/yacc2.test 14 May 2005 20:28:56 -0000 1.7 +++ tests/yacc2.test 19 Aug 2006 18:27:31 -0000 @@ -1,5 +1,5 @@ #! /bin/sh -# Copyright (C) 1999, 2001, 2002, 2003 Free Software Foundation, Inc. +# Copyright (C) 1999, 2001, 2002, 2003, 2006 Free Software Foundation, Inc. # # This file is part of GNU Automake. # @@ -38,11 +38,8 @@ # Don't redefine several times the same variable. cp Makefile.am Makefile.src - - - $ACLOCAL -$AUTOMAKE +$AUTOMAKE -a # If zardoz.h IS mentioned, fail grep 'zardoz.h' Makefile.in > /dev/null && exit 1 Index: tests/yacc3.test =================================================================== RCS file: /cvs/automake/automake/tests/yacc3.test,v retrieving revision 1.8 diff -u -r1.8 yacc3.test --- tests/yacc3.test 14 May 2005 20:28:56 -0000 1.8 +++ tests/yacc3.test 19 Aug 2006 18:27:31 -0000 @@ -1,5 +1,5 @@ #! /bin/sh -# Copyright (C) 1999, 2001, 2002 Free Software Foundation, Inc. +# Copyright (C) 1999, 2001, 2002, 2006 Free Software Foundation, Inc. # # This file is part of GNU Automake. # @@ -23,6 +23,8 @@ . ./defs || exit 1 +set -e + cat >> configure.in << 'END' AC_PROG_CC AC_PROG_YACC @@ -36,8 +38,8 @@ @echo $(DIST_COMMON) END -$ACLOCAL || exit 1 -$AUTOMAKE || exit 1 +$ACLOCAL +$AUTOMAKE -a $FGREP -v @SET_MAKE@ Makefile.in > Makefile.sed # It should not be disted here @@ -50,6 +52,6 @@ cp Save Makefile.am echo "$flag = -d" >> Makefile.am - $AUTOMAKE -Wno-gnu || exit 1 - grep 'zardoz.h' Makefile.in || exit 1 + $AUTOMAKE -Wno-gnu + grep 'zardoz.h' Makefile.in done Index: tests/yaccpp.test =================================================================== RCS file: /cvs/automake/automake/tests/yaccpp.test,v retrieving revision 1.5 diff -u -r1.5 yaccpp.test --- tests/yaccpp.test 14 May 2005 20:28:56 -0000 1.5 +++ tests/yaccpp.test 19 Aug 2006 18:27:31 -0000 @@ -1,5 +1,5 @@ #! /bin/sh -# Copyright (C) 1997, 2001, 2002 Free Software Foundation, Inc. +# Copyright (C) 1997, 2001, 2002, 2006 Free Software Foundation, Inc. # # This file is part of GNU Automake. # @@ -22,6 +22,8 @@ . ./defs || exit 1 +set -e + cat >> configure.in << 'END' AC_PROG_CXX AC_PROG_YACC @@ -32,7 +34,7 @@ zardoz_SOURCES = zardoz.yy END -$ACLOCAL || exit 1 -$AUTOMAKE || exit 1 +$ACLOCAL +$AUTOMAKE -a grep zardoz.cc Makefile.in -- Alexandre Duret-Lutz Shared books are happy books. http://www.bookcrossing.com/friend/gadl