* lib/am/lex.am, lib/am/yacc.am: Drop the inline rules, always use
authorAlexandre Duret-Lutz <adl@gnu.org>
Sat, 19 Aug 2006 18:31:51 +0000 (18:31 +0000)
committerAlexandre Duret-Lutz <adl@gnu.org>
Sat, 19 Aug 2006 18:31:51 +0000 (18:31 +0000)
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.

13 files changed:
ChangeLog
NEWS
automake.in
doc/automake.texi
lib/am/lex.am
lib/am/yacc.am
tests/lex.test
tests/lex4.test
tests/mmodely.test
tests/yacc.test
tests/yacc2.test
tests/yacc3.test
tests/yaccpp.test

index 8c34ee8..d551bce 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,16 @@
 2006-08-19  Alexandre Duret-Lutz  <adl@gnu.org>
 
+       * 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.
+
        * doc/automake.texi (Releases): Update statistics until 1.9.6.
 
        * Makefile.am (maintainer-check): Check for mkdir_p.
diff --git a/NEWS b/NEWS
index 1a74f3f..bd911c1 100644 (file)
--- a/NEWS
+++ b/NEWS
@@ -133,6 +133,9 @@ New in 1.9a:
     $(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.
 \f
 New in 1.9:
 
index 4cbe8f8..1d4d5eb 100755 (executable)
@@ -1223,8 +1223,6 @@ sub handle_languages
                         '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 @@ sub yacc_lex_finish_helper
   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 @@ sub lang_yacc_finish
 
   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 @@ sub lang_lex_finish
   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 870869e..b084c9d 100644 (file)
@@ -2116,9 +2116,10 @@ package.  The latest version can be downloaded from
 @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
+@command{yacc} instances can be invoked in a single directory in
+parallel.
 
 @end table
 
@@ -5953,26 +5954,21 @@ When @code{AM_MAINTAINER_MODE} (@pxref{maintainer-mode}) is used, the
 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
-@command{lex}) 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
-@command{yacc} (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
-@code{AC_CONFIG_AUX_DIR}, 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
+@command{ylwrap} 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
+@command{lex}) 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 38f7abb..12c939e 100644 (file)
@@ -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 @@ endif %?MAINTAINER-MODE%
 
 ?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 1f0d626..0add90b 100644 (file)
@@ -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 @@ endif %?MAINTAINER-MODE%
 
 ?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 118b755..604b57a 100755 (executable)
@@ -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 @@ END
 
 : > 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 45a6744..2fc104b 100755 (executable)
@@ -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 @@ END
 
 : > joe.ll
 
-$ACLOCAL || exit 1
-$AUTOMAKE || exit 1
+$ACLOCAL
+$AUTOMAKE -a
 
 $FGREP joe.Po Makefile.in
index b383e18..3fc43ad 100755 (executable)
@@ -65,16 +65,19 @@ $sleep
 
 $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 bac4827..b070569 100755 (executable)
@@ -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 @@ bin_PROGRAMS = zardoz
 zardoz_SOURCES = zardoz.y
 END
 
-$ACLOCAL || exit 1
-$AUTOMAKE || exit 1
+$ACLOCAL
+$AUTOMAKE -a
 
 grep 'zardoz.c' Makefile.in
index 8a96656..5f142f6 100755 (executable)
@@ -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 @@ END
 # 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 6f30c22..f6b83f5 100755 (executable)
@@ -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 @@ magic:
        @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 @@ for flag in YFLAGS AM_YFLAGS zardoz_YFLAGS; do
    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 df056db..f9ffa36 100755 (executable)
@@ -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 @@ bin_PROGRAMS = zardoz
 zardoz_SOURCES = zardoz.yy
 END
 
-$ACLOCAL || exit 1
-$AUTOMAKE || exit 1
+$ACLOCAL
+$AUTOMAKE -a
 
 grep zardoz.cc Makefile.in