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
Open
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
43 changes: 43 additions & 0 deletions build.c
Original file line number Diff line number Diff line change
Expand Up @@ -146,6 +146,49 @@ computedirty(struct edge *e, struct node *newest)
}
}

void
buildupdate(struct node *n)
Copy link
Owner

Choose a reason for hiding this comment

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

I wonder if we could reuse even more code here by passing input and output nodes as parameters to a helper function

{
struct edge *e;
struct node *newest;
size_t i;

e = n->gen;
if (e->flags & FLAG_CYCLE)
fatal("dependency cycle involving '%s'", n->path->s);
e->flags |= FLAG_CYCLE | FLAG_WORK;
for (i = e->outdynidx; i < e->nout; ++i) {
n = e->out[i];
if (n->mtime == MTIME_UNKNOWN) {
n->dirty = false;
nodestat(n);
}
}
newest = NULL;
for (i = e->indynidx; i < e->inorderidx; ++i) {
n = e->in[i];
buildadd(n);
if (i < e->inorderidx) {
if (n->dirty)
e->flags |= FLAG_DIRTY_IN;
if (n->mtime != MTIME_MISSING && !isnewer(newest, n))
newest = n;
}
if (n->dirty || (n->gen && n->gen->nblock > 0))
++e->nblock;
}
computedirty(e, newest);
if (!(e->flags & FLAG_DIRTY_OUT))
e->nprune = e->nblock;
if (!(e->flags & FLAG_DIRTY_OUT))
e->nprune = e->nblock;
if (e->flags & FLAG_DIRTY) {
if (e->nblock == 0)
queue(e);
}
e->flags &= ~FLAG_CYCLE;
}

void
buildadd(struct node *n)
{
Expand Down
2 changes: 2 additions & 0 deletions build.h
Original file line number Diff line number Diff line change
Expand Up @@ -12,5 +12,7 @@ extern struct buildoptions buildopts;
void buildreset(void);
/* schedule a particular target to be built */
void buildadd(struct node *);
/* reschedule a particular target to be built */
void buildupdate(struct node *);
/* execute rules to build the scheduled targets */
void build(void);