Module Name: othersrc
Committed By: dholland
Date: Sat Mar 23 23:50:46 UTC 2013
Modified Files:
othersrc/usr.bin/dholland-make2: dir.c job.c job.h make.1 parse.c
Log Message:
Merge -r1.67 of dir.c, -r1.172 of job.c, -r1.41 of job.h, -r1.211 of
make.1, and -r1.187 of parse.c from HEAD (committed by Christos):
Add a .STALE special target that gets invoked when dependency files contain
stail entries.
To generate a diff of this commit:
cvs rdiff -u -r1.9 -r1.10 othersrc/usr.bin/dholland-make2/dir.c
cvs rdiff -u -r1.8 -r1.9 othersrc/usr.bin/dholland-make2/job.c
cvs rdiff -u -r1.3 -r1.4 othersrc/usr.bin/dholland-make2/job.h
cvs rdiff -u -r1.1.1.1 -r1.2 othersrc/usr.bin/dholland-make2/make.1
cvs rdiff -u -r1.13 -r1.14 othersrc/usr.bin/dholland-make2/parse.c
Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.
Modified files:
Index: othersrc/usr.bin/dholland-make2/dir.c
diff -u othersrc/usr.bin/dholland-make2/dir.c:1.9 othersrc/usr.bin/dholland-make2/dir.c:1.10
--- othersrc/usr.bin/dholland-make2/dir.c:1.9 Sat Mar 23 23:36:18 2013
+++ othersrc/usr.bin/dholland-make2/dir.c Sat Mar 23 23:50:46 2013
@@ -1,4 +1,4 @@
-/* $NetBSD: dir.c,v 1.9 2013/03/23 23:36:18 dholland Exp $ */
+/* $NetBSD: dir.c,v 1.10 2013/03/23 23:50:46 dholland Exp $ */
/*
* Copyright (c) 1988, 1989, 1990 The Regents of the University of California.
@@ -138,8 +138,9 @@
#include "make.h"
#include "hash.h"
#include "dir.h"
+#include "job.h"
-__RCSID("$NetBSD: dir.c,v 1.9 2013/03/23 23:36:18 dholland Exp $");
+__RCSID("$NetBSD: dir.c,v 1.10 2013/03/23 23:50:46 dholland Exp $");
/*
* A search path consists of a list of Path structures. A Path structure
@@ -1427,10 +1428,11 @@ Dir_MTime(GNode *gn, Boolean recheck)
* so that we give that to the compiler.
*/
gn->path = bmake_strdup(fullName);
- fprintf(stdout,
- "%s: %s, %d: ignoring stale %s for %s, found %s\n",
- progname, gn->fname, gn->lineno,
- makeDependfile, gn->name, fullName);
+ if (!Job_RunTarget(".STALE", gn->fname))
+ fprintf(stdout,
+ "%s: %s, %d: ignoring stale %s for %s, "
+ "found %s\n", progname, gn->fname, gn->lineno,
+ makeDependfile, gn->name, fullName);
}
}
}
Index: othersrc/usr.bin/dholland-make2/job.c
diff -u othersrc/usr.bin/dholland-make2/job.c:1.8 othersrc/usr.bin/dholland-make2/job.c:1.9
--- othersrc/usr.bin/dholland-make2/job.c:1.8 Sat Mar 23 23:36:18 2013
+++ othersrc/usr.bin/dholland-make2/job.c Sat Mar 23 23:50:46 2013
@@ -1,4 +1,4 @@
-/* $NetBSD: job.c,v 1.8 2013/03/23 23:36:18 dholland Exp $ */
+/* $NetBSD: job.c,v 1.9 2013/03/23 23:50:46 dholland Exp $ */
/*
* Copyright (c) 1988, 1989, 1990 The Regents of the University of California.
@@ -149,7 +149,7 @@
#include "trace.h"
# define STATIC static
-MAKE_RCSID("$NetBSD: job.c,v 1.8 2013/03/23 23:36:18 dholland Exp $");
+MAKE_RCSID("$NetBSD: job.c,v 1.9 2013/03/23 23:50:46 dholland Exp $");
/*
* error handling variables
@@ -1230,8 +1230,10 @@ Job_CheckCommands(GNode *gn, void (*abor
static const char msg[] = ": don't know how to make";
if (gn->flags & FROM_DEPEND) {
- fprintf(stdout, "%s: %s, %d: ignoring stale %s for %s\n",
- progname, gn->fname, gn->lineno, makeDependfile, gn->name);
+ if (!Job_RunTarget(".STALE", gn->fname))
+ fprintf(stdout, "%s: %s, %d: ignoring stale %s for %s\n",
+ progname, gn->fname, gn->lineno, makeDependfile,
+ gn->name);
return TRUE;
}
@@ -2193,8 +2195,6 @@ Job_SetPrefix(void)
void
Job_Init(void)
{
- GNode *begin; /* node for commands to do at the very start */
-
/* Allocate space for all the job info */
job_table = bmake_malloc(maxJobs * sizeof *job_table);
memset(job_table, 0, maxJobs * sizeof *job_table);
@@ -2270,15 +2270,7 @@ Job_Init(void)
ADDSIG(SIGCONT, JobContinueSig)
#undef ADDSIG
- begin = Targ_FindNode(".BEGIN", TARG_NOCREATE);
-
- if (begin != NULL) {
- JobRun(begin);
- if (begin->made == ERROR) {
- PrintOnError(begin, "\n\nStop.");
- exit(1);
- }
- }
+ (void)Job_RunTarget(".BEGIN", NULL);
postCommands = Targ_FindNode(".END", TARG_CREATE);
}
@@ -2944,6 +2936,38 @@ Job_TokenWithdraw(void)
return TRUE;
}
+/*-
+ *-----------------------------------------------------------------------
+ * Job_RunTarget --
+ * Run the named target if found. If a filename is specified, then
+ * set that to the sources.
+ *
+ * Results:
+ * None
+ *
+ * Side Effects:
+ * exits if the target fails.
+ *
+ *-----------------------------------------------------------------------
+ */
+Boolean
+Job_RunTarget(const char *target, const char *fname) {
+ GNode *gn = Targ_FindNode(target, TARG_NOCREATE);
+
+ if (gn == NULL)
+ return FALSE;
+
+ if (fname)
+ Var_Set(ALLSRC, fname, gn, 0);
+
+ JobRun(gn);
+ if (gn->made == ERROR) {
+ PrintOnError(gn, "\n\nStop.");
+ exit(1);
+ }
+ return TRUE;
+}
+
#ifdef USE_SELECT
int
emul_poll(struct pollfd *fd, int nfd, int timeout)
Index: othersrc/usr.bin/dholland-make2/job.h
diff -u othersrc/usr.bin/dholland-make2/job.h:1.3 othersrc/usr.bin/dholland-make2/job.h:1.4
--- othersrc/usr.bin/dholland-make2/job.h:1.3 Sat Mar 23 18:46:17 2013
+++ othersrc/usr.bin/dholland-make2/job.h Sat Mar 23 23:50:46 2013
@@ -1,4 +1,4 @@
-/* $NetBSD: job.h,v 1.3 2013/03/23 18:46:17 dholland Exp $ */
+/* $NetBSD: job.h,v 1.4 2013/03/23 23:50:46 dholland Exp $ */
/*
* Copyright (c) 1988, 1989, 1990 The Regents of the University of California.
@@ -268,5 +268,6 @@ void Job_TokenReturn(void);
Boolean Job_TokenWithdraw(void);
void Job_ServerStart(int, int, int);
void Job_SetPrefix(void);
+Boolean Job_RunTarget(const char *, const char *);
#endif /* _JOB_H_ */
Index: othersrc/usr.bin/dholland-make2/make.1
diff -u othersrc/usr.bin/dholland-make2/make.1:1.1.1.1 othersrc/usr.bin/dholland-make2/make.1:1.2
--- othersrc/usr.bin/dholland-make2/make.1:1.1.1.1 Mon Feb 25 01:33:00 2013
+++ othersrc/usr.bin/dholland-make2/make.1 Sat Mar 23 23:50:46 2013
@@ -1,4 +1,4 @@
-.\" $NetBSD: make.1,v 1.1.1.1 2013/02/25 01:33:00 dholland Exp $
+.\" $NetBSD: make.1,v 1.2 2013/03/23 23:50:46 dholland Exp $
.\"
.\" Copyright (c) 1990, 1993
.\" The Regents of the University of California. All rights reserved.
@@ -29,7 +29,7 @@
.\"
.\" from: @(#)make.1 8.4 (Berkeley) 3/19/94
.\"
-.Dd January 23, 2013
+.Dd March 5, 2013
.Dt MAKE 1
.Os
.Sh NAME
@@ -2008,6 +2008,10 @@ If no sources are specified, the
.Ic .SILENT
attribute is applied to every
command in the file.
+.It Ic .STALE
+This target gets run when a dependency file contains stale entries, having
+.Va .ALLSRC
+set to the name of that dependency file.
.It Ic .SUFFIXES
Each source specifies a suffix to
.Nm .
Index: othersrc/usr.bin/dholland-make2/parse.c
diff -u othersrc/usr.bin/dholland-make2/parse.c:1.13 othersrc/usr.bin/dholland-make2/parse.c:1.14
--- othersrc/usr.bin/dholland-make2/parse.c:1.13 Sat Mar 23 23:36:18 2013
+++ othersrc/usr.bin/dholland-make2/parse.c Sat Mar 23 23:50:46 2013
@@ -1,4 +1,4 @@
-/* $NetBSD: parse.c,v 1.13 2013/03/23 23:36:18 dholland Exp $ */
+/* $NetBSD: parse.c,v 1.14 2013/03/23 23:50:46 dholland Exp $ */
/*
* Copyright (c) 1988, 1989, 1990, 1993
@@ -137,7 +137,7 @@
#include "buf.h"
#include "pathnames.h"
-MAKE_RCSID("$NetBSD: parse.c,v 1.13 2013/03/23 23:36:18 dholland Exp $");
+MAKE_RCSID("$NetBSD: parse.c,v 1.14 2013/03/23 23:50:46 dholland Exp $");
//#define CLEANUP
@@ -206,6 +206,7 @@ typedef enum {
ExShell, /* .SHELL */
Silent, /* .SILENT */
SingleShell, /* .SINGLESHELL */
+ Stale, /* .STALE */
Suffixes, /* .SUFFIXES */
Wait, /* .WAIT */
Attribute /* Generic attribute */
@@ -329,6 +330,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 },
@@ -1265,6 +1267,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
@@ -1275,41 +1278,42 @@ ParseDoDependency(char *line)
* .ORDER Must set initial predecessor to NULL
*/
switch (specType) {
- case ExPath:
- patharrayarray_add(&paths, &dirSearchPath, NULL);
- break;
- case Main:
- if (stringarray_num(&create) > 0) {
- specType = Not;
- }
- break;
- case Begin:
- case End:
- case dotError:
- case Interrupt:
- gn = Targ_FindNode(line, TARG_CREATE);
- if (doing_depend)
- ParseMark(gn);
- gn->type |= OP_NOTMAIN|OP_SPECIAL;
- glist_add(&targets, gn, NULL);
- break;
- case Default:
- gn = Targ_NewGN(".DEFAULT");
- gn->type |= (OP_NOTMAIN|OP_TRANSFORM);
- glist_add(&targets, gn, NULL);
- DEFAULT = gn;
- break;
- case NotParallel:
- maxJobs = 1;
- break;
- case SingleShell:
- compatMake = TRUE;
- break;
- case Order:
- predecessor = NULL;
- break;
- default:
- break;
+ case ExPath:
+ patharrayarray_add(&paths, &dirSearchPath, NULL);
+ break;
+ case Main:
+ if (stringarray_num(&create) > 0) {
+ 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;
+ glist_add(&targets, gn, NULL);
+ break;
+ case Default:
+ gn = Targ_NewGN(".DEFAULT");
+ gn->type |= (OP_NOTMAIN|OP_TRANSFORM);
+ glist_add(&targets, gn, NULL);
+ 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) {
/*
@@ -1418,6 +1422,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: