summaryrefslogtreecommitdiff
path: root/expand.c
diff options
context:
space:
mode:
authorPaul Smith <psmith@gnu.org>2002-05-10 03:15:07 +0000
committerPaul Smith <psmith@gnu.org>2002-05-10 03:15:07 +0000
commit9052b52dfc69d9567e2e664b0f096bfae535bcad (patch)
tree39e24d1a4d38996e5ffc42601d98d5b47289ee3f /expand.c
parent5dedf7be638113e65df4bab535386db212a0e812 (diff)
downloadgunmake-9052b52dfc69d9567e2e664b0f096bfae535bcad.tar.gz
Fix Debian bug #144306: pass target-specific variables into the environment
properly. Fix configure: allow cross-compilation; fix getloadavg (still needs _lots_ of work!) Let $(call ...) functions to be self-referencing. Lets us do transitive closures, for example.
Diffstat (limited to 'expand.c')
-rw-r--r--expand.c44
1 files changed, 22 insertions, 22 deletions
diff --git a/expand.c b/expand.c
index e397cf4..e32e289 100644
--- a/expand.c
+++ b/expand.c
@@ -95,16 +95,28 @@ initialize_variable_output ()
static char *allocated_variable_append PARAMS ((const struct variable *v));
char *
-recursively_expand (v)
- register struct variable *v;
+recursively_expand_for_file (v, file)
+ struct variable *v;
+ struct file *file;
{
char *value;
+ struct variable_set_list *save;
if (v->expanding)
- /* Expanding V causes infinite recursion. Lose. */
- fatal (reading_file,
- _("Recursive variable `%s' references itself (eventually)"),
- v->name);
+ {
+ if (!v->exp_count)
+ /* Expanding V causes infinite recursion. Lose. */
+ fatal (reading_file,
+ _("Recursive variable `%s' references itself (eventually)"),
+ v->name);
+ --v->exp_count;
+ }
+
+ if (file)
+ {
+ save = current_variable_set_list;
+ current_variable_set_list = file->variables;
+ }
v->expanding = 1;
if (v->append)
@@ -113,22 +125,10 @@ recursively_expand (v)
value = allocated_variable_expand (v->value);
v->expanding = 0;
- return value;
-}
+ if (file)
+ current_variable_set_list = save;
-/* Warn that NAME is an undefined variable. */
-
-#ifdef __GNUC__
-__inline
-#endif
-static void
-warn_undefined (name, length)
- char *name;
- unsigned int length;
-{
- if (warn_undefined_variables_flag)
- error (reading_file,
- _("warning: undefined variable `%.*s'"), (int)length, name);
+ return value;
}
/* Expand a simple reference to variable NAME, which is LENGTH chars long. */
@@ -280,7 +280,7 @@ variable_expand_string (line, string, length)
Is the resultant text a substitution reference? */
colon = lindex (beg, end, ':');
- if (colon != 0)
+ if (colon)
{
/* This looks like a substitution reference: $(FOO:A=B). */
char *subst_beg, *subst_end, *replace_beg, *replace_end;