automake-commit
[Top][All Lists]
Advanced

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

[Automake-commit] [SCM] GNU Automake branch, master, updated. v1.11-588-


From: Stefano Lattarini
Subject: [Automake-commit] [SCM] GNU Automake branch, master, updated. v1.11-588-g405477b
Date: Sun, 09 Jan 2011 15:30:05 +0000

This is an automated email from the git hooks/post-receive script. It was
generated because a ref change was pushed to the repository containing
the project "GNU Automake".

http://git.sv.gnu.org/gitweb/?p=automake.git;a=commitdiff;h=405477b5a2ea6d79c30255db14dbb59b84495fb7

The branch, master has been updated
       via  405477b5a2ea6d79c30255db14dbb59b84495fb7 (commit)
       via  3544a43c4923f767467536d02abb511d7e04ab2c (commit)
       via  eb7adcd2b2911e26792000bc89e09894b182f323 (commit)
       via  c5b255bacb70ccb09b923f1a5acb4e6abca88385 (commit)
       via  8c8c974284b0feb9d8f060d12d79d0373bb38dc4 (commit)
      from  4cffe41f88d2cdb9df4b0ec04c15fb4d73d93c8a (commit)

Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.

- Log -----------------------------------------------------------------
commit 405477b5a2ea6d79c30255db14dbb59b84495fb7
Merge: 4cffe41 3544a43
Author: Stefano Lattarini <address@hidden>
Date:   Sun Jan 9 16:20:34 2011 +0100

    Merge branch 'yacc-work'

commit 3544a43c4923f767467536d02abb511d7e04ab2c
Author: Stefano Lattarini <address@hidden>
Date:   Fri Jan 7 21:52:56 2011 +0100

    yacc: support variable expansions in *YFLAGS definition.
    
    This change fixes automake bug#7800.
    
    * automake.in (lang_yacc_target_hook): Use 'value_as_list_recursive'
    instead of 'variable_value' to get the value of *YFLAGS variables.
    Related changes.
    ($DASH_D_PATTERN): Removed.
    * tests/Makefile.am (XFAIL_TESTS): Remove yflags-var-expand.test.
    * tests/yacc-clean.test: Remove workaround for now-fixed bug.
    * NEWS: Update.

