From owner-svn-src-head@freebsd.org Mon Dec 19 23:38:10 2016 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 50DB9C88AEA; Mon, 19 Dec 2016 23:38:10 +0000 (UTC) (envelope-from sjg@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id C68B51E9F; Mon, 19 Dec 2016 23:38:09 +0000 (UTC) (envelope-from sjg@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id uBJNc9dE034933; Mon, 19 Dec 2016 23:38:09 GMT (envelope-from sjg@FreeBSD.org) Received: (from sjg@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id uBJNc7Rs034916; Mon, 19 Dec 2016 23:38:07 GMT (envelope-from sjg@FreeBSD.org) Message-Id: <201612192338.uBJNc7Rs034916@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: sjg set sender to sjg@FreeBSD.org using -f From: "Simon J. Gerraty" Date: Mon, 19 Dec 2016 23:38:07 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r310304 - in head: contrib/bmake contrib/bmake/mk usr.bin/bmake X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 19 Dec 2016 23:38:10 -0000 Author: sjg Date: Mon Dec 19 23:38:07 2016 New Revision: 310304 URL: https://svnweb.freebsd.org/changeset/base/310304 Log: Merge bmake-20161212 Added: head/contrib/bmake/mk/sys.debug.mk - copied unchanged from r310300, vendor/NetBSD/bmake/dist/mk/sys.debug.mk head/contrib/bmake/mk/sys.vars.mk - copied unchanged from r310300, vendor/NetBSD/bmake/dist/mk/sys.vars.mk Modified: head/contrib/bmake/ChangeLog head/contrib/bmake/Makefile head/contrib/bmake/bmake.1 head/contrib/bmake/bmake.cat1 head/contrib/bmake/compat.c head/contrib/bmake/job.c head/contrib/bmake/main.c head/contrib/bmake/make.1 head/contrib/bmake/make.c head/contrib/bmake/make.h head/contrib/bmake/mk/ChangeLog head/contrib/bmake/mk/FILES head/contrib/bmake/mk/dirdeps.mk head/contrib/bmake/mk/gendirdeps.mk head/contrib/bmake/mk/install-mk head/contrib/bmake/mk/lib.mk head/contrib/bmake/mk/meta.stage.mk head/contrib/bmake/mk/meta.sys.mk head/contrib/bmake/mk/meta2deps.py head/contrib/bmake/mk/meta2deps.sh head/contrib/bmake/mk/sys.mk head/contrib/bmake/nonints.h head/contrib/bmake/parse.c head/usr.bin/bmake/Makefile Directory Properties: head/contrib/bmake/ (props changed) Modified: head/contrib/bmake/ChangeLog ============================================================================== --- head/contrib/bmake/ChangeLog Mon Dec 19 22:28:28 2016 (r310303) +++ head/contrib/bmake/ChangeLog Mon Dec 19 23:38:07 2016 (r310304) @@ -1,3 +1,32 @@ +2016-12-12 Simon J. Gerraty + + * 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 + + * 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 + + * 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 + + * 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 + + * Makefile MAN: tweak .Dt to match ${PROG} + 2016-08-18 Simon J. Gerraty * Makefile (_MAKE_VERSION): 20160818 Modified: head/contrib/bmake/Makefile ============================================================================== --- head/contrib/bmake/Makefile Mon Dec 19 22:28:28 2016 (r310303) +++ head/contrib/bmake/Makefile Mon Dec 19 23:38:07 2016 (r310304) @@ -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 > $@ Modified: head/contrib/bmake/bmake.1 ============================================================================== --- head/contrib/bmake/bmake.1 Mon Dec 19 22:28:28 2016 (r310303) +++ head/contrib/bmake/bmake.1 Mon Dec 19 23:38:07 2016 (r310304) @@ -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. Modified: head/contrib/bmake/bmake.cat1 ============================================================================== --- head/contrib/bmake/bmake.cat1 Mon Dec 19 22:28:28 2016 (r310303) +++ head/contrib/bmake/bmake.cat1 Mon Dec 19 23:38:07 2016 (r310304) @@ -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 TTAARRGGEETT 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 Modified: head/contrib/bmake/compat.c ============================================================================== --- head/contrib/bmake/compat.c Mon Dec 19 22:28:28 2016 (r310303) +++ head/contrib/bmake/compat.c Mon Dec 19 23:38:07 2016 (r310304) @@ -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 #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; - 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); + CompatDeleteTarget(curTarg); + if ((curTarg != NULL) && !Targ_Precious (curTarg)) { /* * 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 @@ again: * 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); } } Modified: head/contrib/bmake/job.c ============================================================================== --- head/contrib/bmake/job.c Mon Dec 19 22:28:28 2016 (r310303) +++ head/contrib/bmake/job.c Mon Dec 19 23:38:07 2016 (r310304) @@ -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 #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 @@ -404,6 +404,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 * * Signal lock routines to get exclusive access. Currently used to @@ -1049,6 +1064,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)) { @@ -1066,6 +1084,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); } @@ -2601,12 +2622,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, Modified: head/contrib/bmake/main.c ============================================================================== --- head/contrib/bmake/main.c Mon Dec 19 22:28:28 2016 (r310303) +++ head/contrib/bmake/main.c Mon Dec 19 23:38:07 2016 (r310304) @@ -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 #ifndef lint @@ -81,7 +81,7 @@ __COPYRIGHT("@(#) Copyright (c) 1988, 19 #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 Modified: head/contrib/bmake/make.1 ============================================================================== --- head/contrib/bmake/make.1 Mon Dec 19 22:28:28 2016 (r310303) +++ head/contrib/bmake/make.1 Mon Dec 19 23:38:07 2016 (r310304) @@ -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 @@ -2022,6 +2022,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. Modified: head/contrib/bmake/make.c ============================================================================== --- head/contrib/bmake/make.c Mon Dec 19 22:28:28 2016 (r310303) +++ head/contrib/bmake/make.c Mon Dec 19 23:38:07 2016 (r310304) @@ -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 #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 { Modified: head/contrib/bmake/make.h ============================================================================== --- head/contrib/bmake/make.h Mon Dec 19 22:28:28 2016 (r310303) +++ head/contrib/bmake/make.h Mon Dec 19 23:38:07 2016 (r310304) @@ -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 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 *); Modified: head/contrib/bmake/mk/ChangeLog ============================================================================== --- head/contrib/bmake/mk/ChangeLog Mon Dec 19 22:28:28 2016 (r310303) +++ head/contrib/bmake/mk/ChangeLog Mon Dec 19 23:38:07 2016 (r310304) @@ -1,3 +1,62 @@ +2016-12-12 Simon J. Gerraty + + * 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 + + * 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 + + * 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 + + * 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 + + * 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 + + * 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 + + * 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 + + * meta.sys.mk (META_COOKIE_TOUCH): use ${.OBJDIR}/${.TARGET:T} as default + 2016-08-15 Simon J. Gerraty * install-mk (MK_VERSION): 20160815 Modified: head/contrib/bmake/mk/FILES ============================================================================== --- head/contrib/bmake/mk/FILES Mon Dec 19 22:28:28 2016 (r310303) +++ head/contrib/bmake/mk/FILES Mon Dec 19 23:38:07 2016 (r310304) @@ -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 Modified: head/contrib/bmake/mk/dirdeps.mk ============================================================================== --- head/contrib/bmake/mk/dirdeps.mk Mon Dec 19 22:28:28 2016 (r310303) +++ head/contrib/bmake/mk/dirdeps.mk Mon Dec 19 23:38:07 2016 (r310304) @@ -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 . +# 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}/${.M .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${AL .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 # 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 .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 ${.MAK _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 Modified: head/contrib/bmake/mk/gendirdeps.mk ============================================================================== --- head/contrib/bmake/mk/gendirdeps.mk Mon Dec 19 22:28:28 2016 (r310303) +++ head/contrib/bmake/mk/gendirdeps.mk Mon Dec 19 23:38:07 2016 (r310304) @@ -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} ${ .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 Modified: head/contrib/bmake/mk/install-mk ============================================================================== --- head/contrib/bmake/mk/install-mk Mon Dec 19 22:28:28 2016 (r310303) +++ head/contrib/bmake/mk/install-mk Mon Dec 19 23:38:07 2016 (r310304) @@ -55,7 +55,7 @@ # Simon J. Gerraty # 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 Modified: head/contrib/bmake/mk/lib.mk ============================================================================== --- head/contrib/bmake/mk/lib.mk Mon Dec 19 22:28:28 2016 (r310303) +++ head/contrib/bmake/mk/lib.mk Mon Dec 19 23:38:07 2016 (r310304) @@ -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 -.endif - -print-shlib-major: -.if defined(SHLIB_MAJOR) && ${MK_PIC} != "no" - @echo ${SHLIB_MAJOR} -.else - @false +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-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,'` *** DIFF OUTPUT TRUNCATED AT 1000 LINES ***