From 0ddf0df13c298fc48548d32cc8fca04ef190093d Mon Sep 17 00:00:00 2001 From: Roland McGrath Date: Mon, 13 May 1996 18:40:28 +0000 Subject: [PATCH] Sun May 12 19:19:43 1996 Aaron Digulla * 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() --- variable.c | 32 ++++++++++++++++++++++++++++++-- 1 file changed, 30 insertions(+), 2 deletions(-) diff --git a/variable.c b/variable.c index 12cfcc49..65b9cccc 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);