diff options
Diffstat (limited to 'contrib/bmake/parse.c')
-rw-r--r-- | contrib/bmake/parse.c | 96 |
1 files changed, 57 insertions, 39 deletions
diff --git a/contrib/bmake/parse.c b/contrib/bmake/parse.c index 0b18f5d..14c868b 100644 --- a/contrib/bmake/parse.c +++ b/contrib/bmake/parse.c @@ -1,4 +1,4 @@ -/* $NetBSD: parse.c,v 1.185 2012/06/12 19:21:51 joerg Exp $ */ +/* $NetBSD: parse.c,v 1.188 2013/03/22 16:07:59 sjg Exp $ */ /* * Copyright (c) 1988, 1989, 1990, 1993 @@ -69,14 +69,14 @@ */ #ifndef MAKE_NATIVE -static char rcsid[] = "$NetBSD: parse.c,v 1.185 2012/06/12 19:21:51 joerg Exp $"; +static char rcsid[] = "$NetBSD: parse.c,v 1.188 2013/03/22 16:07:59 sjg Exp $"; #else #include <sys/cdefs.h> #ifndef lint #if 0 static char sccsid[] = "@(#)parse.c 8.3 (Berkeley) 3/19/94"; #else -__RCSID("$NetBSD: parse.c,v 1.185 2012/06/12 19:21:51 joerg Exp $"); +__RCSID("$NetBSD: parse.c,v 1.188 2013/03/22 16:07:59 sjg Exp $"); #endif #endif /* not lint */ #endif @@ -213,6 +213,7 @@ typedef enum { ExShell, /* .SHELL */ Silent, /* .SILENT */ SingleShell, /* .SINGLESHELL */ + Stale, /* .STALE */ Suffixes, /* .SUFFIXES */ Wait, /* .WAIT */ Attribute /* Generic attribute */ @@ -336,6 +337,7 @@ static const struct { { ".SHELL", ExShell, 0 }, { ".SILENT", Silent, OP_SILENT }, { ".SINGLESHELL", SingleShell, 0 }, +{ ".STALE", Stale, 0 }, { ".SUFFIXES", Suffixes, 0 }, { ".USE", Attribute, OP_USE }, { ".USEBEFORE", Attribute, OP_USEBEFORE }, @@ -915,6 +917,8 @@ ParseDoOp(void *gnp, void *opp) gn->type |= op & ~OP_OPMASK; cohort = Targ_FindNode(gn->name, TARG_NOHASH); + if (doing_depend) + ParseMark(cohort); /* * Make the cohort invisible as well to avoid duplicating it into * other variables. True, parents of this target won't tend to do @@ -987,6 +991,8 @@ ParseDoSrc(int tOp, const char *src) */ snprintf(wait_src, sizeof wait_src, ".WAIT_%u", ++wait_number); gn = Targ_FindNode(wait_src, TARG_NOHASH); + if (doing_depend) + ParseMark(gn); gn->type = OP_WAIT | OP_PHONY | OP_DEPENDS | OP_NOTMAIN; Lst_ForEach(targets, ParseLinkSrc, gn); return; @@ -1018,6 +1024,8 @@ ParseDoSrc(int tOp, const char *src) * source and the current one. */ gn = Targ_FindNode(src, TARG_CREATE); + if (doing_depend) + ParseMark(gn); if (predecessor != NULL) { (void)Lst_AtEnd(predecessor->order_succ, gn); (void)Lst_AtEnd(gn->order_pred, predecessor); @@ -1049,6 +1057,8 @@ ParseDoSrc(int tOp, const char *src) /* Find/create the 'src' node and attach to all targets */ gn = Targ_FindNode(src, TARG_CREATE); + if (doing_depend) + ParseMark(gn); if (tOp) { gn->type |= tOp; } else { @@ -1294,6 +1304,7 @@ ParseDoDependency(char *line) * apply the .DEFAULT commands. * .PHONY The list of targets * .NOPATH Don't search for file in the path + * .STALE * .BEGIN * .END * .ERROR @@ -1304,42 +1315,45 @@ ParseDoDependency(char *line) * .ORDER Must set initial predecessor to NULL */ switch (specType) { - case ExPath: - if (paths == NULL) { - paths = Lst_Init(FALSE); - } - (void)Lst_AtEnd(paths, dirSearchPath); - break; - case Main: - if (!Lst_IsEmpty(create)) { - specType = Not; - } - break; - case Begin: - case End: - case dotError: - case Interrupt: - gn = Targ_FindNode(line, TARG_CREATE); - gn->type |= OP_NOTMAIN|OP_SPECIAL; - (void)Lst_AtEnd(targets, gn); - break; - case Default: - gn = Targ_NewGN(".DEFAULT"); - gn->type |= (OP_NOTMAIN|OP_TRANSFORM); - (void)Lst_AtEnd(targets, gn); - DEFAULT = gn; - break; - case NotParallel: - maxJobs = 1; - break; - case SingleShell: - compatMake = TRUE; - break; - case Order: - predecessor = NULL; - break; - default: - break; + case ExPath: + if (paths == NULL) { + paths = Lst_Init(FALSE); + } + (void)Lst_AtEnd(paths, dirSearchPath); + break; + case Main: + if (!Lst_IsEmpty(create)) { + specType = Not; + } + break; + case Begin: + case End: + case Stale: + case dotError: + case Interrupt: + gn = Targ_FindNode(line, TARG_CREATE); + if (doing_depend) + ParseMark(gn); + gn->type |= OP_NOTMAIN|OP_SPECIAL; + (void)Lst_AtEnd(targets, gn); + break; + case Default: + gn = Targ_NewGN(".DEFAULT"); + gn->type |= (OP_NOTMAIN|OP_TRANSFORM); + (void)Lst_AtEnd(targets, gn); + DEFAULT = gn; + break; + case NotParallel: + maxJobs = 1; + break; + case SingleShell: + compatMake = TRUE; + break; + case Order: + predecessor = NULL; + break; + default: + break; } } else if (strncmp(line, ".PATH", 5) == 0) { /* @@ -1398,6 +1412,8 @@ ParseDoDependency(char *line) } else { gn = Suff_AddTransform(targName); } + if (doing_depend) + ParseMark(gn); (void)Lst_AtEnd(targets, gn); } @@ -1445,6 +1461,7 @@ ParseDoDependency(char *line) Parse_Error(PARSE_WARNING, "Special and mundane targets don't mix. Mundane ones ignored"); break; case Default: + case Stale: case Begin: case End: case dotError: @@ -2454,6 +2471,7 @@ ParseGmakeExport(char *line) "Variable/Value missing from \"export\""); return; } + *value++ = '\0'; /* terminate variable */ /* * Expand the value before putting it in the environment. |