Import bmake-20161212

From ChangeLog
2016-12-12  Simon J. Gerraty  <sjg@bad.crufty.net>

	* Makefile (_MAKE_VERSION): 20161212
	  Merge with NetBSD make, pick up
          o main.c: look for obj.${MACHINE}-${MACHINE_ARCH} too.

2016-12-09  Simon J. Gerraty  <sjg@bad.crufty.net>

	* Makefile (_MAKE_VERSION): 20161209
	  Merge with NetBSD make, pick up
	  o main.c: cleanup setting of .OBJDIR
	  o parse.c: avoid coredump from (var)=val

2016-11-26  Simon J. Gerraty  <sjg@bad.crufty.net>

	* Makefile (_MAKE_VERSION): 20161126
	  Merge with NetBSD make, pick up
	  o make.c: Make_OODate: report src node name if path not set

2016-09-26  Simon J. Gerraty  <sjg@bad.crufty.net>

	* Makefile (_MAKE_VERSION): 20160926
	  Merge with NetBSD make, pick up
	  o support for .DELETE_ON_ERROR: (remove targets that fail)

2016-09-26  Simon J. Gerraty  <sjg@bad.crufty.net>

	* Makefile MAN: tweak .Dt to match ${PROG}

mk/ChangeLog

2016-12-12  Simon J. Gerraty  <sjg@bad.crufty.net>

	* install-mk (MK_VERSION): 20161212

	* meta2deps.py: set pid_cwd[pid] when we process 'C'hdir,
	rather than when we detect pid change.

2016-12-07  Simon J. Gerraty  <sjg@bad.crufty.net>

	* install-mk (MK_VERSION): 20161207

	* meta.stage.mk: add stage_as_and_symlink for staging packages.
	  We build foo.tgz stage_as foo-${VERSION}.tgz but want to be able
	  to use foo.tgz to reference the latest staged version - so we
	  make foo.tgz a symlink to it.
	  Using a target to do both operations ensures we stay in sync.

2016-11-26  Simon J. Gerraty  <sjg@bad.crufty.net>

	* install-mk (MK_VERSION): 20161126

	* dirdeps.mk: set DIRDEPS_CACHE before we include local.dirdeps.mk
	  so it can add dependencies.

2016-10-10  Simon J. Gerraty  <sjg@bad.crufty.net>

	* dirdeps.mk: set DEP_* before we expand .MAKE.DEPENDFILE_PREFERENCE
	  do that they can influence the result correctly.

	* dirdeps.mk (${DIRDEPS_CACHE}): make sure we pass on TARGET_SPEC

	* dirdeps.mk: Add ONLY_TARGET_SPEC_LIST and NOT_TARGET_SPEC_LIST
	  similar to ONLY_MACHINE_LIST and NOT_MACHINE_LIST

2016-10-05  Simon J. Gerraty  <sjg@bad.crufty.net>

	* dirdeps.mk: remove dependence on jot (normal situations anyway).
	  Before we read another Makefile.depend* set DEP_* vars from
	  _DEP_TARGET_SPEC in case it uses any of them with :=
	  When bootstrapping, trim any ,* from extention of chosen _src
	  Makefile.depend* to get the machine value we subst for.

2016-09-30  Simon J. Gerraty  <sjg@bad.crufty.net>

	* dirdeps.mk: use TARGET_SPEC_VARS to qualify components added to
	  DEP_SKIP_DIR and DEP_DIRDEPS_FILTER

	* sys.mk: extract some bits to sys.{debug,vars}.mk
	  for easier re-use by others.

2016-09-23  Simon Gerraty  <sjg@sjg-mba13>

	* lib.mk: Use ${PICO} for extension for PIC objects.
	  default to .pico (like NetBSD) safe on case insensitive filesystem.

2016-08-19  Simon J. Gerraty  <sjg@bad.crufty.net>

	* meta.sys.mk (META_COOKIE_TOUCH): use ${.OBJDIR}/${.TARGET:T} as default
This commit is contained in:
Simon J. Gerraty 2016-12-19 21:50:59 +00:00
parent cdfa59c89c
commit b9b4b0cc41
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/vendor/NetBSD/bmake/dist/; revision=310299
svn path=/vendor/NetBSD/bmake/20161212/; revision=310300; tag=vendor/NetBSD/bmake/20161212
25 changed files with 556 additions and 276 deletions

View File

@ -1,3 +1,32 @@
2016-12-12 Simon J. Gerraty <sjg@bad.crufty.net>
* Makefile (_MAKE_VERSION): 20161212
Merge with NetBSD make, pick up
o main.c: look for obj.${MACHINE}-${MACHINE_ARCH} too.
2016-12-09 Simon J. Gerraty <sjg@bad.crufty.net>
* Makefile (_MAKE_VERSION): 20161209
Merge with NetBSD make, pick up
o main.c: cleanup setting of .OBJDIR
o parse.c: avoid coredump from (var)=val
2016-11-26 Simon J. Gerraty <sjg@bad.crufty.net>
* Makefile (_MAKE_VERSION): 20161126
Merge with NetBSD make, pick up
o make.c: Make_OODate: report src node name if path not set
2016-09-26 Simon J. Gerraty <sjg@bad.crufty.net>
* Makefile (_MAKE_VERSION): 20160926
Merge with NetBSD make, pick up
o support for .DELETE_ON_ERROR: (remove targets that fail)
2016-09-26 Simon J. Gerraty <sjg@bad.crufty.net>
* Makefile MAN: tweak .Dt to match ${PROG}
2016-08-18 Simon J. Gerraty <sjg@bad.crufty.net>
* Makefile (_MAKE_VERSION): 20160818

View File

@ -1,7 +1,7 @@
# $Id: Makefile,v 1.72 2016/08/18 23:02:26 sjg Exp $
# $Id: Makefile,v 1.77 2016/12/12 07:34:19 sjg Exp $
# Base version on src date
_MAKE_VERSION= 20160818
_MAKE_VERSION= 20161212
PROG= bmake
@ -156,7 +156,10 @@ my.history: ${MAKEFILE}
.NOPATH: ${MAN}
${MAN}: make.1 my.history
@echo making $@
@sed -e 's/^.Nx/NetBSD/' -e '/^.Nm/s/make/${PROG}/' \
@sed \
-e '/^.Dt/s/MAKE/${PROG:tu}/' \
-e 's/^.Nx/NetBSD/' \
-e '/^.Nm/s/make/${PROG}/' \
-e '/^.Sh HISTORY/rmy.history' \
-e '/^.Sh HISTORY/,$$s,^.Nm,make,' ${srcdir}/make.1 > $@

14
bmake.1
View File

@ -1,4 +1,4 @@
.\" $NetBSD: make.1,v 1.262 2016/08/18 19:23:20 wiz Exp $
.\" $NetBSD: make.1,v 1.263 2016/08/26 23:37:54 dholland Exp $
.\"
.\" Copyright (c) 1990, 1993
.\" The Regents of the University of California. All rights reserved.
@ -29,8 +29,8 @@
.\"
.\" from: @(#)make.1 8.4 (Berkeley) 3/19/94
.\"
.Dd August 15, 2016
.Dt MAKE 1
.Dd August 26, 2016
.Dt BMAKE 1
.Os
.Sh NAME
.Nm bmake
@ -2011,6 +2011,14 @@ variable of a target that inherits
.Ic .DEFAULT Ns 's
commands is set
to the target's own name.
.It Ic .DELETE_ON_ERROR
If this target is present in the makefile, it globally causes make to
delete targets whose commands fail.
(By default, only targets whose commands are interrupted during
execution are deleted.
This is the historical behavior.)
This setting can be used to help prevent half-finished or malformed
targets from being left around and corrupting future rebuilds.
.It Ic .END
Any command lines attached to this target are executed after everything
else is done.

View File

@ -1,4 +1,4 @@
MAKE(1) NetBSD General Commands Manual MAKE(1)
BMAKE(1) NetBSD General Commands Manual BMAKE(1)
NNAAMMEE
bbmmaakkee -- maintain program dependencies
@ -1285,6 +1285,14 @@ SSPPEECCIIAALL TTAARRGGEETTSS
target that inherits ..DDEEFFAAUULLTT's commands is set to the target's
own name.
..DDEELLEETTEE__OONN__EERRRROORR
If this target is present in the makefile, it globally causes
make to delete targets whose commands fail. (By default, only
targets whose commands are interrupted during execution are
deleted. This is the historical behavior.) This setting can be
used to help prevent half-finished or malformed targets from
being left around and corrupting future rebuilds.
..EENNDD Any command lines attached to this target are executed after
everything else is done.
@ -1498,4 +1506,4 @@ BBUUGGSS
There is no way of escaping a space character in a filename.
NetBSD 5.1 August 15, 2016 NetBSD 5.1
NetBSD 5.1 August 26, 2016 NetBSD 5.1

Before

Width:  |  Height:  |  Size: 78 KiB

After

Width:  |  Height:  |  Size: 79 KiB

View File

