Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

dyndep support #48

Open
wants to merge 13 commits into
base: master
Choose a base branch
from
55 changes: 32 additions & 23 deletions build.c
Original file line number Diff line number Diff line change
Expand Up @@ -115,13 +115,43 @@ queue(struct edge *e)
*front = e;
}

static void
computedirty(struct edge *e, struct node *newest)
{
struct node *n;
size_t i;
bool generator, restat;

/* all outputs are dirty if any are older than the newest input */
generator = edgevarbool(e, "generator");
restat = edgevarbool(e, "restat");
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just checking, does ninja treat set-but-empty generator and restat as false?

for (i = 0; i < e->nout && !(e->flags & FLAG_DIRTY_OUT); ++i) {
n = e->out[i];
if (isdirty(n, newest, generator, restat)) {
n->dirty = true;
e->flags |= FLAG_DIRTY_OUT;
}
}
if (e->flags & FLAG_DIRTY) {
for (i = 0; i < e->nout; ++i) {
n = e->out[i];
if (buildopts.explain && !n->dirty) {
if (e->flags & FLAG_DIRTY_IN)
warn("explain %s: input is dirty", n->path->s);
else if (e->flags & FLAG_DIRTY_OUT)
warn("explain %s: output of generating action is dirty", n->path->s);
}
n->dirty = true;
}
}
}

void
buildadd(struct node *n)
{
struct edge *e;
struct node *newest;
size_t i;
bool generator, restat;

e = n->gen;
if (!e) {
Expand Down Expand Up @@ -158,28 +188,7 @@ buildadd(struct node *n)
if (n->dirty || (n->gen && n->gen->nblock > 0))
++e->nblock;
}
/* all outputs are dirty if any are older than the newest input */
generator = edgevar(e, "generator", true);
restat = edgevar(e, "restat", true);
for (i = 0; i < e->nout && !(e->flags & FLAG_DIRTY_OUT); ++i) {
n = e->out[i];
if (isdirty(n, newest, generator, restat)) {
n->dirty = true;
e->flags |= FLAG_DIRTY_OUT;
}
}
if (e->flags & FLAG_DIRTY) {
for (i = 0; i < e->nout; ++i) {
n = e->out[i];
if (buildopts.explain && !n->dirty) {
if (e->flags & FLAG_DIRTY_IN)
warn("explain %s: input is dirty", n->path->s);
else if (e->flags & FLAG_DIRTY_OUT)
warn("explain %s: output of generating action is dirty", n->path->s);
}
n->dirty = true;
}
}
computedirty(e, newest);
if (!(e->flags & FLAG_DIRTY_OUT))
e->nprune = e->nblock;
if (e->flags & FLAG_DIRTY) {
Expand Down