diff options
| author | mycroft <mycroft@NetBSD.org> | 2000-06-10 21:44:08 +0000 |
|---|---|---|
| committer | mycroft <mycroft@NetBSD.org> | 2000-06-10 21:44:08 +0000 |
| commit | edfd0106e2073cd3d872914503cd4609eb31f530 (patch) | |
| tree | 95b62b99a302b43d8a82f1b5a0c8180318824f58 /usr.bin/make/make.c | |
| parent | d26027dd5b41d52696b4efd5ccb21e698f8cd59f (diff) | |
Introduce an OP_MARK bit, and use it to suppress duplicates during .ALLSRC
and .USE expansion. Also, remove some more Lst_Member() checks that are now
redundant.
Diffstat (limited to 'usr.bin/make/make.c')
| -rw-r--r-- | usr.bin/make/make.c | 37 |
1 files changed, 29 insertions, 8 deletions
diff --git a/usr.bin/make/make.c b/usr.bin/make/make.c index 22ff6fe6a98..365dd63c1db 100644 --- a/usr.bin/make/make.c +++ b/usr.bin/make/make.c @@ -1,4 +1,4 @@ -/* $NetBSD: make.c,v 1.27 2000/02/29 22:00:02 sjg Exp $ */ +/* $NetBSD: make.c,v 1.28 2000/06/10 21:44:08 mycroft Exp $ */ /* * Copyright (c) 1988, 1989, 1990, 1993 @@ -39,14 +39,14 @@ */ #ifdef MAKE_BOOTSTRAP -static char rcsid[] = "$NetBSD: make.c,v 1.27 2000/02/29 22:00:02 sjg Exp $"; +static char rcsid[] = "$NetBSD: make.c,v 1.28 2000/06/10 21:44:08 mycroft Exp $"; #else #include <sys/cdefs.h> #ifndef lint #if 0 static char sccsid[] = "@(#)make.c 8.1 (Berkeley) 6/6/93"; #else -__RCSID("$NetBSD: make.c,v 1.27 2000/02/29 22:00:02 sjg Exp $"); +__RCSID("$NetBSD: make.c,v 1.28 2000/06/10 21:44:08 mycroft Exp $"); #endif #endif /* not lint */ #endif @@ -102,6 +102,7 @@ static int numNodes; /* Number of nodes to be processed. If this static int MakeAddChild __P((ClientData, ClientData)); static int MakeFindChild __P((ClientData, ClientData)); +static int MakeUnmark __P((ClientData, ClientData)); static int MakeAddAllSrc __P((ClientData, ClientData)); static int MakeTimeStamp __P((ClientData, ClientData)); static int MakeHandleUse __P((ClientData, ClientData)); @@ -377,6 +378,10 @@ Make_HandleUse (cgn, pgn) { register LstNode ln; /* An element in the children list */ + if (cgn->type & OP_MARK) + return (0); + cgn->type |= OP_MARK; + if (cgn->type & (OP_USE|OP_TRANSFORM)) { if ((cgn->type & OP_USE) || Lst_IsEmpty(pgn->commands)) { /* @@ -410,11 +415,9 @@ Make_HandleUse (cgn, pgn) gn = tgn; } - if (Lst_Member (pgn->children, gn) == NILLNODE) { - (void) Lst_AtEnd (pgn->children, gn); - (void) Lst_AtEnd (gn->parents, pgn); - pgn->unmade += 1; - } + (void) Lst_AtEnd (pgn->children, gn); + (void) Lst_AtEnd (gn->parents, pgn); + pgn->unmade += 1; } Lst_Close (cgn->children); } @@ -669,6 +672,17 @@ Make_Update (cgn) *----------------------------------------------------------------------- */ static int +MakeUnmark (cgnp, pgnp) + ClientData cgnp; + ClientData pgnp; +{ + GNode *cgn = (GNode *) cgnp; + + cgn->type &= ~OP_MARK; + return (0); +} + +static int MakeAddAllSrc (cgnp, pgnp) ClientData cgnp; /* The child to add */ ClientData pgnp; /* The parent to whose ALLSRC variable it should be */ @@ -676,6 +690,11 @@ MakeAddAllSrc (cgnp, pgnp) { GNode *cgn = (GNode *) cgnp; GNode *pgn = (GNode *) pgnp; + + if (cgn->type & OP_MARK) + return (0); + cgn->type |= OP_MARK; + if ((cgn->type & (OP_EXEC|OP_USE|OP_INVISIBLE)) == 0) { char *child; char *p1 = NULL; @@ -742,6 +761,7 @@ void Make_DoAllVar (gn) GNode *gn; { + Lst_ForEach (gn->children, MakeUnmark, (ClientData) gn); Lst_ForEach (gn->children, MakeAddAllSrc, (ClientData) gn); if (!Var_Exists (OODATE, gn)) { @@ -968,6 +988,7 @@ Make_ExpandUse (targs) (void)Dir_MTime(gn); Var_Set (TARGET, gn->path ? gn->path : gn->name, gn); + Lst_ForEach (gn->children, MakeUnmark, (ClientData)gn); Lst_ForEach (gn->children, MakeHandleUse, (ClientData)gn); Suff_FindDeps (gn); |
