diff options
author | Alexandre Duret-Lutz <adl@gnu.org> | 2004-02-29 19:10:21 +0000 |
---|---|---|
committer | Alexandre Duret-Lutz <adl@gnu.org> | 2004-02-29 19:10:21 +0000 |
commit | 2ac4685e495eae08c7b7ca778558102a70af28a1 (patch) | |
tree | 8b7400fbfa41cc564276e313582bb358d6707da7 /tests | |
parent | a9800a566efb292d0cba6301815e40c42ff1b552 (diff) | |
download | automake-2ac4685e495eae08c7b7ca778558102a70af28a1.tar.gz |
* automake.in (lang_yacc_target_hook): Use Automake::Rule::define
so that rules for the same headers are not output twice.
* lib/Automake/Variable.pm (value_as_list_recursive): Do not
call `return' inside `map'.
* tests/cond30.test: Make sure `a.c' and `b.c' both appear
in the Makefile.in.
* tests/cond35.test, tests/cond36.test: New files.
* tests/Makefile.am (TESTS): Add cond35.test and cond36.test.
Report from Roman Fietze.
Diffstat (limited to 'tests')
-rw-r--r-- | tests/Makefile.am | 2 | ||||
-rw-r--r-- | tests/Makefile.in | 2 | ||||
-rwxr-xr-x | tests/cond30.test | 5 | ||||
-rwxr-xr-x | tests/cond35.test | 94 | ||||
-rwxr-xr-x | tests/cond36.test | 64 |
5 files changed, 166 insertions, 1 deletions
diff --git a/tests/Makefile.am b/tests/Makefile.am index f9c812f02..a1333479c 100644 --- a/tests/Makefile.am +++ b/tests/Makefile.am @@ -121,6 +121,8 @@ cond31.test \ cond32.test \ cond33.test \ cond34.test \ +cond35.test \ +cond36.test \ condd.test \ condinc.test \ condinc2.test \ diff --git a/tests/Makefile.in b/tests/Makefile.in index e6f60dd6b..8b808575f 100644 --- a/tests/Makefile.in +++ b/tests/Makefile.in @@ -236,6 +236,8 @@ cond31.test \ cond32.test \ cond33.test \ cond34.test \ +cond35.test \ +cond36.test \ condd.test \ condinc.test \ condinc2.test \ diff --git a/tests/cond30.test b/tests/cond30.test index c9fb80b23..10ff041c0 100755 --- a/tests/cond30.test +++ b/tests/cond30.test @@ -1,5 +1,5 @@ #!/bin/sh -# Copyright (C) 2003 Free Software Foundation, Inc. +# Copyright (C) 2003, 2004 Free Software Foundation, Inc. # # This file is part of GNU Automake. # @@ -56,3 +56,6 @@ grep 'BEG: a.foo :END' stdout EXEEXT=.foo $MAKE -e print > stdout cat stdout grep 'BEG: b.foo :END' stdout + +grep 'a_SOURCES = a.c' Makefile.in +grep 'b_SOURCES = b.c' Makefile.in diff --git a/tests/cond35.test b/tests/cond35.test new file mode 100755 index 000000000..3e9bae6d0 --- /dev/null +++ b/tests/cond35.test @@ -0,0 +1,94 @@ +#!/bin/sh +# Copyright (C) 2004 Free Software Foundation, Inc. +# +# This file is part of GNU Automake. +# +# GNU Automake 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. +# +# GNU Automake 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 Automake; see the file COPYING. If not, write to +# the Free Software Foundation, Inc., 59 Temple Place - Suite 330, +# Boston, MA 02111-1307, USA. + +# Check rules output for parser defined conditionally. +# Report from Roman Fietze. + +required='flex bison gcc' +. ./defs + +set -e + +cat >>configure.in <<'EOF' +AM_CONDITIONAL([CASE_A], test -z "$case_B") +AC_PROG_CC +AM_PROG_LEX +AC_PROG_YACC +AC_OUTPUT +EOF + +cat >>Makefile.am <<'EOF' +AM_YFLAGS = -d + +BUILT_SOURCES = tparse.h + +if CASE_A +bin_PROGRAMS = ta +ta_SOURCES = ta.c tparse.h tscan.l tparse.y +ta_LDADD = $(LEXLIB) +else +bin_PROGRAMS = tb +tb_SOURCES = tb.c tparse.h tscan.l tparse.y +tb_LDADD = $(LEXLIB) +endif + + +test-ta: + test -f ta$(EXEEXT) +test-tb: + test -f tb$(EXEEXT) +EOF + +$ACLOCAL +$AUTOCONF +$AUTOMAKE --add-missing + +test `grep tparse.h: Makefile.in | wc -l` = 1 + +cat > tscan.l << 'END' +%% +"END" return EOF; +END + +cat > tparse.y << 'END' +%{ +void yyerror (char *s) {} +%} +%token EOF +%% +foobar : 'f' 'o' 'o' 'b' 'a' 'r' EOF {}; +END + +cat >ta.c <<'END' +int main() +{ + return 0; +} +END + +cp ta.c tb.c + +./configure +$MAKE +$MAKE test-ta + +./configure case_B=yes +$MAKE +$MAKE test-tb diff --git a/tests/cond36.test b/tests/cond36.test new file mode 100755 index 000000000..e87c460d3 --- /dev/null +++ b/tests/cond36.test @@ -0,0 +1,64 @@ +#!/bin/sh +# Copyright (C) 2004 Free Software Foundation, Inc. +# +# This file is part of GNU Automake. +# +# GNU Automake 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. +# +# GNU Automake 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 Automake; see the file COPYING. If not, write to +# the Free Software Foundation, Inc., 59 Temple Place - Suite 330, +# Boston, MA 02111-1307, USA. + +# Check rules output for parser defined conditionally. + +required='flex bison gcc' +. ./defs + +set -e + +cat >>configure.in <<'EOF' +AM_CONDITIONAL([CASE_A], test -z "$case_B") +AC_PROG_CC +AM_PROG_LEX +AC_PROG_YACC +AC_OUTPUT +EOF + +cat >>Makefile.am <<'EOF' +AM_YFLAGS = -d + +BUILT_SOURCES = tparse.h + +if CASE_A +bin_PROGRAMS = ta +ta_SOURCES = ta.c tparse.h tscan.l tparse.y +ta_LDADD = $(LEXLIB) +else +bin_PROGRAMS = tb +tb_SOURCES = tb.c tparse.h tscan.l tparse.y +tb_LDADD = $(LEXLIB) +tparse.h: tparce.c + echo whatever +endif +EOF + +$ACLOCAL + +# Presently Automake doesn't fully support partially overriden rules +# and should complain. +AUTOMAKE_fails --add-missing +grep 'tparse.h.*already defined' stderr + +# Still and all, it should generate two rules. +test `grep tparse.h: Makefile.in | wc -l` = 2 +grep '@CASE_A_TRUE@tparse.h:' Makefile.in +grep '@CASE_A_FALSE@tparse.h:' Makefile.in |