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.
This commit is contained in:
Paul Smith 2010-11-30 14:48:52 +00:00
parent 391456aad7
commit ae2ab76fac
4 changed files with 22 additions and 6 deletions

View File

@ -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> 2010-11-06 Paul Smith <psmith@gnu.org>
* variable.c (print_auto_variable): Print auto variables; ignore others. * variable.c (print_auto_variable): Print auto variables; ignore others.

View File

@ -31,7 +31,7 @@ Copyright @copyright{} 1988, 1989, 1990, 1991, 1992, 1993, 1994, 1995,
@quotation @quotation
Permission is granted to copy, distribute and/or modify this document 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 any later version published by the Free Software Foundation; with no
Invariant Sections, with the Front-Cover Texts being ``A GNU Manual,'' 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 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 Variable values of the top-level @code{make} can be passed to the
sub-@code{make} through the environment by explicit request. These sub-@code{make} through the environment by explicit request. These
variables are defined in the sub-@code{make} as defaults, but do not variables are defined in the sub-@code{make} as defaults, but they do
override what is specified in the makefile used by the sub-@code{make} not override variables defined in the makefile used by
makefile unless you use the @samp{-e} switch (@pxref{Options Summary, the sub-@code{make} unless you use the @samp{-e} switch (@pxref{Options
,Summary of Options}).@refill Summary, ,Summary of Options}).@refill
To pass down, or @dfn{export}, a variable, @code{make} adds the 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 variable and its value to the environment for running each line of the

3
read.c
View File

@ -1802,7 +1802,8 @@ record_target_var (struct nameseq *filenames, char *defn,
int len = strlen(v->name); int len = strlen(v->name);
gv = lookup_variable (v->name, len); 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) if (v->value != 0)
free (v->value); free (v->value);

View File

@ -237,6 +237,16 @@ a: ; @echo "$(FOO)"
run_make_test(undef, 'FOO=C', "C f1\n"); 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 # TEST #20: Check for continuation after semicolons
run_make_test(q! run_make_test(q!