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.
2004-02-29 Alexandre Duret-Lutz <adl@gnu.org>
+ * 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.
+
Fix for PR/413:
* lib/am/distdir.am (distcheck): Create $dc_destdir with `umask
077 && mkdir' instead of `$(mkdir_p)'. This prevents possible
Robert Boehne rboehne@ricardo-us.com
Robert Collins robert.collins@itdomain.com.au
Roberto Bagnara bagnara@cs.unipr.it
+Roman Fietze roman.fietze@telemotive.de
Ronald Landheer ronald@landheer.com
Rusty Ballinger rusty@rlyeh.engr.sgi.com
Ryan T. Sammartino ryants@shaw.ca
# Add a dependency for the generated header file, and arrange
# for that file to be included in the distribution.
# FIXME: this fails for `nodist_*_SOURCES'.
- $output_rules .= ("${header}: $output\n"
- # Recover from removal of $header
- . "\t\@if test ! -f \$@; then \\\n"
- . "\t rm -f $output; \\\n"
- . "\t \$(MAKE) $output; \\\n"
- . "\telse :; fi\n");
+ foreach my $cond (Automake::Rule::define (${header}, 'internal',
+ RULE_AUTOMAKE, TRUE,
+ INTERNAL))
+ {
+ my $condstr = $cond->subst_string;
+ $output_rules .= ("$condstr${header}: $output\n"
+ # Recover from removal of $header
+ . "$condstr\t\@if test ! -f \$@; then \\\n"
+ . "$condstr\t rm -f $output; \\\n"
+ . "$condstr\t \$(MAKE) $output; \\\n"
+ . "$condstr\telse :; fi\n");
+ }
&push_dist_common ($header);
+
# 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
# Collect results.
sub {
my ($var, $parent_cond, @allresults) = @_;
- return map { my ($cond, @vals) = @$_; return @vals } @allresults;
+ return map { my ($cond, @vals) = @$_; @vals } @allresults;
},
%options);
}
cond32.test \
cond33.test \
cond34.test \
+cond35.test \
+cond36.test \
condd.test \
condinc.test \
condinc2.test \
cond32.test \
cond33.test \
cond34.test \
+cond35.test \
+cond36.test \
condd.test \
condinc.test \
condinc2.test \
#!/bin/sh
-# Copyright (C) 2003 Free Software Foundation, Inc.
+# Copyright (C) 2003, 2004 Free Software Foundation, Inc.
#
# This file is part of GNU Automake.
#
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
--- /dev/null
+#!/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
--- /dev/null
+#!/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