commit eb7adcd2b2911e26792000bc89e09894b182f323
Author: Stefano Lattarini <address@hidden>
Date:   Fri Jan 7 20:52:17 2011 +0100

    yacc: more tests on *YFLAGS support
    
    * tests/yflags-var-expand.test: New test, still xfailing.  It
    exposes automake bug#7800 -- "automake fails to honor `-d' in
    AM_YFLAGS when variable expansions are involved".
    * tests/yflags-d-false-positive.test: New test, checking that
    automake do not spuriously see `-d' in *YFLAGS when that isn't
    really there.
    * tests/yflags-force-override.test: New test, checking that
    automake can cope with definition of the YFLAGS variable in
    Makefile.am (even if that is an extremely bad practice, as that
    variable is user-reserved).
    * tests/yflags-cmdline-override.test: New test, checking that
    automake can cope with user-redefinition of YFLAGS at configure
    time and/or at make time.
    * tests/yflags-conditional.test: New test, checks that automake
    warns on conditionally-defined *YFLAGS variables.
    * tests/Makefile.am (TESTS, XFAIL_TESTS): Update.

commit c5b255bacb70ccb09b923f1a5acb4e6abca88385
Author: Stefano Lattarini <address@hidden>
Date:   Wed Jan 5 16:07:56 2011 +0100

    yacc: extend and improve tests
    
    * tests/yacc-basic.test: Also check that the intermediate C file
    is mentioned in the generated Makefile.in, and that it is created
    by the first make invocation.
    * tests/yacc3.test: Test removed, superseded by ...
    * tests/yacc-d-basic.test: ... this new test.
    * tests/yacc2.test: Add reference to that new test in the heading
    comments.
    * tests/yacc-d-vpath.test: New test.
    * tests/yaccvpath.test: Updated heading comments.  Do not require
    gcc anymore, as any working C compiler should be enough.  Remove
    redundant comments.
    * tests/yacc-nodist.test: New test.
    * tests/yacc-dist-nobuild.test: New test.
    * tests/Makefile.am (TESTS): Update.

commit 8c8c974284b0feb9d8f060d12d79d0373bb38dc4
Merge: ed2c8bc d4dcf50
Author: Stefano Lattarini <address@hidden>
Date:   Sat Jan 8 13:33:41 2011 +0100

    Merge commit 'tests-lexyacc-extend' into yacc-works
    
    Extend, fix and improve tests on Lex and Yacc support.

-----------------------------------------------------------------------

Summary of changes:
 ChangeLog                                          |  144 ++++++++++++------
 NEWS                                               |    6 +
 automake.in                                        |   15 +-
 tests/Makefile.am                                  |   10 +-
 tests/Makefile.in                                  |   10 +-
 tests/yacc-basic.test                              |   12 ++-
 tests/yacc-clean.test                              |    5 -
 tests/yacc-d-basic.test                            |  158 ++++++++++++++++++++
 tests/{yaccvpath.test => yacc-d-vpath.test}        |   31 +++--
 tests/{yaccdry.test => yacc-dist-nobuild.test}     |   59 ++++++--
 tests/yacc-nodist.test                             |  101 +++++++++++++
 tests/yacc2.test                                   |    3 +-
 tests/yaccvpath.test                               |   13 +-
 tests/yflags-cmdline-override.test                 |   90 +++++++++++
 tests/{colon.test => yflags-conditional.test}      |   37 ++---
 tests/{yacc.test => yflags-d-false-positives.test} |   21 ++-
 tests/{yaccdry.test => yflags-force-override.test} |   44 +++---
 tests/{yacc3.test => yflags-var-expand.test}       |   53 ++++---
 18 files changed, 643 insertions(+), 169 deletions(-)
 create mode 100755 tests/yacc-d-basic.test
 copy tests/{yaccvpath.test => yacc-d-vpath.test} (74%)
 copy tests/{yaccdry.test => yacc-dist-nobuild.test} (53%)
 create mode 100755 tests/yacc-nodist.test
 create mode 100755 tests/yflags-cmdline-override.test
 copy tests/{colon.test => yflags-conditional.test} (62%)
 copy tests/{yacc.test => yflags-d-false-positives.test} (62%)
 copy tests/{yaccdry.test => yflags-force-override.test} (57%)
 rename tests/{yacc3.test => yflags-var-expand.test} (50%)

diff --git a/ChangeLog b/ChangeLog
index d9104b8..537344d 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,100 @@
+2011-01-08   Stefano Lattarini  <address@hidden>
+
+       yacc: support variable expansions in *YFLAGS definition.
+       This change fixes automake bug#7800.
+       * automake.in (lang_yacc_target_hook): Use 'value_as_list_recursive'
+       instead of 'variable_value' to get the value of *YFLAGS variables.
+       Related changes.
+       ($DASH_D_PATTERN): Removed.
+       * tests/Makefile.am (XFAIL_TESTS): Remove yflags-var-expand.test.
+       * tests/yacc-clean.test: Remove workaround for now-fixed bug.
+       * NEWS: Update.
+
+2011-01-08   Stefano Lattarini  <address@hidden>
+
+       yacc: more tests on *YFLAGS support
+       * tests/yflags-var-expand.test: New test, still xfailing.  It
+       exposes automake bug#7800 -- "automake fails to honor `-d' in
+       AM_YFLAGS when variable expansions are involved".
+       * tests/yflags-d-false-positive.test: New test, checking that
+       automake do not spuriously see `-d' in *YFLAGS when that isn't
+       really there.
+       * tests/yflags-force-override.test: New test, checking that
+       automake can cope with definition of the YFLAGS variable in
+       Makefile.am (even if that is an extremely bad practice, as that
+       variable is user-reserved).
+       * tests/yflags-cmdline-override.test: New test, checking that
+       automake can cope with user-redefinition of YFLAGS at configure
+       time and/or at make time.
+       * tests/yflags-conditional.test: New test, checks that automake
+       warns on conditionally-defined *YFLAGS variables.
+       * tests/Makefile.am (TESTS, XFAIL_TESTS): Update.
+
+2011-01-08   Stefano Lattarini  <address@hidden>
+
+       yacc: extend and improve tests
+       * tests/yacc-basic.test: Also check that the intermediate C file
+       is mentioned in the generated Makefile.in, and that it is created
+       by the first make invocation.
+       * tests/yacc3.test: Test removed, superseded by ...
+       * tests/yacc-d-basic.test: ... this new test.
+       * tests/yacc2.test: Add reference to that new test in the heading
+       comments.
+       * tests/yacc-d-vpath.test: New test.
+       * tests/yaccvpath.test: Updated heading comments.  Do not require
+       gcc anymore, as any working C compiler should be enough.  Remove
+       redundant comments.
+       * tests/yacc-nodist.test: New test.
+       * tests/yacc-dist-nobuild.test: New test.
+       * tests/Makefile.am (TESTS): Update.
+
+2010-12-13  Stefano Lattarini  <address@hidden>
+
+       Extend, fix and improve tests on Lex and Yacc support.
+       * tests/lexcpp.test: New test script, on support for Lex + C++.
+       * tests/lexvpath.test: New test script, test build and rebuild
+       rules for lexers in VPATH setup.
+       * tests/yacc-basic.test: New test script, run simple "semantic"
+       checks on basic Yacc support (similarly to what lex3.test does
+       for Lex support).
+       * tests/lex.test: Don't create useless dummy source file joe.l.
+       Remove extra blank lines.
+       * tests/lex4.test: Add trailing `:' command.  Do not create dummy
+       useless lex source file.
+       * tests/lex2.test: Likewise.  Call automake with the `-a' option,
+       so that it doesn't fail for the absence of `ylwrap' script.  Make
+       grepping of automake stderr stricter.
+       * tests/yacc7.test: Add trailing `:' command.  Enable `errexit'
+       shell flag earlier (just after having sourced ./defs).
+       * tests/yacc4.test: Likewise.  Also ...
+       (configure.in): Use pre-populated skeleton set up by ./defs,
+       instead of writing one from scratch.
+       Other minor cosmetic changes.
+       * tests/yacc5.test: Likewise.
+       * tests/yaccvpath.test: Likewise. Also ...
+       ($distdir): New variable.
+       Use it throughout.
+       * tests/lex5.test: Likewise.
+       * tests/lex3.test: Likewise.  Check the distdir, rather than
+       grepping the distribution tarball.  Extend the test on the
+       created binary, and be sure to avoid hangs.  Add some comments.
+       * tests/yacc.test: Use stricter grepping.  Add trailing `:'.
+       * tests/yacc6.test: Likewise.
+       * tests/yacc3.test: Likewise.  Do not create the unused file
+       `Makefile.sed'.  Remove useless rules from Makefile.am.  Other
+       minor cosmetic changes.
+       * tests/yacc2.test: Make grepping of generated `Makefile.in' and
+       of automake error messages stricter.  Do not redirect output of
+       grep to /dev/null.  Move call to aclocal earlier.  Reduce the
+       number of empty blank lines.  Fix a typo in comments.
+       * tests/yacc8.test: Fixed bugs that reduced the completeness of
+       the tests.  Added trailing `:' command.
+       (configure.in): Use pre-populated skeleton set up by ./defs,
+       instead of writing one from scratch.
+       * tests/yaccpp.test: Test also extensions `.y++', `.ypp', and
+       `.yxx', rather than only `.yy'.
+       * tests/Makefile.am (TESTS): Update.
+
 2011-01-09   Stefano Lattarini  <address@hidden>
 
        cosmetics: remove trailing whitespaces
@@ -335,53 +432,6 @@
        * tests/defs (xsi-shell): Add comment telling to keep the
        XSI-conformance checks in sync with libtool.
 
