make(1): add more debugging for searching transformation rules

This commit is contained in:
rillig 2020-11-22 21:34:34 +00:00
parent 6bfc267595
commit 3c2d904d39
5 changed files with 40 additions and 30 deletions

View File

@ -1,4 +1,4 @@
/* $NetBSD: make.h,v 1.213 2020/11/22 10:48:11 rillig Exp $ */
/* $NetBSD: make.h,v 1.214 2020/11/22 21:34:34 rillig Exp $ */
/*
* Copyright (c) 1988, 1989, 1990, 1993
@ -279,7 +279,8 @@ typedef enum GNodeType {
* this node will be saved on the .END node instead, to be executed at
* the very end. */
OP_SAVE_CMDS = 1 << 25,
/* Already processed by Suff_FindDeps */
/* Already processed by Suff_FindDeps, to find dependencies from suffix
* transformation rules. */
OP_DEPS_FOUND = 1 << 24,
/* Node found while expanding .ALLSRC */
OP_MARK = 1 << 23,

View File

@ -1,4 +1,4 @@
/* $NetBSD: suff.c,v 1.300 2020/11/22 20:29:53 rillig Exp $ */
/* $NetBSD: suff.c,v 1.301 2020/11/22 21:34:34 rillig Exp $ */
/*
* Copyright (c) 1988, 1989, 1990, 1993
@ -114,7 +114,7 @@
#include "dir.h"
/* "@(#)suff.c 8.4 (Berkeley) 3/21/94" */
MAKE_RCSID("$NetBSD: suff.c,v 1.300 2020/11/22 20:29:53 rillig Exp $");
MAKE_RCSID("$NetBSD: suff.c,v 1.301 2020/11/22 21:34:34 rillig Exp $");
#define SUFF_DEBUG0(text) DEBUG0(SUFF, text)
#define SUFF_DEBUG1(fmt, arg1) DEBUG1(SUFF, fmt, arg1)
@ -893,8 +893,10 @@ CandidateList_PrintAddrs(CandidateList *list)
{
CandidateListNode *ln;
for (ln = list->first; ln != NULL; ln = ln->next)
debug_printf(" %p", ln->datum);
for (ln = list->first; ln != NULL; ln = ln->next) {
Candidate *cand = ln->datum;
debug_printf(" %p:%s", cand, cand->file);
}
debug_printf("\n");
}
#endif
@ -929,8 +931,8 @@ CandidateList_Add(CandidateList *list, char *srcName, Candidate *targ,
#ifdef DEBUG_SRC
Lst_Append(targ->childrenList, cand);
debug_printf("%s add suff %p candidate %p to list %p:",
debug_tag, targ, cand, list);
debug_printf("%s add suff %p:%s candidate %p:%s to list %p:",
debug_tag, targ, targ->file, cand, cand->file, list);
CandidateList_PrintAddrs(list);
#endif
}
@ -988,8 +990,8 @@ RemoveCandidate(CandidateList *srcs)
src->parent->numChildren--;
}
#ifdef DEBUG_SRC
debug_printf("free: list %p src %p children %d\n",
srcs, src, src->numChildren);
debug_printf("free: list %p src %p:%s children %d\n",
srcs, src, src->file, src->numChildren);
Lst_Free(src->childrenList);
#endif
Lst_Remove(srcs, ln);
@ -998,8 +1000,8 @@ RemoveCandidate(CandidateList *srcs)
}
#ifdef DEBUG_SRC
else {
debug_printf("keep: list %p src %p children %d:",
srcs, src, src->numChildren);
debug_printf("keep: list %p src %p:%s children %d:",
srcs, src, src->file, src->numChildren);
CandidateList_PrintAddrs(src->childrenList);
}
#endif
@ -1026,7 +1028,8 @@ FindThem(CandidateList *srcs, CandidateList *slst)
*/
if (Targ_FindNode(src->file) != NULL) {
#ifdef DEBUG_SRC
debug_printf("remove from list %p src %p\n", srcs, src);
debug_printf("remove from list %p src %p:%s\n",
srcs, src, src->file);
#endif
retsrc = src;
break;
@ -1037,7 +1040,8 @@ FindThem(CandidateList *srcs, CandidateList *slst)
if (file != NULL) {
retsrc = src;
#ifdef DEBUG_SRC
debug_printf("remove from list %p src %p\n", srcs, src);
debug_printf("remove from list %p src %p:%s\n",
srcs, src, src->file);
#endif
free(file);
break;
@ -1119,7 +1123,8 @@ FindCmds(Candidate *targ, CandidateList *slst)
ret = Candidate_New(bmake_strdup(sgn->name), targ->prefix, suff, targ, sgn);
targ->numChildren++;
#ifdef DEBUG_SRC
debug_printf("3 add targ %p ret %p\n", targ, ret);
debug_printf("3 add targ %p:%s ret %p:%s\n",
targ, targ->file, ret, ret->file);
Lst_Append(targ->childrenList, ret);
#endif
Lst_Append(slst, ret);
@ -1741,6 +1746,10 @@ FindDepsRegular(GNode *gn, CandidateList *slst)
const char *name = gn->name;
size_t nameLen = strlen(name);
#ifdef DEBUG_SRC
DEBUG1(SUFF, "FindDepsRegular \"%s\"\n", gn->name);
#endif
/*
* Begin at the beginning...
*/
@ -1918,9 +1927,9 @@ sfnd_return:
/* Find implicit sources for the target.
*
* Nodes are added to the graph below the passed-in node. The nodes are
* marked to have their IMPSRC variable filled in. The PREFIX variable is set
* for the given node and all its implied children.
* Nodes are added to the graph as children of the passed-in node. The nodes
* are marked to have their IMPSRC variable filled in. The PREFIX variable
* is set for the given node and all its implied children.
*
* The path found by this target is the shortest path in the transformation
* graph, which may pass through non-existent targets, to an existing target.
@ -1957,7 +1966,7 @@ FindDeps(GNode *gn, CandidateList *slst)
Var_Set(TARGET, GNode_Path(gn), gn);
Var_Set(PREFIX, gn->name, gn);
SUFF_DEBUG1("SuffFindDeps (%s)\n", gn->name);
SUFF_DEBUG1("SuffFindDeps \"%s\"\n", gn->name);
if (gn->type & OP_ARCHV)
FindDepsArchive(gn, slst);

View File

@ -26,16 +26,16 @@ ParseDoDependency(.DEFAULT:)
ParseReadLine (24): ' : Making ${.TARGET} from ${.IMPSRC} all ${.ALLSRC} by default.'
transformation .DEFAULT complete
Wildcard expanding "all"...
SuffFindDeps (all)
SuffFindDeps "all"
No known suffix on all. Using .NULL suffix
adding suffix rules
Wildcard expanding "suff-incomplete.c"...suffix is ".c"...
SuffFindDeps (suff-incomplete.c)
SuffFindDeps "suff-incomplete.c"
trying suff-incomplete.a...not there
Wildcard expanding "suff-incomplete.c"...suffix is ".c"...
: Making suff-incomplete.c from suff-incomplete.c all by default.
Wildcard expanding "all"...
SuffFindDeps (.END)
SuffFindDeps ".END"
No known suffix on .END. Using .NULL suffix
adding suffix rules
Wildcard expanding ".END"...

View File

@ -42,11 +42,11 @@ Adding suffix ".dead-end"
inserting ".dead-end" (6) at end of list
inserting ".short" (4) at end of list
Wildcard expanding "all"...
SuffFindDeps (all)
SuffFindDeps "all"
No known suffix on all. Using .NULL suffix
adding suffix rules
Wildcard expanding "suff-lookup.cc"...suffix is ".cc"...
SuffFindDeps (suff-lookup.cc)
SuffFindDeps "suff-lookup.cc"
trying suff-lookup.ccc...not there
trying suff-lookup.c...not there
trying suff-lookup.short...not there
@ -57,14 +57,14 @@ SuffFindDeps (suff-lookup.cc)
suffix is ".ccc"...
suffix is ".c"...
suffix is ".sho"...
SuffFindDeps (suff-lookup.sho)
SuffFindDeps "suff-lookup.sho"
suffix is ".sho"...
: 'Making suff-lookup.sho out of nothing.'
: 'Making suff-lookup.c from suff-lookup.sho.'
: 'Making suff-lookup.ccc from suff-lookup.c.'
: 'Making suff-lookup.cc from suff-lookup.ccc.'
Wildcard expanding "all"...
SuffFindDeps (.END)
SuffFindDeps ".END"
No known suffix on .END. Using .NULL suffix
adding suffix rules
Wildcard expanding ".END"...

View File

@ -35,14 +35,14 @@ transformation .c complete
ParseDoDependency(.SUFFIXES: .c .b .a)
Adding ".END" to all targets.
Wildcard expanding "all"...
SuffFindDeps (all)
SuffFindDeps "all"
No known suffix on all. Using .NULL suffix
adding suffix rules
trying all.c...not there
trying all.b...not there
trying all.a...not there
Wildcard expanding "suff-rebuild-example"...
SuffFindDeps (suff-rebuild-example)
SuffFindDeps "suff-rebuild-example"
No known suffix on suff-rebuild-example. Using .NULL suffix
adding suffix rules
trying suff-rebuild-example.c...not there
@ -56,14 +56,14 @@ Adding "suff-rebuild-example.c" to all targets.
suffix is ".c"...
suffix is ".b"...
suffix is ".a"...
SuffFindDeps (suff-rebuild-example.a)
SuffFindDeps "suff-rebuild-example.a"
suffix is ".a"...
: Making suff-rebuild-example.a out of nothing.
: Making suff-rebuild-example.b from suff-rebuild-example.a.
: Making suff-rebuild-example.c from suff-rebuild-example.b.
: Making suff-rebuild-example from suff-rebuild-example.c.
Wildcard expanding "all"...
SuffFindDeps (.END)
SuffFindDeps ".END"
No known suffix on .END. Using .NULL suffix
adding suffix rules
trying .END.c...not there