]> sourceware.org Git - automake.git/commitdiff
* lib/Automake/Variable.pm (transform_variable_recursively):
authorAlexandre Duret-Lutz <adl@gnu.org>
Sun, 1 Feb 2004 18:06:50 +0000 (18:06 +0000)
committerAlexandre Duret-Lutz <adl@gnu.org>
Sun, 1 Feb 2004 18:06:50 +0000 (18:06 +0000)
Define rewritten variables in all conditions not *covered* by user
definitions, not simply in conditions without a previous
definition.
* tests/cond34.test: New file.
* tests/Makefile.am (TESTS): Add cond34.test.
Report from Elena A. Vengerova

ChangeLog
THANKS
lib/Automake/Variable.pm
tests/Makefile.am
tests/Makefile.in
tests/cond34.test [new file with mode: 0755]

index 5cc62254c097235c680086584f6550270ac95e7a..9c7197500419fd3cf5a1e74259880eea4747951c 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,13 @@
 2004-02-01  Alexandre Duret-Lutz  <adl@gnu.org>
 
+       * lib/Automake/Variable.pm (transform_variable_recursively):
+       Define rewritten variables in all conditions not *covered* by user
+       definitions, not simply in conditions without a previous
+       definition.
+       * tests/cond34.test: New file.
+       * tests/Makefile.am (TESTS): Add cond34.test.
+       Report from Elena A. Vengerova
+
        * doc/automake.texi (Multiple Outputs): Typo.
 
        * doc/automake.texi (Emacs Lisp): Typos.
diff --git a/THANKS b/THANKS
index f049c0c8aee6a6cc520b7aa37925288a0d448ad2..253b9b6187a148db2ed1ab140e066e6addb15f92 100644 (file)
--- a/THANKS
+++ b/THANKS
@@ -55,6 +55,7 @@ Dmitry Mikhin         dmitrym@acres.com.au
 Doug Evans             devans@cygnus.com
 Duncan Gibson          duncan@thermal.esa.int
 Eleftherios Gkioulekas lf@amath.washington.edu
+Elena A. Vengerova     helen@oktetlabs.ru
 Elmar Hoffmann         elho@elho.net
 Elrond                 Elrond@Wunder-Nett.org
 Enrico Scholz          enrico.scholz@informatik.tu-chemnitz.de
index cec6b56482164c7d5860619b0cfff367f735d061..e743011c02c777cef2cd1a1aed836907a87481fd 100644 (file)
@@ -1510,17 +1510,26 @@ sub transform_variable_recursively ($$$$$&;%)
           # we are trying to override a user variable.  Delete
           # the old variable first.
           variable_delete ($varname) if $varname eq $var->name;
-          # Define for all conditions.  Make sure we define
-          # an empty variable in condition TRUE otherwise.
+          # Define an empty variable in condition TRUE if there is no
+          # result.
           @allresults = ([TRUE, '']) unless @allresults;
+          # Define the rewritten variable in all conditions not
+          # already covered by user definitions.
           foreach my $pair (@allresults)
             {
               my ($cond, @result) = @$pair;
-              define ($varname, VAR_AUTOMAKE, '', $cond, "@result",
-                      '', $where, VAR_PRETTY)
-                unless vardef ($varname, $cond);
-              rvardef ($varname, $cond)->set_seen;
+              my $var = var $varname;
+              my @conds = ($var
+                           ? $var->not_always_defined_in_cond ($cond)->conds
+                           : $cond);
+
+              foreach (@conds)
+                {
+                  define ($varname, VAR_AUTOMAKE, '', $_, "@result",
+                          '', $where, VAR_PRETTY);
+                }
             }
+          set_seen $varname;
         }
        return "\$($varname)";
      },
index 91f017462500c5403d2e3f723142d25de3727270..07a58a90abbdfa8df36790de06412d20969162e6 100644 (file)
@@ -120,6 +120,7 @@ cond30.test \
 cond31.test \
 cond32.test \
 cond33.test \
+cond34.test \
 condd.test \
 condinc.test \
 condinc2.test \
index 75145f4582af7d4c5b06c4b306b2a6d094c78764..7df7cf0a66d681bd5484389e6e15e2612998131f 100644 (file)
@@ -235,6 +235,7 @@ cond30.test \
 cond31.test \
 cond32.test \
 cond33.test \
+cond34.test \
 condd.test \
 condinc.test \
 condinc2.test \
diff --git a/tests/cond34.test b/tests/cond34.test
new file mode 100755 (executable)
index 0000000..4f71656
--- /dev/null
@@ -0,0 +1,72 @@
+#!/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 for _DEPDENDENCIES definition with conditional _LDADD.
+# Report from Elena A. Vengerova
+
+. ./defs
+
+set -e
+
+cat >>configure.in <<'EOF'
+AM_CONDITIONAL([TWO], test -n "$two")
+AC_PROG_CC
+AC_OUTPUT
+EOF
+
+cat >>Makefile.am <<'EOF'
+OBJEXT=z
+
+bin_PROGRAMS = test1 test2
+
+if TWO
+  test1_LDADD = two.$(OBJEXT)
+  test2_LDADD = two.$(OBJEXT)
+  test2_DEPENDENCIES = $(test2_LDADD) somethingelse.a
+else !TWO
+  test1_LDADD = one.$(OBJEXT)
+  test2_LDADD = three.$(OBJEXT)
+endif !TWO
+
+test1_DEPENDENCIES = $(test1_LDADD) somethingelse.a
+
+dep-test1:
+       echo BEG: $(test1_DEPENDENCIES) :END
+dep-test2:
+       echo BEG: $(test2_DEPENDENCIES) :END
+
+EOF
+
+:> test.c
+
+$ACLOCAL
+$AUTOCONF
+$AUTOMAKE
+./configure
+$MAKE dep-test1 >out
+grep 'BEG: one.z somethingelse.a :END' out
+$MAKE dep-test2 >out
+grep 'BEG: three.z :END' out
+
+./configure two=2
+$MAKE dep-test1 >out
+grep 'BEG: two.z somethingelse.a :END' out
+$MAKE dep-test2 >out
+grep 'BEG: two.z somethingelse.a :END' out
This page took 0.046531 seconds and 5 git commands to generate.