version 1.66, 2007/09/17 09:16:58 |
version 1.67, 2007/09/17 09:28:36 |
|
|
static int |
static int |
SuffSuffIsPrefix(void *s, const void *str) |
SuffSuffIsPrefix(void *s, const void *str) |
{ |
{ |
return SuffStrIsPrefix(((Suff *)s)->name, |
return SuffStrIsPrefix(((Suff *)s)->name, |
(const char *)str) == NULL ? 1 : 0; |
(const char *)str) == NULL ? 1 : 0; |
} |
} |
|
|
|
|
if (srcLn == NULL) |
if (srcLn == NULL) |
srcLn = Lst_FindConst(&sufflist, SuffSuffIsPrefix, str); |
srcLn = Lst_FindConst(&sufflist, SuffSuffIsPrefix, str); |
else |
else |
srcLn = Lst_FindFromConst(Lst_Succ(srcLn), |
srcLn = Lst_FindFromConst(Lst_Succ(srcLn), |
SuffSuffIsPrefix, str); |
SuffSuffIsPrefix, str); |
if (srcLn == NULL) { |
if (srcLn == NULL) { |
/* |
/* |
|
|
break; |
break; |
} |
} |
|
|
if ((ptr = Dir_FindFile(s->file, &s->suff->searchPath)) |
if ((ptr = Dir_FindFile(s->file, &s->suff->searchPath)) |
!= NULL) { |
!= NULL) { |
rs = s; |
rs = s; |
#ifdef DEBUG_SRC |
#ifdef DEBUG_SRC |
|
|
*/ |
*/ |
suff = (Suff *)Lst_Datum(ln2); |
suff = (Suff *)Lst_Datum(ln2); |
|
|
if (Lst_Member(&suff->parents, targ->suff) |
if (Lst_Member(&suff->parents, targ->suff) |
!= NULL) { |
!= NULL) { |
/* |
/* |
* Hot Damn! Create a new Src structure |
* Hot Damn! Create a new Src structure |
|
|
gn = (GNode *)Lst_Datum(ln); |
gn = (GNode *)Lst_Datum(ln); |
|
|
if (DEBUG(SUFF)) |
if (DEBUG(SUFF)) |
printf("\tapplying %s -> %s to \"%s\"\n", s->name, t->name, |
printf("\tapplying %s -> %s to \"%s\"\n", s->name, t->name, |
tGn->name); |
tGn->name); |
|
|
/* Record last child for expansion purposes. */ |
/* Record last child for expansion purposes. */ |
|
|
* the node is only a source (not on the lhs of a dependency |
* the node is only a source (not on the lhs of a dependency |
* operator or [XXX] it has neither children or commands). */ |
* operator or [XXX] it has neither children or commands). */ |
if (OP_NOP(gn->type) || |
if (OP_NOP(gn->type) || |
(Lst_IsEmpty(&gn->children) && |
(Lst_IsEmpty(&gn->children) && |
Lst_IsEmpty(&gn->commands))) { |
Lst_IsEmpty(&gn->commands))) { |
gn->path = Dir_FindFile(gn->name, |
gn->path = Dir_FindFile(gn->name, |
(targ == NULL ? defaultPath : |
(targ == NULL ? defaultPath : |
|
|
/* Suffix known for the thing -- trim |
/* Suffix known for the thing -- trim |
* the suffix off the path to form the |
* the suffix off the path to form the |
* proper .PREFIX variable. */ |
* proper .PREFIX variable. */ |
int savep = strlen(gn->path) - |
int savep = strlen(gn->path) - |
targ->suff->nameLen; |
targ->suff->nameLen; |
char savec; |
char savec; |
|
|
|
|
savec = gn->path[savep]; |
savec = gn->path[savep]; |
gn->path[savep] = '\0'; |
gn->path[savep] = '\0'; |
|
|
if ((ptr = strrchr(gn->path, '/')) |
if ((ptr = strrchr(gn->path, '/')) |
!= NULL) |
!= NULL) |
ptr++; |
ptr++; |
else |
else |
|
|
* the target has no known suffix. */ |
* the target has no known suffix. */ |
gn->suffix = NULL; |
gn->suffix = NULL; |
|
|
if ((ptr = strrchr(gn->path, '/')) |
if ((ptr = strrchr(gn->path, '/')) |
!= NULL) |
!= NULL) |
ptr++; |
ptr++; |
else |
else |
|
|
targ->node = Targ_FindNode(targ->file, TARG_CREATE); |
targ->node = Targ_FindNode(targ->file, TARG_CREATE); |
} |
} |
|
|
SuffApplyTransform(targ->node, src->node, targ->suff, |
SuffApplyTransform(targ->node, src->node, targ->suff, |
src->suff); |
src->suff); |
|
|
if (targ->node != gn) { |
if (targ->node != gn) { |
|
|
*/ |
*/ |
suffNull = s; |
suffNull = s; |
} else { |
} else { |
Parse_Error(PARSE_WARNING, |
Parse_Error(PARSE_WARNING, |
"Desired null suffix %s not defined.", name); |
"Desired null suffix %s not defined.", name); |
} |
} |
} |
} |