diff options
author | Paul Smith <psmith@gnu.org> | 2003-05-02 01:44:59 +0000 |
---|---|---|
committer | Paul Smith <psmith@gnu.org> | 2003-05-02 01:44:59 +0000 |
commit | 1a5beef51f5c32081116e502c1c90a3e32813020 (patch) | |
tree | 5cf133d3615d2674df02234f6d5708d22175a67d /read.c | |
parent | 652234e967b825478d0b756a65353f252adf73d3 (diff) | |
download | gunmake-1a5beef51f5c32081116e502c1c90a3e32813020.tar.gz |
- Fix bug #1405: allow multiple pattern-specific variables to match a target.
- Fix some uncleanliness about the implementation of patterns-specific vars.
- Some enhancements to the OS/2 port.
Diffstat (limited to 'read.c')
-rw-r--r-- | read.c | 36 |
1 files changed, 20 insertions, 16 deletions
@@ -1667,9 +1667,9 @@ record_target_var (struct nameseq *filenames, char *defn, int two_colon, { struct variable *v; register char *name = filenames->name; - struct variable_set_list *vlist; char *fname; char *percent; + struct pattern_var *p; nextf = filenames->next; free ((char *) filenames); @@ -1679,11 +1679,13 @@ record_target_var (struct nameseq *filenames, char *defn, int two_colon, percent = find_percent (name); if (percent) { - struct pattern_var *p; - /* Get a reference for this pattern-specific variable struct. */ - p = create_pattern_var(name, percent); - vlist = p->vars; + p = create_pattern_var (name, percent); + p->variable.fileinfo = *flocp; + v = parse_variable_definition (&p->variable, defn); + v->value = xstrdup (v->value); + if (!v) + error (flocp, _("Malformed pattern-specific variable definition")); fname = p->target; } else @@ -1701,15 +1703,17 @@ record_target_var (struct nameseq *filenames, char *defn, int two_colon, f = f->double_colon; initialize_file_variables (f, 1); - vlist = f->variables; fname = f->name; + + current_variable_set_list = f->variables; + v = try_variable_definition (flocp, defn, origin, 1); + if (!v) + error (flocp, _("Malformed target-specific variable definition")); + current_variable_set_list = global; } - /* Make the new variable context current and define the variable. */ - current_variable_set_list = vlist; - v = try_variable_definition (flocp, defn, origin, 1); - if (!v) - error (flocp, _("Malformed per-target variable definition")); + /* Set up the variable to be *-specific. */ + v->origin = origin; v->per_target = 1; if (exported) v->export = v_export; @@ -1721,12 +1725,14 @@ record_target_var (struct nameseq *filenames, char *defn, int two_colon, struct variable *gv; int len = strlen(v->name); - current_variable_set_list = global; gv = lookup_variable (v->name, len); if (gv && (gv->origin == o_env_override || gv->origin == o_command)) { - v = define_variable_in_set (v->name, len, gv->value, gv->origin, - gv->recursive, vlist->set, flocp); + if (v->value != 0) + free (v->value); + v->value = xstrdup (gv->value); + v->origin = gv->origin; + v->recursive = gv->recursive; v->append = 0; } } @@ -1735,8 +1741,6 @@ record_target_var (struct nameseq *filenames, char *defn, int two_colon, if (name != fname && (name < fname || name > fname + strlen (fname))) free (name); } - - current_variable_set_list = global; } /* Record a description line for files FILENAMES, |