version 1.3, 1996/09/02 16:04:14 |
version 1.4, 1996/11/30 21:09:00 |
|
|
/* $OpenBSD$ */ |
/* $OpenBSD$ */ |
/* $NetBSD: make.c,v 1.9 1996/08/30 23:21:10 christos Exp $ */ |
/* $NetBSD: make.c,v 1.10 1996/11/06 17:59:15 christos Exp $ */ |
|
|
/* |
/* |
* Copyright (c) 1988, 1989, 1990 The Regents of the University of California. |
* Copyright (c) 1988, 1989, 1990, 1993 |
* Copyright (c) 1988, 1989 by Adam de Boor |
* The Regents of the University of California. All rights reserved. |
* Copyright (c) 1989 by Berkeley Softworks |
* Copyright (c) 1989 by Berkeley Softworks |
* All rights reserved. |
* All rights reserved. |
* |
* |
|
|
|
|
#ifndef lint |
#ifndef lint |
#if 0 |
#if 0 |
static char sccsid[] = "@(#)make.c 5.3 (Berkeley) 6/1/90"; |
static char sccsid[] = "@(#)make.c 8.1 (Berkeley) 6/6/93"; |
static char rcsid[] = "$NetBSD: make.c,v 1.8 1996/03/15 21:52:37 christos Exp $"; |
|
#else |
#else |
static char rcsid[] = "$OpenBSD$"; |
static char rcsid[] = "$OpenBSD$"; |
#endif |
#endif |
|
|
*----------------------------------------------------------------------- |
*----------------------------------------------------------------------- |
* Make_TimeStamp -- |
* Make_TimeStamp -- |
* Set the cmtime field of a parent node based on the mtime stamp in its |
* Set the cmtime field of a parent node based on the mtime stamp in its |
* child. Called from MakeOODate via Lst_ForEach. |
* child. Called from MakeOODate via Lst_ForEach. |
* |
* |
* Results: |
* Results: |
* Always returns 0. |
* Always returns 0. |
* |
* |
* Side Effects: |
* Side Effects: |
* The cmtime of the parent node will be changed if the mtime |
* The cmtime of the parent node will be changed if the mtime |
|
|
* will have been recreated. |
* will have been recreated. |
* |
* |
* Results: |
* Results: |
* TRUE if the node is out of date. FALSE otherwise. |
* TRUE if the node is out of date. FALSE otherwise. |
* |
* |
* Side Effects: |
* Side Effects: |
* The mtime field of the node and the cmtime field of its parents |
* The mtime field of the node and the cmtime field of its parents |
|
|
printf(".USE node..."); |
printf(".USE node..."); |
} |
} |
oodate = FALSE; |
oodate = FALSE; |
} else if (gn->type & OP_LIB) { |
} else if ((gn->type & OP_LIB) && Arch_IsLib(gn)) { |
if (DEBUG(MAKE)) { |
if (DEBUG(MAKE)) { |
printf("library..."); |
printf("library..."); |
} |
} |
|
|
*/ |
*/ |
(void) Lst_Concat (pgn->commands, cgn->commands, LST_CONCNEW); |
(void) Lst_Concat (pgn->commands, cgn->commands, LST_CONCNEW); |
} |
} |
|
|
if (Lst_Open (cgn->children) == SUCCESS) { |
if (Lst_Open (cgn->children) == SUCCESS) { |
while ((ln = Lst_Next (cgn->children)) != NILLNODE) { |
while ((ln = Lst_Next (cgn->children)) != NILLNODE) { |
gn = (GNode *)Lst_Datum (ln); |
gn = (GNode *)Lst_Datum (ln); |
|
|
} |
} |
Lst_Close (cgn->children); |
Lst_Close (cgn->children); |
} |
} |
|
|
pgn->type |= cgn->type & ~(OP_OPMASK|OP_USE|OP_TRANSFORM); |
pgn->type |= cgn->type & ~(OP_OPMASK|OP_USE|OP_TRANSFORM); |
|
|
/* |
/* |
|
|
* Make_Update -- |
* Make_Update -- |
* Perform update on the parents of a node. Used by JobFinish once |
* Perform update on the parents of a node. Used by JobFinish once |
* a node has been dealt with and by MakeStartJobs if it finds an |
* a node has been dealt with and by MakeStartJobs if it finds an |
* up-to-date node. |
* up-to-date node. |
* |
* |
* Results: |
* Results: |
* Always returns 0 |
* Always returns 0 |
|
|
} |
} |
#endif |
#endif |
} |
} |
|
|
if (Lst_Open (cgn->parents) == SUCCESS) { |
if (Lst_Open (cgn->parents) == SUCCESS) { |
while ((ln = Lst_Next (cgn->parents)) != NILLNODE) { |
while ((ln = Lst_Next (cgn->parents)) != NILLNODE) { |
pgn = (GNode *)Lst_Datum (ln); |
pgn = (GNode *)Lst_Datum (ln); |
|
|
(void)Lst_EnQueue(toBeMade, (ClientData)succ); |
(void)Lst_EnQueue(toBeMade, (ClientData)succ); |
} |
} |
} |
} |
|
|
/* |
/* |
* Set the .PREFIX and .IMPSRC variables for all the implied parents |
* Set the .PREFIX and .IMPSRC variables for all the implied parents |
* of this node. |
* of this node. |
|
|
MakeStartJobs () |
MakeStartJobs () |
{ |
{ |
register GNode *gn; |
register GNode *gn; |
|
|
while (!Job_Full() && !Lst_IsEmpty (toBeMade)) { |
while (!Job_Full() && !Lst_IsEmpty (toBeMade)) { |
gn = (GNode *) Lst_DeQueue (toBeMade); |
gn = (GNode *) Lst_DeQueue (toBeMade); |
if (DEBUG(MAKE)) { |
if (DEBUG(MAKE)) { |
|
|
continue; |
continue; |
} |
} |
} |
} |
|
|
numNodes--; |
numNodes--; |
if (Make_OODate (gn)) { |
if (Make_OODate (gn)) { |
if (DEBUG(MAKE)) { |
if (DEBUG(MAKE)) { |
|
|
*/ |
*/ |
Make_DoAllVar (gn); |
Make_DoAllVar (gn); |
} |
} |
|
|
Make_Update (gn); |
Make_Update (gn); |
} |
} |
} |
} |
|
|
|
|
examine = Lst_Duplicate(targs, NOCOPY); |
examine = Lst_Duplicate(targs, NOCOPY); |
numNodes = 0; |
numNodes = 0; |
|
|
/* |
/* |
* Make an initial downward pass over the graph, marking nodes to be made |
* Make an initial downward pass over the graph, marking nodes to be made |
* as we go down. We call Suff_FindDeps to find where a node is and |
* as we go down. We call Suff_FindDeps to find where a node is and |
* to get some children for it if it has none and also has no commands. |
* to get some children for it if it has none and also has no commands. |
* If the node is a leaf, we stick it on the toBeMade queue to |
* If the node is a leaf, we stick it on the toBeMade queue to |
* be looked at in a minute, otherwise we add its children to our queue |
* be looked at in a minute, otherwise we add its children to our queue |
* and go on about our business. |
* and go on about our business. |
*/ |
*/ |
while (!Lst_IsEmpty (examine)) { |
while (!Lst_IsEmpty (examine)) { |
gn = (GNode *) Lst_DeQueue (examine); |
gn = (GNode *) Lst_DeQueue (examine); |
|
|
if (!gn->make) { |
if (!gn->make) { |
gn->make = TRUE; |
gn->make = TRUE; |
numNodes++; |
numNodes++; |
|
|
/* |
/* |
* Apply any .USE rules before looking for implicit dependencies |
* Apply any .USE rules before looking for implicit dependencies |
* to make sure everything has commands that should... |
* to make sure everything has commands that should... |
|
|
} |
} |
} |
} |
} |
} |
|
|
Lst_Destroy (examine, NOFREE); |
Lst_Destroy (examine, NOFREE); |
|
|
if (queryFlag) { |
if (queryFlag) { |
|
|
* get started, nothing will happen since the remaining upward |
* get started, nothing will happen since the remaining upward |
* traversal of the graph is performed by the routines in job.c upon |
* traversal of the graph is performed by the routines in job.c upon |
* the finishing of a job. So we fill the Job table as much as we can |
* the finishing of a job. So we fill the Job table as much as we can |
* before going into our loop. |
* before going into our loop. |
*/ |
*/ |
(void) MakeStartJobs(); |
(void) MakeStartJobs(); |
} |
} |
|
|
*/ |
*/ |
errors = ((errors == 0) && (numNodes != 0)); |
errors = ((errors == 0) && (numNodes != 0)); |
Lst_ForEach(targs, MakePrintStatus, (ClientData) &errors); |
Lst_ForEach(targs, MakePrintStatus, (ClientData) &errors); |
|
|
return (TRUE); |
return (TRUE); |
} |
} |