Formerly variable.c.~2~

This commit is contained in:
Roland McGrath 1992-05-03 22:02:26 +00:00
parent fec655d5e9
commit b8d48ad379

View file

@ -1,5 +1,5 @@
/* Internals of variables for GNU Make. /* Internals of variables for GNU Make.
Copyright (C) 1988, 1989, 1990, 1991 Free Software Foundation, Inc. Copyright (C) 1988, 1989, 1990, 1991, 1992 Free Software Foundation, Inc.
This file is part of GNU Make. This file is part of GNU Make.
GNU Make is free software; you can redistribute it and/or modify GNU Make is free software; you can redistribute it and/or modify
@ -120,6 +120,7 @@ define_variable_in_set (name, length, value, origin, recursive, set)
v->origin = origin; v->origin = origin;
v->recursive = recursive; v->recursive = recursive;
v->expanding = 0; v->expanding = 0;
v->export = v_default;
v->next = set->table[hashval]; v->next = set->table[hashval];
set->table[hashval] = v; set->table[hashval] = v;
return v; return v;
@ -441,8 +442,6 @@ target_environment (file)
register unsigned nvariables; register unsigned nvariables;
char **result; char **result;
int noexport = enter_file (".NOEXPORT")->is_target;
/* Find the lowest number of buckets in any set in the list. */ /* Find the lowest number of buckets in any set in the list. */
s = file->variables; s = file->variables;
buckets = s->set->buckets; buckets = s->set->buckets;
@ -471,17 +470,12 @@ target_environment (file)
register struct variable_bucket *ov; register struct variable_bucket *ov;
register char *p = v->name; register char *p = v->name;
/* If `.NOEXPORT' was specified, only export command-line and switch (v->export)
environment variables. This is a temporary (very ugly) hack {
until I fix this problem the right way in version 4. Ick. */ case v_default:
if (noexport if (v->origin != o_command
&& (v->origin != o_command
&& v->origin != o_env && v->origin != o_env_override && v->origin != o_env && v->origin != o_env_override
&& !(v->origin == o_file && getenv (p) != 0))) && !(v->origin == o_file && getenv (p) != 0))
continue;
if (v->origin == o_default
|| streq (p, "MAKELEVEL"))
continue; continue;
if (*p != '_' && (*p < 'A' || *p > 'Z') if (*p != '_' && (*p < 'A' || *p > 'Z')
@ -494,6 +488,13 @@ target_environment (file)
if (*p != '\0') if (*p != '\0')
continue; continue;
case v_export:
break;
case v_noexport:
continue;
}
for (ov = table[j]; ov != 0; ov = ov->next) for (ov = table[j]; ov != 0; ov = ov->next)
if (streq (v->name, ov->variable->name)) if (streq (v->name, ov->variable->name))
break; break;
@ -542,9 +543,12 @@ target_environment (file)
Any whitespace around the "=" or ":=" is removed. The first form Any whitespace around the "=" or ":=" is removed. The first form
defines a variable that is recursively re-evaluated. The second form defines a variable that is recursively re-evaluated. The second form
defines a variable whose value is variable-expanded at the time of defines a variable whose value is variable-expanded at the time of
definition and then is evaluated only once at the time of expansion. */ definition and then is evaluated only once at the time of expansion.
int If a variable was defined, a pointer to its `struct variable' is returned.
If not, NULL is returned. */
struct variable *
try_variable_definition (line, origin) try_variable_definition (line, origin)
char *line; char *line;
enum variable_origin origin; enum variable_origin origin;
@ -586,10 +590,9 @@ try_variable_definition (line, origin)
--end; --end;
p = next_token (p); p = next_token (p);
(void) define_variable (beg, end - beg, recursive ? p : variable_expand (p), return define_variable (beg, end - beg,
recursive ? p : variable_expand (p),
origin, recursive); origin, recursive);
return 1;
} }
/* Print information for variable V, prefixing it with PREFIX. */ /* Print information for variable V, prefixing it with PREFIX. */