-2010-12-13  Stefano Lattarini  <address@hidden>
-
-       Extend, fix and improve tests on Lex and Yacc support.
-       * tests/lexcpp.test: New test script, on support for Lex + C++.
-       * tests/lexvpath.test: New test script, test build and rebuild
-       rules for lexers in VPATH setup.
-       * tests/yacc-basic.test: New test script, run simple "semantic"
-       checks on basic Yacc support (similarly to what lex3.test does
-       for Lex support).
-       * tests/lex.test: Don't create useless dummy source file joe.l.
-       Remove extra blank lines.
-       * tests/lex4.test: Add trailing `:' command.  Do not create dummy
-       useless lex source file.
-       * tests/lex2.test: Likewise.  Call automake with the `-a' option,
-       so that it doesn't fail for the absence of `ylwrap' script.  Make
-       grepping of automake stderr stricter.
-       * tests/yacc7.test: Add trailing `:' command.  Enable `errexit'
-       shell flag earlier (just after having sourced ./defs).
-       * tests/yacc4.test: Likewise.  Also ...
-       (configure.in): Use pre-populated skeleton set up by ./defs,
-       instead of writing one from scratch.
-       Other minor cosmetic changes.
-       * tests/yacc5.test: Likewise.
-       * tests/yaccvpath.test: Likewise. Also ...
-       ($distdir): New variable.
-       Use it throughout.
-       * tests/lex5.test: Likewise.
-       * tests/lex3.test: Likewise.  Check the distdir, rather than
-       grepping the distribution tarball.  Extend the test on the
-       created binary, and be sure to avoid hangs.  Add some comments.
-       * tests/yacc.test: Use stricter grepping.  Add trailing `:'.
-       * tests/yacc6.test: Likewise.
-       * tests/yacc3.test: Likewise.  Do not create the unused file
-       `Makefile.sed'.  Remove useless rules from Makefile.am.  Other
-       minor cosmetic changes.
-       * tests/yacc2.test: Make grepping of generated `Makefile.in' and
-       of automake error messages stricter.  Do not redirect output of
-       grep to /dev/null.  Move call to aclocal earlier.  Reduce the
-       number of empty blank lines.  Fix a typo in comments.
-       * tests/yacc8.test: Fixed bugs that reduced the completeness of
-       the tests.  Added trailing `:' command.
-       (configure.in): Use pre-populated skeleton set up by ./defs,
-       instead of writing one from scratch.
-       * tests/yaccpp.test: Test also extensions `.y++', `.ypp', and
-       `.yxx', rather than only `.yy'.
-       * tests/Makefile.am (TESTS): Update.
-
 2010-12-17  Stefano Lattarini  <address@hidden>
 
        Minor cleanups in canon7.test.
diff --git a/NEWS b/NEWS
index e83fd2b..4cda1bc 100644
--- a/NEWS
+++ b/NEWS
@@ -99,6 +99,12 @@ Bugs fixed in 1.11a:
   - The code for automatic dependency tracking works around a Solaris
     make bug triggered by sources containing repeated slashes when the
     `subdir-objects' option was used.
+
+  - Automake now detects the presence of the `-d' flag in the various
+    `*YFLAGS' variables even when their definitions involve indirections
+    through other variables, such as in:
+      foo_opts = -d
+      AM_YFLAGS = $(foo_opts)
 
 New in 1.11:
 
diff --git a/automake.in b/automake.in
index bdbb4f0..3403c96 100644
--- a/automake.in
+++ b/automake.in
@@ -208,8 +208,6 @@ my $INCLUDE_PATTERN = ('^include\s+'
                       . '|(\$\(srcdir\)/' . $PATH_PATTERN . ')'
                       . '|([^/\$]' . $PATH_PATTERN . '))\s*(#.*)?' . "\$");
 
-# Match `-d' as a command-line argument in a string.
-my $DASH_D_PATTERN = "(^|\\s)-d(\\s|\$)";
 # Directories installed during 'install-exec' phase.
 my $EXEC_DIR_PATTERN =
   '^(?:bin|sbin|libexec|sysconf|localstate|lib|pkglib|.*exec.*)' . "\$";