@ -1,4 +1,4 @@
/* $NetBSD: compat.c,v 1.105 2016/05/12 20:28:34 sjg Exp $ */
/* $NetBSD: compat.c,v 1.106 2016/08/26 23:28:39 dholland Exp $ */
/*
* Copyright (c) 1988, 1989, 1990 The Regents of the University of California.
@ -70,14 +70,14 @@
*/
#ifndef MAKE_NATIVE
static char rcsid[] = "$NetBSD: compat.c,v 1.105 2016/05/12 20:28:34 sjg Exp $";
static char rcsid[] = "$NetBSD: compat.c,v 1.106 2016/08/26 23:28:39 dholland Exp $";
#else
#include <sys/cdefs.h>
#ifndef lint
#if 0
static char sccsid[] = "@(#)compat.c 8.2 (Berkeley) 3/19/94";
#else
__RCSID("$NetBSD: compat.c,v 1.105 2016/05/12 20:28:34 sjg Exp $");
__RCSID("$NetBSD: compat.c,v 1.106 2016/08/26 23:28:39 dholland Exp $");
#endif
#endif /* not lint */
#endif
@ -119,6 +119,25 @@ static GNode *curTarg = NULL;
static GNode *ENDNode;
static void CompatInterrupt(int);
/*
* CompatDeleteTarget -- delete a failed, interrupted, or otherwise
* duffed target if not inhibited by .PRECIOUS.
*/
static void
CompatDeleteTarget(GNode *gn)
{
if ((gn != NULL) && !Targ_Precious (gn)) {
char *p1;
char *file = Var_Value(TARGET, gn, &p1);
if (!noExecute && eunlink(file) != -1) {
Error("*** %s removed", file);
}
free(p1);
}
}
/*-
*-----------------------------------------------------------------------
* CompatInterrupt --
@ -132,6 +151,9 @@ static void CompatInterrupt(int);
* The target is removed and the process exits. If .INTERRUPT exists,
* its commands are run first WITH INTERRUPTS IGNORED..
*
* XXX: is .PRECIOUS supposed to inhibit .INTERRUPT? I doubt it, but I've
* left the logic alone for now. - dholland 20160826
*
*-----------------------------------------------------------------------
*/
static void
@ -139,16 +161,9 @@ CompatInterrupt(int signo)
{
GNode *gn;
CompatDeleteTarget(curTarg);
if ((curTarg != NULL) && !Targ_Precious (curTarg)) {
char *p1;
char *file = Var_Value(TARGET, curTarg, &p1);
if (!noExecute && eunlink(file) != -1) {
Error("*** %s removed", file);
}
free(p1);
/*
* Run .INTERRUPT only if hit with interrupt signal
*/
@ -158,7 +173,6 @@ CompatInterrupt(int signo)
Compat_Make(gn, gn);
}
}
}
if (signo == SIGQUIT)
_exit(signo);
@ -447,6 +461,11 @@ CompatRunCommand(void *cmdp, void *gnp)
* continue.
*/
printf(" (continuing)\n");
} else {
printf("\n");
}
if (deleteOnError) {
CompatDeleteTarget(gn);
}
} else {
/*
@ -607,7 +626,7 @@ Compat_Make(void *gnp, void *pgnp)
} else if (keepgoing) {
pgn->flags &= ~REMAKE;
} else {
PrintOnError(gn, "\n\nStop.");
PrintOnError(gn, "\nStop.");
exit(1);
}
} else if (gn->made == ERROR) {
@ -698,7 +717,7 @@ Compat_Run(Lst targs)
if (gn != NULL) {
Compat_Make(gn, gn);
if (gn->made == ERROR) {
PrintOnError(gn, "\n\nStop.");
PrintOnError(gn, "\nStop.");
exit(1);
}
}
@ -739,7 +758,7 @@ Compat_Run(Lst targs)
if (errors == 0) {
Compat_Make(ENDNode, ENDNode);
if (gn->made == ERROR) {
PrintOnError(gn, "\n\nStop.");
PrintOnError(gn, "\nStop.");
exit(1);
}
}

34
job.c
View File

@ -1,4 +1,4 @@
/* $NetBSD: job.c,v 1.187 2016/05/12 20:28:34 sjg Exp $ */
/* $NetBSD: job.c,v 1.188 2016/08/26 23:28:39 dholland 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.187 2016/05/12 20:28:34 sjg Exp $";
static char rcsid[] = "$NetBSD: job.c,v 1.188 2016/08/26 23:28:39 dholland 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.187 2016/05/12 20:28:34 sjg Exp $");
__RCSID("$NetBSD: job.c,v 1.188 2016/08/26 23:28:39 dholland Exp $");
#endif
#endif /* not lint */
#endif
@ -387,6 +387,21 @@ job_table_dump(const char *where)
}
}
/*
* Delete the target of a failed, interrupted, or otherwise
* unsuccessful job unless inhibited by .PRECIOUS.
*/
static void
JobDeleteTarget(GNode *gn)
{
if ((gn->type & (OP_JOIN|OP_PHONY)) == 0 && !Targ_Precious(gn)) {
char *file = (gn->path == NULL ? gn->name : gn->path);
if (!noExecute && eunlink(file) != -1) {
Error("*** %s removed", file);
}
}
}
/*
* JobSigLock/JobSigUnlock
*
@ -1033,6 +1048,9 @@ JobFinish (Job *job, WAIT_T status)
if (job->flags & JOB_IGNERR) {
WAIT_STATUS(status) = 0;
} else {
if (deleteOnError) {
JobDeleteTarget(job->node);
}
PrintOnError(job->node, NULL);
}
} else if (DEBUG(JOB)) {
@ -1050,6 +1068,9 @@ JobFinish (Job *job, WAIT_T status)
}
(void)printf("*** [%s] Signal %d\n",
job->node->name, WTERMSIG(status));
if (deleteOnError) {
JobDeleteTarget(job->node);
}
}
(void)fflush(stdout);
}
@ -2578,12 +2599,7 @@ JobInterrupt(int runINTERRUPT, int signo)
gn = job->node;
if ((gn->type & (OP_JOIN|OP_PHONY)) == 0 && !Targ_Precious(gn)) {
char *file = (gn->path == NULL ? gn->name : gn->path);
if (!noExecute && eunlink(file) != -1) {
Error("*** %s removed", file);
}
}
JobDeleteTarget(gn);
if (job->pid) {
if (DEBUG(JOB)) {
(void)fprintf(debug_file,

61
main.c
View File

@ -1,4 +1,4 @@
/* $NetBSD: main.c,v 1.250 2016/08/11 19:53:17 sjg Exp $ */
/* $NetBSD: main.c,v 1.254 2016/12/10 23:12:39 christos Exp $ */
/*
* Copyright (c) 1988, 1989, 1990, 1993
@ -69,7 +69,7 @@
*/
#ifndef MAKE_NATIVE
static char rcsid[] = "$NetBSD: main.c,v 1.250 2016/08/11 19:53:17 sjg Exp $";
static char rcsid[] = "$NetBSD: main.c,v 1.254 2016/12/10 23:12:39 christos Exp $";
#else
#include <sys/cdefs.h>
#ifndef lint
@ -81,7 +81,7 @@ __COPYRIGHT("@(#) Copyright (c) 1988, 1989, 1990, 1993\
#if 0
static char sccsid[] = "@(#)main.c 8.3 (Berkeley) 3/19/94";
#else
__RCSID("$NetBSD: main.c,v 1.250 2016/08/11 19:53:17 sjg Exp $");
__RCSID("$NetBSD: main.c,v 1.254 2016/12/10 23:12:39 christos Exp $");
#endif
#endif /* not lint */
#endif
@ -155,6 +155,7 @@ Lst create; /* Targets to be made */
time_t now; /* Time at start of make */
GNode *DEFAULT; /* .DEFAULT node */
Boolean allPrecious; /* .PRECIOUS given on line by itself */
Boolean deleteOnError; /* .DELETE_ON_ERROR: set */
static Boolean noBuiltins; /* -r flag */
static Lst makefiles; /* ordered list of makefiles to read */
@ -711,18 +712,24 @@ Main_ParseArgLine(const char *line)
}
Boolean
Main_SetObjdir(const char *path)
Main_SetObjdir(const char *fmt, ...)
{
struct stat sb;
char *p = NULL;
char buf[MAXPATHLEN + 1];
char *p, *path;
char buf[MAXPATHLEN + 1], pbuf[MAXPATHLEN + 1];
Boolean rc = FALSE;
va_list ap;
va_start(ap, fmt);
vsnprintf(path = pbuf, MAXPATHLEN, fmt, ap);
va_end(ap);
/* expand variable substitutions */
if (strchr(path, '$') != 0) {
snprintf(buf, MAXPATHLEN, "%s", path);
path = p = Var_Subst(NULL, buf, VAR_GLOBAL, VARF_WANTRES);
}
} else
p = NULL;
if (path[0] != '/') {
snprintf(buf, MAXPATHLEN, "%s/%s", curdir, path);
@ -749,6 +756,18 @@ Main_SetObjdir(const char *path)
return rc;
}
static Boolean
Main_SetVarObjdir(const char *var, const char *suffix)
{
char *p1, *path;
if ((path = Var_Value(var, VAR_CMD, &p1)) == NULL)
return FALSE;
(void)Main_SetObjdir("%s%s", path, suffix);
free(p1);
return TRUE;
}
/*-
* ReadAllMakefiles --
* wrapper around ReadMakefile() to read all.
@ -979,6 +998,7 @@ main(int argc, char **argv)
noRecursiveExecute = FALSE; /* Execute all .MAKE targets */
keepgoing = FALSE; /* Stop on error */
allPrecious = FALSE; /* Remove targets when interrupted */
deleteOnError = FALSE; /* Historical default behavior */
queryFlag = FALSE; /* This is not just a check-run */
noBuiltins = FALSE; /* Read the built-in rules */
touchFlag = FALSE; /* Actually update targets */
@ -1128,28 +1148,19 @@ main(int argc, char **argv)
* MAKEOBJDIR is set in the environment, try only that value
* and fall back to .CURDIR if it does not exist.
*
* Otherwise, try _PATH_OBJDIR.MACHINE, _PATH_OBJDIR, and
* finally _PATH_OBJDIRPREFIX`pwd`, in that order. If none
* Otherwise, try _PATH_OBJDIR.MACHINE-MACHINE_ARCH, _PATH_OBJDIR.MACHINE,
* and * finally _PATH_OBJDIRPREFIX`pwd`, in that order. If none
* of these paths exist, just use .CURDIR.
*/
Dir_Init(curdir);
(void)Main_SetObjdir(curdir);
(void)Main_SetObjdir("%s", curdir);
if ((path = Var_Value("MAKEOBJDIRPREFIX", VAR_CMD, &p1)) != NULL) {
(void)snprintf(mdpath, MAXPATHLEN, "%s%s", path, curdir);
(void)Main_SetObjdir(mdpath);
free(p1);
} else if ((path = Var_Value("MAKEOBJDIR", VAR_CMD, &p1)) != NULL) {
(void)Main_SetObjdir(path);
free(p1);
} else {
(void)snprintf(mdpath, MAXPATHLEN, "%s.%s", _PATH_OBJDIR, machine);
if (!Main_SetObjdir(mdpath) && !Main_SetObjdir(_PATH_OBJDIR)) {
(void)snprintf(mdpath, MAXPATHLEN, "%s%s",
_PATH_OBJDIRPREFIX, curdir);
(void)Main_SetObjdir(mdpath);
}
}
if (!Main_SetVarObjdir("MAKEOBJDIRPREFIX", curdir) &&
!Main_SetVarObjdir("MAKEOBJDIR", "") &&
!Main_SetObjdir("%s.%s-%s", _PATH_OBJDIR, machine, machine_arch) &&
!Main_SetObjdir("%s.%s", _PATH_OBJDIR, machine) &&
!Main_SetObjdir("%s", _PATH_OBJDIR))
(void)Main_SetObjdir("%s%s", _PATH_OBJDIRPREFIX, curdir);
/*
* Initialize archive, target and suffix modules in preparation for

12
make.1
View File

@ -1,4 +1,4 @@
.\" $NetBSD: make.1,v 1.262 2016/08/18 19:23:20 wiz Exp $
.\" $NetBSD: make.1,v 1.263 2016/08/26 23:37:54 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 August 15, 2016
.Dd August 26, 2016
.Dt MAKE 1
.Os
.Sh NAME
@ -2011,6 +2011,14 @@ variable of a target that inherits
.Ic .DEFAULT Ns 's
commands is set
to the target's own name.
.It Ic .DELETE_ON_ERROR
If this target is present in the makefile, it globally causes make to
delete targets whose commands fail.
(By default, only targets whose commands are interrupted during
execution are deleted.
This is the historical behavior.)
This setting can be used to help prevent half-finished or malformed
targets from being left around and corrupting future rebuilds.
.It Ic .END
Any command lines attached to this target are executed after everything
else is done.

8
make.c
View File

@ -1,4 +1,4 @@
/* $NetBSD: make.c,v 1.95 2016/02/18 18:29:14 christos Exp $ */
/* $NetBSD: make.c,v 1.96 2016/11/10 23:41:58 sjg Exp $ */
/*
* Copyright (c) 1988, 1989, 1990, 1993
@ -69,14 +69,14 @@
*/
#ifndef MAKE_NATIVE
static char rcsid[] = "$NetBSD: make.c,v 1.95 2016/02/18 18:29:14 christos Exp $";
static char rcsid[] = "$NetBSD: make.c,v 1.96 2016/11/10 23:41:58 sjg 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.95 2016/02/18 18:29:14 christos Exp $");
__RCSID("$NetBSD: make.c,v 1.96 2016/11/10 23:41:58 sjg Exp $");
#endif
#endif /* not lint */
#endif
@ -308,7 +308,7 @@ Make_OODate(GNode *gn)
if (DEBUG(MAKE)) {
if (gn->cmgn != NULL && gn->mtime < gn->cmgn->mtime) {
fprintf(debug_file, "modified before source %s...",
gn->cmgn->path);
gn->cmgn->path ? gn->cmgn->path : gn->cmgn->name);
} else if (gn->mtime == 0) {
fprintf(debug_file, "non-existent and no sources...");
} else {

5
make.h
View File

@ -1,4 +1,4 @@
/* $NetBSD: make.h,v 1.100 2016/06/07 00:40:00 sjg Exp $ */
/* $NetBSD: make.h,v 1.102 2016/12/07 15:00:46 christos Exp $ */
/*
* Copyright (c) 1988, 1989, 1990, 1993
@ -389,6 +389,7 @@ extern Boolean beSilent; /* True if should print no commands */
extern Boolean noExecute; /* True if should execute nothing */
extern Boolean noRecursiveExecute; /* True if should execute nothing */
extern Boolean allPrecious; /* True if every target is precious */
extern Boolean deleteOnError; /* True if failed targets should be deleted */
extern Boolean keepgoing; /* True if should continue on unaffected
* portions of the graph when have an error
* in one portion */
@ -503,7 +504,7 @@ char * Check_Cwd_Cmd(const char *);
void Check_Cwd(const char **);
void PrintOnError(GNode *, const char *);
void Main_ExportMAKEFLAGS(Boolean);
Boolean Main_SetObjdir(const char *);
Boolean Main_SetObjdir(const char *, ...) MAKE_ATTR_PRINTFLIKE(1, 2);
int mkTempFile(const char *, char **);
int str2Lst_Append(Lst, char *, const char *);
int cached_lstat(const char *, void *);

View File

@ -1,3 +1,62 @@
2016-12-12 Simon J. Gerraty <sjg@bad.crufty.net>
* install-mk (MK_VERSION): 20161212
* meta2deps.py: set pid_cwd[pid] when we process 'C'hdir,
rather than when we detect pid change.
2016-12-07 Simon J. Gerraty <sjg@bad.crufty.net>
* install-mk (MK_VERSION): 20161207
* meta.stage.mk: add stage_as_and_symlink for staging packages.
We build foo.tgz stage_as foo-${VERSION}.tgz but want to be able
to use foo.tgz to reference the latest staged version - so we
make foo.tgz a symlink to it.
Using a target to do both operations ensures we stay in sync.
2016-11-26 Simon J. Gerraty <sjg@bad.crufty.net>
* install-mk (MK_VERSION): 20161126
* dirdeps.mk: set DIRDEPS_CACHE before we include local.dirdeps.mk
so it can add dependencies.
2016-10-10 Simon J. Gerraty <sjg@bad.crufty.net>
* dirdeps.mk: set DEP_* before we expand .MAKE.DEPENDFILE_PREFERENCE
do that they can influence the result correctly.
* dirdeps.mk (${DIRDEPS_CACHE}): make sure we pass on TARGET_SPEC
* dirdeps.mk: Add ONLY_TARGET_SPEC_LIST and NOT_TARGET_SPEC_LIST
similar to ONLY_MACHINE_LIST and NOT_MACHINE_LIST
2016-10-05 Simon J. Gerraty <sjg@bad.crufty.net>
* dirdeps.mk: remove dependence on jot (normal situations anyway).
Before we read another Makefile.depend* set DEP_* vars from
_DEP_TARGET_SPEC in case it uses any of them with :=
When bootstrapping, trim any ,* from extention of chosen _src
Makefile.depend* to get the machine value we subst for.
2016-09-30 Simon J. Gerraty <sjg@bad.crufty.net>
* dirdeps.mk: use TARGET_SPEC_VARS to qualify components added to
DEP_SKIP_DIR and DEP_DIRDEPS_FILTER
* sys.mk: extract some bits to sys.{debug,vars}.mk
for easier re-use by others.
2016-09-23 Simon Gerraty <sjg@sjg-mba13>
* lib.mk: Use ${PICO} for extension for PIC objects.
default to .pico (like NetBSD) safe on case insensitive filesystem.
2016-08-19 Simon J. Gerraty <sjg@bad.crufty.net>
* meta.sys.mk (META_COOKIE_TOUCH): use ${.OBJDIR}/${.TARGET:T} as default
2016-08-15 Simon J. Gerraty <sjg@bad.crufty.net>
* install-mk (MK_VERSION): 20160815

View File

@ -38,7 +38,9 @@ stage-install.sh
subdir.mk
sys.mk
sys.clean-env.mk
sys.debug.mk
sys.dependfile.mk
sys.vars.mk
sys/AIX.mk
sys/Darwin.mk
sys/Generic.mk

View File

@ -1,4 +1,4 @@
# $Id: dirdeps.mk,v 1.73 2016/08/15 19:28:13 sjg Exp $
# $Id: dirdeps.mk,v 1.84 2016/11/27 02:44:34 sjg Exp $
# Copyright (c) 2010-2013, Juniper Networks, Inc.
# All rights reserved.
@ -56,9 +56,12 @@
# .MAKE.DEPENDFILE_PREFIX) to refer to these makefiles to
# distinguish them from others.
#
# Each Makefile.depend file sets DEP_RELDIR to be the
# the RELDIR (path relative to SRCTOP) for its directory, and
# since each Makefile.depend file includes dirdeps.mk, this
# Before each Makefile.depend file is read, we set
# DEP_RELDIR to be the the RELDIR (path relative to SRCTOP) for
# its directory, and DEP_MACHINE etc according to the .<target_spec>
# represented by the suffix of the corresponding target.
#
# Since each Makefile.depend file includes dirdeps.mk, this
# processing is recursive and results in .MAKE.LEVEL 0 learning the
# dependencies of the tree wrt the initial directory (_DEP_RELDIR).
#
@ -110,6 +113,29 @@
# # as we may need it to find Makefile.depend*
# TARGET_SPEC = ${TARGET_SPEC_VARS:@v@${$v:U}@:ts,}
#
# The following variables can influence the initial DIRDEPS
# computation with regard to the TARGET_SPECs that will be
# built.
# Most should also be considered by init.mk
#
# ONLY_TARGET_SPEC_LIST
# Defines a list of TARGET_SPECs for which the current
# directory can be built.
# If ALL_MACHINES is defined, we build for all the
# TARGET_SPECs listed.
#
# ONLY_MACHINE_LIST
# As for ONLY_TARGET_SPEC_LIST but only specifies
# MACHINEs.
#
# NOT_TARGET_SPEC_LIST
# A list of TARGET_SPECs for which the current
# directory should not be built.
#
# NOT_MACHINE_LIST
# A list of MACHINEs the current directory should not be
# built for.
#
# touch this at your peril
_DIRDEP_USE_LEVEL?= 0
@ -171,9 +197,13 @@ DEP_$v ?= ${$v}
# we compute below are fully qualified wrt DEP_TARGET_SPEC.
# The makefiles may only partially specify (eg. MACHINE only),
# so we need to construct a set of modifiers to fill in the gaps.
# jot 10 should output 1 2 3 .. 10
JOT ?= jot
_tspec_x := ${${JOT} ${TARGET_SPEC_VARS:[#]}:L:sh}
.if ${TARGET_SPEC_VARS:[#]} > 10
# seriously? better have jot(1) or equivalent to produce suitable sequence
_tspec_x := ${${JOT:Ujot} ${TARGET_SPEC_VARS:[#]}:L:sh}
.else
# we can provide the sequence ourselves
_tspec_x := ${1 2 3 4 5 6 7 8 9 10:L:[1..${TARGET_SPEC_VARS:[#]}]}
.endif
# this handles unqualified entries
M_dep_qual_fixes = C;(/[^/.,]+)$$;\1.$${DEP_TARGET_SPEC};
# there needs to be at least one item missing for these to make sense
@ -287,6 +317,18 @@ _DEP_RELDIR := ${DEP_RELDIR}
.endif
# DIRDEPS_CACHE can be very handy for debugging.
# Also if repeatedly building the same target,
# we can avoid the overhead of re-computing the tree dependencies.
MK_DIRDEPS_CACHE ?= no
BUILD_DIRDEPS_CACHE ?= no
BUILD_DIRDEPS ?= yes
.if ${MK_DIRDEPS_CACHE} == "yes"
# this is where we will cache all our work
DIRDEPS_CACHE ?= ${_OBJDIR:tA}/dirdeps.cache${.TARGETS:Nall:O:u:ts-:S,/,_,g:S,^,.,:N.}
.endif
# pickup customizations
# as below you can use !target(_DIRDEP_USE) to protect things
# which should only be done once.
@ -305,8 +347,10 @@ SKIP_DIR.host += ${SKIP_HOSTDIR}
DEP_SKIP_DIR = ${SKIP_DIR} \
${SKIP_DIR.${DEP_TARGET_SPEC}:U} \
${SKIP_DIR.${DEP_MACHINE}:U} \
${SKIP_DIRDEPS.${DEP_MACHINE}:U}
${TARGET_SPEC_VARS:@v@${SKIP_DIR.${DEP_$v}:U}@} \
${SKIP_DIRDEPS.${DEP_TARGET_SPEC}:U} \
${TARGET_SPEC_VARS:@v@${SKIP_DIRDEPS.${DEP_$v}:U}@}
NSkipDir = ${DEP_SKIP_DIR:${M_ListToSkip}}
@ -344,7 +388,7 @@ _DIRDEP_USE: .USE .MAKE
.ifdef ALL_MACHINES
# this is how you limit it to only the machines we have been built for
# previously.
.if empty(ONLY_MACHINE_LIST)
.if empty(ONLY_TARGET_SPEC_LIST) && empty(ONLY_MACHINE_LIST)
.if !empty(ALL_MACHINE_LIST)
# ALL_MACHINE_LIST is the list of all legal machines - ignore anything else
_machine_list != cd ${_CURDIR} && 'ls' -1 ${ALL_MACHINE_LIST:O:u:@m@${.MAKE.DEPENDFILE:T:R}.$m@} 2> /dev/null; echo
@ -353,7 +397,7 @@ _machine_list != 'ls' -1 ${_CURDIR}/${.MAKE.DEPENDFILE_PREFIX}.* 2> /dev/null; e
.endif
_only_machines := ${_machine_list:${NIgnoreFiles:UN*.bak}:E:O:u}
.else
_only_machines := ${ONLY_MACHINE_LIST}
_only_machines := ${ONLY_TARGET_SPEC_LIST:U} ${ONLY_MACHINE_LIST:U}
.endif
.if empty(_only_machines)
@ -362,30 +406,35 @@ _only_machines := ${TARGET_MACHINE:U${ALL_MACHINE_LIST:U${DEP_MACHINE}}}
.endif
.else # ! ALL_MACHINES
# if ONLY_MACHINE_LIST is set, we are limited to that
# if ONLY_TARGET_SPEC_LIST or ONLY_MACHINE_LIST is set, we are limited to that.
# Note that ONLY_TARGET_SPEC_LIST should be fully qualified.
# if TARGET_MACHINE is set - it is really the same as ONLY_MACHINE_LIST
# otherwise DEP_MACHINE is it - so DEP_MACHINE will match.
_only_machines := ${ONLY_TARGET_SPEC_LIST:U:M${DEP_MACHINE},*}
.if empty(_only_machines)
_only_machines := ${ONLY_MACHINE_LIST:U${TARGET_MACHINE:U${DEP_MACHINE}}:M${DEP_MACHINE}}
.endif
.endif
.if !empty(NOT_MACHINE_LIST)
_only_machines := ${_only_machines:${NOT_MACHINE_LIST:${M_ListToSkip}}}
.endif
.if !empty(NOT_TARGET_SPEC_LIST)
# we must first qualify
_dm := ${DEP_MACHINE}
_only_machines := ${_only_machines:M*,*} ${_only_machines:N*,*:@DEP_MACHINE@${DEP_TARGET_SPEC}@:S,^,.,:${M_dep_qual_fixes:ts:}:O:u:S,^.,,}
DEP_MACHINE := ${_dm}
_only_machines := ${_only_machines:${NOT_TARGET_SPEC_LIST:${M_ListToSkip}}}
.endif
# clean up
_only_machines := ${_only_machines:O:u}
# make sure we have a starting place?
DIRDEPS ?= ${RELDIR}
.endif # target
# if repeatedly building the same target,
# we can avoid the overhead of re-computing the tree dependencies.
MK_DIRDEPS_CACHE ?= no
BUILD_DIRDEPS_CACHE ?= no
BUILD_DIRDEPS ?= yes
.if !defined(NO_DIRDEPS) && !defined(NO_DIRDEPS_BELOW)
.if ${MK_DIRDEPS_CACHE} == "yes"
# this is where we will cache all our work
DIRDEPS_CACHE?= ${_OBJDIR:tA}/dirdeps.cache${.TARGETS:Nall:O:u:ts-:S,/,_,g:S,^,.,:N.}
# just ensure this exists
build-dirdeps:
@ -420,6 +469,7 @@ ${DIRDEPS_CACHE}: .META .NOMETA_CMP
} > ${.TARGET}.new
+@MAKELEVEL=${.MAKE.LEVEL} DIRDEPS_CACHE=${DIRDEPS_CACHE} \
DIRDEPS="${DIRDEPS}" \
TARGET_SPEC=${TARGET_SPEC} \
MAKEFLAGS= ${.MAKE} -C ${_CURDIR} -f ${BUILD_DIRDEPS_MAKEFILE} \
${BUILD_DIRDEPS_TARGETS} BUILD_DIRDEPS_CACHE=yes \
.MAKE.DEPENDFILE=.none \
@ -489,8 +539,10 @@ _machines := ${_machines:O:u}
_dm := ${DEP_MACHINE}
# apply the same filtering that we do when qualifying DIRDEPS.
# M_dep_qual_fixes expects .${MACHINE}* so add (and remove) '.'
_machines := ${_machines:@DEP_MACHINE@${DEP_TARGET_SPEC}@:S,^,.,:${M_dep_qual_fixes:ts:}:O:u:S,^.,,}
# Again we expect that any already qualified machines are fully qualified.
_machines := ${_machines:M*,*} ${_machines:N*,*:@DEP_MACHINE@${DEP_TARGET_SPEC}@:S,^,.,:${M_dep_qual_fixes:ts:}:O:u:S,^.,,}
DEP_MACHINE := ${_dm}
_machines := ${_machines:O:u}
.endif
# reset each time through
@ -522,7 +574,7 @@ _build_dirs += ${_machines:N${DEP_TARGET_SPEC}:@m@${_CURDIR}.$m@}
# these we reset each time through as they can depend on DEP_MACHINE
DEP_DIRDEPS_FILTER = \
${DIRDEPS_FILTER.${DEP_TARGET_SPEC}:U} \
${DIRDEPS_FILTER.${DEP_MACHINE}:U} \
${TARGET_SPEC_VARS:@v@${DIRDEPS_FILTER.${DEP_$v}:U}@} \
${DIRDEPS_FILTER:U}
.if empty(DEP_DIRDEPS_FILTER)
# something harmless
@ -621,6 +673,19 @@ _dirdeps_checked.$d:
.endif
# Note: _build_all_dirs is fully qualifed so d:R is always the directory
.if exists(${d:R})
# we pass _DEP_TARGET_SPEC to tell the next step what we want
_DEP_TARGET_SPEC := ${d:E}
# some makefiles may still look at this
_DEP_MACHINE := ${d:E:C/,.*//}
# set these too in case Makefile.depend* uses them
.if ${TARGET_SPEC_VARS:[#]} > 1
_dtspec := ${_DEP_TARGET_SPEC:S/,/ /g}
.for i in ${_tspec_x}
DEP_${TARGET_SPEC_VARS:[$i]} := ${_dtspec:[$i]}
.endfor
.else
DEP_MACHINE := ${_DEP_MACHINE}
.endif
# Warning: there is an assumption here that MACHINE is always
# the first entry in TARGET_SPEC_VARS.
# If TARGET_SPEC and MACHINE are insufficient, you have a problem.
@ -631,10 +696,6 @@ _qm := ${_m:C;(\.depend)$;\1.${d:E};:${M_dep_qual_fixes:ts:}}
.if ${_debug_search}
.info Looking for ${_qm}
.endif
# we pass _DEP_TARGET_SPEC to tell the next step what we want
_DEP_TARGET_SPEC := ${d:E}
# some makefiles may still look at this
_DEP_MACHINE := ${d:E:C/,.*//}
# set this "just in case"
# we can skip :tA since we computed the path above
DEP_RELDIR := ${_m:H:S,${SRCTOP}/,,}
@ -687,7 +748,7 @@ _src != cd ${.CURDIR} && for m in ${.MAKE.DEPENDFILE_PREFERENCE:T:S,${MACHINE},*
_src?= ${.MAKE.DEPENDFILE}
.MAKE.DEPENDFILE_BOOTSTRAP_SED+= -e 's,${_src:E},${MACHINE},g'
.MAKE.DEPENDFILE_BOOTSTRAP_SED+= -e 's/${_src:E:C/,.*//}/${MACHINE}/g'
# just create Makefile.depend* for this dir
bootstrap-this: .NOTMAIN
@ -696,7 +757,7 @@ bootstrap-this: .NOTMAIN
.if ${_src:T} != ${.MAKE.DEPENDFILE_PREFIX:T}
(cd ${.CURDIR} && sed ${.MAKE.DEPENDFILE_BOOTSTRAP_SED} ${_src} > ${_want})
.else
cp ${.CURDIR}/${_src} ${_want}
cp ${.CURDIR}/${_src:T} ${_want}
.endif
# create Makefile.depend* for this dir and its dependencies

View File

@ -1,4 +1,4 @@
# $Id: gendirdeps.mk,v 1.32 2016/04/05 15:58:37 sjg Exp $
# $Id: gendirdeps.mk,v 1.33 2016/10/11 22:37:28 sjg Exp $
# Copyright (c) 2010-2013, Juniper Networks, Inc.
# All rights reserved.
@ -146,6 +146,9 @@ M2D_OBJROOTS += ${OBJTOP} ${_OBJROOT} ${_objroot}
.if defined(SB_OBJROOT)
M2D_OBJROOTS += ${SB_OBJROOT}
.endif
.if defined(STAGE_ROOT)
M2D_OBJROOTS += ${STAGE_ROOT}
.endif
.if ${.MAKE.DEPENDFILE_PREFERENCE:U${.MAKE.DEPENDFILE}:M*.${MACHINE}} == ""
# meta2deps.py only groks objroot
# so we need to give it what it expects

View File

@ -55,7 +55,7 @@
# Simon J. Gerraty <sjg@crufty.net>
# RCSid:
# $Id: install-mk,v 1.130 2016/08/15 19:28:13 sjg Exp $
# $Id: install-mk,v 1.135 2016/12/12 19:07:42 sjg Exp $
#
# @(#) Copyright (c) 1994 Simon J. Gerraty
#
@ -70,7 +70,7 @@
# sjg@crufty.net
#
MK_VERSION=20160815
MK_VERSION=20161212
OWNER=
GROUP=
MODE=444

View File

@ -1,4 +1,4 @@
# $Id: lib.mk,v 1.54 2016/08/02 20:52:17 sjg Exp $
# $Id: lib.mk,v 1.55 2016/09/23 23:04:51 sjg Exp $
.if !target(__${.PARSEFILE}__)
__${.PARSEFILE}__:
@ -9,39 +9,30 @@ __${.PARSEFILE}__:
NEED_SOLINKS?= yes
.endif
.if exists(${.CURDIR}/shlib_version)
SHLIB_MAJOR != . ${.CURDIR}/shlib_version ; echo $$major
SHLIB_MINOR != . ${.CURDIR}/shlib_version ; echo $$minor
SHLIB_VERSION_FILE?= ${.CURDIR}/shlib_version
.if !defined(SHLIB_MAJOR) && exists(${SHLIB_VERSION_FILE})
SHLIB_MAJOR != . ${SHLIB_VERSION_FILE} ; echo $$major
SHLIB_MINOR != . ${SHLIB_VERSION_FILE} ; echo $$minor
SHLIB_TEENY != . ${SHLIB_VERSION_FILE} ; echo $$teeny
.endif
print-shlib-major:
.if defined(SHLIB_MAJOR) && ${MK_PIC} != "no"
@echo ${SHLIB_MAJOR}
.else
@false
.endif
print-shlib-minor:
.if defined(SHLIB_MINOR) && ${MK_PIC} != "no"
@echo ${SHLIB_MINOR}
.else
@false
.endif
print-shlib-teeny:
.if defined(SHLIB_TEENY) && ${MK_PIC} != "no"
@echo ${SHLIB_TEENY}
.for x in major minor teeny
print-shlib-$x:
.if defined(SHLIB_${x:tu}) && ${MK_PIC} != "no"
@echo ${SHLIB_${x:tu}}
.else
@false
.endif
.endfor
SHLIB_FULLVERSION ?= ${${SHLIB_MAJOR} ${SHLIB_MINOR} ${SHLIB_TEENY}:L:ts.}
SHLIB_FULLVERSION := ${SHLIB_FULLVERSION}
# add additional suffixes not exported.
# .po is used for profiling object files.
# .So is used for PIC object files.
.SUFFIXES: .out .a .ln .So .po .o .s .S .c .cc .C .m .F .f .r .y .l .cl .p .h
# ${PICO} is used for PIC object files.
PICO?= .pico
.SUFFIXES: .out .a .ln ${PICO} .po .o .s .S .c .cc .C .m .F .f .r .y .l .cl .p .h
.SUFFIXES: .sh .m4 .m
CFLAGS+= ${COPTS}
@ -62,12 +53,12 @@ CFLAGS+= ${COPTS}
# with ELF, also set shared-lib version for ld.so.
# SHLIB_LDSTARTFILE: support .o file, call C++ file-level constructors
# SHLIB_LDENDFILE: support .o file, call C++ file-level destructors
# FPICFLAGS: flags for ${FC} to compile .[fF] files to .So objects.
# FPICFLAGS: flags for ${FC} to compile .[fF] files to ${PICO} objects.
# CPPICFLAGS: flags for ${CPP} to preprocess .[sS] files for ${AS}
# CPICFLAGS: flags for ${CC} to compile .[cC] files to .So objects.
# CPICFLAGS: flags for ${CC} to compile .[cC] files to ${PICO} objects.
# CAPICFLAGS flags for {$CC} to compiling .[Ss] files
# (usually just ${CPPPICFLAGS} ${CPICFLAGS})
# APICFLAGS: flags for ${AS} to assemble .[sS] to .So objects.
# APICFLAGS: flags for ${AS} to assemble .[sS] to ${PICO} objects.
.if ${TARGET_OSNAME} == "NetBSD"
.if ${MACHINE_ARCH} == "alpha"
@ -162,14 +153,14 @@ LD_shared=-b
LD_so=sl
DLLIB=
# HPsUX lorder does not grok anything but .o
LD_sobjs=`${LORDER} ${OBJS} | ${TSORT} | sed 's,\.o,.So,'`
LD_sobjs=`${LORDER} ${OBJS} | ${TSORT} | sed 's,\.o,${PICO},'`
LD_pobjs=`${LORDER} ${OBJS} | ${TSORT} | sed 's,\.o,.po,'`
.elif ${TARGET_OSNAME} == "OSF1"
LD_shared= -msym -shared -expect_unresolved '*'
LD_solib= -all lib${LIB}_pic.a
DLLIB=
# lorder does not grok anything but .o
LD_sobjs=`${LORDER} ${OBJS} | ${TSORT} | sed 's,\.o,.So,'`
LD_sobjs=`${LORDER} ${OBJS} | ${TSORT} | sed 's,\.o,${PICO},'`
LD_pobjs=`${LORDER} ${OBJS} | ${TSORT} | sed 's,\.o,.po,'`
AR_cq= -cqs
.elif ${TARGET_OSNAME} == "FreeBSD"
@ -250,9 +241,9 @@ AR_cq ?= cq
DLLIB ?= -ldl
.endif
# some libs have lots of objects, and scanning all .o, .po and .So meta files
# some libs have lots of objects, and scanning all .o, .po and ${PICO} meta files
# is a waste of time, this tells meta.autodep.mk to just pick one
# (typically .So)
# (typically ${PICO})
# yes, 42 is a random number.
.if ${MK_DIRDEPS_BUILD} == "yes" && ${SRCS:Uno:[\#]} > 42
OPTIMIZE_OBJECT_META_FILES ?= yes
@ -287,7 +278,7 @@ ${CXX_SUFFIXES:%=%.o}:
${CXX_SUFFIXES:%=%.po}:
${COMPILE.cc} -pg ${.IMPSRC} -o ${.TARGET}
.S.So .s.So:
.S${PICO} .s${PICO}:
${COMPILE.S} ${PICFLAG} ${CC_PIC} ${CFLAGS:M-[ID]*} ${AINC} ${.IMPSRC} -o ${.TARGET}
.else
.c.po:
@ -302,7 +293,7 @@ ${CXX_SUFFIXES:%=%.po}:
@${LD} ${LD_X} ${LD_r} ${.TARGET}.o -o ${.TARGET}
@rm -f ${.TARGET}.o
.S.So .s.So:
.S${PICO} .s${PICO}:
@echo ${COMPILE.S} ${PICFLAG} ${CC_PIC} ${CFLAGS:M-[ID]*} ${AINC} ${.IMPSRC} -o ${.TARGET}
@${COMPILE.S} ${PICFLAG} ${CC_PIC} ${CFLAGS:M-[ID]*} ${AINC} ${.IMPSRC} -o ${.TARGET}.o
@${LD} ${LD_x} ${LD_r} ${.TARGET}.o -o ${.TARGET}
@ -310,23 +301,23 @@ ${CXX_SUFFIXES:%=%.po}:
.endif
.if (${LD_x} == "")
.c.So:
.c${PICO}:
${COMPILE.c} ${PICFLAG} ${CC_PIC} ${.IMPSRC} -o ${.TARGET}
${CXX_SUFFIXES:%=%.So}:
${CXX_SUFFIXES:%=%${PICO}}:
${COMPILE.cc} ${PICFLAG} ${CC_PIC} ${.IMPSRC} -o ${.TARGET}
.S.po .s.po:
${COMPILE.S} ${PROFFLAGS} ${CFLAGS:M-[ID]*} ${AINC} ${.IMPSRC} -o ${.TARGET}
.else
.c.So:
.c${PICO}:
@echo ${COMPILE.c} ${PICFLAG} ${CC_PIC} ${.IMPSRC} -o ${.TARGET}
@${COMPILE.c} ${PICFLAG} ${CC_PIC} ${.IMPSRC} -o ${.TARGET}.o
@${LD} ${LD_x} ${LD_r} ${.TARGET}.o -o ${.TARGET}
@rm -f ${.TARGET}.o
${CXX_SUFFIXES:%=%.So}:
${CXX_SUFFIXES:%=%${PICO}}:
@echo ${COMPILE.cc} ${PICFLAG} ${CC_PIC} ${.IMPSRC} -o ${.TARGET}
@${COMPILE.cc} ${PICFLAG} ${CC_PIC} ${.IMPSRC} -o ${.TARGET}.o
@${LD} ${LD_x} ${LD_r} ${.TARGET}.o -o ${.TARGET}
@ -396,7 +387,7 @@ prebuild:
all: _SUBDIRUSE
.for s in ${SRCS:N*.h:M*/*}
${.o .So .po .lo:L:@o@${s:T:R}$o@}: $s
${.o ${PICO} .po .lo:L:@o@${s:T:R}$o@}: $s
.endfor
OBJS+= ${SRCS:T:N*.h:R:S/$/.o/g}
@ -441,7 +432,7 @@ lib${LIB}_p.a:: ${POBJS}
@${AR} ${AR_cq} ${.TARGET} ${LD_pobjs}
${RANLIB} ${.TARGET}
SOBJS+= ${OBJS:.o=.So}
SOBJS+= ${OBJS:.o=${PICO}}
.NOPATH: ${SOBJS}
lib${LIB}_pic.a:: ${SOBJS}
@echo building shared object ${LIB} library
@ -502,7 +493,7 @@ cleandir: _SUBDIRUSE clean
.if defined(SRCS) && (!defined(MKDEP) || ${MKDEP} != autodep)
afterdepend: .depend
@(TMP=/tmp/_depend$$$$; \
sed -e 's/^\([^\.]*\).o[ ]*:/\1.o \1.po \1.So \1.ln:/' \
sed -e 's/^\([^\.]*\).o[ ]*:/\1.o \1.po \1${PICO} \1.ln:/' \
< .depend > $$TMP; \
mv $$TMP .depend)
.endif

View File

@ -1,4 +1,4 @@
# $Id: meta.stage.mk,v 1.45 2016/05/26 03:59:09 sjg Exp $
# $Id: meta.stage.mk,v 1.47 2016/12/07 23:07:49 sjg Exp $
#
# @(#) Copyright (c) 2011, Simon J. Gerraty
#
@ -58,7 +58,7 @@ GENDIRDEPS_FILTER += Nnot-empty-is-important \
LN_CP_SCRIPT = LnCp() { \
rm -f $$2 2> /dev/null; \
{ [ -z "$$mode" ] && ln $$1 $$2 2> /dev/null; } || \
{ [ -z "$$mode" ] && ${LN:Uln} $$1 $$2 2> /dev/null; } || \
cp -p $$1 $$2; }
# a staging conflict should cause an error
@ -219,19 +219,29 @@ stage_symlinks: .dirdep
.if !empty(STAGE_AS_SETS)
CLEANFILES += ${STAGE_AS_SETS:@s@stage*$s@}
STAGE_TARGETS += stage_as
STAGE_TARGETS += stage_as stage_as_and_symlink
# sometimes things need to be renamed as they are staged
# each ${file} will be staged as ${STAGE_AS_${file:T}}
# one could achieve the same with SYMLINKS
# stage_as_and_symlink makes the original name a symlink to the new name
# it is the same as using stage_as and stage_symlinks but ensures
# both operations happen together
.for s in ${STAGE_AS_SETS:O:u}
STAGE_AS.$s ?= ${.ALLSRC:N.dirdep:Nstage_*}
STAGE_AS_AND_SYMLINK.$s ?= ${.ALLSRC:N.dirdep:Nstage_*}
stage_as: stage_as.$s
stage_as.$s: .dirdep
@${STAGE_AS_SCRIPT}; StageAs ${FLAGS.$@} ${STAGE_FILES_DIR.$s:U${STAGE_DIR.$s}:${STAGE_DIR_FILTER}} ${STAGE_AS.$s:@f@$f ${STAGE_AS_${f:tA}:U${STAGE_AS_${f:T}:U${f:T}}}@}
@touch $@
stage_as_and_symlink: stage_as_and_symlink.$s
stage_as_and_symlink.$s: .dirdep
@${STAGE_AS_SCRIPT}; StageAs ${FLAGS.$@} ${STAGE_FILES_DIR.$s:U${STAGE_DIR.$s}:${STAGE_DIR_FILTER}} ${STAGE_AS_AND_SYMLINK.$s:@f@$f ${STAGE_AS_${f:tA}:U${STAGE_AS_${f:T}:U${f:T}}}@}
@${STAGE_LINKS_SCRIPT}; StageLinks -s ${STAGE_FILES_DIR.$s:U${STAGE_DIR.$s}:${STAGE_DIR_FILTER}} ${STAGE_AS_AND_SYMLINK.$s:@f@${STAGE_AS_${f:tA}:U${STAGE_AS_${f:T}:U${f:T}}} $f@}
@touch $@
.endfor
.endif

View File

@ -1,4 +1,4 @@
# $Id: meta.sys.mk,v 1.29 2016/08/13 17:51:45 sjg Exp $
# $Id: meta.sys.mk,v 1.31 2016/09/10 00:44:46 sjg Exp $
#
# @(#) Copyright (c) 2010, Simon J. Gerraty
@ -102,9 +102,6 @@ _metaError: .NOMETA .NOTMAIN
.endif
META_COOKIE_TOUCH=
# some targets need to be .PHONY in non-meta mode
META_NOPHONY= .PHONY
# Are we, after all, in meta mode?
.if ${.MAKE.MODE:Uno:Mmeta*} != ""
MKDEP_MK = meta.autodep.mk
@ -121,7 +118,7 @@ MKDEP_MK = meta.autodep.mk
# we can afford to use cookies to prevent some targets
# re-running needlessly
META_COOKIE_TOUCH= touch ${COOKIE.${.TARGET}:U${.OBJDIR}/${.TARGET}}
META_COOKIE_TOUCH?= touch ${COOKIE.${.TARGET}:U${.OBJDIR}/${.TARGET:T}}
META_NOPHONY=
# some targets involve old pre-built targets
@ -162,5 +159,9 @@ BUILD_AT_LEVEL0 ?= no
.endif
.endif
.else
META_COOKIE_TOUCH=
# some targets need to be .PHONY in non-meta mode
META_NOPHONY= .PHONY
.endif
.endif

View File

@ -37,7 +37,7 @@
"""
RCSid:
$Id: meta2deps.py,v 1.19 2016/04/02 20:45:40 sjg Exp $
$Id: meta2deps.py,v 1.22 2016/12/12 19:07:42 sjg Exp $
Copyright (c) 2011-2013, Juniper Networks, Inc.
All rights reserved.
@ -113,7 +113,7 @@ def abspath(path, cwd, last_dir=None, debug=0, debug_out=sys.stderr):
if rpath:
path = rpath
if (path.find('/') < 0 or
path.find('./') > 0 or
path.find('./') > 0 or
path.endswith('/..') or
os.path.islink(path)):
return os.path.realpath(path)
@ -153,38 +153,38 @@ def __init__(self, name, conf={}):
"""if name is set we will parse it now.
conf can have the follwing keys:
SRCTOPS list of tops of the src tree(s).
SRCTOPS list of tops of the src tree(s).
CURDIR the src directory 'bmake' was run from.
CURDIR the src directory 'bmake' was run from.
RELDIR the relative path from SRCTOP to CURDIR
RELDIR the relative path from SRCTOP to CURDIR
MACHINE the machine we built for.
set to 'none' if we are not cross-building.
More specifically if machine cannot be deduced from objdirs.
MACHINE the machine we built for.
set to 'none' if we are not cross-building.
More specifically if machine cannot be deduced from objdirs.
TARGET_SPEC
Sometimes MACHINE isn't enough.
Sometimes MACHINE isn't enough.
HOST_TARGET
when we build for the pseudo machine 'host'
the object tree uses HOST_TARGET rather than MACHINE.
when we build for the pseudo machine 'host'
the object tree uses HOST_TARGET rather than MACHINE.
OBJROOTS a list of the common prefix for all obj dirs it might
end in '/' or '-'.
end in '/' or '-'.
DPDEPS names an optional file to which per file dependencies
will be appended.
For example if 'some/path/foo.h' is read from SRCTOP
then 'DPDEPS_some/path/foo.h +=' "RELDIR" is output.
This can allow 'bmake' to learn all the dirs within
the tree that depend on 'foo.h'
DPDEPS names an optional file to which per file dependencies
will be appended.
For example if 'some/path/foo.h' is read from SRCTOP
then 'DPDEPS_some/path/foo.h +=' "RELDIR" is output.
This can allow 'bmake' to learn all the dirs within
the tree that depend on 'foo.h'
EXCLUDES
A list of paths to ignore.
ccache(1) can otherwise be trouble.
EXCLUDES
A list of paths to ignore.
ccache(1) can otherwise be trouble.
debug desired debug level
debug desired debug level
debug_out open file to send debug output to (sys.stderr)
@ -228,8 +228,9 @@ def __init__(self, name, conf={}):
if objroot.endswith(e):
# this is not what we want - fix it
objroot = objroot[0:-len(e)]
if e.endswith('/'):
objroot += '/'
if objroot[-1] != '/':
objroot += '/'
if not objroot in self.objroots:
self.objroots.append(objroot)
_objroot = os.path.realpath(objroot)
@ -292,6 +293,9 @@ def file_depends(self, out=None):
return None
for f in sort_unique(self.file_deps):
print('DPDEPS_%s += %s' % (f, self.reldir), file=out)
# these entries provide for reverse DIRDEPS lookup
for f in self.obj_deps:
print('DEPDIRS_%s += %s' % (f, self.reldir), file=out)
def seenit(self, dir):
"""rememer that we have seen dir."""
@ -359,28 +363,28 @@ def try_parse(self, name=None, file=None):
def parse(self, name=None, file=None):
"""A meta file looks like:
# Meta data file "path"
CMD "command-line"
CWD "cwd"
TARGET "target"
-- command output --
-- filemon acquired metadata --
# buildmon version 3
V 3
C "pid" "cwd"
E "pid" "path"
F "pid" "child"
R "pid" "path"
W "pid" "path"
X "pid" "status"
D "pid" "path"
L "pid" "src" "target"
M "pid" "old" "new"
S "pid" "path"
# Bye bye
# Meta data file "path"
CMD "command-line"
CWD "cwd"
TARGET "target"
-- command output --
-- filemon acquired metadata --
# buildmon version 3
V 3
C "pid" "cwd"
E "pid" "path"
F "pid" "child"
R "pid" "path"
W "pid" "path"
X "pid" "status"
D "pid" "path"
L "pid" "src" "target"
M "pid" "old" "new"
S "pid" "path"
# Bye bye
We go to some effort to avoid processing a dependency more than once.
Of the above record types only C,E,F,L,R,V and W are of interest.
We go to some effort to avoid processing a dependency more than once.
Of the above record types only C,E,F,L,R,V and W are of interest.
"""
version = 0 # unknown
@ -430,7 +434,6 @@ def parse(self, name=None, file=None):
pid = int(w[1])
if pid != last_pid:
if last_pid:
pid_cwd[last_pid] = cwd
pid_last_dir[last_pid] = self.last_dir
cwd = getv(pid_cwd, pid, self.cwd)
self.last_dir = getv(pid_last_dir, pid, self.cwd)
@ -447,7 +450,8 @@ def parse(self, name=None, file=None):
cwd = abspath(w[2], cwd, None, self.debug, self.debug_out)
if cwd.endswith('/.'):
cwd = cwd[0:-2]
self.last_dir = cwd
self.last_dir = pid_last_dir[pid] = cwd
pid_cwd[pid] = cwd
if self.debug > 1:
print("cwd=", cwd, file=self.debug_out)
continue
@ -544,6 +548,9 @@ def parse_path(self, path, cwd, op=None, w=[]):
ddep = self.find_obj(objroot, dir, path, w[2])
if ddep:
self.add(self.obj_deps, ddep, 'obj')
if self.dpdeps and objroot.endswith('/stage/'):
sp = '/'.join(path.replace(objroot,'').split('/')[1:])
self.add(self.file_deps, sp, 'file')
else:
# don't waste time looking again
self.seenit(w[2])

View File

@ -77,7 +77,7 @@
# RCSid:
# $Id: meta2deps.sh,v 1.10 2016/03/02 18:53:36 sjg Exp $
# $Id: meta2deps.sh,v 1.12 2016/12/13 20:44:16 sjg Exp $
# Copyright (c) 2010-2013, Juniper Networks, Inc.
# All rights reserved.
@ -255,7 +255,7 @@ meta2deps() {
*)
case "$lpid" in
"") ;;
*) eval ldir_$lpid=$ldir cwd_$lpid=$cwd;;
*) eval ldir_$lpid=$ldir;;
esac
eval ldir=\${ldir_$pid:-$CWD} cwd=\${cwd_$pid:-$CWD}
lpid=$pid
@ -271,9 +271,11 @@ meta2deps() {
esac
# watch out for temp dirs that no longer exist
test -d ${cwd:-/dev/null/no/such} || cwd=$CWD
eval cwd_$pid=$cwd
continue
;;
F,*) eval cwd_$path=$cwd ldir_$path=$ldir
F,*) # $path is new pid
eval cwd_$path=$cwd ldir_$path=$ldir
continue
;;
*) dir=${path%/*}

33
mk/sys.debug.mk Normal file
View File

@ -0,0 +1,33 @@
# $Id: sys.debug.mk,v 1.1 2016/10/01 19:11:55 sjg Exp $
#
# @(#) Copyright (c) 2009, Simon J. Gerraty
#
# This file is provided in the hope that it will
# be of use. There is absolutely NO WARRANTY.
# Permission to copy, redistribute or otherwise
# use this file is hereby granted provided that
# the above copyright notice and this notice are
# left intact.
#
# Please send copies of changes and bug-fixes to:
# sjg@crufty.net
#
# Sometimes we want to turn on debugging in just one or two places
# if .CURDIR is matched by any entry in DEBUG_MAKE_SYS_DIRS we
# will apply DEBUG_MAKE_FLAGS now.
# if an entry in DEBUG_MAKE_DIRS matches, we at the end of sys.mk
# eg. DEBUG_MAKE_FLAGS=-dv DEBUG_MAKE_SYS_DIRS="*lib/sjg"
# use DEBUG_MAKE_FLAGS0 to apply only to .MAKE.LEVEL 0
#
.if ${.MAKE.LEVEL:U1} == 0
# we use indirection, to simplify the tests below, and incase
# DEBUG_* were given on our command line.
_DEBUG_MAKE_FLAGS = ${DEBUG_MAKE_FLAGS0}
_DEBUG_MAKE_SYS_DIRS = ${DEBUG_MAKE_SYS_DIRS0:U${DEBUG_MAKE_SYS_DIRS}}
_DEBUG_MAKE_DIRS = ${DEBUG_MAKE_DIRS0:U${DEBUG_MAKE_DIRS}}
.else
_DEBUG_MAKE_FLAGS = ${DEBUG_MAKE_FLAGS}
_DEBUG_MAKE_SYS_DIRS = ${DEBUG_MAKE_SYS_DIRS}
_DEBUG_MAKE_DIRS = ${DEBUG_MAKE_DIRS}
.endif

View File

@ -1,4 +1,4 @@
# $Id: sys.mk,v 1.43 2016/04/05 15:58:37 sjg Exp $
# $Id: sys.mk,v 1.44 2016/10/01 19:11:55 sjg Exp $
#
# @(#) Copyright (c) 2003-2009, Simon J. Gerraty
#
@ -15,38 +15,8 @@
# Avoid putting anything platform specific in here.
# We use the following paradigm for preventing multiple inclusion.
# It relies on the fact that conditionals and dependencies are resolved
# at the time they are read.
#
# _this ?= ${.PARSEFILE}
# .if !target(__${_this}__)
# __${_this}__:
#
.if ${MAKE_VERSION:U0} > 20100408
_this = ${.PARSEDIR:tA}/${.PARSEFILE}
.else
_this = ${.PARSEDIR}/${.PARSEFILE}
.endif
# Sometimes we want to turn on debugging in just one or two places
# if .CURDIR is matched by any entry in DEBUG_MAKE_SYS_DIRS we
# will apply DEBUG_MAKE_FLAGS now.
# if an entry in DEBUG_MAKE_DIRS matches, we at the end of sys.mk
# eg. DEBUG_MAKE_FLAGS=-dv DEBUG_MAKE_SYS_DIRS="*lib/sjg"
# use DEBUG_MAKE_FLAGS0 to apply only to .MAKE.LEVEL 0
#
.if ${.MAKE.LEVEL:U1} == 0
# we use indirection, to simplify the tests below, and incase
# DEBUG_* were given on our command line.
_DEBUG_MAKE_FLAGS = ${DEBUG_MAKE_FLAGS0}
_DEBUG_MAKE_SYS_DIRS = ${DEBUG_MAKE_SYS_DIRS0:U${DEBUG_MAKE_SYS_DIRS}}
_DEBUG_MAKE_DIRS = ${DEBUG_MAKE_DIRS0:U${DEBUG_MAKE_DIRS}}
.else
_DEBUG_MAKE_FLAGS = ${DEBUG_MAKE_FLAGS}
_DEBUG_MAKE_SYS_DIRS = ${DEBUG_MAKE_SYS_DIRS}
_DEBUG_MAKE_DIRS = ${DEBUG_MAKE_DIRS}
.endif
# _DEBUG_MAKE_FLAGS etc.
.include <sys.debug.mk>
.if !empty(_DEBUG_MAKE_FLAGS)
.if ${_DEBUG_MAKE_SYS_DIRS:Uno:@x@${.CURDIR:M$x}@} != ""
@ -54,47 +24,8 @@ _DEBUG_MAKE_DIRS = ${DEBUG_MAKE_DIRS}
.endif
.endif
# if this is an ancient version of bmake
MAKE_VERSION ?= 0
.if ${MAKE_VERSION:M*make-*}
# turn it into what we want - just the date
MAKE_VERSION := ${MAKE_VERSION:[1]:C,.*-,,}
.endif
# some useful modifiers
# A useful trick for testing multiple :M's against something
# :L says to use the variable's name as its value - ie. literal
# got = ${clean* destroy:${M_ListToMatch:S,V,.TARGETS,}}
M_ListToMatch = L:@m@$${V:M$$m}@
# match against our initial targets (see above)
M_L_TARGETS = ${M_ListToMatch:S,V,_TARGETS,}
# turn a list into a set of :N modifiers
# NskipFoo = ${Foo:${M_ListToSkip}}
M_ListToSkip= O:u:ts::S,:,:N,g:S,^,N,
# type should be a builtin in any sh since about 1980,
# but sadly there are exceptions!
.if ${.MAKE.OS:Unknown:NBSD/OS} == ""
_type_sh = which
.endif
# AUTOCONF := ${autoconf:L:${M_whence}}
M_type = @x@(${_type_sh:Utype} $$x) 2> /dev/null; echo;@:sh:[0]:N* found*:[@]:C,[()],,g
M_whence = ${M_type}:M/*:[1]
# convert a path to a valid shell variable
M_P2V = tu:C,[./-],_,g
# convert path to absolute
.if ${MAKE_VERSION:U0} > 20100408
M_tA = tA
.else
M_tA = C,.*,('cd' & \&\& 'pwd') 2> /dev/null || echo &,:sh
.endif
# absoulte path to what we are reading.
_PARSEDIR = ${.PARSEDIR:${M_tA}}
# useful modifiers
.include <sys.vars.mk>
# we expect a recent bmake
.if !defined(_TARGETS)

71
mk/sys.vars.mk Normal file
View File

@ -0,0 +1,71 @@
# $Id: sys.vars.mk,v 1.1 2016/10/01 19:11:55 sjg Exp $
#
# @(#) Copyright (c) 2003-2009, Simon J. Gerraty
#
# This file is provided in the hope that it will
# be of use. There is absolutely NO WARRANTY.
# Permission to copy, redistribute or otherwise
# use this file is hereby granted provided that
# the above copyright notice and this notice are
# left intact.
#
# Please send copies of changes and bug-fixes to:
# sjg@crufty.net
#
# We use the following paradigm for preventing multiple inclusion.
# It relies on the fact that conditionals and dependencies are resolved
# at the time they are read.
#
# _this ?= ${.PARSEFILE}
# .if !target(__${_this}__)
# __${_this}__:
#
.if ${MAKE_VERSION:U0} > 20100408
_this = ${.PARSEDIR:tA}/${.PARSEFILE}
.else
_this = ${.PARSEDIR}/${.PARSEFILE}
.endif
# if this is an ancient version of bmake
MAKE_VERSION ?= 0
.if ${MAKE_VERSION:M*make-*}
# turn it into what we want - just the date
MAKE_VERSION := ${MAKE_VERSION:[1]:C,.*-,,}
.endif
# some useful modifiers
# A useful trick for testing multiple :M's against something
# :L says to use the variable's name as its value - ie. literal
# got = ${clean* destroy:${M_ListToMatch:S,V,.TARGETS,}}
M_ListToMatch = L:@m@$${V:M$$m}@
# match against our initial targets (see above)
M_L_TARGETS = ${M_ListToMatch:S,V,_TARGETS,}
# turn a list into a set of :N modifiers
# NskipFoo = ${Foo:${M_ListToSkip}}
M_ListToSkip= O:u:ts::S,:,:N,g:S,^,N,
# type should be a builtin in any sh since about 1980,
# but sadly there are exceptions!
.if ${.MAKE.OS:Unknown:NBSD/OS} == ""
_type_sh = which
.endif
# AUTOCONF := ${autoconf:L:${M_whence}}
M_type = @x@(${_type_sh:Utype} $$x) 2> /dev/null; echo;@:sh:[0]:N* found*:[@]:C,[()],,g
M_whence = ${M_type}:M/*:[1]
# convert a path to a valid shell variable
M_P2V = tu:C,[./-],_,g
# convert path to absolute
.if ${MAKE_VERSION:U0} > 20100408
M_tA = tA
.else
M_tA = C,.*,('cd' & \&\& 'pwd') 2> /dev/null || echo &,:sh
.endif
# absoulte path to what we are reading.
_PARSEDIR = ${.PARSEDIR:${M_tA}}

View File

@ -1,4 +1,4 @@
/* $NetBSD: nonints.h,v 1.73 2016/06/03 01:21:59 sjg Exp $ */
/* $NetBSD: nonints.h,v 1.74 2016/09/05 00:40:29 sevan Exp $ */
/*-
* Copyright (c) 1988, 1989, 1990, 1993
@ -109,7 +109,6 @@ void JobReapChild(pid_t, WAIT_T, Boolean);
/* main.c */
void Main_ParseArgLine(const char *);
void MakeMode(const char *);
int main(int, char **);
char *Cmd_Exec(const char *, const char **);
void Error(const char *, ...) MAKE_ATTR_PRINTFLIKE(1, 2);
void Fatal(const char *, ...) MAKE_ATTR_PRINTFLIKE(1, 2) MAKE_ATTR_DEAD;

19
parse.c
View File

@ -1,4 +1,4 @@
/* $NetBSD: parse.c,v 1.214 2016/04/06 09:57:00 gson Exp $ */
/* $NetBSD: parse.c,v 1.217 2016/12/09 22:56:21 sjg Exp $ */
/*
* Copyright (c) 1988, 1989, 1990, 1993
@ -69,14 +69,14 @@
*/
#ifndef MAKE_NATIVE
static char rcsid[] = "$NetBSD: parse.c,v 1.214 2016/04/06 09:57:00 gson Exp $";
static char rcsid[] = "$NetBSD: parse.c,v 1.217 2016/12/09 22:56:21 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.214 2016/04/06 09:57:00 gson Exp $");
__RCSID("$NetBSD: parse.c,v 1.217 2016/12/09 22:56:21 sjg Exp $");
#endif
#endif /* not lint */
#endif
@ -184,6 +184,7 @@ typedef struct IFile {
typedef enum {
Begin, /* .BEGIN */
Default, /* .DEFAULT */
DeleteOnError, /* .DELETE_ON_ERROR */
End, /* .END */
dotError, /* .ERROR */
Ignore, /* .IGNORE */
@ -301,6 +302,7 @@ static const struct {
} parseKeywords[] = {
{ ".BEGIN", Begin, 0 },
{ ".DEFAULT", Default, 0 },
{ ".DELETE_ON_ERROR", DeleteOnError, 0 },
{ ".END", End, 0 },
{ ".ERROR", dotError, 0 },
{ ".EXEC", Attribute, OP_EXEC },
@ -1334,6 +1336,7 @@ ParseDoDependency(char *line)
* .BEGIN
* .END
* .ERROR
* .DELETE_ON_ERROR
* .INTERRUPT Are not to be considered the
* main target.
* .NOTPARALLEL Make only one target at a time.
@ -1369,6 +1372,9 @@ ParseDoDependency(char *line)
(void)Lst_AtEnd(targets, gn);
DEFAULT = gn;
break;
case DeleteOnError:
deleteOnError = TRUE;
break;
case NotParallel:
maxJobs = 1;
break;
@ -1597,7 +1603,8 @@ ParseDoDependency(char *line)
goto out;
}
*line = '\0';
} else if ((specType == NotParallel) || (specType == SingleShell)) {
} else if ((specType == NotParallel) || (specType == SingleShell) ||
(specType == DeleteOnError)) {
*line = '\0';
}
@ -1658,7 +1665,7 @@ ParseDoDependency(char *line)
Suff_SetNull(line);
break;
case ExObjdir:
Main_SetObjdir(line);
Main_SetObjdir("%s", line);
break;
default:
break;
@ -1858,7 +1865,7 @@ Parse_DoVar(char *line, GNode *ctxt)
* XXX Rather than counting () and {} we should look for $ and
* then expand the variable.
*/
for (depth = 0, cp = line + 1; depth != 0 || *cp != '='; cp++) {
for (depth = 0, cp = line + 1; depth > 0 || *cp != '='; cp++) {
if (*cp == '(' || *cp == '{') {
depth++;
continue;