Add the ability to tweak the token output before targets in job mode.
Eg. .MAKE.JOB.PREFIX=${.newline}---${.MAKE:T}[${.MAKE.PID}] would produce ---make[1234] target ---
This commit is contained in:
parent
cadfc6aaa0
commit
216e9ba475
@ -1,4 +1,4 @@
|
||||
/* $NetBSD: job.c,v 1.124 2006/10/27 21:00:19 dsl Exp $ */
|
||||
/* $NetBSD: job.c,v 1.125 2007/10/01 22:14:09 sjg Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 1988, 1989, 1990 The Regents of the University of California.
|
||||
@ -70,14 +70,14 @@
|
||||
*/
|
||||
|
||||
#ifndef MAKE_NATIVE
|
||||
static char rcsid[] = "$NetBSD: job.c,v 1.124 2006/10/27 21:00:19 dsl Exp $";
|
||||
static char rcsid[] = "$NetBSD: job.c,v 1.125 2007/10/01 22:14:09 sjg Exp $";
|
||||
#else
|
||||
#include <sys/cdefs.h>
|
||||
#ifndef lint
|
||||
#if 0
|
||||
static char sccsid[] = "@(#)job.c 8.2 (Berkeley) 3/19/94";
|
||||
#else
|
||||
__RCSID("$NetBSD: job.c,v 1.124 2006/10/27 21:00:19 dsl Exp $");
|
||||
__RCSID("$NetBSD: job.c,v 1.125 2007/10/01 22:14:09 sjg Exp $");
|
||||
#endif
|
||||
#endif /* not lint */
|
||||
#endif
|
||||
@ -305,15 +305,16 @@ STATIC GNode *lastNode; /* The node for which output was most recently
|
||||
STATIC const char *targFmt; /* Format string to use to head output from a
|
||||
* job when it's not the most-recent job heard
|
||||
* from */
|
||||
static char *targPrefix = NULL; /* What we print at the start of targFmt */
|
||||
static Job tokenWaitJob; /* token wait pseudo-job */
|
||||
|
||||
static Job childExitJob; /* child exit pseudo-job */
|
||||
#define CHILD_EXIT "."
|
||||
#define DO_JOB_RESUME "R"
|
||||
|
||||
#define TARG_FMT "--- %s ---\n" /* Default format */
|
||||
#define TARG_FMT "%s %s ---\n" /* Default format */
|
||||
#define MESSAGE(fp, gn) \
|
||||
(void)fprintf(fp, targFmt, gn->name)
|
||||
(void)fprintf(fp, targFmt, targPrefix, gn->name)
|
||||
|
||||
static sigset_t caught_signals; /* Set of signals we handle */
|
||||
#if defined(SYSV)
|
||||
@ -2053,6 +2054,20 @@ Shell_GetNewline(void)
|
||||
return commandShell->newline;
|
||||
}
|
||||
|
||||
void
|
||||
Job_SetPrefix(void)
|
||||
{
|
||||
char tmp[sizeof("${" MAKEJOBPREFIX "}") + 1];
|
||||
|
||||
if (targPrefix) {
|
||||
free(targPrefix);
|
||||
} else if (!Var_Exists(MAKEJOBPREFIX, VAR_GLOBAL)) {
|
||||
Var_Set(MAKEJOBPREFIX, "---", VAR_GLOBAL, 0);
|
||||
}
|
||||
strncpy(tmp, "${" MAKEJOBPREFIX "}", sizeof(tmp));
|
||||
targPrefix = Var_Subst(NULL, tmp, VAR_GLOBAL, 0);
|
||||
}
|
||||
|
||||
/*-
|
||||
*-----------------------------------------------------------------------
|
||||
* Job_Init --
|
||||
|
@ -1,4 +1,4 @@
|
||||
/* $NetBSD: job.h,v 1.33 2006/10/11 07:01:44 dsl Exp $ */
|
||||
/* $NetBSD: job.h,v 1.34 2007/10/01 22:14:09 sjg Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 1988, 1989, 1990 The Regents of the University of California.
|
||||
@ -258,5 +258,6 @@ void JobFlagForMigration(int);
|
||||
void Job_TokenReturn(void);
|
||||
Boolean Job_TokenWithdraw(void);
|
||||
void Job_ServerStart(int, int, int);
|
||||
void Job_SetPrefix(void);
|
||||
|
||||
#endif /* _JOB_H_ */
|
||||
|
@ -1,4 +1,4 @@
|
||||
/* $NetBSD: main.c,v 1.141 2007/01/01 21:29:01 dsl Exp $ */
|
||||
/* $NetBSD: main.c,v 1.142 2007/10/01 22:14:10 sjg Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 1988, 1989, 1990, 1993
|
||||
@ -69,7 +69,7 @@
|
||||
*/
|
||||
|
||||
#ifndef MAKE_NATIVE
|
||||
static char rcsid[] = "$NetBSD: main.c,v 1.141 2007/01/01 21:29:01 dsl Exp $";
|
||||
static char rcsid[] = "$NetBSD: main.c,v 1.142 2007/10/01 22:14:10 sjg Exp $";
|
||||
#else
|
||||
#include <sys/cdefs.h>
|
||||
#ifndef lint
|
||||
@ -81,7 +81,7 @@ __COPYRIGHT("@(#) Copyright (c) 1988, 1989, 1990, 1993\n\
|
||||
#if 0
|
||||
static char sccsid[] = "@(#)main.c 8.3 (Berkeley) 3/19/94";
|
||||
#else
|
||||
__RCSID("$NetBSD: main.c,v 1.141 2007/01/01 21:29:01 dsl Exp $");
|
||||
__RCSID("$NetBSD: main.c,v 1.142 2007/10/01 22:14:10 sjg Exp $");
|
||||
#endif
|
||||
#endif /* not lint */
|
||||
#endif
|
||||
@ -865,6 +865,19 @@ main(int argc, char **argv)
|
||||
Var_Set("MFLAGS", "", VAR_GLOBAL, 0);
|
||||
Var_Set(".ALLTARGETS", "", VAR_GLOBAL, 0);
|
||||
|
||||
/*
|
||||
* Set some other useful macros
|
||||
*/
|
||||
{
|
||||
char tmp[64];
|
||||
|
||||
snprintf(tmp, sizeof(tmp), "%u", getpid());
|
||||
Var_Set(".MAKE.PID", tmp, VAR_GLOBAL, 0);
|
||||
snprintf(tmp, sizeof(tmp), "%u", getppid());
|
||||
Var_Set(".MAKE.PPID", tmp, VAR_GLOBAL, 0);
|
||||
}
|
||||
Job_SetPrefix();
|
||||
|
||||
/*
|
||||
* First snag any flags out of the MAKE environment variable.
|
||||
* (Note this is *not* MAKEFLAGS since /bin/make uses that and it's
|
||||
|
@ -1,4 +1,4 @@
|
||||
.\" $NetBSD: make.1,v 1.131 2007/08/13 06:14:08 rillig Exp $
|
||||
.\" $NetBSD: make.1,v 1.132 2007/10/01 22:14:10 sjg Exp $
|
||||
.\"
|
||||
.\" Copyright (c) 1990, 1993
|
||||
.\" The Regents of the University of California. All rights reserved.
|
||||
@ -580,6 +580,27 @@ The preferred variable to use is the environment variable
|
||||
because it is more compatible with other versions of
|
||||
.Nm
|
||||
and cannot be confused with the special target with the same name.
|
||||
.It Va .MAKE.PID
|
||||
The process-id of
|
||||
.Nm .
|
||||
.It Va .MAKE.PPID
|
||||
The parent process-id of
|
||||
.Nm .
|
||||
.It Va .MAKE.JOB.PREFIX
|
||||
If
|
||||
.Nm
|
||||
is run with
|
||||
.Ar j
|
||||
then output for each target is prefixed with a token
|
||||
.Ql --- target ---
|
||||
the first part of which can be controlled via
|
||||
.Va .MAKE.JOB.PREFIX .
|
||||
.br
|
||||
For example:
|
||||
.Li .MAKE.JOB.PREFIX=${.newline}---${.MAKE:T}[${.MAKE.PID}]
|
||||
would produce tokens like
|
||||
.Ql ---make[1234] target ---
|
||||
making it easier to track the degree of parallelism being achieved.
|
||||
.It Ev MAKEFLAGS
|
||||
The environment variable
|
||||
.Ql Ev MAKEFLAGS
|
||||
|
@ -1,4 +1,4 @@
|
||||
/* $NetBSD: make.h,v 1.67 2007/01/01 21:48:43 dsl Exp $ */
|
||||
/* $NetBSD: make.h,v 1.68 2007/10/01 22:14:11 sjg Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 1988, 1989, 1990, 1993
|
||||
@ -397,6 +397,7 @@ extern char *progname; /* The program name */
|
||||
|
||||
#define MAKEFLAGS ".MAKEFLAGS"
|
||||
#define MAKEOVERRIDES ".MAKEOVERRIDES"
|
||||
#define MAKEJOBPREFIX ".MAKE.JOB.PREFIX"
|
||||
|
||||
/*
|
||||
* debug control:
|
||||
|
@ -1,4 +1,4 @@
|
||||
/* $NetBSD: parse.c,v 1.134 2007/05/23 19:03:56 dsl Exp $ */
|
||||
/* $NetBSD: parse.c,v 1.135 2007/10/01 22:14:11 sjg Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 1988, 1989, 1990, 1993
|
||||
@ -69,14 +69,14 @@
|
||||
*/
|
||||
|
||||
#ifndef MAKE_NATIVE
|
||||
static char rcsid[] = "$NetBSD: parse.c,v 1.134 2007/05/23 19:03:56 dsl Exp $";
|
||||
static char rcsid[] = "$NetBSD: parse.c,v 1.135 2007/10/01 22:14:11 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.134 2007/05/23 19:03:56 dsl Exp $");
|
||||
__RCSID("$NetBSD: parse.c,v 1.135 2007/10/01 22:14:11 sjg Exp $");
|
||||
#endif
|
||||
#endif /* not lint */
|
||||
#endif
|
||||
@ -1614,6 +1614,8 @@ Parse_DoVar(char *line, GNode *ctxt)
|
||||
*/
|
||||
Dir_InitCur(cp);
|
||||
Dir_SetPATH();
|
||||
} else if (strcmp(line, MAKEJOBPREFIX) == 0) {
|
||||
Job_SetPrefix();
|
||||
}
|
||||
if (freeCp)
|
||||
free(cp);
|
||||
|
Loading…
x
Reference in New Issue
Block a user