@@ -6100,11 +6098,14 @@ sub lang_yacc_target_hook
 {
     my ($self, $aggregate, $output, $input, %transform) = @_;
 
-    my $flag = $aggregate . "_YFLAGS";
-    my $flagvar = var $flag;
-    my $YFLAGSvar = var 'YFLAGS';
-    if (($flagvar && $flagvar->variable_value =~ /$DASH_D_PATTERN/o)
-       || ($YFLAGSvar && $YFLAGSvar->variable_value =~ /$DASH_D_PATTERN/o))
+    my $flagvar = var ($aggregate . "_YFLAGS");
+    my $YFLAGSvar = var ('YFLAGS');
+    # We cannot work reliably with conditionally-defined YFLAGS.
+    $flagvar->check_defined_unconditionally if $flagvar;
+    $YFLAGSvar->check_defined_unconditionally if $YFLAGSvar;
+    my @flags = $flagvar ? $flagvar->value_as_list_recursive : ();
+    my @YFLAGS = $YFLAGSvar ? $YFLAGSvar->value_as_list_recursive : ();
+    if (grep (/^-d$/, @flags) || grep (/^-d$/, @YFLAGS))
     {
        (my $output_base = $output) =~ s/$KNOWN_EXTENSIONS_PATTERN$//;
        my $header = $output_base . '.h';
diff --git a/tests/Makefile.am b/tests/Makefile.am
index 5ec73d0..56253de 100644
--- a/tests/Makefile.am
+++ b/tests/Makefile.am
@@ -938,20 +938,28 @@ whoami.test \
 xsource.test \
 xz.test \
 yacc-basic.test \
+yacc-d-basic.test \
 yacc-clean.test \
 yacc.test \
 yacc2.test \
-yacc3.test \
 yacc4.test \
 yacc5.test \
 yacc6.test \
 yacc7.test \
 yacc8.test \
 yaccdry.test \
+yacc-dist-nobuild.test \
+yacc-nodist.test \
 yaccpp.test \
 yaccvpath.test \
+yacc-d-vpath.test \
 yflags.test \
 yflags2.test \
+yflags-cmdline-override.test \
+yflags-conditional.test \
+yflags-d-false-positives.test \
+yflags-force-override.test \
+yflags-var-expand.test \
 $(parallel_tests)
 
 EXTRA_DIST += $(TESTS)
diff --git a/tests/Makefile.in b/tests/Makefile.in
index 2b73372..58004e7 100644
--- a/tests/Makefile.in
+++ b/tests/Makefile.in
@@ -1201,20 +1201,28 @@ whoami.test \
 xsource.test \
 xz.test \
 yacc-basic.test \
+yacc-d-basic.test \
 yacc-clean.test \
 yacc.test \
 yacc2.test \
-yacc3.test \
 yacc4.test \
 yacc5.test \
 yacc6.test \
 yacc7.test \
 yacc8.test \
 yaccdry.test \
+yacc-dist-nobuild.test \
+yacc-nodist.test \
 yaccpp.test \
 yaccvpath.test \
+yacc-d-vpath.test \
 yflags.test \
 yflags2.test \
+yflags-cmdline-override.test \
+yflags-conditional.test \
+yflags-d-false-positives.test \
+yflags-force-override.test \
+yflags-var-expand.test \
 $(parallel_tests)
 
 all: all-am
diff --git a/tests/yacc-basic.test b/tests/yacc-basic.test
index af0c488..e8bf27d 100755
--- a/tests/yacc-basic.test
+++ b/tests/yacc-basic.test
@@ -1,5 +1,5 @@
 #! /bin/sh
-# Copyright (C) 2010 Free Software Foundation, Inc.
+# Copyright (C) 2010, 2011 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
@@ -32,6 +32,10 @@ END
 cat > Makefile.am << 'END'
 bin_PROGRAMS = foo
 foo_SOURCES = parse.y foo.c
+
+.PHONY: echo-distcom
+echo-distcom:
+       @echo ' ' $(DIST_COMMON) ' '
 END
 
 cat > parse.y << 'END'
@@ -55,12 +59,18 @@ $AUTOMAKE -a
 
 ./configure
 $MAKE
+# The `parse.c' file must be created and not removed (i.e., not treated
+# like an "intermediate file" in the GNU make sense).
+test -f parse.c
 
 echo a | ./foo
 echo b | ./foo && Exit 1
 
 # The generated file `parse.c' must be shipped.
+$MAKE echo-distcom
+$MAKE -s echo-distcom | grep '[ /]parse.c '
 $MAKE distdir
+ls -l $distdir
 test -f $distdir/parse.c
 
 # Sanity check on distribution.
diff --git a/tests/yacc-clean.test b/tests/yacc-clean.test
index a8df065..d6a3fca 100755
--- a/tests/yacc-clean.test
+++ b/tests/yacc-clean.test
@@ -62,10 +62,6 @@ END
 cat > sub2/Makefile.am << 'END'
 include $(top_srcdir)/sub1/Makefile.am
 AM_YFLAGS = -d
-## FIXME: these apparently redundant definitions are required to
-## work around automake bug#7800.
-bar_YFLAGS += -d
-qux_YFLAGS += -d
 END
 
 cat > sub1/parse.y << 'END'
@@ -86,7 +82,6 @@ int main ()
 END
 cp sub1/main.c sub2/main.c
 
-
 $ACLOCAL
 $AUTOCONF
 $AUTOMAKE -a
diff --git a/tests/yacc-d-basic.test b/tests/yacc-d-basic.test
new file mode 100755
index 0000000..f5f88d8
--- /dev/null
+++ b/tests/yacc-d-basic.test
@@ -0,0 +1,158 @@
+#! /bin/sh
+# Copyright (C) 2011 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
+# the Free Software Foundation; either version 2, or (at your option)
+# any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program.  If not, see <http://www.gnu.org/licenses/>.
+
+# Tests on basic Yacc support for when we have -d in YFLAGS, AM_YFLAGS
+# or maude_YFLAGS.
+
+required=bison
+. ./defs || Exit 1
+
+set -e
+
+tab='  '
+distdir=$me-1.0
+
+cat >> configure.in << 'END'
+AC_PROG_CC
+AC_PROG_YACC
+AC_CONFIG_FILES([foo/Makefile bar/Makefile baz/Makefile])
+AC_OUTPUT
+END
+
+cat > Makefile.am <<'END'
+SUBDIRS = foo bar baz
+END
+
+mkdir foo bar baz
+
+cat > foo/Makefile.am <<'END'
+bin_PROGRAMS = zardoz
+zardoz_SOURCES = parse.y main.c
+.PHONY: echo-distcom
+echo-distcom:
+       @echo ' ' $(DIST_COMMON) ' '
+END
+cp foo/Makefile.am bar/Makefile.am
+cp foo/Makefile.am baz/Makefile.am
+
+cat > foo/parse.y << 'END'
+%{
+#include "parse.h"
+int yylex () { return 0; }
+void yyerror (char *s) {}
+%}
+%%
+x : 'x' {};
+%%
+END
+cp foo/parse.y bar/parse.y
+
+cat > foo/main.c << 'END'
+#include "parse.h"
+int main ()
+{
+  return yyparse ();
+}
+END
+cp foo/main.c bar/main.c
+
+# Even the generated header file is renamed when target-specific YFLAGS
+# are used.  This might not be the best behavior, but it has been in
+# place for quite a long time, so just go along with it for now.
+sed 's/"parse\.h"/"zardoz-parse.h"/' foo/parse.y > baz/parse.y
+sed 's/"parse\.h"/"zardoz-parse.h"/' foo/main.c > baz/main.c
+
+$ACLOCAL
+$AUTOCONF
+
+$AUTOMAKE -a
+$FGREP parse.h foo/Makefile.in bar/Makefile.in baz/Makefile.in && Exit 1
+
+cat >> foo/Makefile.am <<END
+BUILT_SOURCES = parse.h
+YFLAGS=\
+-d
+END
+$AUTOMAKE -Wno-gnu foo/Makefile
+
+sed 's/EOL$//' >> bar/Makefile.am <<END
+AM_YFLAGS${tab}=  -d EOL
+BUILT_SOURCES = parse.h
+END
+$AUTOMAKE bar/Makefile
+
+cat >> baz/Makefile.am <<END
+BUILT_SOURCES = zardoz-parse.h
+zardoz_YFLAGS =-d${tab}
+END
+$AUTOMAKE baz/Makefile
+
+./configure
+
+$MAKE
+
+test -f foo/parse.c
+test -f foo/parse.h
+test -f bar/parse.c
+test -f bar/parse.h
+test -f baz/zardoz-parse.c
+test -f baz/zardoz-parse.h
+
+# The generated C and header files must be shipped.
+for dir in foo bar; do
+  cd $dir
+  $MAKE echo-distcom
+  $MAKE -s echo-distcom | grep '[ /]parse.c '
+  $MAKE -s echo-distcom | grep '[ /]parse.h '
+  cd ..
+done
+cd baz
+$MAKE echo-distcom
+$MAKE -s echo-distcom | grep '[ /]zardoz-parse.c '
+$MAKE -s echo-distcom | grep '[ /]zardoz-parse.h '
+cd ..
+
+$MAKE distdir
+ls -l $distdir
+test -f $distdir/foo/parse.c
+test -f $distdir/foo/parse.h
+test -f $distdir/bar/parse.c
+test -f $distdir/bar/parse.h
+test -f $distdir/baz/zardoz-parse.c
+test -f $distdir/baz/zardoz-parse.h
+
+# Sanity check the distribution.
+$MAKE distcheck
+
+# While we are at it, make sure that `parse.c' and `parse.h' are erased
+# by maintainer-clean, and not by distclean.
+$MAKE distclean
+test -f foo/parse.c
+test -f foo/parse.h
+test -f bar/parse.c
+test -f bar/parse.h
+test -f baz/zardoz-parse.c
+test -f baz/zardoz-parse.h
+./configure # We must re-create `Makefile'.
+$MAKE maintainer-clean
+test ! -f foo/parse.c
+test ! -f foo/parse.h
+test ! -f bar/parse.c
+test ! -f bar/parse.h
+test ! -f baz/zardoz-parse.c
+test ! -f baz/zardoz-parse.h
+
+:
diff --git a/tests/yaccvpath.test b/tests/yacc-d-vpath.test
similarity index 74%
copy from tests/yaccvpath.test
copy to tests/yacc-d-vpath.test
index 7f44671..0edaaa8 100755
--- a/tests/yaccvpath.test
+++ b/tests/yacc-d-vpath.test
@@ -1,5 +1,5 @@
 #! /bin/sh
-# Copyright (C) 2001, 2002, 2003, 2010 Free Software Foundation, Inc.
+# Copyright (C) 2011 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
@@ -15,14 +15,14 @@
 # along with this program.  If not, see <http://www.gnu.org/licenses/>.
 
 # This test checks that dependent files are updated before including
-# in the distribution. `parse.c' depends on `parse.y'. The later is
-# updated so that `parse.c' should be rebuild. Then we are running
+# in the distribution. `parse.c' depends on `parse.y'.  The latter is
+# updated so that `parse.c' should be rebuilt.  Then we are running
 # `make' and `make distdir' and check whether the version of `parse.c'
 # to be distributed is up to date.
 
-# Please keep this in sync with sister test `lexvapth.test'.
+# Please keep this in sync with sister test `yaccvpath.test'.
 
-required='gcc bison'
+required=bison
 . ./defs || Exit 1
 
 set -e
@@ -38,6 +38,7 @@ END
 cat > Makefile.am << 'END'
 bin_PROGRAMS = foo
 foo_SOURCES = parse.y foo.c
+AM_YFLAGS = -d
 END
 
 # Original parser, with `foobar'
@@ -46,11 +47,13 @@ cat > parse.y << 'END'
 int yylex () {return 0;}
 void yyerror (char *s) {}
 %}
+%token FOOBAR
 %%
 foobar : 'f' 'o' 'o' 'b' 'a' 'r' {};
 END
 
 cat > foo.c << 'END'
+#include "parse.h"
 int main () { return 0; }
 END
 
@@ -58,15 +61,17 @@ $ACLOCAL
 $AUTOCONF
 $AUTOMAKE -a
 
-$YACC parse.y
+$YACC -d parse.y
 mv y.tab.c parse.c
+mv y.tab.h parse.h
+# Sanity checks.
+grep foobar parse.c
+grep FOOBAR parse.h
 
 mkdir sub
 cd sub
 ../configure
 
-# A delay is needed to make sure that the new parse.y is indeed newer
-# than parse.c, i.e. the they don't have the same timestamp.
 $sleep
 
 # New parser, with `fubar'
@@ -75,20 +80,18 @@ cat > ../parse.y << 'END'
 int yylex () {return 0;}
 void yyerror (char *s) {}
 %}
