7 char buf[BIGBLOCK], cwd[256];
12 Word head, ahead, lp, ln, *w, *ww, *aw;
18 for(a = node->prereqs; a; a = a->next)
22 no recipe? go to buggery!
25 if(!(node->flags&VIRTUAL) && !(node->flags&NORECIPE)){
26 if(getwd(cwd, sizeof cwd))
27 fprint(2, "mk: no recipe to make '%s' in directory %s\n", node->name, cwd);
29 fprint(2, "mk: no recipe to make '%s'\n", node->name);
32 if(strchr(node->name, '(') && node->time == 0)
37 if(!(node->flags&VIRTUAL))
40 Bprint(&bout, "no touch of virtual '%s'\n", node->name);
53 ww->next = newword(node->name);
54 aw->next = newword(node->name);
56 for(w = r->alltargets; w; w = w->next){
58 subst(aa->stem, w->s, buf, sizeof(buf));
60 strecpy(buf, buf + sizeof buf - 1, w->s);
61 aw->next = newword(buf);
63 if((s = symlook(buf, S_NODE, 0)) == 0)
64 continue; /* not a node we are interested in */
66 if(aflag == 0 && n->time) {
67 for(a = n->prereqs; a; a = a->next)
68 if(a->n && outofdate(n, a, 0))
73 ww->next = newword(buf);
75 if(n == node) continue;
80 for(n = node; n; n = n->next)
81 if((n->flags&READY) == 0)
84 gather the params for the job
86 lp.next = ln.next = 0;
87 for(n = node; n; n = n->next){
88 for(a = n->prereqs; a; a = a->next){
90 addw(&lp, a->n->name);
91 if(outofdate(n, a, 0)){
92 addw(&ln, a->n->name);
94 fprint(1, "%s(%ld) < %s(%ld)\n",
95 n->name, n->time, a->n->name, a->n->time);
99 fprint(1, "%s has no prerequisites\n",
103 MADESET(n, BEINGMADE);
105 /* print("lt=%s ln=%s lp=%s\n",wtos(head.next, ' '),wtos(ln.next, ' '),wtos(lp.next, ' '));/**/
106 run(newjob(r, node, aa->stem, aa->match, lp.next, ln.next, head.next, ahead.next));
111 addw(Word *w, char *s)
115 for(lw = w; w = w->next; lw = w){
116 if(strcmp(s, w->s) == 0)
119 lw->next = newword(s);