summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRoland McGrath <roland@redhat.com>1996-05-13 18:40:28 +0000
committerRoland McGrath <roland@redhat.com>1996-05-13 18:40:28 +0000
commit0ddf0df13c298fc48548d32cc8fca04ef190093d (patch)
tree67fc80eee3baa9500c78e0cb5c9701c8a2d9cbb4
parentb4dcc6f6bddcd050404effffd3b753e22930358e (diff)
downloadgunmake-0ddf0df13c298fc48548d32cc8fca04ef190093d.tar.gz
Sun May 12 19:19:43 1996 Aaron Digulla <digulla@fh-konstanz.de>
* main.c: (main), variable.c Changed handling of ENV-vars. Make stores now the names of the variables only and reads their contents when they are accessed to reflect that these variables are really global (ie. they CAN change WHILE make runs !) This handling is made in lookup_variable() * variable.c: Handling of ENV variable happens inside lookup_variable()
-rw-r--r--variable.c32
1 files changed, 30 insertions, 2 deletions
diff --git a/variable.c b/variable.c
index 12cfcc4..65b9ccc 100644
--- a/variable.c
+++ b/variable.c
@@ -1,5 +1,5 @@
/* Internals of variables for GNU Make.
-Copyright (C) 1988, 89, 90, 91, 92, 93, 94 Free Software Foundation, Inc.
+Copyright (C) 1988, 89, 90, 91, 92, 93, 94, 96 Free Software Foundation, Inc.
This file is part of GNU Make.
GNU Make is free software; you can redistribute it and/or modify
@@ -366,7 +366,7 @@ define_automatic_variables ()
? "" : remote_description);
(void) define_variable ("MAKE_VERSION", 12, buf, o_default, 0);
-
+
/* This won't override any definition, but it
will provide one if there isn't one there. */
v = define_variable ("SHELL", 5, default_shell, o_default, 0);
@@ -611,6 +611,34 @@ try_variable_definition (filename, lineno, line, origin)
flavor = append;
break;
}
+ else if (c == '$')
+ {
+ /* This might begin a variable expansion reference. Make sure we
+ don't misrecognize chars inside the reference as =, := or +=. */
+ char closeparen;
+ int count;
+ c = *p++;
+ if (c == '(')
+ closeparen = ')';
+ else if (c == '{')
+ closeparen = '}';
+ else
+ continue; /* Nope. */
+
+ /* P now points past the opening paren or brace.
+ Count parens or braces until it is matched. */
+ count = 0;
+ for (; *p != '\0'; ++p)
+ {
+ if (*p == c)
+ ++count;
+ else if (*p == closeparen && --count < 0)
+ {
+ ++p;
+ break;
+ }
+ }
+ }
}
beg = next_token (line);