+%token FUBAR
 %%
-fubar : 'f' 'o' 'o' 'b' 'a' 'r' {};
+fubar : 'f' 'u' 'b' 'a' 'r' {};
 END
 
 $MAKE
 $MAKE distdir
 $FGREP fubar $distdir/parse.c
+$FGREP FUBAR $distdir/parse.h
 
-#
 # Now check to make sure that `make dist' will rebuild the parser.
-#
 
-# A delay is needed to make sure that the new parse.y is indeed newer
-# than parse.c, i.e. the they don't have the same timestamp.
 $sleep
 
 # New parser, with `maude'
@@ -97,11 +100,13 @@ cat > ../parse.y << 'END'
 int yylex () {return 0;}
 void yyerror (char *s) {}
 %}
+%token MAUDE
 %%
 maude : 'm' 'a' 'u' 'd' 'e' {};
 END
 
 $MAKE distdir
 $FGREP maude $distdir/parse.c
+$FGREP MAUDE $distdir/parse.h
 
 :
diff --git a/tests/yaccdry.test b/tests/yacc-dist-nobuild.test
similarity index 53%
copy from tests/yaccdry.test
copy to tests/yacc-dist-nobuild.test
index d2e7632..a6444de 100755
--- a/tests/yaccdry.test
+++ b/tests/yacc-dist-nobuild.test
@@ -1,5 +1,5 @@
 #! /bin/sh
-# Copyright (C) 2010 Free Software Foundation, Inc.
+# Copyright (C) 2011 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
@@ -14,13 +14,16 @@
 # You should have received a copy of the GNU General Public License
 # along with this program.  If not, see <http://www.gnu.org/licenses/>.
 
-# Removal recovery rules for headers should not remove files with `make -n'.
+# Check that distributed Yacc-generated parsers are not uselessly
+# remade from an unpacked distributed tarball.
 
 required=bison
 . ./defs || Exit 1
 
 set -e
 
+distdir=$me-1.0
+
 cat >> configure.in << 'END'
 AC_PROG_CC
 AC_PROG_YACC
@@ -28,33 +31,59 @@ AC_OUTPUT
 END
 
 cat > Makefile.am << 'END'
