diff options
Diffstat (limited to 'usr.bin/make/suff.c')
| -rw-r--r-- | usr.bin/make/suff.c | 108 |
1 files changed, 32 insertions, 76 deletions
diff --git a/usr.bin/make/suff.c b/usr.bin/make/suff.c index 5da296c81e78..e6665dadec13 100644 --- a/usr.bin/make/suff.c +++ b/usr.bin/make/suff.c @@ -414,25 +414,19 @@ SuffInsert (l, s) } Lst_Close (l); - if (DEBUG(SUFF)) { - printf("inserting %s(%d)...", s->name, s->sNum); - } + DEBUGF(SUFF, "inserting %s(%d)...", s->name, s->sNum); if (ln == NULL) { - if (DEBUG(SUFF)) { - printf("at end of list\n"); - } + DEBUGF(SUFF, "at end of list\n"); (void)Lst_AtEnd (l, (void *)s); s->refCount++; (void)Lst_AtEnd(s->ref, (void *) l); } else if (s2->sNum != s->sNum) { - if (DEBUG(SUFF)) { - printf("before %s(%d)\n", s2->name, s2->sNum); - } + DEBUGF(SUFF, "before %s(%d)\n", s2->name, s2->sNum); (void)Lst_Insert (l, ln, (void *)s); s->refCount++; (void)Lst_AtEnd(s->ref, (void *) l); - } else if (DEBUG(SUFF)) { - printf("already there\n"); + } else { + DEBUGF(SUFF, "already there\n"); } } @@ -625,10 +619,8 @@ Suff_AddTransform (line) /* * link the two together in the proper relationship and order */ - if (DEBUG(SUFF)) { - printf("defining transformation from `%s' to `%s'\n", - s->name, t->name); - } + DEBUGF(SUFF, "defining transformation from `%s' to `%s'\n", + s->name, t->name); SuffInsert (t->children, s); SuffInsert (s->parents, t); @@ -666,10 +658,8 @@ Suff_EndTransform(gnp, dummy) (void)SuffParseTransform(gn->name, &s, &t); - if (DEBUG(SUFF)) { - printf("deleting transformation from `%s' to `%s'\n", - s->name, t->name); - } + DEBUGF(SUFF, "deleting transformation from `%s' to `%s'\n", + s->name, t->name); /* * Remove the source from the target's children list. We check for a @@ -685,8 +675,8 @@ Suff_EndTransform(gnp, dummy) * Remove the target from the source's parents list */ SuffRemove(s->parents, t); - } else if ((gn->type & OP_TRANSFORM) && DEBUG(SUFF)) { - printf("transformation %s complete\n", gn->name); + } else if (gn->type & OP_TRANSFORM) { + DEBUGF(SUFF, "transformation %s complete\n", gn->name); } return(dummy ? 0 : 0); @@ -1160,9 +1150,7 @@ SuffFindThem (srcs, slst) while (!Lst_IsEmpty (srcs)) { s = (Src *) Lst_DeQueue (srcs); - if (DEBUG(SUFF)) { - printf ("\ttrying %s...", s->file); - } + DEBUGF(SUFF, "\ttrying %s...", s->file); /* * A file is considered to exist if either a node exists in the @@ -1185,16 +1173,14 @@ SuffFindThem (srcs, slst) break; } - if (DEBUG(SUFF)) { - printf ("not there\n"); - } + DEBUGF(SUFF, "not there\n"); SuffAddLevel (srcs, s); Lst_AtEnd(slst, (void *) s); } - if (DEBUG(SUFF) && rs) { - printf ("got it\n"); + if (rs) { + DEBUGF(SUFF, "got it\n"); } return (rs); } @@ -1280,9 +1266,7 @@ SuffFindCmds (targ, slst) Lst_AtEnd(targ->cp, (void *) ret); #endif Lst_AtEnd(slst, (void *) ret); - if (DEBUG(SUFF)) { - printf ("\tusing existing source %s\n", s->name); - } + DEBUGF(SUFF, "\tusing existing source %s\n", s->name); return (ret); } } @@ -1333,9 +1317,7 @@ SuffExpandChildren(cgnp, pgnp) * the children list. */ if (strchr(cgn->name, '$') != (char *)NULL) { - if (DEBUG(SUFF)) { - printf("Expanding \"%s\"...", cgn->name); - } + DEBUGF(SUFF, "Expanding \"%s\"...", cgn->name); cp = Var_Subst(NULL, cgn->name, pgn, TRUE); if (cp != (char *)NULL) { @@ -1424,9 +1406,7 @@ SuffExpandChildren(cgnp, pgnp) while(!Lst_IsEmpty(members)) { gn = (GNode *)Lst_DeQueue(members); - if (DEBUG(SUFF)) { - printf("%s...", gn->name); - } + DEBUGF(SUFF, "%s...", gn->name); if (Lst_Member(pgn->children, (void *)gn) == NULL) { (void)Lst_Append(pgn->children, prevLN, (void *)gn); prevLN = Lst_Succ(prevLN); @@ -1447,9 +1427,7 @@ SuffExpandChildren(cgnp, pgnp) ln = Lst_Member(pgn->children, (void *)cgn); pgn->unmade--; Lst_Remove(pgn->children, ln); - if (DEBUG(SUFF)) { - printf("\n"); - } + DEBUGF(SUFF, "\n"); } else if (Dir_HasWildcards(cgn->name)) { Lst exp; /* List of expansions */ Lst path; /* Search path along which to expand */ @@ -1465,16 +1443,12 @@ SuffExpandChildren(cgnp, pgnp) cp = cgn->name + strlen(cgn->name); ln = Lst_Find(sufflist, (void *)cp, SuffSuffIsSuffixP); - if (DEBUG(SUFF)) { - printf("Wildcard expanding \"%s\"...", cgn->name); - } + DEBUGF(SUFF, "Wildcard expanding \"%s\"...", cgn->name); if (ln != NULL) { Suff *s = (Suff *)Lst_Datum(ln); - if (DEBUG(SUFF)) { - printf("suffix is \"%s\"...", s->name); - } + DEBUGF(SUFF, "suffix is \"%s\"...", s->name); path = s->searchPath; } else { /* @@ -1495,9 +1469,7 @@ SuffExpandChildren(cgnp, pgnp) */ cp = (char *)Lst_DeQueue(exp); - if (DEBUG(SUFF)) { - printf("%s...", cp); - } + DEBUGF(SUFF, "%s...", cp); gn = Targ_FindNode(cp, TARG_CREATE); /* @@ -1524,9 +1496,7 @@ SuffExpandChildren(cgnp, pgnp) ln = Lst_Member(pgn->children, (void *)cgn); pgn->unmade--; Lst_Remove(pgn->children, ln); - if (DEBUG(SUFF)) { - printf("\n"); - } + DEBUGF(SUFF, "\n"); } return(0); @@ -1610,9 +1580,7 @@ SuffApplyTransform(tGn, sGn, t, s) gn = (GNode *)Lst_Datum(ln); - if (DEBUG(SUFF)) { - printf("\tapplying %s -> %s to \"%s\"\n", s->name, t->name, tGn->name); - } + DEBUGF(SUFF, "\tapplying %s -> %s to \"%s\"\n", s->name, t->name, tGn->name); /* * Record last child for expansion purposes @@ -1718,9 +1686,7 @@ SuffFindArchiveDeps(gn, slst) /* * Didn't know what it was -- use .NULL suffix if not in make mode */ - if (DEBUG(SUFF)) { - printf("using null suffix\n"); - } + DEBUGF(SUFF, "using null suffix\n"); ms = suffNull; } @@ -1749,10 +1715,8 @@ SuffFindArchiveDeps(gn, slst) /* * Got one -- apply it */ - if (!SuffApplyTransform(gn, mem, (Suff *)Lst_Datum(ln), ms) && - DEBUG(SUFF)) - { - printf("\tNo transformation from %s -> %s\n", + if (!SuffApplyTransform(gn, mem, (Suff *)Lst_Datum(ln), ms)) { + DEBUGF(SUFF, "\tNo transformation from %s -> %s\n", ms->name, ((Suff *)Lst_Datum(ln))->name); } } @@ -1895,9 +1859,7 @@ SuffFindNormalDeps(gn, slst) * Handle target of unknown suffix... */ if (Lst_IsEmpty(targs) && suffNull != NULL) { - if (DEBUG(SUFF)) { - printf("\tNo known suffix on %s. Using .NULL suffix\n", gn->name); - } + DEBUGF(SUFF, "\tNo known suffix on %s. Using .NULL suffix\n", gn->name); targ = (Src *)emalloc(sizeof (Src)); targ->file = estrdup(gn->name); @@ -1918,12 +1880,10 @@ SuffFindNormalDeps(gn, slst) if (Lst_IsEmpty(gn->commands) && Lst_IsEmpty(gn->children)) SuffAddLevel(srcs, targ); else { - if (DEBUG(SUFF)) - printf("not "); + DEBUGF(SUFF, "not "); } - if (DEBUG(SUFF)) - printf("adding suffix rules\n"); + DEBUGF(SUFF, "adding suffix rules\n"); (void)Lst_AtEnd(targs, (void *)targ); } @@ -1971,9 +1931,7 @@ SuffFindNormalDeps(gn, slst) Lst_ForEach(gn->children, SuffExpandChildren, (void *)gn); if (targ == NULL) { - if (DEBUG(SUFF)) { - printf("\tNo valid suffix on %s\n", gn->name); - } + DEBUGF(SUFF, "\tNo valid suffix on %s\n", gn->name); sfnd_abort: /* @@ -2216,9 +2174,7 @@ SuffFindDeps (gn, slst) gn->type |= OP_DEPS_FOUND; } - if (DEBUG(SUFF)) { - printf ("SuffFindDeps (%s)\n", gn->name); - } + DEBUGF(SUFF, "SuffFindDeps (%s)\n", gn->name); if (gn->type & OP_ARCHV) { SuffFindArchiveDeps(gn, slst); |
