automake-commit
[Top][All Lists]
Advanced

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

[Automake-commit] [SCM] GNU Automake branch, yacc-work, updated. v1.11-4


From: Stefano Lattarini
Subject: [Automake-commit] [SCM] GNU Automake branch, yacc-work, updated. v1.11-406-gfea854e
Date: Sat, 14 May 2011 18:30:55 +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=fea854ed044c3bdb3f7d85fafa35e1d17a9e63fc

The branch, yacc-work has been updated
       via  fea854ed044c3bdb3f7d85fafa35e1d17a9e63fc (commit)
       via  b67712acad6d2b0be448687c76e69a43b71e27b4 (commit)
       via  68da6ae8ce04258668e63aee320011c8bf130d18 (commit)
       via  1e6914a488ba23c9a098510d100de7cbe6edb79d (commit)
      from  4a187a50b89839f823f174256afa0903e0040a97 (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 fea854ed044c3bdb3f7d85fafa35e1d17a9e63fc
Author: Stefano Lattarini <address@hidden>
Date:   Fri May 13 20:51:50 2011 +0200

    lex: "make clean" removes .c files from non-distributed .l
    
    Previously, while automake did *not* distribute C source and header
    files derived from non-distributed Lex sources, it still caused
    them to be removed only by "make maintainer-clean" only, and not by
    simply "make clean" or "make distclean".
    This caused "make distcheck" to fail, unless the developer put
    those generated .c files in CLEANFILES or in DISTCLEANFILES by
    hand.
    
    This change fixes this issue, by making non-distributed `.c' files
    generated by non-distributed Lex sources cleaned by "make clean".
    A similar problem for Yacc support had been fixed with the commit
    v1.11-263-ged2c8bc.
    
    * tests/automake.in (lang_lex_target_hook): Make C source files
    derived from non-distributed Lex files cleaned by "make clean",
    not only by "make maintainer-clean".
    * tests/lex-clean.test: New test.
    * tests/lex-clean-cxx.test: Likewise.
    * tests/lex-nodist.test: Likewise.
    * tests/lex-pr204.test: Likewise.
    * tests/pr204.test: For consistency, renamed ...
    * tests/yacc-pr204.test: ... to this, and updated to keep it
    more in sync with 'lex-pr204.test'.
    * tests/yacc-nodist.test: Updated to keep it more in sync with
    'lex-nodist.test'.
    * tests/Makefile.am (TESTS): Update.
    * NEWS: Update.

commit b67712acad6d2b0be448687c76e69a43b71e27b4
Author: Stefano Lattarini <address@hidden>
Date:   Fri May 13 16:09:10 2011 +0200

    lex tests: make test on Lex dependency tracking more "semantic"
    
    * tests/lex4.test: Renamed ...
    * tests/lex-depend-grep.test: ... to this, and extended.
    * tests/lex-depend.test, tests/lex-depend-cxx.test: ... these
    new tests.
    * tests/Makefile.am (TESTS): Update.

commit 68da6ae8ce04258668e63aee320011c8bf130d18
Author: Stefano Lattarini <address@hidden>
Date:   Fri May 13 15:03:20 2011 +0200

    lex tests: remove erroneous check about ylwrap distribution
    
    * tests/lex5.test: Do not check that the ylwrap script is *not*
    distributed when there is only one lexer, as ylwrap is in fact
    expected to distributed unconditionally (at least starting from
    commit `Release-1-9-323-gc5881cc' of 19-08-2006).  Note that this
    bogus check wasn't triggering any failure because it was done at
    the wrong time (i.e. from the VPATH build directory), so that it
    could never fail anyway.
    Instead, check that ylwrap is distributed even when there is only
    one lexer.
    Since we are at it, add a couple of `ls -l' calls, to get better
    debugging info.

commit 1e6914a488ba23c9a098510d100de7cbe6edb79d
Author: Stefano Lattarini <address@hidden>
Date:   Fri May 13 14:48:42 2011 +0200

    yacc tests: "make clean" removes C++ files from non-distributed .y
    
    * tests/yacc-clean-cxx.test: New test, sister of `yacc-clean.test'.
    * tests/yacc-clean.test: Update heading comment to reference the
    new sister test.
    * tests/Makefile.am (TESTS): Update.

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

Summary of changes:
 ChangeLog                                   |   61 ++++++++++
 NEWS                                        |    5 +-
 automake.in                                 |   13 +-
 tests/Makefile.am                           |   11 ++-
 tests/Makefile.in                           |   11 ++-
 tests/lex-clean-cxx.test                    |  127 ++++++++++++++++++++
 tests/lex-clean.test                        |  114 ++++++++++++++++++
 tests/lex-depend-cxx.test                   |   90 ++++++++++++++
 tests/{lex4.test => lex-depend-grep.test}   |   16 ++-
 tests/{yacc-depend.test => lex-depend.test} |   78 ++++++-------
 tests/{yacc-nodist.test => lex-nodist.test} |   69 ++++-------
 tests/lex-pr204.test                        |   88 ++++++++++++++
 tests/lex5.test                             |    9 +-
 tests/yacc-clean-cxx.test                   |  169 +++++++++++++++++++++++++++
 tests/yacc-clean.test                       |    1 +
 tests/yacc-nodist.test                      |   13 ++-
 tests/{pr204.test => yacc-pr204.test}       |   12 ++-
 17 files changed, 774 insertions(+), 113 deletions(-)
 create mode 100755 tests/lex-clean-cxx.test
 create mode 100755 tests/lex-clean.test
 create mode 100755 tests/lex-depend-cxx.test
 rename tests/{lex4.test => lex-depend-grep.test} (66%)
 copy tests/{yacc-depend.test => lex-depend.test} (51%)
 copy tests/{yacc-nodist.test => lex-nodist.test} (51%)
 create mode 100755 tests/lex-pr204.test
 create mode 100755 tests/yacc-clean-cxx.test
 rename tests/{pr204.test => yacc-pr204.test} (82%)

diff --git a/ChangeLog b/ChangeLog
index f095b17..133a6aa 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,64 @@
+2011-05-13   Stefano Lattarini  <address@hidden>
+
+       lex: "make clean" removes .c files from non-distributed .l
+       Previously, while automake did *not* distribute C source and header
+       files derived from non-distributed Lex sources, it still caused
+       them to be removed only by "make maintainer-clean" only, and not by
+       simply "make clean" or "make distclean".
+       This caused "make distcheck" to fail, unless the developer put
+       those generated .c files in CLEANFILES or in DISTCLEANFILES by
+       hand.
+       This change fixes this issue, by making non-distributed `.c' files
+       generated by non-distributed Lex sources cleaned by "make clean".
+       A similar problem for Yacc support had been fixed with the commit
+       v1.11-263-ged2c8bc.
+       * tests/automake.in (lang_lex_target_hook): Make C source files
+       derived from non-distributed Lex files cleaned by "make clean",
+       not only by "make maintainer-clean".
+       * tests/lex-clean.test: New test.
+       * tests/lex-clean-cxx.test: Likewise.
+       * tests/lex-nodist.test: Likewise.
+       * tests/lex-pr204.test: Likewise.
+       * tests/pr204.test: For consistency, renamed ...
+       * tests/yacc-pr204.test: ... to this, and updated to keep it
+       more in sync with 'lex-pr204.test'.
+       * tests/yacc-nodist.test: Updated to keep it more in sync with
+       'lex-nodist.test'.
+       * tests/Makefile.am (TESTS): Update.
+       * NEWS: Update.
+
+2011-05-13  Stefano Lattarini  <address@hidden>
+
+       lex tests: make test on Lex dependency tracking more "semantic"
+       * tests/lex4.test: Renamed ...
+       * tests/lex-depend-grep.test: ... to this, and extended.
+       * tests/lex-depend.test, tests/lex-depend-cxx.test: ... these
+       new tests.
+       * tests/Makefile.am (TESTS): Update.
+
+2011-05-13  Stefano Lattarini  <address@hidden>
+
+       lex tests: remove erroneous check about ylwrap distribution
+       * tests/lex5.test: Do not check that the ylwrap script is *not*
+       distributed when there is only one lexer, as ylwrap is in fact
+       expected to distributed unconditionally (at least starting from
+       commit `Release-1-9-323-gc5881cc' of 19-08-2006).  Note that this
+       bogus check wasn't triggering any failure because it was done at
+       the wrong time (i.e. from the VPATH build directory), so that it
+       could never fail anyway.
+       Instead, check that ylwrap is distributed even when there is only
+       one lexer.
+       Since we are at it, add a couple of `ls -l' calls, to get better
+       debugging info.
+
+2011-05-13  Stefano Lattarini  <address@hidden>
+
+       yacc tests: "make clean" removes C++ files from non-distributed .y
+       * tests/yacc-clean-cxx.test: New test, sister of `yacc-clean.test'.
+       * tests/yacc-clean.test: Update heading comment to reference the
+       new sister test.
+       * tests/Makefile.am (TESTS): Update.
+
 2011-05-06  Stefano Lattarini  <address@hidden>
 
        tests: add a workaround for automake bug#8485
diff --git a/NEWS b/NEWS
index 80e0cfc..f861868 100644
--- a/NEWS
+++ b/NEWS
@@ -7,8 +7,9 @@ New in 1.11.0a:
 
 * Changes to Yacc support:
 
-  - C source and header files derived from non-distributed Yacc sources are
-    now removed by "make clean", not only by "make maintainer-clean".
+  - C source and header files derived from non-distributed Yacc and/or
+    Lex sources are now removed by a simple "make clean" (while they were
+    previously removed only "make maintainer-clean").
 
   - Slightly backward-incompatible change, relevant only for use of Yacc
     with C++: the extensions of the header files produced by the Yacc
diff --git a/automake.in b/automake.in
index de0833c..83d9119 100755
--- a/automake.in
+++ b/automake.in
@@ -6151,13 +6151,12 @@ sub lang_yacc_target_hook
 # compile a lex file.
 sub lang_lex_target_hook
 {
-    my ($self, $aggregate, $output, $input) = @_;
-    # If the files are built in the build directory, then we want to
-    # remove them with `make clean'.  If they are in srcdir they
-    # shouldn't be touched.  However, we can't determine this
-    # statically, and the GNU rules say that yacc/lex output files
-    # should be removed by maintainer-clean.  So that's what we do.
-    $clean_files{$output} = MAINTAINER_CLEAN;
+    my ($self, $aggregate, $output, $input, %transform) = @_;
+    # The GNU rules say that yacc/lex output files should be removed
+    # by maintainer-clean.  However, if the files are not distributed,
+    # then we want to remove them with "make clean"; otherwise,
+    # "make distcheck" will fail.
+    $clean_files{$output} = $transform{'DIST_SOURCE'} ? MAINTAINER_CLEAN : 
CLEAN;
 }
 
 # This is a helper for both lex and yacc.
diff --git a/tests/Makefile.am b/tests/Makefile.am
index 1f3e83f..6257975 100644
--- a/tests/Makefile.am
+++ b/tests/Makefile.am
@@ -442,11 +442,17 @@ ldflags.test \
 lex.test \
 lex2.test \
 lex3.test \
-lex4.test \
 lex5.test \
 lexcpp.test \
 lexvpath.test \
+lex-clean.test \
+lex-clean-cxx.test \
+lex-depend.test \
+lex-depend-cxx.test \
+lex-depend-grep.test \
 lex-line.test \
+lex-nodist.test \
+lex-pr204.test \
 lex-subobj-nodep.test \
 lflags.test \
 lflags2.test \
@@ -616,7 +622,6 @@ pr2.test \
 pr9.test \
 pr72.test \
 pr87.test \
-pr204.test \
 pr211.test \
 pr220.test \
 pr224.test \
@@ -838,6 +843,7 @@ yacc-d-basic.test \
 yacc-cxx.test \
 yacc-d-cxx.test \
 yacc-clean.test \
+yacc-clean-cxx.test \
 yacc.test \
 yacc2.test \
 yacc4.test \
@@ -855,6 +861,7 @@ yacc-deleted-headers.test \
 yacc-dist-nobuild.test \
 yacc-dist-nobuild-subdir.test \
 yacc-nodist.test \
+yacc-pr204.test \
 yaccpp.test \
 yaccvpath.test \
 yacc-d-vpath.test \
diff --git a/tests/Makefile.in b/tests/Makefile.in
index c06637e..2a13346 100644
--- a/tests/Makefile.in
+++ b/tests/Makefile.in
@@ -713,11 +713,17 @@ ldflags.test \
 lex.test \
 lex2.test \
 lex3.test \
-lex4.test \
 lex5.test \
 lexcpp.test \
 lexvpath.test \
+lex-clean.test \
+lex-clean-cxx.test \
+lex-depend.test \
+lex-depend-cxx.test \
+lex-depend-grep.test \
 lex-line.test \
+lex-nodist.test \
+lex-pr204.test \
 lex-subobj-nodep.test \
 lflags.test \
 lflags2.test \
@@ -887,7 +893,6 @@ pr2.test \
 pr9.test \
 pr72.test \
 pr87.test \
-pr204.test \
 pr211.test \
 pr220.test \
 pr224.test \
@@ -1109,6 +1114,7 @@ yacc-d-basic.test \
 yacc-cxx.test \
 yacc-d-cxx.test \
 yacc-clean.test \
+yacc-clean-cxx.test \
 yacc.test \
 yacc2.test \
 yacc4.test \
@@ -1126,6 +1132,7 @@ yacc-deleted-headers.test \
 yacc-dist-nobuild.test \
 yacc-dist-nobuild-subdir.test \
 yacc-nodist.test \
+yacc-pr204.test \
 yaccpp.test \
 yaccvpath.test \
 yacc-d-vpath.test \
diff --git a/tests/lex-clean-cxx.test b/tests/lex-clean-cxx.test
new file mode 100755
index 0000000..3400977
--- /dev/null
+++ b/tests/lex-clean-cxx.test
@@ -0,0 +1,127 @@
+#! /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 C++ source and header files derived from non-distributed
+# Yacc sources are cleaned by "make clean", while C++ source and
+# header files derived from distributed Yacc sources are cleaned by
+# "make maintainer-clean".
+# See also sister test `lex-clean.test'.
+
+required=lex
+. ./defs || Exit 1
+
+set -e
+
+cat >> configure.in << 'END'
+AC_PROG_CXX
+AC_PROG_LEX
+AC_OUTPUT
+END
+
+cat > Makefile.am << 'END'
+bin_PROGRAMS = foo bar baz qux
+
+foo_SOURCES = mainfoo.cc parsefoo.lxx
+
+bar_SOURCES = mainbar.cpp parsebar.ll
+bar_LFLAGS = $(AM_LFLAGS)
+
+baz_SOURCES = mainbaz.c++
+nodist_baz_SOURCES = parsebaz.l++
+
+qux_SOURCES = mainqux.cxx
+nodist_qux_SOURCES = parsequx.lpp
+qux_LFLAGS = $(AM_LFLAGS)
+
+parsebaz.l++ parsequx.lpp:
+       cp $(srcdir)/parsefoo.lxx $@
+
+CLEANFILES = parsebaz.l++ parsequx.lpp
+
+LDADD = $(LEXLIB)
+END
+
+cat > parsefoo.lxx << 'END'
+%%
+"GOOD"   return EOF;
+.
+END
+cp parsefoo.lxx parsebar.ll
+
+cat > mainfoo.cc << 'END'
+// This file should contain valid C++ but invalid C.
+using namespace std;
+int main (int argc, char **argv)
+{
+  extern int yylex (void);
+  return yylex ();
+}
+END
+cp mainfoo.cc mainbar.cpp
+cp mainfoo.cc mainbaz.c++
+cp mainfoo.cc mainqux.cxx
+
+$ACLOCAL
+$AUTOCONF
+$AUTOMAKE -a
+
+./configure
+
+cp config.status config.sav
+
+$MAKE
+ls -l
+# Sanity checks.
+test -f parsefoo.cxx
+test -f bar-parsebar.cc
+test -f parsebaz.l++
+test -f parsebaz.c++
+test -f parsequx.lpp
+test -f qux-parsequx.cpp
+
+for target in clean distclean; do
+  $MAKE $target
+  ls -l
+  test -f parsefoo.cxx
+  test -f bar-parsebar.cc
+  test ! -r parsebaz.l++
+  test ! -r parsebaz.c++
+  test ! -r parsequx.lpp
+  test ! -r qux-parsequx.cpp
+done
+
+cp config.sav config.status
+./config.status # re-create Makefile
+
+$MAKE maintainer-clean
+ls -l
+test -f parsefoo.lxx
+test -f parsebar.ll
+test ! -r parsefoo.cxx
+test ! -r bar-parsebar.cc
+test -f parsefoo.lxx
+test -f parsebar.ll
+test ! -r parsefoo.cxx
+test ! -r bar-parsebar.cc
+
+cp config.sav config.status
+./config.status # re-create Makefile
+
+# The distribution must work correctly, assuming the user has
+# the proper tools to process yacc files.
+$MAKE distcheck
+
+:
diff --git a/tests/lex-clean.test b/tests/lex-clean.test
new file mode 100755
index 0000000..dd36f80
--- /dev/null
+++ b/tests/lex-clean.test
@@ -0,0 +1,114 @@
+#! /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 .c files derived from non-distributed .l sources
+# are cleaned by "make clean", while .c files derived from
+# distributed .l sources are cleaned by "make maintainer-clean".
+# See also sister test `lex-clean-cxx.test'.
+
+required=yacc
+. ./defs || Exit 1
+
+set -e
+
+cat >> configure.in << 'END'
+AC_PROG_CC
+AC_PROG_LEX
+AC_OUTPUT
+END
+
+cat > Makefile.am << 'END'
+bin_PROGRAMS = foo bar baz qux
+
+foo_SOURCES = main.c lexer.l
+
+bar_SOURCES = main.c lexer.l
+bar_LFLAGS = $(AM_LFLAGS)
+
+baz_SOURCES = main.c
+nodist_baz_SOURCES = baz.l
+
+qux_SOURCES = main.c
+nodist_qux_SOURCES = baz.l
+qux_LFLAGS = $(AM_LFLAGS)
+
+baz.l:
+       cp $(srcdir)/lexer.l $@
+
+CLEANFILES = baz.l
+
+LDADD = $(LEXLIB)
+END
+
+cat > lexer.l << 'END'
+%%
+"GOOD"   return EOF;
+.
+END
+
+cat > main.c << 'END'
+int main (void)
+{
+  return yylex ();
+}
+END
+
+$ACLOCAL
+$AUTOCONF
+$AUTOMAKE -a
+
+./configure
+
+cp config.status config.sav
+
+$MAKE
+ls -l
+# Sanity checks.
+test -f lexer.l
+test -f lexer.c
+test -f bar-lexer.c
+test -f baz.l
+test -f baz.c
+test -f qux-baz.c
+
+for target in clean distclean; do
+  $MAKE $target
+  ls -l
+  test -f lexer.l
+  test -f lexer.c
+  test -f bar-lexer.c
+  test ! -r baz.l
+  test ! -r baz.c
+  test ! -r qux-baz.c
+done
+
+cp config.sav config.status
+./config.status # re-create Makefile
+
+$MAKE maintainer-clean
+ls -l
+test -f lexer.l
+test ! -r lexer.c
+test ! -r bar-lexer.c
+
+cp config.sav config.status
+./config.status # re-create Makefile
+
+# The distribution must work correctly, assuming the user has
+# the proper tools to process yacc files.
+$MAKE distcheck
+
+:
diff --git a/tests/lex-depend-cxx.test b/tests/lex-depend-cxx.test
new file mode 100755
index 0000000..860a96f
--- /dev/null
+++ b/tests/lex-depend-cxx.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/>.
+
+# Test to make sure dependencies work with Lex/C++.
+# Test synthesized from PR automake/6.
+
+required=lex
+. ./defs || Exit 1
+
+set -e
+
+cat >> configure.in << 'END'
+AC_PROG_CXX
+AM_PROG_LEX
+AC_OUTPUT
+END
+
+cat > Makefile.am << 'END'
+noinst_PROGRAMS = joe moe
+joe_SOURCES = joe.ll
+moe_SOURCES = moe.l++
+LDADD = $(LEXLIB)
+
+.PHONY: test-deps-exist
+test-deps-exist:
+       ls -l $(DEPDIR) ;: For debugging.
+       test -f $(DEPDIR)/joe.Po
+       test -f $(DEPDIR)/moe.Po
+
+.PHONY: test-obj-updated
+test-obj-updated: joe.$(OBJEXT) moe.$(OBJEXT)
+       stat older my-hdr.hxx joe.$(OBJEXT) moe.$(OBJEXT) || :
+       test `ls -t older joe.$(OBJEXT) | sed 1q` = joe.$(OBJEXT)
+       test `ls -t older moe.$(OBJEXT) | sed 1q` = moe.$(OBJEXT)
+END
+
+cat > joe.ll << 'END'
+%%
+"foo" return EOF;
+.
+%%
+#include "my-hdr.hxx"
+int main (int argc, char **argv)
+{
+  printf("Hello, World!\n");
+  return 0;
+}
+END
+
+cp joe.ll moe.l++
+
+cat > my-hdr.hxx <<'END'
+// This header contains deliberetly invalid C (but valid C++)
+#include <cstdio>
+using namespace std;
+END
+
+$ACLOCAL
+$AUTOMAKE -a
+
+$FGREP joe.Po Makefile.in
+$FGREP moe.Po Makefile.in
+
+$AUTOCONF
+# Try to enable dependency tracking if possible, even if that means
+# using slow dependency extractors.
+./configure --enable-dependency-tracking
+
+$MAKE test-deps-exist
+$MAKE
+
+: > older
+$sleep
+touch my-hdr.hxx
+$MAKE test-obj-updated
+
+:
diff --git a/tests/lex4.test b/tests/lex-depend-grep.test
similarity index 66%
rename from tests/lex4.test
rename to tests/lex-depend-grep.test
index b171160..468d313 100755
--- a/tests/lex4.test
+++ b/tests/lex-depend-grep.test
@@ -15,8 +15,9 @@
 # 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 dependencies work with .ll files.
-# Test synthesized from PR automake/6.
+# Test to make sure dependencies for Lex and C/C++ does not break
+# in obvious ways.  See PR automake/6, and related semantic tests
+# `lex-depend.test' and `lex-depend-cxx.test'.
 
 . ./defs || Exit 1
 
@@ -29,13 +30,20 @@ AM_PROG_LEX
 END
 
 cat > Makefile.am << 'END'
-bin_PROGRAMS = zoo
+bin_PROGRAMS = zoo foo
 zoo_SOURCES = joe.ll
+foo_SOURCES = moe.l
+noinst_PROGRAMS = zardoz
+zardoz_SOURCES = _0.l _1.ll _2.lxx _3.l++ _4.lpp
 END
 
 $ACLOCAL
 $AUTOMAKE -a
 
-$FGREP joe.Po Makefile.in
+$EGREP '([mj]oe|_[01234]|include|\.P)' Makefile.in # For debugging.
+
+for x in joe moe _0 _1 _2 _3 _4; do
+  grep "include.*$x\.Po" Makefile.in
+done
 
 :
diff --git a/tests/yacc-depend.test b/tests/lex-depend.test
similarity index 51%
copy from tests/yacc-depend.test
copy to tests/lex-depend.test
index 2f708ec..13d5554 100755
--- a/tests/yacc-depend.test
+++ b/tests/lex-depend.test
@@ -1,6 +1,5 @@
 #! /bin/sh
-# Copyright (C) 2001, 2002, 2003, 2004, 2006, 2007, 2010, 2011 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,71 +14,70 @@
 # You should have received a copy of the GNU General Public License
 # along with this program.  If not, see <http://www.gnu.org/licenses/>.
 
-# Make sure depcomp does not needlessly update headers for yacc rules.
-# Report from Paolo Bonzini.
+# Test to make sure automatic dependency tracking work with Lex/C.
+# Test suggested by PR automake/6.
 
-required=yacc
+required=lex
 . ./defs || Exit 1
 
 set -e
 
 cat >> configure.in << 'END'
 AC_PROG_CC
-AC_PROG_YACC
+AM_PROG_LEX
 AC_OUTPUT
 END
 
 cat > Makefile.am << 'END'
-bin_PROGRAMS = foo
-AM_YFLAGS = -d
-foo_SOURCES = foo.y main.c
-BUILT_SOURCES = foo.h
-END
+bin_PROGRAMS = zoo
+zoo_SOURCES = joe.l
+LDADD = $(LEXLIB)
 
-cat > foo.y << 'END'
-%{
-int yylex () { return 0; }
-void yyerror (char *s) { return; }
-%}
-%token TOKEN
-%%
-foobar : 'f' 'o' 'o' 'b' 'a' 'r' {};
-END
+.PHONY: test-deps-exist
+test-deps-exist:
+       ls -l $(DEPDIR) ;: For debugging.
+       test -f $(DEPDIR)/joe.Po
 
+.PHONY: test-obj-updated
+test-obj-updated: joe.$(OBJEXT)
+       stat older my-hdr.h joe.$(OBJEXT) || : For debugging.
+       test `ls -t older joe.$(OBJEXT) | sed 1q` = joe.$(OBJEXT)
+END
 
-cat > main.c << 'END'
-#include "foo.h"
-int main(void)
+cat > joe.l << 'END'
+%%
+"foo" return EOF;
+.
+%%
+#include "my-hdr.h"
+int main (void)
 {
-  return yyparse ();
+  printf("%s\n", MESSAGE);
+  return 0;
 }
 END
 
+cat > my-hdr.h <<'END'
+#include <stdio.h>
+#define MESSAGE "Hello, World!"
+END
+
 $ACLOCAL
-$AUTOCONF
 $AUTOMAKE -a
 
+$FGREP joe.Po Makefile.in
+
+$AUTOCONF
 # Try to enable dependency tracking if possible, even if that means
 # using slow dependency extractors.
 ./configure --enable-dependency-tracking
-$MAKE
-ls -l # For debugging.
 
-# Make sure foo.h is not updated if not really needed.
-$sleep
-: > my-timestamp
-$sleep
-touch foo.y
+$MAKE test-deps-exist
 $MAKE
-stat my-timestamp foo.* || : # For debugging.
-is_newest my-timestamp foo.h
 
-# Make sure foo.h is updated if needed.
+: > older
 $sleep
-sed 's/TOKEN/TEKON/g' foo.y > t
-mv -f t foo.y
-$MAKE
-stat my-timestamp foo.* || : # For debugging.
-is_newest foo.h my-timestamp
+touch my-hdr.h
+$MAKE test-obj-updated
 
 :
diff --git a/tests/yacc-nodist.test b/tests/lex-nodist.test
similarity index 51%
copy from tests/yacc-nodist.test
copy to tests/lex-nodist.test
index ab2af66..5948400 100755
--- a/tests/yacc-nodist.test
+++ b/tests/lex-nodist.test
@@ -14,77 +14,58 @@
 # 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.
-# The test `pr204' does similar check with AM_MAINTAINER_MODE enabled.
+# Checks for .c files derived from non-distributed .l sources.
+# The test `lex-pr204.test' does similar check with AM_MAINTAINER_MODE
+# enabled.
+# The tests 'yacc-nodist.test' and 'yacc-pr204.test' does similar checks
+# for yacc-generated .c and .h files.
 
-required=yacc
+required=lex
 . ./defs || Exit 1
 
 set -e
 
 cat >> configure.in << 'END'
 AC_PROG_CC
-AC_PROG_YACC
-AC_CONFIG_FILES([sub1/Makefile sub2/Makefile])
+dnl Sister test 'lex-pr204.test' should use 'AC_PROG_LEX' instead.
+AM_PROG_LEX
 AC_OUTPUT
 END
 
 cat > Makefile.am << 'END'
-SUBDIRS = sub1 sub2
-.PHONY: test
+.PHONY: test-build test-dist
 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
+       ls -l
+       test -f lexer.l
+       test -f lexer.c
 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
+       ls -l $(distdir)
+       test ! -r $(distdir)/lexer.l
+       test ! -r $(distdir)/lexer.c
 check-local: test-build test-dist
-END
-
-mkdir sub1 sub2
 
-cat > sub1/Makefile.am << 'END'
-parse.y:
+lexer.l:
        rm -f $@ address@hidden
        :; { : \
-         && echo "%{" \
-         && echo "int yylex () { return 0; }" \
-         && echo "void yyerror (char *s) {}" \
-         && echo "%}" \
-         && echo "%%" \
-         && echo "maude : 'm' 'a' 'u' 'd' 'e' {}"; \
+         && echo '%%' \
+         && echo '"GOOD" return EOF;' \
+         && echo '.'; \
        } > address@hidden
-       chmod a-w address@hidden
-       mv -f address@hidden $@
+       chmod a-w address@hidden && mv -f address@hidden $@
+
 bin_PROGRAMS = prog
 prog_SOURCES = main.c
-nodist_prog_SOURCES = parse.y
+nodist_prog_SOURCES = lexer.l
+prog_LDADD = $(LEXLIB)
 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'
+cat > main.c << 'END'
 int main ()
 {
-  return yyparse ();
+  return yylex ();
 }
 END
-cat - sub1/main.c > sub2/main.c << 'END'
-#include "parse.h"
-END
 
 $ACLOCAL
 $AUTOCONF
diff --git a/tests/lex-pr204.test b/tests/lex-pr204.test
new file mode 100755
index 0000000..095d611
--- /dev/null
+++ b/tests/lex-pr204.test
@@ -0,0 +1,88 @@
+#! /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/>.
+
+# Related to PR 204.
+# C sources derived from nodist_ lex sources should not be distributed.
+# See also related test `lex-nodist.test'.
+# The tests 'yacc-nodist.test' and 'yacc-pr204.test' does similar checks
+# for yacc-generated .c and .h files.
+
+required=lex
+. ./defs || Exit 1
+
+set -e
+
+cat >> configure.in <<'EOF'
+AM_MAINTAINER_MODE
+AC_PROG_CC
+dnl We use AC_PROG_LEX deliberately.
+dnl Sister 'lex-nodist.test' should use 'AM_PROG_LEX' instead.
+AC_PROG_LEX
+AC_OUTPUT
+EOF
+
+# The LEXER2 intermediate variable is there to make sure Automake
+# matches 'nodist_' against the right variable name...
+cat > Makefile.am << 'EOF'
+EXTRA_PROGRAMS = foo
+LEXER2 = lexer2.l
+nodist_foo_SOURCES = lexer.l $(LEXER2)
+
+distdirtest: distdir
+       test ! -f $(distdir)/lexer.c
+       test ! -f $(distdir)/lexer.l
+       test ! -f $(distdir)/lexer.h
+       test ! -f $(distdir)/lexer2.c
+       test ! -f $(distdir)/lexer2.l
+       test ! -f $(distdir)/lexer2.h
+EOF
+
+cat > lexer.l << 'END'
+%%
+"GOOD"   return EOF;
+.
+%%
+int main (void)
+{
+  return yylex ();
+}
+END
+
+cp lexer.l lexer2.l
+
+$ACLOCAL
+$AUTOCONF
+$AUTOMAKE -a
+
+./configure
+$MAKE distdirtest
+
+# Make sure lexer.c and lexer2.c are still targets.
+$MAKE lexer.c lexer2.c
+test -f lexer.c
+test -f lexer2.c
+
+# Ensure the rebuild rule works despite AM_MAINTAINER_MODE, because
+# it's a nodist_ lexer.
+$sleep
+touch lexer.l lexer2.l
+$sleep
+$MAKE lexer.c lexer2.c
+stat lexer.c lexer.l lexer2.c lexer2.l || : # For debugging.
+test `ls -t lexer.c lexer.l | sed 1q` = lexer.c
+test `ls -t lexer2.c lexer2.l | sed 1q` = lexer2.c
+
+:
diff --git a/tests/lex5.test b/tests/lex5.test
index 12d9f00..fd394eb 100755
--- a/tests/lex5.test
+++ b/tests/lex5.test
@@ -58,15 +58,18 @@ $ACLOCAL
 $AUTOCONF
 $AUTOMAKE -a
 
+# We expect ylwrap to be used and distributed even if there is
+# only one lexer.
+test -f ylwrap
+
 mkdir sub
 cd sub
 ../configure
 $MAKE foo/foo.o
+ls -l # For debugging.
 
 test -f foo/foo.c
 test -f foo/foo.o
-# ylwrap is not needed
-test ! -f ./ylwrap
 
 # Now, adds another lexer to test ylwrap.
 
@@ -84,11 +87,11 @@ END
 $sleep
 
 $AUTOMAKE -a --no-force
-test -f ./ylwrap
 
 cd sub
 using_gnumake || $MAKE Makefile
 $MAKE foo/foo2.o
+ls -l # For debugging.
 test -f foo/foo2.c
 test -f foo/foo2.o
 
diff --git a/tests/yacc-clean-cxx.test b/tests/yacc-clean-cxx.test
new file mode 100755
index 0000000..96ceaf8
--- /dev/null
+++ b/tests/yacc-clean-cxx.test
@@ -0,0 +1,169 @@
+#! /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 C++ source and header files derived from non-distributed
+# Yacc sources are cleaned by "make clean", while C++ source and
+# header files derived from distributed Yacc sources are cleaned by
+# "make maintainer-clean".
+# See also sister test `yacc-clean.test'.
+
+required=yacc
+. ./defs || Exit 1
+
+set -e
+
+cat >> configure.in << 'END'
+AC_PROG_CXX
+AC_PROG_YACC
+AC_CONFIG_FILES([sub1/Makefile sub2/Makefile])
+AC_OUTPUT
+END
+
+cat > Makefile.am << 'END'
+# Use two subdirectories, one to test with `-d' in YFLAGS, the
+# other one to test with empty YFLAGS.
+SUBDIRS = sub1 sub2
+END
+
+mkdir sub1 sub2
+
+cat > sub1/Makefile.am << 'END'
+bin_PROGRAMS = foo bar baz qux
+
+foo_SOURCES = mainfoo.cc parsefoo.yxx
+
+bar_SOURCES = mainbar.cpp parsebar.yy
+bar_YFLAGS = $(AM_YFLAGS)
+
+baz_SOURCES = mainbaz.c++
+nodist_baz_SOURCES = parsebaz.y++
+
+qux_SOURCES = mainqux.cxx
+nodist_qux_SOURCES = parsequx.ypp
+qux_YFLAGS = $(AM_YFLAGS)
+
+parsebaz.y++ parsequx.ypp:
+       cp $(srcdir)/parsefoo.yxx $@
+
+CLEANFILES = parsebaz.y++ parsequx.ypp
+END
+
+cat > sub2/Makefile.am << 'END'
+include $(top_srcdir)/sub1/Makefile.am
+AM_YFLAGS = -d
+END
+
+cat > sub1/parsefoo.yxx << 'END'
+%{
+// This file should contain valid C++ but invalid C.
+#include <cstdio>
+int yylex (void) { return (getchar ()); }
+void yyerror (const char *s) { return; }
+%}
+%%
+x : 'x' { };
+END
+cp sub1/parsefoo.yxx sub1/parsebar.yy
+cp sub1/parsefoo.yxx sub2/parsefoo.yxx
+cp sub1/parsefoo.yxx sub2/parsebar.yy
+
+cat > sub1/mainfoo.cc << 'END'
+// This file should contain valid C++ but invalid C.
+using namespace std;
+int main (int argc, char **argv)
+{
+  extern int yyparse (void);
+  return yyparse ();
+}
+END
+cp sub1/mainfoo.cc sub1/mainbar.cpp
+cp sub1/mainfoo.cc sub1/mainbaz.c++
+cp sub1/mainfoo.cc sub1/mainqux.cxx
+cp sub1/main???.c* sub2
+
+$ACLOCAL
+$AUTOCONF
+$AUTOMAKE -a
+
+./configure
+
+cp config.status config.sav
+
+$MAKE
+ls -l . sub1 sub2
+# Sanity checks.
+test -f sub1/parsefoo.cxx
+test -f sub1/bar-parsebar.cc
+test -f sub1/parsebaz.y++
+test -f sub1/parsebaz.c++
+test -f sub1/parsequx.ypp
+test -f sub1/qux-parsequx.cpp
+test -f sub2/parsefoo.cxx
+test -f sub2/parsefoo.hxx
+test -f sub2/bar-parsebar.cc
+test -f sub2/bar-parsebar.hh
+test -f sub2/parsebaz.y++
+test -f sub2/parsebaz.c++
+test -f sub2/parsebaz.h++
+test -f sub2/parsequx.ypp
+test -f sub2/qux-parsequx.cpp
+test -f sub2/qux-parsequx.hpp
+
+for target in clean distclean; do
+  $MAKE $target
+  ls -l . sub1 sub2
+  test -f sub1/parsefoo.cxx
+  test -f sub1/bar-parsebar.cc
+  test ! -r sub1/parsebaz.y++
+  test ! -r sub1/parsebaz.c++
+  test ! -r sub1/parsequx.ypp
+  test ! -r sub1/qux-parsequx.cpp
+  test -f sub2/parsefoo.cxx
+  test -f sub2/parsefoo.hxx
+  test -f sub2/bar-parsebar.cc
+  test -f sub2/bar-parsebar.hh
+  test ! -r sub2/parsebaz.y++
+  test ! -r sub2/parsebaz.c++
+  test ! -r sub2/parsebaz.h++
+  test ! -r sub2/parsequx.ypp
+  test ! -r sub2/qux-parsequx.cpp
+  test ! -r sub2/qux-parsequx.hpp
+done
+
+cp config.sav config.status
+./config.status # re-create Makefile
+
+$MAKE maintainer-clean
+ls -l . sub1 sub2
+test -f sub1/parsefoo.yxx
+test -f sub1/parsebar.yy
+test ! -r sub1/parsefoo.cxx
+test ! -r sub1/bar-parsebar.cc
+test -f sub2/parsefoo.yxx
+test -f sub2/parsebar.yy
+test ! -r sub2/parsefoo.cxx
+test ! -r sub2/parsefoo.hxx
+test ! -r sub2/bar-parsebar.cc
+test ! -r sub2/bar-parsebar.hh
+
+cp config.sav config.status
+./config.status # re-create Makefile
+
+# The distribution must work correctly, assuming the user has
+# the proper tools to process yacc files.
+$MAKE distcheck
+
+:
diff --git a/tests/yacc-clean.test b/tests/yacc-clean.test
index c8e8863..bdc8dd0 100755
--- a/tests/yacc-clean.test
+++ b/tests/yacc-clean.test
@@ -17,6 +17,7 @@
 # Check that .c and .h files derived from non-distributed .y sources
 # are cleaned by "make clean", while .c and .h files derived from
 # distributed .y sources are cleaned by "make maintainer-clean".
+# See also sister test `yacc-cxx-clean.test'.
 
 required=yacc
 . ./defs || Exit 1
diff --git a/tests/yacc-nodist.test b/tests/yacc-nodist.test
index ab2af66..846e247 100755
--- a/tests/yacc-nodist.test
+++ b/tests/yacc-nodist.test
@@ -14,8 +14,11 @@
 # 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.
-# The test `pr204' does similar check with AM_MAINTAINER_MODE enabled.
+# Checks for .c and .h files derived from non-distributed yacc sources.
+# The test 'yacc-pr204.test' does similar check with AM_MAINTAINER_MODE
+# enabled.
+# The tests 'lex-nodist.test' and 'lex-pr204.test' does similar checks
+# for lex-generated .c files.
 
 required=yacc
 . ./defs || Exit 1
@@ -31,7 +34,7 @@ END
 
 cat > Makefile.am << 'END'
 SUBDIRS = sub1 sub2
-.PHONY: test
+.PHONY: test-build test-dist
 test-build: all
        ls -l . sub1 sub2
        test -f sub1/parse.y
@@ -63,8 +66,8 @@ parse.y:
          && echo "%%" \
          && echo "maude : 'm' 'a' 'u' 'd' 'e' {}"; \
        } > address@hidden
