-/* $OpenBSD: compat.c,v 1.7 1997/04/21 08:37:49 deraadt Exp $ */
-/* $NetBSD: compat.c,v 1.18 1997/03/28 22:31:22 christos Exp $ */
+/* $OpenBSD: compat.c,v 1.8 1997/04/28 01:52:36 millert Exp $ */
+/* $NetBSD: compat.c,v 1.14 1996/11/06 17:59:01 christos Exp $ */
/*
* Copyright (c) 1988, 1989, 1990 The Regents of the University of California.
#if 0
static char sccsid[] = "@(#)compat.c 8.2 (Berkeley) 3/19/94";
#else
-static char rcsid[] = "$OpenBSD: compat.c,v 1.7 1997/04/21 08:37:49 deraadt Exp $";
+static char rcsid[] = "$OpenBSD: compat.c,v 1.8 1997/04/28 01:52:36 millert Exp $";
#endif
#endif /* not lint */
gn->made = UPTODATE;
}
- if (gn->made == UNMADE) {
+ if (gn->type & OP_USE) {
+ Make_HandleUse(gn, pgn);
+ } else if (gn->made == UNMADE) {
/*
* First mark ourselves to be made, then apply whatever transformations
* the suffix module thinks are necessary. Once that's done, we can
}
}
- /*
- * Expand .USE nodes right now, because they can modify the structure
- * of the tree.
- */
- Lst_Destroy(Make_ExpandUse(targs), NOFREE);
-
/*
* For each entry in the list of targets to create, call CompatMake on
* it to create the thing. CompatMake will leave the 'made' field of gn
-/* $OpenBSD: make.c,v 1.5 1997/04/01 07:28:17 millert Exp $ */
-/* $NetBSD: make.c,v 1.14 1997/03/28 22:31:21 christos Exp $ */
+/* $OpenBSD: make.c,v 1.6 1997/04/28 01:52:38 millert Exp $ */
+/* $NetBSD: make.c,v 1.10 1996/11/06 17:59:15 christos Exp $ */
/*
* Copyright (c) 1988, 1989, 1990, 1993
#if 0
static char sccsid[] = "@(#)make.c 8.1 (Berkeley) 6/6/93";
#else
-static char rcsid[] = "$OpenBSD: make.c,v 1.5 1997/04/01 07:28:17 millert Exp $";
+static char rcsid[] = "$OpenBSD: make.c,v 1.6 1997/04/28 01:52:38 millert Exp $";
#endif
#endif /* not lint */
*
* Make_HandleUse See if a child is a .USE node for a parent
* and perform the .USE actions if so.
- *
- * Make_ExpandUse Expand .USE nodes and return the new list of
- * targets.
*/
#include "make.h"
* TRUE, there's a cycle in the graph */
static int MakeAddChild __P((ClientData, ClientData));
-static int MakeFindChild __P((ClientData, ClientData));
static int MakeAddAllSrc __P((ClientData, ClientData));
static int MakeTimeStamp __P((ClientData, ClientData));
static int MakeHandleUse __P((ClientData, ClientData));
return (0);
}
\f
-/*-
- *-----------------------------------------------------------------------
- * MakeFindChild --
- * Function used by Make_Run to find the pathname of a child
- * that was already made.
- *
- * Results:
- * Always returns 0
- *
- * Side Effects:
- * The path and mtime of the node and the cmtime of the parent are
- * updated
- *-----------------------------------------------------------------------
- */
-static int
-MakeFindChild (gnp, pgnp)
- ClientData gnp; /* the node to find */
- ClientData pgnp;
-{
- GNode *gn = (GNode *) gnp;
- GNode *pgn = (GNode *) pgnp;
-
- (void) Dir_MTime(gn);
- if (pgn->cmtime < gn->mtime)
- pgn->cmtime = gn->mtime;
- gn->made = UPTODATE;
-
- return (0);
-}
-\f
/*-
*-----------------------------------------------------------------------
* Make_HandleUse --
register GNode *cgn; /* The .USE node */
register GNode *pgn; /* The target of the .USE node */
{
+ register GNode *gn; /* A child of the .USE node */
register LstNode ln; /* An element in the children list */
if (cgn->type & (OP_USE|OP_TRANSFORM)) {
if (Lst_Open (cgn->children) == SUCCESS) {
while ((ln = Lst_Next (cgn->children)) != NILLNODE) {
- register GNode *tgn, *gn = (GNode *)Lst_Datum (ln);
-
- /*
- * Expand variables in the .USE node's name
- * and save the unexpanded form.
- * We don't need to do this for commands.
- * They get expanded properly when we execute.
- */
- if (gn->uname == NULL) {
- gn->uname = gn->name;
- } else {
- if (gn->name)
- free(gn->name);
- }
- gn->name = Var_Subst(NULL, gn->uname, pgn, FALSE);
- if (gn->name && gn->uname && strcmp(gn->name, gn->uname) != 0) {
- /* See if we have a target for this node. */
- tgn = Targ_FindNode(gn->name, TARG_NOCREATE);
- if (tgn != NILGNODE)
- gn = tgn;
- }
+ gn = (GNode *)Lst_Datum (ln);
if (Lst_Member (pgn->children, gn) == NILLNODE) {
(void) Lst_AtEnd (pgn->children, gn);
* children the parent has. This is used by Make_Run to decide
* whether to queue the parent or examine its children...
*/
- if ((cgn->type & OP_USE) &&
- (ln = Lst_Member (pgn->children, (ClientData) cgn)) != NILLNODE) {
- Lst_Remove(pgn->children, ln);
+ if (cgn->type & OP_USE) {
pgn->unmade--;
}
}
/*-
*-----------------------------------------------------------------------
- * Make_ExpandUse --
- * Expand .USE nodes and create a new targets list
+ * Make_Run --
+ * Initialize the nodes to remake and the list of nodes which are
+ * ready to be made by doing a breadth-first traversal of the graph
+ * starting from the nodes in the given list. Once this traversal
+ * is finished, all the 'leaves' of the graph are in the toBeMade
+ * queue.
+ * Using this queue and the Job module, work back up the graph,
+ * calling on MakeStartJobs to keep the job table as full as
+ * possible.
+ *
* Results:
- * The new list of targets.
+ * TRUE if work was done. FALSE otherwise.
*
* Side Effects:
- * numNodes is set to the number of elements in the list of targets.
+ * The make field of all nodes involved in the creation of the given
+ * targets is set to 1. The toBeMade list is set to contain all the
+ * 'leaves' of these subgraphs.
*-----------------------------------------------------------------------
*/
-Lst
-Make_ExpandUse (targs)
+Boolean
+Make_Run (targs)
Lst targs; /* the initial list of targets */
{
register GNode *gn; /* a temporary pointer */
register Lst examine; /* List of targets to examine */
- register Lst ntargs; /* List of new targets to be made */
+ int errors; /* Number of errors the Job module reports */
- ntargs = Lst_Init (FALSE);
+ toBeMade = Lst_Init (FALSE);
examine = Lst_Duplicate(targs, NOCOPY);
numNodes = 0;
/*
* Apply any .USE rules before looking for implicit dependencies
* to make sure everything has commands that should...
- * Make sure that the TARGET is set, so that we can make
- * expansions.
*/
- Var_Set (TARGET, gn->name, gn);
Lst_ForEach (gn->children, MakeHandleUse, (ClientData)gn);
Suff_FindDeps (gn);
- if (gn->unmade != 0 && (gn->type & OP_MADE) == 0) {
+ if (gn->unmade != 0) {
Lst_ForEach (gn->children, MakeAddChild, (ClientData)examine);
} else {
- (void)Lst_EnQueue (ntargs, (ClientData)gn);
- if (gn->type & OP_MADE)
- Lst_ForEach (gn->children, MakeFindChild, (ClientData)gn);
+ (void)Lst_EnQueue (toBeMade, (ClientData)gn);
}
}
}
Lst_Destroy (examine, NOFREE);
- return (ntargs);
-}
-
-/*-
- *-----------------------------------------------------------------------
- * Make_Run --
- * Initialize the nodes to remake and the list of nodes which are
- * ready to be made by doing a breadth-first traversal of the graph
- * starting from the nodes in the given list. Once this traversal
- * is finished, all the 'leaves' of the graph are in the toBeMade
- * queue.
- * Using this queue and the Job module, work back up the graph,
- * calling on MakeStartJobs to keep the job table as full as
- * possible.
- *
- * Results:
- * TRUE if work was done. FALSE otherwise.
- *
- * Side Effects:
- * The make field of all nodes involved in the creation of the given
- * targets is set to 1. The toBeMade list is set to contain all the
- * 'leaves' of these subgraphs.
- *-----------------------------------------------------------------------
- */
-Boolean
-Make_Run (targs)
- Lst targs; /* the initial list of targets */
-{
- int errors; /* Number of errors the Job module reports */
-
- toBeMade = Make_ExpandUse (targs);
if (queryFlag) {
/*
-/* $OpenBSD: parse.c,v 1.13 1997/04/01 07:28:21 millert Exp $ */
+/* $OpenBSD: parse.c,v 1.14 1997/04/28 01:52:40 millert Exp $ */
/* $NetBSD: parse.c,v 1.29 1997/03/10 21:20:04 christos Exp $ */
/*
#if 0
static char sccsid[] = "@(#)parse.c 8.3 (Berkeley) 3/19/94";
#else
-static char rcsid[] = "$OpenBSD: parse.c,v 1.13 1997/04/01 07:28:21 millert Exp $";
+static char rcsid[] = "$OpenBSD: parse.c,v 1.14 1997/04/28 01:52:40 millert Exp $";
#endif
#endif /* not lint */
Lst
Parse_MainName()
{
- Lst main; /* result list */
+ Lst listmain; /* result list */
- main = Lst_Init (FALSE);
+ listmain = Lst_Init (FALSE);
if (mainNode == NILGNODE) {
Punt ("no target to make.");
/*NOTREACHED*/
} else if (mainNode->type & OP_DOUBLEDEP) {
- (void) Lst_AtEnd (main, (ClientData)mainNode);
- Lst_Concat(main, mainNode->cohorts, LST_CONCNEW);
+ (void) Lst_AtEnd (listmain, (ClientData)mainNode);
+ Lst_Concat(listmain, mainNode->cohorts, LST_CONCNEW);
}
else
- (void) Lst_AtEnd (main, (ClientData)mainNode);
- return (main);
+ (void) Lst_AtEnd (listmain, (ClientData)mainNode);
+ return (listmain);
}