-AM_YFLAGS = -d
-bin_PROGRAMS = foo
-foo_SOURCES = foo.c parse.y
-END
-
-cat > foo.c << 'END'
-int main () { return 0; }
+bin_PROGRAMS = foobar zardoz
+foobar_SOURCES = parse.y main.c
+zardoz_SOURCES = $(foobar_SOURCES)
+zardoz_YFLAGS = -d
 END
 
 cat > parse.y << 'END'
 %{
-int yylex () {return 0;}
+int yylex () { return 0; }
 void yyerror (char *s) {}
 %}
 %%
 foobar : 'f' 'o' 'o' 'b' 'a' 'r' {};
 END
 
+cat > main.c << 'END'
+int main () { return 0; }
+END
+
 $ACLOCAL
-$AUTOMAKE --add-missing
 $AUTOCONF
+$AUTOMAKE -a
+
 ./configure
 $MAKE
 
-rm -f parse.h
-$MAKE -n parse.h
-test -f parse.c
-test ! -f parse.h
+$MAKE distdir
+chmod -R a-w $distdir
+
+mkdir bin
+cat > bin/yacc <<'END'
+#!/bin/sh
+echo "$0 invoked, shouldn't happen!" >&2
+exit 1
+END
+cp bin/yacc bin/bison
+chmod a+x bin/yacc bin/bison
+PATH=`pwd`/bin$PATH_SEPARATOR$PATH
+
+YACC=yacc BISON=bison
+export YACC BISON
+
+mkdir build
+cd build
+../$distdir/configure
+$MAKE
+
+# Sanity check.
+chmod u+w ../$distdir
+rm -f ../$distdir/parse.c
+chmod a-w ../$distdir
+$MAKE >out 2>&1 && { cat out; Exit 1; }
+cat out
+$FGREP parse.c out
 
 :
diff --git a/tests/yacc-nodist.test b/tests/yacc-nodist.test
new file mode 100755
index 0000000..2b4ce09
--- /dev/null
+++ b/tests/yacc-nodist.test
@@ -0,0 +1,101 @@
+#! /bin/sh
+# Copyright (C) 2011 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
+# the Free Software Foundation; either version 2, or (at your option)
+# any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program.  If not, see <http://www.gnu.org/licenses/>.
+
+# Checks for .c and .h files derived from non-distributed .y sources.
+
+required=bison
+. ./defs || Exit 1
+
+set -e
+
+cat >> configure.in << 'END'
+AC_PROG_CC
+AC_PROG_YACC
+AC_CONFIG_FILES([sub1/Makefile sub2/Makefile])
+AC_OUTPUT
+END
+
+cat > Makefile.am << 'END'
+SUBDIRS = sub1 sub2
+.PHONY: test
+test-build: all
+       ls -l . sub1 sub2
+       test -f sub1/parse.y
+       test -f sub1/parse.c
+       test -f sub2/parse.y
+       test -f sub2/parse.c
+       test -f sub2/parse.h
+test-dist: distdir
+       ls -l $(distdir) $(distdir)/sub1 $(distdir)/sub2
+       test ! -r $(distdir)/sub1/parse.y
+       test ! -r $(distdir)/sub1/parse.c
+       test ! -r $(distdir)/sub1/parse.h
+       test ! -r $(distdir)/sub2/parse.y
+       test ! -r $(distdir)/sub2/parse.c
+       test ! -r $(distdir)/sub2/parse.h
+check-local: test-build test-dist
+END
+
+mkdir sub1 sub2
+
+cat > sub1/Makefile.am << 'END'
+parse.y:
+       rm -f $@ address@hidden
+       :; { : \
+         && echo "%{" \
+         && echo "int yylex () { return 0; }" \
+         && echo "void yyerror (char *s) {}" \
+         && echo "%}" \
+         && echo "%%" \
+         && echo "maude : 'm' 'a' 'u' 'd' 'e' {}"; \
+       } > address@hidden
+       chmod a-w address@hidden
+       mv -f address@hidden $@
+bin_PROGRAMS = prog
+prog_SOURCES = main.c
+nodist_prog_SOURCES = parse.y
+CLEANFILES = $(nodist_prog_SOURCES)
+END
+
+cat sub1/Makefile.am - > sub2/Makefile.am << 'END'
+AM_YFLAGS = -d
+BUILT_SOURCES = parse.h
+END
+
+cat > sub1/main.c << 'END'
+int main ()
+{
+  return yyparse ();
+}
+END
+cat - sub1/main.c > sub2/main.c << 'END'
+#include "parse.h"
+END
+
+$ACLOCAL
+$AUTOCONF
+$AUTOMAKE -a
+
+./configure
+$MAKE
+$MAKE test-build
+$MAKE test-dist
+
+# But the distribution must work correctly, assuming the user has
+# the proper tools to process yacc files.
+$MAKE distcheck
+
+:
diff --git a/tests/yacc2.test b/tests/yacc2.test
index f598595..959c6b5 100755
--- a/tests/yacc2.test
+++ b/tests/yacc2.test
@@ -1,5 +1,5 @@
 #! /bin/sh
-# Copyright (C) 1999, 2001, 2002, 2003, 2006, 2010 Free Software
+# Copyright (C) 1999, 2001, 2002, 2003, 2006, 2010, 2011 Free Software
 # Foundation, Inc.
 #
 # This program is free software; you can redistribute it and/or modify
@@ -17,6 +17,7 @@
 
 # Test to make sure intermediate .h file is not generated nor removed
 # if (AM_)?YFLAGS do not contain -d.  Requested by Jim Meyering.
+# See also the related semantic test `yacc-d-basic.test'.
 
 . ./defs || Exit 1
 
diff --git a/tests/yaccvpath.test b/tests/yaccvpath.test
index 7f44671..c4dc400 100755
--- a/tests/yaccvpath.test
+++ b/tests/yaccvpath.test
@@ -1,5 +1,6 @@
 #! /bin/sh
-# Copyright (C) 2001, 2002, 2003, 2010 Free Software Foundation, Inc.
+# Copyright (C) 2001, 2002, 2003, 2010, 2011 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
@@ -20,9 +21,9 @@
 # `make' and `make distdir' and check whether the version of `parse.c'
 # to be distributed is up to date.
 
-# Please keep this in sync with sister test `lexvapth.test'.
+# Please keep this in sync with sister test `yacc-d-vpath.test'.
 
