diff options
author | Paul Smith <psmith@gnu.org> | 1999-11-17 07:33:47 +0000 |
---|---|---|
committer | Paul Smith <psmith@gnu.org> | 1999-11-17 07:33:47 +0000 |
commit | ebb733c0f9ab045b6fd6245df2baf2e87463e1bc (patch) | |
tree | bf5d793b4cc99724673804160f2e5e73889da8cc /variable.c | |
parent | 3e26bde6dbc9a8a46d5a1a694e6810e689cbd25a (diff) | |
download | gunmake-ebb733c0f9ab045b6fd6245df2baf2e87463e1bc.tar.gz |
* Many cleanups and bugfixes.
* New handling of += in target-specific variables.
Diffstat (limited to 'variable.c')
-rw-r--r-- | variable.c | 16 |
1 files changed, 15 insertions, 1 deletions
@@ -678,10 +678,11 @@ target_environment (file) returned. */ struct variable * -try_variable_definition (flocp, line, origin) +try_variable_definition (flocp, line, origin, target_var) const struct floc *flocp; char *line; enum variable_origin origin; + int target_var; { register int c; register char *p = line; @@ -691,6 +692,7 @@ try_variable_definition (flocp, line, origin) f_simple, f_recursive, f_append, f_conditional } flavor = f_bogus; char *name, *expanded_name, *value, *alloc_value=NULL; struct variable *v; + int append = 0; while (1) { @@ -800,6 +802,16 @@ try_variable_definition (flocp, line, origin) value = p; break; case f_append: + /* If we have += but we're in a target variable context, defer the + append until the context expansion. */ + if (target_var) + { + append = 1; + flavor = f_recursive; + value = p; + break; + } + /* An appending variable definition "var += value". Extract the old value and append the new one. */ v = lookup_variable (expanded_name, strlen (expanded_name)); @@ -939,6 +951,8 @@ try_variable_definition (flocp, line, origin) v = define_variable (expanded_name, strlen (expanded_name), value, origin, flavor == f_recursive); + v->append = append; + if (alloc_value) free (alloc_value); free (expanded_name); |