This stems from a discussion on bug-automake: <http://lists.gnu.org/archive/html/bug-automake/2010-04/msg00008.html>
Apparently, when yacc `*.y' and/or lex `*.l' files are used in a foo_SOURCES primary, the generated Makefile.in does not prevent Heirloom make from using its builtin ".l => .o" and/or ".y => .o" rules instead of the automake-generated ".l => .c => .o" and/or ".y => .c => .o" rules' chains. This, among other things, might cause the created *.o files to be compiled with wrong flags, and the created *.c files to be generated with the wrong lex/yacc flags. The attached patch introduces a couple of tests checking for the just described bug. Hopefully, a patch fixing this bug will follow soon. Regards, Stefano
From 35ace11f38af8c02d542a1f2a444bf0bc6ada042 Mon Sep 17 00:00:00 2001 From: Stefano Lattarini <stefano.lattar...@gmail.com> Date: Sat, 24 Apr 2010 16:40:09 +0200 Subject: [PATCH] New tests: Heirlooom make and Lex/Yacc rules. * tests/lex6.test: New test (fails if $MAKE is Heirloom make). * tests/yacc9.test: Likewise. * tests/Makefile.am (TESTS): Extended accordingly. --- ChangeLog | 7 ++++++ tests/Makefile.am | 2 + tests/Makefile.in | 2 + tests/lex6.test | 58 +++++++++++++++++++++++++++++++++++++++++++++++++++++ tests/yacc9.test | 58 +++++++++++++++++++++++++++++++++++++++++++++++++++++ 5 files changed, 127 insertions(+), 0 deletions(-) create mode 100755 tests/lex6.test create mode 100755 tests/yacc9.test diff --git a/ChangeLog b/ChangeLog index a026c84..df5273d 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,10 @@ +2010-04-25 Stefano Lattarini <stefano.lattar...@gmail.com> + + New tests: incompatibility of Heirlooom make w.r.t. Lex/Yacc rules. + * tests/lex6.test: New test (fails if $MAKE is Heirloom make). + * tests/yacc9.test: Likewise. + * tests/Makefile.am (TESTS): Extended accordingly. + 2010-04-20 Ralf Wildenhues <ralf.wildenh...@gmx.de> Fix -Werror handling for presence of configure.in and configure.ac. diff --git a/tests/Makefile.am b/tests/Makefile.am index cff34c5..7ca537f 100644 --- a/tests/Makefile.am +++ b/tests/Makefile.am @@ -403,6 +403,7 @@ lex2.test \ lex3.test \ lex4.test \ lex5.test \ +lex6.test \ libexec.test \ libobj2.test \ libobj3.test \ @@ -777,6 +778,7 @@ yacc5.test \ yacc6.test \ yacc7.test \ yacc8.test \ +yacc9.test \ yaccpp.test \ yaccvpath.test \ $(parallel_tests) diff --git a/tests/Makefile.in b/tests/Makefile.in index 3ff9012..3537f3e 100644 --- a/tests/Makefile.in +++ b/tests/Makefile.in @@ -644,6 +644,7 @@ lex2.test \ lex3.test \ lex4.test \ lex5.test \ +lex6.test \ libexec.test \ libobj2.test \ libobj3.test \ @@ -1018,6 +1019,7 @@ yacc5.test \ yacc6.test \ yacc7.test \ yacc8.test \ +yacc9.test \ yaccpp.test \ yaccvpath.test \ $(parallel_tests) diff --git a/tests/lex6.test b/tests/lex6.test new file mode 100755 index 0000000..02837c4 --- /dev/null +++ b/tests/lex6.test @@ -0,0 +1,58 @@ +#! /bin/sh +# Copyright (C) 2010 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 make uses our .l => .c => .o rule chain rather than a +# built-in .l => .o rule. +# Please keep this in sync with the syster test yacc9.test. + +. ./defs || Exit 1 + +required=gcc #FIXME: any working C Compiler should be OK! +set -e + +cat >ylwrap <<EOF +#!/bin/sh +echo 'main() { /*GrepMe*/ }' >foo.c +EOF +chmod a+x ylwrap + +cat > configure.in <<END +AC_INIT([$me], [1.0]) +AC_CONFIG_AUX_DIR([.]) +AM_INIT_AUTOMAKE +AC_PROG_CC +AC_SUBST([LEX], [false]) # should never be run +AC_OUTPUT([Makefile]) +END + +cat > Makefile.am <<END +bin_PROGRAMS = foo +foo_SOURCES = foo.l +END + +: > foo.l + +$ACLOCAL +$AUTOCONF +$AUTOMAKE -a + +./configure +$MAKE >out 2>&1 || { cat out; Exit 1; } +cat out + +test -f foo.c + +$FGREP '/*GrepMe*/' foo.c diff --git a/tests/yacc9.test b/tests/yacc9.test new file mode 100755 index 0000000..5b7911d --- /dev/null +++ b/tests/yacc9.test @@ -0,0 +1,58 @@ +#! /bin/sh +# Copyright (C) 2010 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 make uses our .y => .c => .o rule chain rather than a +# built-in .y => .o rule. +# Please keep this in sync with the syster test lex6.test. + +. ./defs || Exit 1 + +required=gcc #FIXME: any working C Compiler should be OK! +set -e + +cat >ylwrap <<EOF +#!/bin/sh +echo 'main() { /*GrepMe*/ }' >foo.c +EOF +chmod a+x ylwrap + +cat > configure.in <<END +AC_INIT([$me], [1.0]) +AC_CONFIG_AUX_DIR([.]) +AM_INIT_AUTOMAKE +AC_PROG_CC +AC_SUBST([YACC], [false]) # should never be run +AC_OUTPUT([Makefile]) +END + +cat > Makefile.am <<END +bin_PROGRAMS = foo +foo_SOURCES = foo.y +END + +: > foo.y + +$ACLOCAL +$AUTOCONF +$AUTOMAKE -a + +./configure +$MAKE >out 2>&1 || { cat out; Exit 1; } +cat out + +test -f foo.c + +$FGREP '/*GrepMe*/' foo.c -- 1.6.5