summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorpsmith <>2010-11-30 14:48:52 +0000
committerpsmith <>2010-11-30 14:48:52 +0000
commit4690ebb2c38de40759e65567e5b4de1e4846a09a (patch)
treef8e91850df80b6d378542d48be5040d1b60e02f1
parent19a994a3b1beedd9f770675a8d323a6c64508254 (diff)
downloadmake-4690ebb2c38de40759e65567e5b4de1e4846a09a.tar.gz
Check if the target-specific variable is the same as the global
variable, and if so don't try to update it. Savannah bug #31743.
-rw-r--r--ChangeLog5
-rw-r--r--doc/make.texi12
-rw-r--r--read.c3
-rw-r--r--tests/scripts/features/targetvars10
4 files changed, 23 insertions, 7 deletions
diff --git a/ChangeLog b/ChangeLog
index fdcb106f..1b95ae27 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,8 @@
+2010-11-28 Paul Smith <psmith@gnu.org>
+
+ * read.c (record_target_var): Don't reset v if it's the same as
+ the global version. Fixes Savannah bug #31743.
+
2010-11-06 Paul Smith <psmith@gnu.org>
* variable.c (print_auto_variable): Print auto variables; ignore others.
diff --git a/doc/make.texi b/doc/make.texi
index e5fe6b85..723e1c79 100644
--- a/doc/make.texi
+++ b/doc/make.texi
@@ -4,7 +4,7 @@
@include version.texi
@set EDITION 0.71
-@set RCSID $Id: make.texi,v 1.68 2010/11/06 21:56:25 psmith Exp $
+@set RCSID $Id: make.texi,v 1.69 2010/11/30 14:48:53 psmith Exp $
@settitle GNU @code{make}
@setchapternewpage odd
@@ -31,7 +31,7 @@ Copyright @copyright{} 1988, 1989, 1990, 1991, 1992, 1993, 1994, 1995,
@quotation
Permission is granted to copy, distribute and/or modify this document
-under the terms of the GNU Free Documentation License, Version 1.2 or
+under the terms of the GNU Free Documentation License, Version 1.3 or
any later version published by the Free Software Foundation; with no
Invariant Sections, with the Front-Cover Texts being ``A GNU Manual,''
and with the Back-Cover Texts as in (a) below. A copy of the
@@ -4295,10 +4295,10 @@ recipes, is propagated to the subsystem.@refill
Variable values of the top-level @code{make} can be passed to the
sub-@code{make} through the environment by explicit request. These
-variables are defined in the sub-@code{make} as defaults, but do not
-override what is specified in the makefile used by the sub-@code{make}
-makefile unless you use the @samp{-e} switch (@pxref{Options Summary,
-,Summary of Options}).@refill
+variables are defined in the sub-@code{make} as defaults, but they do
+not override variables defined in the makefile used by
+the sub-@code{make} unless you use the @samp{-e} switch (@pxref{Options
+Summary, ,Summary of Options}).@refill
To pass down, or @dfn{export}, a variable, @code{make} adds the
variable and its value to the environment for running each line of the
diff --git a/read.c b/read.c
index 7b5b0dd0..761e9763 100644
--- a/read.c
+++ b/read.c
@@ -1802,7 +1802,8 @@ record_target_var (struct nameseq *filenames, char *defn,
int len = strlen(v->name);
gv = lookup_variable (v->name, len);
- if (gv && (gv->origin == o_env_override || gv->origin == o_command))
+ if (gv && v != gv
+ && (gv->origin == o_env_override || gv->origin == o_command))
{
if (v->value != 0)
free (v->value);
diff --git a/tests/scripts/features/targetvars b/tests/scripts/features/targetvars
index 6afd48aa..a9b8dbeb 100644
--- a/tests/scripts/features/targetvars
+++ b/tests/scripts/features/targetvars
@@ -237,6 +237,16 @@ a: ; @echo "$(FOO)"
run_make_test(undef, 'FOO=C', "C f1\n");
+# TEST #19: Conditional variables with command-line settings
+
+run_make_test('
+a: FOO ?= f1
+a: ; @echo "$(FOO)"
+',
+ '', "f1\n");
+
+run_make_test(undef, 'FOO=C', "C\n");
+
# TEST #20: Check for continuation after semicolons
run_make_test(q!