-       chmod a-w address@hidden
-       mv -f address@hidden $@
+       chmod a-w address@hidden && mv -f address@hidden $@
+
 bin_PROGRAMS = prog
 prog_SOURCES = main.c
 nodist_prog_SOURCES = parse.y
diff --git a/tests/pr204.test b/tests/yacc-pr204.test
similarity index 82%
rename from tests/pr204.test
rename to tests/yacc-pr204.test
index 64032c7..a1c3691 100755
--- a/tests/pr204.test
+++ b/tests/yacc-pr204.test
@@ -15,10 +15,12 @@
 # along with this program.  If not, see <http://www.gnu.org/licenses/>.
 
 # For PR 204.
-# Sources derived from nodist_ sources should not be distributed.
+# C sources derived from nodist_ yacc sources should not be distributed.
 # See also related test `yacc-nodist.test'.
+# The tests 'lex-nodist.test' and 'lex-pr204.test' does similar checks
+# for lex-generated C files.
 
-required='yacc gcc'
+required=yacc
 . ./defs || Exit 1
 
 set -e
@@ -74,9 +76,11 @@ test -f parse2.c
 # Ensure the rebuild rule works despite AM_MAINTAINER_MODE, because
 # it's a nodist_ parser.
 $sleep
-touch parse.y
+touch parse.y parse2.y
 $sleep
 $MAKE parse.c parse2.c
-test `ls -1t parse.c parse.y | sed 1q` = parse.c
+stat parse.c parse.y parse2.c parse2.y || : # For debugging.
+test `ls -t parse.c parse.y | sed 1q` = parse.c
+test `ls -t parse2.c parse2.y | sed 1q` = parse2.c
 
 :


hooks/post-receive
-- 
GNU Automake



reply via email to

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