-required='gcc bison'
+required=bison
 . ./defs || Exit 1
 
 set -e
@@ -65,8 +66,6 @@ mkdir sub
 cd sub
 ../configure
 
-# A delay is needed to make sure that the new parse.y is indeed newer
-# than parse.c, i.e. the they don't have the same timestamp.
 $sleep
 
 # New parser, with `fubar'
@@ -83,12 +82,8 @@ $MAKE
 $MAKE distdir
 $FGREP fubar $distdir/parse.c
 
-#
 # Now check to make sure that `make dist' will rebuild the parser.
-#
 
-# A delay is needed to make sure that the new parse.y is indeed newer
-# than parse.c, i.e. the they don't have the same timestamp.
 $sleep
 
 # New parser, with `maude'
diff --git a/tests/yflags-cmdline-override.test 
b/tests/yflags-cmdline-override.test
new file mode 100755
index 0000000..86c3583
--- /dev/null
+++ b/tests/yflags-cmdline-override.test
@@ -0,0 +1,90 @@
+#! /bin/sh
+# Copyright (C) 2011 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
+# the Free Software Foundation; either version 2, or (at your option)
+# any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program.  If not, see <http://www.gnu.org/licenses/>.
+
+# Check that automake can cope with user-redefinition of $(YFLAGS)
+# at configure time and/or at make time.
+
+required=yacc
+. ./defs || Exit 1
+
+set -e
+
+unset YFLAGS || :
+
+cat >> configure.in <<'END'
+AC_PROG_CC
+AC_PROG_YACC
+AC_OUTPUT
+END
+
+cat > Makefile.am <<'END'
+bin_PROGRAMS = foo
+foo_SOURCES = foo.y
+# A minor automake wart: automake doesn't generate code to clean
+# `*.output' files generated by yacc (it's not even clear if that
+# would be useful in general, so it's probably better to be
+# conservative).
+CLEANFILES = foo.output
+# Another automake wart: `-d' flag won't be given at automake time,
+# so automake won't be able to generate code to clean `foo.h' :-(
+MAINTAINERCLEANFILES = foo.h
+END
+
+cat > foo.y << 'END'
+%{
+int yylex () { return 0; }
+void yyerror (char *s) { return; }
+int main () { return 0; }
+%}
+%%
+foobar : 'f' 'o' 'o' 'b' 'a' 'r' {};
+END
+
+$ACLOCAL
+$AUTOMAKE -a
+$AUTOCONF
+
+./configure YFLAGS='-d -v'
+$MAKE
+ls -l
+test -f foo.c
+test -f foo.h
+test -f foo.output
+
+$MAKE maintainer-clean
+ls -l
+
+./configure YFLAGS='-v'
+$MAKE
+ls -l
+test -f foo.c
+test ! -r foo.h
+test -f foo.output
+
+$MAKE maintainer-clean
+ls -l
+
+./configure YFLAGS='-v'
+YFLAGS=-d $MAKE -e
+ls -l
+test -f foo.c
+test -f foo.h
+test ! -r foo.output
+
+$MAKE maintainer-clean
+ls -l
+
+:
diff --git a/tests/colon.test b/tests/yflags-conditional.test
similarity index 62%
copy from tests/colon.test
copy to tests/yflags-conditional.test
index f1eec9a..8c673b1 100755
--- a/tests/colon.test
+++ b/tests/yflags-conditional.test
@@ -1,6 +1,5 @@
 #! /bin/sh
-# Copyright (C) 1996, 2000, 2001, 2002, 2010 Free Software Foundation,
-# Inc.
+# Copyright (C) 2011 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
@@ -15,35 +14,33 @@
 # You should have received a copy of the GNU General Public License
 # along with this program.  If not, see <http://www.gnu.org/licenses/>.
 
-# Test for bug reported by Nyul Laszlo.  When using the ":" syntax in
-# AC_OUTPUT, Automake fails to find the correct file.
+# Check that automake complains about conditionally-defined *_YFLAGS.
 
 . ./defs || Exit 1
 
 set -e
 
 cat >> configure.in <<'END'
-AC_CONFIG_FILES([foo.h:foo.hin])
-AC_OUTPUT
+AC_PROG_CC
+AC_PROG_YACC
+AM_CONDITIONAL([COND], [:])
 END
 
-: > foo.hin
-
 cat > Makefile.am <<'END'
-.PHONY: test
-test: distdir
-       ls -l . $(distdir)
-       test -f foo.h
-       test -f $(distdir)/foo.hin
+bin_PROGRAMS = foo bar
+foo_SOURCES = foo.y
+bar_SOURCES = bar.y
+if COND
+AM_YFLAGS = $(YFLAGS)
+bar_YFLAGS = -v
+endif COND
 END
 
-$ACLOCAL
-$AUTOMAKE
-$AUTOCONF
-
-./configure
+: > ylwrap
 
-$MAKE test
-$MAKE distcheck
+$ACLOCAL
+AUTOMAKE_fails
+grep "Makefile\.am:5:.*AM_YFLAGS.* defined conditionally" stderr
+grep "Makefile\.am:6:.*bar_YFLAGS.* defined conditionally" stderr
 
 :
diff --git a/tests/yacc.test b/tests/yflags-d-false-positives.test
similarity index 62%
copy from tests/yacc.test
copy to tests/yflags-d-false-positives.test
index 13b7fe3..38ea763 100755
--- a/tests/yacc.test
+++ b/tests/yflags-d-false-positives.test
@@ -1,6 +1,5 @@
 #! /bin/sh
-# Copyright (C) 1996, 2001, 2002, 2006, 2010 Free Software Foundation,
-# Inc.
+# Copyright (C) 2011 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
@@ -15,26 +14,30 @@
 # You should have received a copy of the GNU General Public License
 # along with this program.  If not, see <http://www.gnu.org/licenses/>.
 
-# Test to make sure intermediate .c file is built from yacc source.
-# Bug from Thomas Morgan.
+# Check for false positives in automake recognition of `-d' in YFLAGS.
 
 . ./defs || Exit 1
 
 set -e
 
-cat >> configure.in << 'END'
+cat >> configure.in <<'END'
 AC_PROG_CC
 AC_PROG_YACC
 END
 
+$ACLOCAL
+
 cat > Makefile.am <<'END'
