]> git.ipfire.org Git - thirdparty/make.git/commitdiff
Check if the target-specific variable is the same as the global
authorPaul Smith <psmith@gnu.org>
Tue, 30 Nov 2010 14:48:52 +0000 (14:48 +0000)
committerPaul Smith <psmith@gnu.org>
Tue, 30 Nov 2010 14:48:52 +0000 (14:48 +0000)
variable, and if so don't try to update it.  Savannah bug #31743.

ChangeLog
doc/make.texi
read.c
tests/scripts/features/targetvars

index fdcb106fa6e0da91bbd405303b943c775bf35465..1b95ae27d1b3f5945a1a232bea378b2aea4f3585 100644 (file)
--- 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.
index 4d089aaa29935960d73a6594fe573d30acc30182..aa36e574be01a84e673e268429ba467cd563df22 100644 (file)
@@ -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 7b5b0dd0a7b63aacbbdde7a794afe16bab3f6c60..761e9763b60efc78881a9ec0be943feaf1727fd9 100644 (file)
--- 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);
index 6afd48aaa4e95eabb15343ca57d53421037476ba..a9b8dbebc413af519a1dd85b4b2f3606acc555eb 100644 (file)
@@ -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!