version 1.93, 2018/10/06 14:00:30 |
version 1.94, 2018/10/08 19:52:53 |
|
|
|
|
static void SuffInsert(Lst, Suff *); |
static void SuffInsert(Lst, Suff *); |
static void SuffAddSrc(void *, void *); |
static void SuffAddSrc(void *, void *); |
static bool SuffRemoveSrc(Lst); |
static int SuffRemoveSrc(Lst); |
static void SuffAddLevel(Lst, Src *); |
static void SuffAddLevel(Lst, Src *); |
static Src *SuffFindThem(Lst, Lst); |
static Src *SuffFindThem(Lst, Lst); |
static Src *SuffFindCmds(Src *, Lst); |
static Src *SuffFindCmds(Src *, Lst); |
|
|
/*- |
/*- |
*---------------------------------------------------------------------- |
*---------------------------------------------------------------------- |
* SuffRemoveSrc -- |
* SuffRemoveSrc -- |
* Free Src structure with a zero reference count in a list |
* Free all src structures in list that don't have a reference count |
* |
* |
* returns true if a src was removed |
* Results: |
|
* Ture if an src was removed |
|
* |
|
* Side Effects: |
|
* The memory is free'd. |
*---------------------------------------------------------------------- |
*---------------------------------------------------------------------- |
*/ |
*/ |
static bool |
static int |
SuffRemoveSrc(Lst l) |
SuffRemoveSrc(Lst l) |
{ |
{ |
LstNode ln; |
LstNode ln; |
Src *s; |
Src *s; |
|
int t = 0; |
|
|
#ifdef DEBUG_SRC |
#ifdef DEBUG_SRC |
printf("cleaning %lx: ", (unsigned long)l); |
printf("cleaning %lx: ", (unsigned long)l); |
|
|
#endif |
#endif |
Lst_Remove(l, ln); |
Lst_Remove(l, ln); |
free(s); |
free(s); |
|
t |= 1; |
return true; |
return true; |
} |
} |
#ifdef DEBUG_SRC |
#ifdef DEBUG_SRC |
|
|
#endif |
#endif |
} |
} |
|
|
return false; |
return t; |
} |
} |
|
|
/*- |
/*- |
|
|
Src *src; /* General Src pointer */ |
Src *src; /* General Src pointer */ |
char *prefix; /* Prefix to use */ |
char *prefix; /* Prefix to use */ |
Src *targ; /* General Src target pointer */ |
Src *targ; /* General Src target pointer */ |
bool phony; |
|
|
|
phony = (gn->type & OP_PHONY) == OP_PHONY; |
|
|
|
Lst_Init(&srcs); |
Lst_Init(&srcs); |
Lst_Init(&targs); |
Lst_Init(&targs); |
|
|
* Should we find one, we discard the one we found before. */ |
* Should we find one, we discard the one we found before. */ |
|
|
|
|
if (!phony) |
record_possible_suffixes(gn, &srcs, &targs); |
record_possible_suffixes(gn, &srcs, &targs); |
|
/* Handle target of unknown suffix... */ |
/* Handle target of unknown suffix... */ |
if (!phony && Lst_IsEmpty(&srcs)) { |
if (Lst_IsEmpty(&srcs)) { |
if (DEBUG(SUFF)) |
if (DEBUG(SUFF)) |
printf("\tNo known suffix on %s. Using empty suffix\n", |
printf("\tNo known suffix on %s. Using empty suffix\n", |
gn->name); |
gn->name); |
|
|
|
|
/* Only use the default suffix rules if we don't have commands |
/* Only use the default suffix rules if we don't have commands |
* or dependencies defined for this gnode. */ |
* or dependencies defined for this gnode. */ |
if (Lst_IsEmpty(&gn->commands)) |
if (Lst_IsEmpty(&gn->commands) && Lst_IsEmpty(&gn->children)) |
SuffAddLevel(&srcs, targ); |
SuffAddLevel(&srcs, targ); |
else { |
else { |
if (DEBUG(SUFF)) |
if (DEBUG(SUFF)) |