void mk(char *target) { Node *node; int did = 0; nproc(); /* it can be updated dynamically */ nrep(); /* it can be updated dynamically */ runerrs = 0; node = graph(target); if(DEBUG(D_GRAPH)){ dumpn("new target\n", node); Bflush(&bout); } clrmade(node); while(node->flags&NOTMADE){ if(work(node, (Node *)0, (Arc *)0)) did = 1; /* found something to do */ else { if(waitup(1, (int *)0) > 0){ if(node->flags&(NOTMADE|BEINGMADE)){ assert(/*must be run errors*/ runerrs); break; /* nothing more waiting */ } } } } if(node->flags&BEINGMADE) waitup(-1, (int *)0); while(jobs) waitup(-2, (int *)0); assert(/*target didnt get done*/ runerrs || (node->flags&MADE)); if(did == 0) Bprint(&bout, "mk: '%s' is up to date\n", node->name); }
static void append(Flattenctx *s, Node *n) { if (debugopt['F']) dumpn(n, stdout); lappend(&s->stmts, &s->nstmts, n); }
void dumpa(char *s, Arc *a) { char buf[1024]; Bprint(&bout, "%sArc@%p: n=%p r=%p flag=0x%x stem='%s'", s, a, a->n, a->r, a->flag, a->stem); if(a->prog) Bprint(&bout, " prog='%s'", a->prog); Bprint(&bout, "\n"); if(a->n){ snprint(buf, sizeof(buf), "%s ", (*s == ' ')? s:""); dumpn(buf, a->n); } }