summaryrefslogtreecommitdiff
path: root/rule.c
diff options
context:
space:
mode:
authorPaul Smith <psmith@gnu.org>2003-05-02 01:44:59 +0000
committerPaul Smith <psmith@gnu.org>2003-05-02 01:44:59 +0000
commit1a5beef51f5c32081116e502c1c90a3e32813020 (patch)
tree5cf133d3615d2674df02234f6d5708d22175a67d /rule.c
parent652234e967b825478d0b756a65353f252adf73d3 (diff)
downloadgunmake-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 'rule.c')
-rw-r--r--rule.c100
1 files changed, 0 insertions, 100 deletions
diff --git a/rule.c b/rule.c
index 1d4a089..77451cc 100644
--- a/rule.c
+++ b/rule.c
@@ -51,14 +51,6 @@ unsigned int max_pattern_deps;
unsigned int max_pattern_dep_length;
-/* Chain of all pattern-specific variables. */
-
-static struct pattern_var *pattern_vars;
-
-/* Pointer to last struct in the chain, so we can add onto the end. */
-
-static struct pattern_var *last_pattern_var;
-
/* Pointer to structure for the file .SUFFIXES
whose dependencies are the suffixes to be searched. */
@@ -537,76 +529,6 @@ create_pattern_rule (char **targets, char **target_percents,
r->terminal = terminal;
}
-/* Create a new pattern-specific variable struct. */
-
-struct pattern_var *
-create_pattern_var (char *target, char *suffix)
-{
- register struct pattern_var *p = 0;
- unsigned int len = strlen(target);
-
- /* Look to see if this pattern already exists in the list. */
- for (p = pattern_vars; p != NULL; p = p->next)
- if (p->len == len && !strcmp(p->target, target))
- break;
-
- if (p == 0)
- {
- p = (struct pattern_var *) xmalloc (sizeof (struct pattern_var));
- if (last_pattern_var != 0)
- last_pattern_var->next = p;
- else
- pattern_vars = p;
- last_pattern_var = p;
- p->next = 0;
- p->target = target;
- p->len = len;
- p->suffix = suffix + 1;
- p->vars = create_new_variable_set();
- }
-
- return p;
-}
-
-/* Look up a target in the pattern-specific variable list. */
-
-struct pattern_var *
-lookup_pattern_var (char *target)
-{
- struct pattern_var *p;
- unsigned int targlen = strlen(target);
-
- for (p = pattern_vars; p != 0; p = p->next)
- {
- char *stem;
- unsigned int stemlen;
-
- if (p->len > targlen)
- /* It can't possibly match. */
- continue;
-
- /* From the lengths of the filename and the pattern parts,
- find the stem: the part of the filename that matches the %. */
- stem = target + (p->suffix - p->target - 1);
- stemlen = targlen - p->len + 1;
-
- /* Compare the text in the pattern before the stem, if any. */
- if (stem > target && !strneq (p->target, target, stem - target))
- continue;
-
- /* Compare the text in the pattern after the stem, if any.
- We could test simply using streq, but this way we compare the
- first two characters immediately. This saves time in the very
- common case where the first character matches because it is a
- period. */
- if (*p->suffix == stem[stemlen]
- && (*p->suffix == '\0' || streq (&p->suffix[1], &stem[stemlen+1])))
- break;
- }
-
- return p;
-}
-
/* Print the data base of rules. */
static void /* Useful to call from gdb. */
@@ -678,26 +600,4 @@ print_rule_data_base (void)
fatal (NILF, _("BUG: num_pattern_rules wrong! %u != %u"),
num_pattern_rules, rules);
}
-
- puts (_("\n# Pattern-specific variable values"));
-
- {
- struct pattern_var *p;
-
- rules = 0;
- for (p = pattern_vars; p != 0; p = p->next)
- {
- ++rules;
-
- printf ("\n%s :\n", p->target);
- print_variable_set (p->vars->set, "# ");
- }
-
- if (rules == 0)
- puts (_("\n# No pattern-specific variable values."));
- else
- {
- printf (_("\n# %u pattern-specific variable values"), rules);
- }
- }
}