From: millert Date: Mon, 28 Apr 1997 01:52:36 +0000 (+0000) Subject: Back out newer .USE code as it caused problems. I've done a "make build" X-Git-Url: http://artulab.com/gitweb/?a=commitdiff_plain;h=8ee12ded8efbf181a32f6b12f72322589b8a6119;p=openbsd Back out newer .USE code as it caused problems. I've done a "make build" without problems and the problem Theo saw before is gone. --- diff --git a/usr.bin/make/compat.c b/usr.bin/make/compat.c index 207aa9f7458..bd547ee6871 100644 --- a/usr.bin/make/compat.c +++ b/usr.bin/make/compat.c @@ -1,5 +1,5 @@ -/* $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. @@ -43,7 +43,7 @@ #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 */ @@ -372,7 +372,9 @@ CompatMake (gnp, pgnp) 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 @@ -631,12 +633,6 @@ Compat_Run(targs) } } - /* - * 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 diff --git a/usr.bin/make/make.c b/usr.bin/make/make.c index f84b75d756f..6d6bffad38b 100644 --- a/usr.bin/make/make.c +++ b/usr.bin/make/make.c @@ -1,5 +1,5 @@ -/* $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 @@ -43,7 +43,7 @@ #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 */ @@ -77,9 +77,6 @@ static char rcsid[] = "$OpenBSD: make.c,v 1.5 1997/04/01 07:28:17 millert Exp $" * * 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" @@ -97,7 +94,6 @@ static int numNodes; /* Number of nodes to be processed. If this * 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)); @@ -307,36 +303,6 @@ MakeAddChild (gnp, lp) return (0); } -/*- - *----------------------------------------------------------------------- - * 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); -} - /*- *----------------------------------------------------------------------- * Make_HandleUse -- @@ -365,6 +331,7 @@ Make_HandleUse (cgn, pgn) 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)) { @@ -378,27 +345,7 @@ Make_HandleUse (cgn, pgn) 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); @@ -418,9 +365,7 @@ Make_HandleUse (cgn, pgn) * 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--; } } @@ -863,24 +808,34 @@ MakePrintStatus(gnp, cyclep) /*- *----------------------------------------------------------------------- - * 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; @@ -903,55 +858,19 @@ Make_ExpandUse (targs) /* * 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) { /* diff --git a/usr.bin/make/make.h b/usr.bin/make/make.h index ab47ff09fc4..5e4f5a51c15 100644 --- a/usr.bin/make/make.h +++ b/usr.bin/make/make.h @@ -1,4 +1,4 @@ -/* $OpenBSD: make.h,v 1.8 1997/04/01 07:28:19 millert Exp $ */ +/* $OpenBSD: make.h,v 1.9 1997/04/28 01:52:39 millert Exp $ */ /* $NetBSD: make.h,v 1.15 1997/03/10 21:20:00 christos Exp $ */ /* @@ -112,7 +112,6 @@ */ typedef struct GNode { char *name; /* The target's name */ - char *uname; /* The unexpanded name of a .USE node */ char *path; /* The full pathname of the file */ int type; /* Its type (see the OP flags, below) */ int order; /* Its wait weight */ @@ -378,7 +377,6 @@ extern int debug; int Make_TimeStamp __P((GNode *, GNode *)); Boolean Make_OODate __P((GNode *)); -Lst Make_ExpandUse __P((Lst)); int Make_HandleUse __P((GNode *, GNode *)); void Make_Update __P((GNode *)); void Make_DoAllVar __P((GNode *)); diff --git a/usr.bin/make/parse.c b/usr.bin/make/parse.c index 9c930d6d950..8ecb4b28641 100644 --- a/usr.bin/make/parse.c +++ b/usr.bin/make/parse.c @@ -1,4 +1,4 @@ -/* $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 $ */ /* @@ -43,7 +43,7 @@ #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 */ @@ -2575,18 +2575,18 @@ Parse_End() 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); } diff --git a/usr.bin/make/targ.c b/usr.bin/make/targ.c index 80a9293362c..bf705b9fded 100644 --- a/usr.bin/make/targ.c +++ b/usr.bin/make/targ.c @@ -1,4 +1,4 @@ -/* $OpenBSD: targ.c,v 1.6 1997/04/01 07:28:24 millert Exp $ */ +/* $OpenBSD: targ.c,v 1.7 1997/04/28 01:52:42 millert Exp $ */ /* $NetBSD: targ.c,v 1.11 1997/02/20 16:51:50 christos Exp $ */ /* @@ -43,7 +43,7 @@ #if 0 static char sccsid[] = "@(#)targ.c 8.2 (Berkeley) 3/19/94"; #else -static char *rcsid = "$OpenBSD: targ.c,v 1.6 1997/04/01 07:28:24 millert Exp $"; +static char *rcsid = "$OpenBSD: targ.c,v 1.7 1997/04/28 01:52:42 millert Exp $"; #endif #endif /* not lint */ @@ -166,7 +166,6 @@ Targ_NewGN (name) gn = (GNode *) emalloc (sizeof (GNode)); gn->name = estrdup (name); - gn->uname = NULL; gn->path = (char *) 0; if (name[0] == '-' && name[1] == 'l') { gn->type = OP_LIB; @@ -216,8 +215,6 @@ TargFreeGN (gnp) free(gn->name); - if (gn->uname) - free(gn->uname); if (gn->path) free(gn->path);