[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Pattern Specific Variable Limitation

From: Matthew Von-Maszewski
Subject: Pattern Specific Variable Limitation
Date: Sun, 18 Mar 2001 18:00:29 -0500

Dear GNU,

I found a small, but in my case defeating, limitation with the Pattern
Specific Variable code.  The code finds the first match for a pattern, not
necessarily the most specific match.  Example:

akamai/% : CFLAGS = -DSHORT
akamai/utils/% : CFLAGS = -DLONG

Any rule with a target beginning with "akamai/" will match the first
pattern, including all targets in the "akamai/utils/" directory.  So all
targets with a path of "akamai/*" and "akamai/utils/*" get CFLAGS = -DSHORT.
This pretty much blew all of today.

[Note:  our usage has the two lines being defined separately in makefiles
that get included into a master make.  It is not possible to easily
guarantee the order of the lines since the user may start from any point in
the directory hierarchy.]

Below is the code I applied to rule.c in make-3.79.1.

Please let me know if you believe this to be a properly formed patch.
Normally I am a Windows programmer, so I might not have this too pretty.
The work was performed on a Linux box (config.h attached).

address@hidden make-3.79.1]$ diff rule.c rule.org
<   struct pattern_var *p, *best;
<   unsigned int bestlen, targlen = strlen(target);
<   best=0;
<   bestlen=0;
>   struct pattern_var *p;
>   unsigned int targlen = strlen(target);
<           && (*p->suffix == '\0' || streq (&p->suffix[1],
<         && p->len >= bestlen)
<       {
<         best=p;
<         bestlen=p->len;
<       }
>           && (*p->suffix == '\0' || streq (&p->suffix[1],
>         break;
<   return best;
>   return p;
address@hidden make-3.79.1]$

Matthew Von-Maszewski
 Director of Process and Software Quality Engineering

 work: 617-250-4669 - address@hidden
pager: 888-402-0573 - address@hidden
 cell: 617-780-5135

Attachment: config.h
Description: Binary data

reply via email to

[Prev in Thread] Current Thread [Next in Thread]