-bin_PROGRAMS = zardoz
+bin_PROGRAMS = zardoz foobar
 zardoz_SOURCES = zardoz.y
+foobar_SOURCES = foobar.y
+# All the "almost -d" substrings ("- d", "-dd", etc.) are meant.
+AM_YFLAGS = -xd --d - d --output=d
+foobar_YFLAGS = - d $(foovar)-d -dd
 END
 
-$ACLOCAL
 $AUTOMAKE -a
-
-$FGREP 'zardoz.c' Makefile.in
+$EGREP '(foobar|zardoz)\.h.*:' Makefile.in && Exit 1
+$EGREP '(foobar|zardoz)\.h' Makefile.in | $FGREP -v '$(YLWRAP) ' && Exit 1
 
 :
diff --git a/tests/yaccdry.test b/tests/yflags-force-override.test
similarity index 57%
copy from tests/yaccdry.test
copy to tests/yflags-force-override.test
index d2e7632..7a3197f 100755
--- a/tests/yaccdry.test
+++ b/tests/yflags-force-override.test
@@ -1,5 +1,5 @@
 #! /bin/sh
-# Copyright (C) 2010 Free Software Foundation, Inc.
+# Copyright (C) 2011 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
@@ -14,47 +14,53 @@
 # You should have received a copy of the GNU General Public License
 # along with this program.  If not, see <http://www.gnu.org/licenses/>.
 
-# Removal recovery rules for headers should not remove files with `make -n'.
+# Check that automake can cope with a definition of the $(YFLAGS) variable
+# in Makefile.am (even if that is extremely bad practice, because that
+# variable is user-reserved).
 
-required=bison
+required=yacc
 . ./defs || Exit 1
 
 set -e
 
-cat >> configure.in << 'END'
+cat >> configure.in <<'END'
 AC_PROG_CC
 AC_PROG_YACC
 AC_OUTPUT
 END
 
-cat > Makefile.am << 'END'
-AM_YFLAGS = -d
+cat > Makefile.am <<'END'
 bin_PROGRAMS = foo
-foo_SOURCES = foo.c parse.y
+foo_SOURCES = foo.y
+# Don't do this in a real-life Makefile.am!
+YFLAGS = -d -v
 END
 
-cat > foo.c << 'END'
-int main () { return 0; }
-END
-
-cat > parse.y << 'END'
+cat > foo.y << 'END'
 %{
-int yylex () {return 0;}
-void yyerror (char *s) {}
+int yylex () { return 0; }
+void yyerror (char *s) { return; }
+int main () { return 0; }
 %}
 %%
 foobar : 'f' 'o' 'o' 'b' 'a' 'r' {};
 END
 
 $ACLOCAL
-$AUTOMAKE --add-missing
+$AUTOMAKE -a -Wno-gnu
+
+$EGREP '(foo|YFLAGS)' Makefile.in # for debugging
+grep '^foo.h *:' Makefile.in
+
 $AUTOCONF
 ./configure
+
 $MAKE
 
-rm -f parse.h
-$MAKE -n parse.h
-test -f parse.c
-test ! -f parse.h
+test -f foo.c
+test -f foo.h
+test -f foo.output
+
+$MAKE distcheck
 
 :
diff --git a/tests/yacc3.test b/tests/yflags-var-expand.test
similarity index 50%
rename from tests/yacc3.test
rename to tests/yflags-var-expand.test
index 46f8d3e..1967be3 100755
--- a/tests/yacc3.test
+++ b/tests/yflags-var-expand.test
@@ -1,6 +1,5 @@
 #! /bin/sh
-# Copyright (C) 1999, 2001, 2002, 2006, 2010 Free Software Foundation,
-# Inc.
+# Copyright (C) 2011 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
@@ -15,38 +14,50 @@
 # You should have received a copy of the GNU General Public License
 # along with this program.  If not, see <http://www.gnu.org/licenses/>.
 
-# Ensure that generated .h file is distributed iff we have -d in
-# (AM_)?YFLAGS.
+# Check that automake expand variables when looking for `-d' in YFLAGS;
+# for example, the following is supposed to work:
+#  foo_flags = -d
+#  AM_YFLAGS = $(foo_flags)
 
 . ./defs || Exit 1
 
 set -e
 
-cat >> configure.in << 'END'
+cat >> configure.in <<'END'
 AC_PROG_CC
 AC_PROG_YACC
 END
 
+$ACLOCAL
+
 cat > Makefile.am <<'END'
-AUTOMAKE_OPTIONS = no-dependencies
-bin_PROGRAMS = zardoz
-zardoz_SOURCES = zardoz.y
+bin_PROGRAMS = foo bar
+foo_SOURCES = foo.y
+bar_SOURCES = bar.y
+my_YFLAGS = -x
+AM_YFLAGS = $(my_YFLAGS:x=d)
+bar_YFLAGS = $(AM_YFLAGS)
 END
 
-$ACLOCAL
 $AUTOMAKE -a
 
-# It should not be disted here
-$FGREP 'zardoz.h' Makefile.in && Exit 1
-
-cp Makefile.am Makefile.sav
-# Test all available flags to make sure header is distributed with
-# `-d'.
-for flag in YFLAGS AM_YFLAGS zardoz_YFLAGS; do
-   cp Makefile.sav Makefile.am
-   echo "$flag = -d" >> Makefile.am
-   $AUTOMAKE -Wno-gnu
-   $FGREP 'zardoz.h' Makefile.in
-done
+$EGREP '(foo|bar|YFLAGS)' Makefile.in # for debugging
+grep '^foo.h *:' Makefile.in
+grep '^bar-bar.h *:' Makefile.in
+
+cat > Makefile.am <<'END'
+AUTOMAKE_OPTIONS = -Wno-gnu
+bin_PROGRAMS = zardoz
+zardoz_SOURCES = parser.y
+my_YFLAGS = $(my_YFLAGS_1)
+my_YFLAGS += $(my_YFLAGS_2)
+my_YFLAGS_2 = -d
+YFLAGS = $(my_YFLAGS)
+END
+
+$AUTOMAKE
+
+$EGREP 'parser|YFLAGS' Makefile.in # for debugging
+grep '^parser.h *:' Makefile.in
 
 :


hooks/post-receive
-- 
GNU Automake



reply via email to

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