version 1.56, 2005/02/16 15:11:52 |
version 1.57, 2005/05/08 00:38:47 |
Line 122 static char meta[256]; |
|
Line 122 static char meta[256]; |
|
static GNode *curTarg = NILGNODE; |
static GNode *curTarg = NILGNODE; |
static GNode *ENDNode; |
static GNode *ENDNode; |
static void CompatInterrupt(int); |
static void CompatInterrupt(int); |
static int CompatMake(ClientData, ClientData); |
|
|
|
static void |
static void |
Compat_Init(void) |
Compat_Init(void) |
Line 176 CompatInterrupt(int signo) |
|
Line 175 CompatInterrupt(int signo) |
|
if (signo == SIGINT) { |
if (signo == SIGINT) { |
gn = Targ_FindNode(".INTERRUPT", TARG_NOCREATE); |
gn = Targ_FindNode(".INTERRUPT", TARG_NOCREATE); |
if (gn != NILGNODE) { |
if (gn != NILGNODE) { |
Lst_ForEach(gn->commands, CompatRunCommand, (ClientData)gn); |
Compat_Make(gn, gn); |
} |
} |
} |
} |
|
|
Line 433 CompatRunCommand(ClientData cmdp, Client |
|
Line 432 CompatRunCommand(ClientData cmdp, Client |
|
|
|
/*- |
/*- |
*----------------------------------------------------------------------- |
*----------------------------------------------------------------------- |
* CompatMake -- |
* Compat_Make -- |
* Make a target. |
* Make a target. |
* |
* |
* Input: |
* Input: |
Line 448 CompatRunCommand(ClientData cmdp, Client |
|
Line 447 CompatRunCommand(ClientData cmdp, Client |
|
* |
* |
*----------------------------------------------------------------------- |
*----------------------------------------------------------------------- |
*/ |
*/ |
static int |
int |
CompatMake(ClientData gnp, ClientData pgnp) |
Compat_Make(ClientData gnp, ClientData pgnp) |
{ |
{ |
GNode *gn = (GNode *) gnp; |
GNode *gn = (GNode *) gnp; |
GNode *pgn = (GNode *) pgnp; |
GNode *pgn = (GNode *) pgnp; |
|
|
|
if (!meta[0]) /* we came here from jobs */ |
|
Compat_Init(); |
if (gn->made == UNMADE && (gn == pgn || (pgn->type & OP_MADE) == 0)) { |
if (gn->made == UNMADE && (gn == pgn || (pgn->type & OP_MADE) == 0)) { |
/* |
/* |
* First mark ourselves to be made, then apply whatever transformations |
* First mark ourselves to be made, then apply whatever transformations |
Line 467 CompatMake(ClientData gnp, ClientData pg |
|
Line 468 CompatMake(ClientData gnp, ClientData pg |
|
gn->made = BEINGMADE; |
gn->made = BEINGMADE; |
if ((gn->type & OP_MADE) == 0) |
if ((gn->type & OP_MADE) == 0) |
Suff_FindDeps(gn); |
Suff_FindDeps(gn); |
Lst_ForEach(gn->children, CompatMake, (ClientData)gn); |
Lst_ForEach(gn->children, Compat_Make, (ClientData)gn); |
if ((gn->flags & REMAKE) == 0) { |
if ((gn->flags & REMAKE) == 0) { |
gn->made = ABORTED; |
gn->made = ABORTED; |
pgn->flags &= ~REMAKE; |
pgn->flags &= ~REMAKE; |
Line 597 CompatMake(ClientData gnp, ClientData pg |
|
Line 598 CompatMake(ClientData gnp, ClientData pg |
|
} |
} |
|
|
cohorts: |
cohorts: |
Lst_ForEach(gn->cohorts, CompatMake, pgnp); |
Lst_ForEach(gn->cohorts, Compat_Make, pgnp); |
return (0); |
return (0); |
} |
} |
|
|
Line 646 Compat_Run(Lst targs) |
|
Line 647 Compat_Run(Lst targs) |
|
if (!queryFlag) { |
if (!queryFlag) { |
gn = Targ_FindNode(".BEGIN", TARG_NOCREATE); |
gn = Targ_FindNode(".BEGIN", TARG_NOCREATE); |
if (gn != NILGNODE) { |
if (gn != NILGNODE) { |
Lst_ForEach(gn->commands, CompatRunCommand, (ClientData)gn); |
Compat_Make(gn, gn); |
if (gn->made == ERROR) { |
if (gn->made == ERROR) { |
PrintOnError("\n\nStop."); |
PrintOnError("\n\nStop."); |
exit(1); |
exit(1); |
Line 661 Compat_Run(Lst targs) |
|
Line 662 Compat_Run(Lst targs) |
|
Lst_Destroy(Make_ExpandUse(targs), NOFREE); |
Lst_Destroy(Make_ExpandUse(targs), NOFREE); |
|
|
/* |
/* |
* For each entry in the list of targets to create, call CompatMake on |
* For each entry in the list of targets to create, call Compat_Make on |
* it to create the thing. CompatMake will leave the 'made' field of gn |
* it to create the thing. Compat_Make will leave the 'made' field of gn |
* in one of several states: |
* in one of several states: |
* UPTODATE gn was already up-to-date |
* UPTODATE gn was already up-to-date |
* MADE gn was recreated successfully |
* MADE gn was recreated successfully |
Line 673 Compat_Run(Lst targs) |
|
Line 674 Compat_Run(Lst targs) |
|
errors = 0; |
errors = 0; |
while (!Lst_IsEmpty (targs)) { |
while (!Lst_IsEmpty (targs)) { |
gn = (GNode *) Lst_DeQueue(targs); |
gn = (GNode *) Lst_DeQueue(targs); |
CompatMake(gn, gn); |
Compat_Make(gn, gn); |
|
|
if (gn->made == UPTODATE) { |
if (gn->made == UPTODATE) { |
printf ("`%s' is up to date.\n", gn->name); |
printf ("`%s' is up to date.\n", gn->name); |
Line 687 Compat_Run(Lst targs) |
|
Line 688 Compat_Run(Lst targs) |
|
* If the user has defined a .END target, run its commands. |
* If the user has defined a .END target, run its commands. |
*/ |
*/ |
if (errors == 0) { |
if (errors == 0) { |
Lst_ForEach(ENDNode->commands, CompatRunCommand, (ClientData)gn); |
Compat_Make(ENDNode, ENDNode); |
if (gn->made == ERROR) { |
if (gn->made == ERROR) { |
PrintOnError("\n\nStop."); |
PrintOnError("\n\nStop."); |
exit(1); |
exit(1); |