From owner-svn-src-all@freebsd.org Thu Aug 3 01:40:07 2017 Return-Path: Delivered-To: svn-src-all@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 18FABDBED5D; Thu, 3 Aug 2017 01:40:07 +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 BB5A9E6; Thu, 3 Aug 2017 01:40:06 +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 v731e5tn047362; Thu, 3 Aug 2017 01:40:05 GMT (envelope-from sjg@FreeBSD.org) Received: (from sjg@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v731e5fU047355; Thu, 3 Aug 2017 01:40:05 GMT (envelope-from sjg@FreeBSD.org) Message-Id: <201708030140.v731e5fU047355@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: sjg set sender to sjg@FreeBSD.org using -f From: "Simon J. Gerraty" Date: Thu, 3 Aug 2017 01:40:05 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-10@freebsd.org Subject: svn commit: r321964 - in stable/10: contrib/bmake contrib/bmake/PSD.doc contrib/bmake/mk contrib/bmake/mk/sys contrib/bmake/unit-tests usr.bin/bmake X-SVN-Group: stable-10 X-SVN-Commit-Author: sjg X-SVN-Commit-Paths: in stable/10: contrib/bmake contrib/bmake/PSD.doc contrib/bmake/mk contrib/bmake/mk/sys contrib/bmake/unit-tests usr.bin/bmake X-SVN-Commit-Revision: 321964 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 03 Aug 2017 01:40:07 -0000 Author: sjg Date: Thu Aug 3 01:40:05 2017 New Revision: 321964 URL: https://svnweb.freebsd.org/changeset/base/321964 Log: MFC bmake-20170720 PR: 221023 Added: stable/10/contrib/bmake/mk/files.mk - copied unchanged from r318163, head/contrib/bmake/mk/files.mk stable/10/contrib/bmake/mk/sys.debug.mk - copied unchanged from r310304, head/contrib/bmake/mk/sys.debug.mk stable/10/contrib/bmake/mk/sys.vars.mk - copied, changed from r310304, head/contrib/bmake/mk/sys.vars.mk Modified: stable/10/contrib/bmake/ChangeLog stable/10/contrib/bmake/Makefile stable/10/contrib/bmake/PSD.doc/tutorial.ms stable/10/contrib/bmake/README stable/10/contrib/bmake/arch.c stable/10/contrib/bmake/bmake.1 stable/10/contrib/bmake/bmake.cat1 stable/10/contrib/bmake/boot-strap stable/10/contrib/bmake/buf.h stable/10/contrib/bmake/compat.c stable/10/contrib/bmake/cond.c stable/10/contrib/bmake/config.h.in stable/10/contrib/bmake/configure stable/10/contrib/bmake/configure.in stable/10/contrib/bmake/dir.c stable/10/contrib/bmake/dir.h stable/10/contrib/bmake/dirname.c stable/10/contrib/bmake/for.c stable/10/contrib/bmake/getopt.c stable/10/contrib/bmake/hash.h stable/10/contrib/bmake/job.c stable/10/contrib/bmake/main.c stable/10/contrib/bmake/make-bootstrap.sh.in stable/10/contrib/bmake/make.1 stable/10/contrib/bmake/make.c stable/10/contrib/bmake/make.h stable/10/contrib/bmake/make_malloc.c stable/10/contrib/bmake/meta.c stable/10/contrib/bmake/meta.h stable/10/contrib/bmake/mk/ChangeLog stable/10/contrib/bmake/mk/FILES stable/10/contrib/bmake/mk/auto.dep.mk stable/10/contrib/bmake/mk/auto.obj.mk stable/10/contrib/bmake/mk/autodep.mk stable/10/contrib/bmake/mk/dirdeps.mk stable/10/contrib/bmake/mk/doc.mk stable/10/contrib/bmake/mk/dpadd.mk stable/10/contrib/bmake/mk/final.mk stable/10/contrib/bmake/mk/gendirdeps.mk stable/10/contrib/bmake/mk/inc.mk stable/10/contrib/bmake/mk/init.mk stable/10/contrib/bmake/mk/install-mk stable/10/contrib/bmake/mk/lib.mk stable/10/contrib/bmake/mk/libnames.mk stable/10/contrib/bmake/mk/meta.autodep.mk stable/10/contrib/bmake/mk/meta.stage.mk stable/10/contrib/bmake/mk/meta.sys.mk stable/10/contrib/bmake/mk/meta2deps.py stable/10/contrib/bmake/mk/meta2deps.sh stable/10/contrib/bmake/mk/mkopt.sh stable/10/contrib/bmake/mk/nls.mk stable/10/contrib/bmake/mk/own.mk stable/10/contrib/bmake/mk/prog.mk stable/10/contrib/bmake/mk/scripts.mk stable/10/contrib/bmake/mk/subdir.mk stable/10/contrib/bmake/mk/sys.clean-env.mk stable/10/contrib/bmake/mk/sys.dependfile.mk stable/10/contrib/bmake/mk/sys.mk stable/10/contrib/bmake/mk/sys/AIX.mk stable/10/contrib/bmake/mk/sys/Darwin.mk stable/10/contrib/bmake/mk/sys/Generic.mk stable/10/contrib/bmake/mk/sys/HP-UX.mk stable/10/contrib/bmake/mk/sys/IRIX.mk stable/10/contrib/bmake/mk/sys/Linux.mk stable/10/contrib/bmake/mk/sys/NetBSD.mk stable/10/contrib/bmake/mk/sys/OSF1.mk stable/10/contrib/bmake/mk/sys/OpenBSD.mk stable/10/contrib/bmake/mk/sys/SunOS.mk stable/10/contrib/bmake/mk/sys/UnixWare.mk stable/10/contrib/bmake/mk/warnings.mk stable/10/contrib/bmake/nonints.h stable/10/contrib/bmake/os.sh stable/10/contrib/bmake/parse.c stable/10/contrib/bmake/sprite.h stable/10/contrib/bmake/str.c stable/10/contrib/bmake/suff.c stable/10/contrib/bmake/targ.c stable/10/contrib/bmake/unit-tests/export-env.exp stable/10/contrib/bmake/unit-tests/export-env.mk stable/10/contrib/bmake/unit-tests/modmatch.exp stable/10/contrib/bmake/unit-tests/modmatch.mk stable/10/contrib/bmake/unit-tests/modts.exp stable/10/contrib/bmake/unit-tests/modts.mk stable/10/contrib/bmake/unit-tests/varmisc.exp stable/10/contrib/bmake/unit-tests/varmisc.mk stable/10/contrib/bmake/var.c stable/10/usr.bin/bmake/Makefile stable/10/usr.bin/bmake/Makefile.inc stable/10/usr.bin/bmake/config.h Directory Properties: stable/10/ (props changed) Modified: stable/10/contrib/bmake/ChangeLog ============================================================================== --- stable/10/contrib/bmake/ChangeLog Thu Aug 3 00:38:13 2017 (r321963) +++ stable/10/contrib/bmake/ChangeLog Thu Aug 3 01:40:05 2017 (r321964) @@ -1,3 +1,296 @@ +2017-07-20 Simon J. Gerraty + + * Makefile (_MAKE_VERSION): 20170720 + Merge with NetBSD make, pick up + o compat.c: pass SIGINT etc onto child and wait for it to exit + before we self-terminate. + +2017-07-11 Simon J. Gerraty + + * Makefile (_MAKE_VERSION): 20170711 + forgot to update after merge on 20170708 ;-) + o main.c: refactor to reduce size of main function. + add -v option to always fully expand values. + o meta.c: ensure command output in meta file has ending newline + even when filemon not being used. + When matching ${.MAKE.META.IGNORE_PATTERNS} do not use + pathname via ':L' since any ':' in pathname breaks that. + Instead set a '${.p.}' to pathname in the target context and + use that. + +2017-05-10 Simon J. Gerraty + + * Makefile (_MAKE_VERSION): 20170510 + Merge with NetBSD make, pick up + o main.c: Main_SetObjdir: ensure buf2 is in scope + +2017-05-08 Simon J. Gerraty + + * Makefile (_MAKE_VERSION): 20170505 + see mk/ChangeLog + +2017-05-05 Simon J. Gerraty + + * parse.c: not everyone has stdint.h + +2017-05-01 Simon J. Gerraty + + * Makefile (_MAKE_VERSION): 20170501 + see mk/ChangeLog + +2017-04-21 Simon J. Gerraty + + * Makefile (_MAKE_VERSION): 20170421 + Merge with NetBSD make, pick up + o str.c: Str_Match: fix closure tests for [^] and add unit-test. + +2017-04-20 Simon J. Gerraty + + * Makefile (_MAKE_VERSION): 20170420 + Merge with NetBSD make, pick up + o main.c: only use -C arg "as is" if it contains no + relative component. + +2017-04-18 Simon J. Gerraty + + * Makefile (_MAKE_VERSION): 20170418 + Merge with NetBSD make, pick up + o main.c: fix Main_SetObjdir() for relative paths (eg obj). + +2017-04-17 Simon J. Gerraty + + * Makefile (_MAKE_VERSION): 20170417 + Merge with NetBSD make, pick up + o fixes a number of coverity complaints + - check return value of fseek, fcntl + - plug memory leak in Dir_FindFile, Var_LoopExpand, + JobPrintCommand, ParseTraditionalInclude + - use bmake_malloc() where NULL is not tollerated + - use MAKE_ATTR_UNUSED rather that kludges like + return(unused ? 0 : 0) + - use purge_cached_realpaths() rather than abuse cached_realpath() + +2017-04-13 Simon J. Gerraty + + * Makefile (_MAKE_VERSION): 20170413 + Merge with NetBSD make, pick up + o main.c: when setting .OBJDIR ignore '$' in paths. + + * job.c: use MALLOC_OPTIONS to set malloc_options. + +2017-04-11 Simon J. Gerraty + + * Makefile (_MAKE_VERSION): 20170411 + Merge with NetBSD make, pick up + o str.c: Str_Match: allow [^a-z] to behave as expected. + +2017-03-26 Simon J. Gerraty + + * Makefile (_MAKE_VERSION): 20170326 + Merge with NetBSD make, pick up + o main.c: purge relative paths from realpath cache when .OBJDIR + is changed. + +2017-03-11 Simon J. Gerraty + + * Makefile (_MAKE_VERSION): 20170311 + Merge with NetBSD make, pick up + o main.c: only use -C arg "as is" if it starts with '/'. + +2017-03-01 Simon J. Gerraty + + * Makefile (_MAKE_VERSION): 20170301 + Merge with NetBSD make, pick up + o main.c: use -C arg "as is" rather than getcwd() + if they identify the same directory. + o parse.c: ensure loadfile buffer is \n terminated in non-mmap case + +2017-02-01 Simon J. Gerraty + + * Makefile (_MAKE_VERSION): 20170201 + Merge with NetBSD make, pick up + o var.c: allow :_=var and avoid use of special context. + +2017-01-30 Simon J. Gerraty + + * Makefile (_MAKE_VERSION): 20170130 + Merge with NetBSD make, pick up + o var.c: add :range and :_ + o main.c: partially initialize Dir_* before MainParseArgs() + can be called. + If -V, skip Main_ExportMAKEFLAGS() + +2017-01-14 Simon J. Gerraty + + * Makefile (_MAKE_VERSION): 20170114 + Merge with NetBSD make, pick up + o var.c: allow specifying the utc value used by :{gm,local}time + +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 + its a neater number; pick up whitespace fixes to man page. + +2016-08-17 Simon J. Gerraty + + * Makefile (_MAKE_VERSION): 20160817 + Merge with NetBSD make, pick up + o meta.c: move handling of .MAKE.META.IGNORE_* to meta_ignore() + so we can call it before adding entries to missingFiles. + Thus we do not track files we have been told to ignore. + +2016-08-15 Simon J. Gerraty + + * Makefile (_MAKE_VERSION): 20160815 + Merge with NetBSD make, pick up + o meta_oodate: apply .MAKE.META.IGNORE_FILTER (if defined) to + pathnames, and skip if the expansion is empty. + Useful for dirdeps.mk when checking DIRDEPS_CACHE. + +2016-08-12 Simon J. Gerraty + + * Makefile (_MAKE_VERSION): 20160812 + Merge with NetBSD make, pick up + o meta.c: remove all missingFiles entries that match a deleted + dir. + o main.c: set .ERROR_CMD if possible. + +2016-06-06 Simon J. Gerraty + + * Makefile (_MAKE_VERSION): 20160606 + Merge with NetBSD make, pick up + o dir.c: extend mtimes cache to others via cached_stat() + +2016-06-04 Simon J. Gerraty + + * Makefile (_MAKE_VERSION): 20160604 + Merge with NetBSD make, pick up + o meta.c: missing filemon data is only relevant if we read a + meta file. + Also do not return oodate for a missing metafile if gn->path + points to .CURDIR + +2016-06-02 Simon J. Gerraty + + * Makefile (_MAKE_VERSION): 20160602 + Merge with NetBSD make, pick up + o cached_realpath(): avoid hitting filesystem more than necessary. + o meta.c: refactor need_meta decision, add knobs for + missing meta file and filemon data wrt out-of-datedness. + +2016-05-28 Simon J. Gerraty + + * Makefile (_MAKE_VERSION): 20160528 + + * boot-strap, make-bootstrap.sh.in: Makefile now uses _MAKE_VERSION + +2016-05-12 Simon J. Gerraty + + * Makefile (_MAKE_VERSION): 20160512 + Merge with NetBSD make, pick up + o meta.c: ignore paths that match .MAKE.META.IGNORE_PATTERNS + this is useful for gcov builds. + o propagate errors from filemon(4). + +2016-05-09 Simon J. Gerraty + + * Makefile (_MAKE_VERSION): 20160509 + Merge with NetBSD make, pick up + o remove use of non-standard types u_int etc. + o meta.c: apply realpath() before matching against metaIgnorePaths + +2016-04-04 Simon J. Gerraty + + * Makefile (_MAKE_VERSION): 20160404 + Merge with NetBSD make, pick up + o allow makefile to set .MAKE.JOBS + + * Makefile (PROG_NAME): use ${_MAKE_VERSION} + +2016-03-15 Simon J. Gerraty + + * Makefile (_MAKE_VERSION): 20160315 + Merge with NetBSD make, pick up + o fix handling of archive members + +2016-03-13 Simon J. Gerraty + + * Makefile (_MAKE_VERSION): rename variable to avoid interference + with checks for ${MAKE_VERSION} + +2016-03-10 Simon J. Gerraty + + * Makefile (MAKE_VERSION): 20160310 + Merge with NetBSD make, pick up + o meta.c: treat missing Read file same as Write, incase we Delete it. + +2016-03-07 Simon J. Gerraty + + * Makefile (MAKE_VERSION): 20160307 + Merge with NetBSD make, pick up + o var.c: fix :ts\nnn to be octal by default. + o meta.c: meta_finish() to cleanup memory. + +2016-02-26 Simon J. Gerraty + + * Makefile (MAKE_VERSION): 20160226 + Merge with NetBSD make, pick up + o meta.c: allow meta file for makeDepend if makefiles want it. + +2016-02-19 Simon J. Gerraty + + * var.c: default .MAKE.SAVE_DOLLARS to FALSE + for backwards compatability. + + * Makefile (MAKE_VERSION): 20160220 + Merge with NetBSD make, pick up + o var.c: add knob to control handling of '$$' in := + +2016-02-18 Simon J. Gerraty + + * Makefile (MAKE_VERSION): 20160218 + Merge with NetBSD make, pick up + o var.c: add .export-literal allows us to fix sys.clean-env.mk + post the changes to Var_Subst. + Var_Subst now takes flags, and does not consume '$$' in := + +2016-02-17 Simon J. Gerraty + + * Makefile (MAKE_VERSION): 20160217 + Merge with NetBSD make, pick up + o var.c: preserve '$$' in := + o parse.c: add .dinclude for handling included + makefile like .depend + 2015-12-20 Simon J. Gerraty * Makefile (MAKE_VERSION): 20151220 Modified: stable/10/contrib/bmake/Makefile ============================================================================== --- stable/10/contrib/bmake/Makefile Thu Aug 3 00:38:13 2017 (r321963) +++ stable/10/contrib/bmake/Makefile Thu Aug 3 01:40:05 2017 (r321964) @@ -1,7 +1,7 @@ -# $Id: Makefile,v 1.49 2015/12/20 22:54:40 sjg Exp $ +# $Id: Makefile,v 1.95 2017/07/20 19:36:13 sjg Exp $ # Base version on src date -MAKE_VERSION= 20151220 +_MAKE_VERSION= 20170720 PROG= bmake @@ -76,7 +76,7 @@ CFLAGS+= ${CPPFLAGS} CFLAGS+= -D_PATH_DEFSYSPATH=\"${DEFAULT_SYS_PATH}\" CFLAGS+= -I. -I${srcdir} ${XDEFS} -DMAKE_NATIVE CFLAGS+= ${COPTS.${.ALLSRC:M*.c:T:u}} -COPTS.main.c+= "-DMAKE_VERSION=\"${MAKE_VERSION}\"" +COPTS.main.c+= "-DMAKE_VERSION=\"${_MAKE_VERSION}\"" # meta mode can be useful even without filemon FILEMON_H ?= /usr/include/dev/filemon/filemon.h @@ -131,9 +131,9 @@ OPTIONS_DEFAULT_NO+= \ .include .if ${MK_PROG_VERSION} == "yes" -PROG_NAME= ${PROG}-${MAKE_VERSION} +PROG_NAME= ${PROG}-${_MAKE_VERSION} .if ${MK_PROG_LINK} == "yes" -SYMLINKS+= ${PROG}-${MAKE_VERSION} ${BINDIR}/${PROG} +SYMLINKS+= ${PROG_NAME} ${BINDIR}/${PROG} .endif .endif @@ -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: stable/10/contrib/bmake/PSD.doc/tutorial.ms ============================================================================== --- stable/10/contrib/bmake/PSD.doc/tutorial.ms Thu Aug 3 00:38:13 2017 (r321963) +++ stable/10/contrib/bmake/PSD.doc/tutorial.ms Thu Aug 3 01:40:05 2017 (r321964) @@ -1,4 +1,4 @@ -.\" $NetBSD: tutorial.ms,v 1.12 2014/09/30 21:33:14 christos Exp $ +.\" $NetBSD: tutorial.ms,v 1.13 2017/03/01 13:05:11 kre Exp $ .\" Copyright (c) 1988, 1989, 1993 .\" The Regents of the University of California. All rights reserved. .\" @@ -117,6 +117,15 @@ .de No .br .ne 0.5i +.ie n \{\ +.nr g3 \w'NOTE ' +.po -\\n(g3u +.br +NOTE +.br +.po +\\n(g3u +.\} +.el \{\ .po -0.5i .br .mk @@ -148,12 +157,14 @@ .rt .ft \\n(g3 .ps \\n(g4 +.\} .. .de Bp .ie !\\n(.$ .IP \(bu 2 .el .IP "\&" 2 .. -.po +.3i +.ie n .po +\w'NOTE 'u +.el .po +.3i .TL PMake \*- A Tutorial .AU Modified: stable/10/contrib/bmake/README ============================================================================== --- stable/10/contrib/bmake/README Thu Aug 3 00:38:13 2017 (r321963) +++ stable/10/contrib/bmake/README Thu Aug 3 01:40:05 2017 (r321964) @@ -1,47 +1,52 @@ bmake + ***** -This directory contains a port of the BSD make tool (from NetBSD) -I have run it on SunOS,Solaris,HP-UX,AIX,IRIX,FreeBSD and Linux. +This directory contains a port of the BSD make tool (from NetBSD). +Since 1993 I have run it on AIX, BSDi, Darwin, FreeBSD, HP-UX, IRIX, +Linux, Minix, OSF, Solaris, SunOS and even UTS. +Others have run it on many more systems. -Version 3 was re-worked from scratch to better facilitate -importing newer make(1) versions from NetBSD. The original code base -was NetBSD-1.0, so version 3 was built by doing a fresh import of the -NetBSD-1.0 usr.bin/make, adding the autoconf and other portability -patches to sync it with bmake v2, and then NetBSD's make -of Feb 20, 2000 was imported and conflicts dealt with. -NetBSD's make was again imported on June 6 and December 15, 2000. +Currently each release is tested on NetBSD, FreeBSD, Solaris and Linux. -In 2003 bmake switched to a date based version (first was 20030714) +Since 2003 bmake switched to a date based version (first was 20030714) which generally represents the date it was last merged with NetBSD's make. Since then, NetBSD's make is imported within a week of any interesting changes, so that bmake tracks it very closely. -Building: +Building +======== -The preferred way to bootstrap bmake is: +The preferred way to bootstrap bmake is:: -./bmake/boot-strap + ./bmake/boot-strap there are a number of args - most of which get passed to configure, eg. +:: -./bmake/boot-strap --prefix=/opt + ./bmake/boot-strap --prefix=/opt see the boot-strap script for details. +For folk that hate to read anything, since 20121212 you can also use +the GNU standard process of:: + + ./configure; make; make install + To make much use of bmake you will need the bsd.*.mk macros or my -portable *.mk macros. See +portable *.mk macros which are included with bmake since 20121212 +and separately available from http://www.crufty.net/ftp/pub/sjg/mk.tar.gz which will be links to the latest versions. -On a non-BSD system, you would want to unpack mk[-YYYYmmdd].tar.gz in -the same directory as bmake (so ./mk and ./bmake exist), and -./bmake/boot-strap will do the rest. +Porting +======= -If you want to do it all by hand then read boot-strap first to get the -idea. +If you encounter a system that bmake does not build or work on *out of +the box*, I welcome patches. +If you can provide access to a suitable machine - even better. -Even if you have an earlier version of bmake installed, use boot-strap -to ensure that all goes well. +More info can be found at http://www.crufty.net/help/sjg/bmake.htm ---sjg +--sjg + Modified: stable/10/contrib/bmake/arch.c ============================================================================== --- stable/10/contrib/bmake/arch.c Thu Aug 3 00:38:13 2017 (r321963) +++ stable/10/contrib/bmake/arch.c Thu Aug 3 01:40:05 2017 (r321964) @@ -1,4 +1,4 @@ -/* $NetBSD: arch.c,v 1.64 2015/10/11 04:51:24 sjg Exp $ */ +/* $NetBSD: arch.c,v 1.70 2017/04/16 20:49:09 riastradh Exp $ */ /* * Copyright (c) 1988, 1989, 1990, 1993 @@ -69,14 +69,14 @@ */ #ifndef MAKE_NATIVE -static char rcsid[] = "$NetBSD: arch.c,v 1.64 2015/10/11 04:51:24 sjg Exp $"; +static char rcsid[] = "$NetBSD: arch.c,v 1.70 2017/04/16 20:49:09 riastradh Exp $"; #else #include #ifndef lint #if 0 static char sccsid[] = "@(#)arch.c 8.2 (Berkeley) 1/2/94"; #else -__RCSID("$NetBSD: arch.c,v 1.64 2015/10/11 04:51:24 sjg Exp $"); +__RCSID("$NetBSD: arch.c,v 1.70 2017/04/16 20:49:09 riastradh Exp $"); #endif #endif /* not lint */ #endif @@ -136,7 +136,6 @@ __RCSID("$NetBSD: arch.c,v 1.64 2015/10/11 04:51:24 sj #include #include #include -#include #ifdef HAVE_AR_H #include #else @@ -156,7 +155,6 @@ struct ar_hdr { #if defined(HAVE_RANLIB_H) && !(defined(__ELF__) || defined(NO_RANLIB)) #include #endif -#include #include #include #ifdef HAVE_UTIME_H @@ -254,8 +252,7 @@ ArchFree(void *ap) free(Hash_GetValue(entry)); free(a->name); - if (a->fnametab) - free(a->fnametab); + free(a->fnametab); Hash_DeleteTable(&a->members); free(a); } @@ -310,9 +307,10 @@ Arch_ParseArchive(char **linePtr, Lst nodeLst, GNode * void *freeIt; char *result; - result = Var_Parse(cp, ctxt, TRUE, TRUE, &length, &freeIt); - if (freeIt) - free(freeIt); + result = Var_Parse(cp, ctxt, VARF_UNDEFERR|VARF_WANTRES, + &length, &freeIt); + free(freeIt); + if (result == var_Error) { return(FAILURE); } else { @@ -325,7 +323,7 @@ Arch_ParseArchive(char **linePtr, Lst nodeLst, GNode * *cp++ = '\0'; if (subLibName) { - libName = Var_Subst(NULL, libName, ctxt, TRUE, TRUE); + libName = Var_Subst(NULL, libName, ctxt, VARF_UNDEFERR|VARF_WANTRES); } @@ -351,9 +349,10 @@ Arch_ParseArchive(char **linePtr, Lst nodeLst, GNode * void *freeIt; char *result; - result = Var_Parse(cp, ctxt, TRUE, TRUE, &length, &freeIt); - if (freeIt) - free(freeIt); + result = Var_Parse(cp, ctxt, VARF_UNDEFERR|VARF_WANTRES, + &length, &freeIt); + free(freeIt); + if (result == var_Error) { return(FAILURE); } else { @@ -404,7 +403,8 @@ Arch_ParseArchive(char **linePtr, Lst nodeLst, GNode * char *oldMemName = memName; size_t sz; - memName = Var_Subst(NULL, memName, ctxt, TRUE, TRUE); + memName = Var_Subst(NULL, memName, ctxt, + VARF_UNDEFERR|VARF_WANTRES); /* * Now form an archive spec and recurse to deal with nested @@ -726,7 +726,8 @@ ArchStatMember(char *archive, char *member, Boolean ha if (fread(memName, elen, 1, arch) != 1) goto badarch; memName[elen] = '\0'; - fseek(arch, -elen, SEEK_CUR); + if (fseek(arch, -elen, SEEK_CUR) != 0) + goto badarch; if (DEBUG(ARCH) || DEBUG(MAKE)) { fprintf(debug_file, "ArchStat: Extended format entry for %s\n", memName); } @@ -737,7 +738,8 @@ ArchStatMember(char *archive, char *member, Boolean ha Hash_SetValue(he, bmake_malloc(sizeof(struct ar_hdr))); memcpy(Hash_GetValue(he), &arh, sizeof(struct ar_hdr)); } - fseek(arch, (size + 1) & ~1, SEEK_CUR); + if (fseek(arch, (size + 1) & ~1, SEEK_CUR) != 0) + goto badarch; } fclose(arch); @@ -759,8 +761,7 @@ ArchStatMember(char *archive, char *member, Boolean ha badarch: fclose(arch); Hash_DeleteTable(&ar->members); - if (ar->fnametab) - free(ar->fnametab); + free(ar->fnametab); free(ar); return NULL; } @@ -833,7 +834,7 @@ ArchSVR4Entry(Arch *ar, char *name, size_t size, FILE } if (DEBUG(ARCH)) { fprintf(debug_file, "Found svr4 archive name table with %lu entries\n", - (u_long)entry); + (unsigned long)entry); } return 0; } @@ -851,7 +852,7 @@ ArchSVR4Entry(Arch *ar, char *name, size_t size, FILE if (entry >= ar->fnamesize) { if (DEBUG(ARCH)) { fprintf(debug_file, "SVR4 entry offset %s is greater than %lu\n", - name, (u_long)ar->fnamesize); + name, (unsigned long)ar->fnamesize); } return 2; } @@ -957,7 +958,10 @@ ArchFindMember(char *archive, char *member, struct ar_ * the file at the actual member, rather than its header, but * not here... */ - fseek(arch, -sizeof(struct ar_hdr), SEEK_CUR); + if (fseek(arch, -sizeof(struct ar_hdr), SEEK_CUR) != 0) { + fclose(arch); + return NULL; + } return (arch); } } else @@ -987,10 +991,17 @@ ArchFindMember(char *archive, char *member, struct ar_ } if (strncmp(ename, member, len) == 0) { /* Found as extended name */ - fseek(arch, -sizeof(struct ar_hdr) - elen, SEEK_CUR); + if (fseek(arch, -sizeof(struct ar_hdr) - elen, + SEEK_CUR) != 0) { + fclose(arch); + return NULL; + } return (arch); } - fseek(arch, -elen, SEEK_CUR); + if (fseek(arch, -elen, SEEK_CUR) != 0) { + fclose(arch); + return NULL; + } goto skip; } else #endif @@ -1003,9 +1014,12 @@ skip: * extract the size of the file from the 'size' field of the * header and round it up during the seek. */ - arhPtr->ar_size[sizeof(arhPtr->AR_SIZE)-1] = '\0'; + arhPtr->AR_SIZE[sizeof(arhPtr->AR_SIZE)-1] = '\0'; size = (int)strtol(arhPtr->AR_SIZE, NULL, 10); - fseek(arch, (size + 1) & ~1, SEEK_CUR); + if (fseek(arch, (size + 1) & ~1, SEEK_CUR) != 0) { + fclose(arch); + return NULL; + } } } @@ -1045,10 +1059,10 @@ Arch_Touch(GNode *gn) arch = ArchFindMember(Var_Value(ARCHIVE, gn, &p1), Var_Value(MEMBER, gn, &p2), &arh, "r+"); - if (p1) - free(p1); - if (p2) - free(p2); + + free(p1); + free(p2); + snprintf(arh.AR_DATE, sizeof(arh.AR_DATE), "%-12ld", (long) now); if (arch != NULL) { @@ -1127,10 +1141,9 @@ Arch_MTime(GNode *gn) arhPtr = ArchStatMember(Var_Value(ARCHIVE, gn, &p1), Var_Value(MEMBER, gn, &p2), TRUE); - if (p1) - free(p1); - if (p2) - free(p2); + + free(p1); + free(p2); if (arhPtr != NULL) { modTime = (time_t)strtol(arhPtr->AR_DATE, NULL, 10); Modified: stable/10/contrib/bmake/bmake.1 ============================================================================== --- stable/10/contrib/bmake/bmake.1 Thu Aug 3 00:38:13 2017 (r321963) +++ stable/10/contrib/bmake/bmake.1 Thu Aug 3 01:40:05 2017 (r321964) @@ -1,4 +1,4 @@ -.\" $NetBSD: make.1,v 1.249 2015/06/05 07:33:40 wiz Exp $ +.\" $NetBSD: make.1,v 1.271 2017/07/03 21:34:20 wiz 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 June 4, 2015 -.Dt MAKE 1 +.Dd June 22, 2017 +.Dt BMAKE 1 .Os .Sh NAME .Nm bmake @@ -48,6 +48,7 @@ .Op Fl m Ar directory .Op Fl T Ar file .Op Fl V Ar variable +.Op Fl v Ar variable .Op Ar variable=value .Op Ar target ... .Sh DESCRIPTION @@ -206,7 +207,9 @@ Print debugging information about target list maintena .It Ar V Force the .Fl V -option to print raw values of variables. +option to print raw values of variables, overriding the default behavior +set via +.Va .MAKE.EXPAND_VARIABLES . .It Ar v Print debugging information about variable assignment. .It Ar x @@ -293,7 +296,7 @@ then will search for the specified file or directory named in the remaining part of the argument string. The search starts with the current directory of -the Makefile and then works upward towards the root of the filesystem. +the Makefile and then works upward towards the root of the file system. If the search is successful, then the resulting directory replaces the .Qq \&.../ specification in the @@ -334,20 +337,39 @@ for each job started and completed. Rather than re-building a target as specified in the makefile, create it or update its modification time to make it appear up-to-date. .It Fl V Ar variable -Print -.Nm Ns 's -idea of the value of -.Ar variable , -in the global context. +Print the value of +.Ar variable . Do not build any targets. Multiple instances of this option may be specified; the variables will be printed one per line, with a blank line for each null or undefined variable. +The value printed is extracted from the global context after all +makefiles have been read. +By default, the raw variable contents (which may +include additional unexpanded variable references) are shown. If .Ar variable contains a .Ql \&$ -then the value will be expanded before printing. +then the value will be recursively expanded to its complete resultant +text before printing. +The expanded value will also be printed if +.Va .MAKE.EXPAND_VARIABLES +is set to true and +the +.Fl dV +option has not been used to override it. +Note that loop-local and target-local variables, as well as values +taken temporarily by global variables during makefile processing, are +not accessible via this option. +The +.Fl dv +debug mode can be used to see these at the cost of generating +substantial extraneous output. +.It Fl v Ar variable +Like +.Fl V +but the variable is always expanded to its complete value. .It Fl W Treat any warnings during makefile parsing as errors. .It Fl w @@ -657,7 +679,7 @@ The seven local variables are as follows: .Bl -tag -width ".ARCHIVE" -offset indent .It Va .ALLSRC The list of all sources for this target; also known as -.Ql Va \&\*[Gt] . +.Ql Va \&> . .It Va .ARCHIVE The name of the archive file; also known as .Ql Va \&! . @@ -666,7 +688,7 @@ In suffix-transformation rules, the name/path of the s target is to be transformed (the .Dq implied source); also known as -.Ql Va \&\*[Lt] . +.Ql Va \&< . It is not defined in explicit rules. .It Va .MEMBER The name of the archive member; also known as @@ -685,12 +707,15 @@ or it will not be recognized. .It Va .TARGET The name of the target; also known as .Ql Va @ . +For compatibility with other makes this is an alias for +.Ic .ARCHIVE +in archive member rules. .El .Pp The shorter forms -.Ql ( Va \*[Gt] , +.Ql ( Va > , .Ql Va \&! , -.Ql Va \*[Lt] , +.Ql Va < , .Ql Va % , .Ql Va \&? , .Ql Va * , @@ -773,6 +798,10 @@ from which generated dependencies are read. A boolean that controls the default behavior of the .Fl V option. +If true, variable values printed with +.Fl V +are fully expanded; if false, the raw variable contents (which may +include additional unexpanded variable references) are shown. .It Va .MAKE.EXPORTED The list of variables exported by .Nm . @@ -843,7 +872,7 @@ Can affect the mode that .Nm runs in. It can contain a number of keywords: -.Bl -hang -width ignore-cmd +.Bl -hang -width missing-filemon=bf. .It Pa compat Like .Fl B , @@ -867,8 +896,19 @@ will not create .meta files in This can be overridden by setting .Va bf to a value which represents True. +.It Pa missing-meta= Ar bf +If +.Va bf +is True, then a missing .meta file makes the target out-of-date. +.It Pa missing-filemon= Ar bf +If +.Va bf +is True, then missing filemon data makes the target out-of-date. +.It Pa nofilemon +Do not use +.Xr filemon 4 . .It Pa env -For debugging, it can be useful to inlcude the environment +For debugging, it can be useful to include the environment in the .meta file. .It Pa verbose If in "meta" mode, print a clue about the target being built. @@ -910,6 +950,12 @@ Provides a list of path prefixes that should be ignore because the contents are expected to change over time. The default list includes: .Ql Pa /dev /etc /proc /tmp /var/run /var/tmp +.It Va .MAKE.META.IGNORE_PATTERNS +Provides a list of patterns to match against pathnames. +Ignore any that match. +.It Va .MAKE.META.IGNORE_FILTER +Provides a list of variable modifiers to apply to each pathname. +Ignore if the expansion is an empty string. .It Va .MAKE.META.PREFIX Defines the message printed for each meta file updated in "meta verbose" mode. The default value is: @@ -918,7 +964,7 @@ The default value is: This variable is used to record the names of variables assigned to on the command line, so that they may be exported as part of .Ql Ev MAKEFLAGS . -This behaviour can be disabled by assigning an empty value to +This behavior can be disabled by assigning an empty value to .Ql Va .MAKEOVERRIDES within a makefile. Extra variables can be exported from a makefile @@ -941,10 +987,35 @@ The process-id of .It Va .MAKE.PPID The parent process-id of .Nm . +.It Va .MAKE.SAVE_DOLLARS +value should be a boolean that controls whether +.Ql $$ +are preserved when doing +.Ql := +assignments. +The default is false, for backwards compatibility. +Set to true for compatability with other makes. +If set to false, +.Ql $$ +becomes +.Ql $ +per normal evaluation rules. .It Va MAKE_PRINT_VAR_ON_ERROR When .Nm -stops due to an error, it prints its name and the value of +stops due to an error, it sets +.Ql Va .ERROR_TARGET +to the name of the target that failed, +.Ql Va .ERROR_CMD +to the commands of the failed target, +and in "meta" mode, it also sets +.Ql Va .ERROR_CWD +to the +.Xr getcwd 3 , +and +.Ql Va .ERROR_META_FILE +to the path of the meta file (if any) describing the failed target. +It then prints its name and the value of .Ql Va .CURDIR as well as the value of any variables named in .Ql Va MAKE_PRINT_VAR_ON_ERROR . @@ -1044,7 +1115,7 @@ sets to the value of .Ql Ev PWD instead. -This behaviour is disabled if +This behavior is disabled if .Ql Ev MAKEOBJDIRPREFIX is set or .Ql Ev MAKEOBJDIR @@ -1114,7 +1185,7 @@ The wildcard characters may be escaped with a backslas As a consequence of the way values are split into words, matched, and then joined, a construct like .Dl ${VAR:M*} -will normalise the inter-word spacing, removing all leading and +will normalize the inter-word spacing, removing all leading and trailing space, and converting multiple consecutive spaces to single spaces. . @@ -1134,7 +1205,7 @@ Randomize words in variable. The results will be different each time you are referring to the modified variable; use the assignment with expansion .Pq Ql Cm \&:= -to prevent such behaviour. +to prevent such behavior. For example, .Bd -literal -offset indent LIST= uno due tre quattro @@ -1160,18 +1231,28 @@ safely through recursive invocations of .Nm . .It Cm \&:R Replaces each word in the variable with everything but its suffix. -.It Cm \&:gmtime +.It Cm \&:range[=count] +The value is an integer sequence representing the words of the original +value, or the supplied +.Va count . +.It Cm \&:gmtime[=utc] The value is a format string for .Xr strftime 3 , -using the current +using .Xr gmtime 3 . +If a +.Va utc +value is not provided or is 0, the current time is used. .It Cm \&:hash -Compute a 32bit hash of the value and encode it as hex digits. -.It Cm \&:localtime +Compute a 32-bit hash of the value and encode it as hex digits. +.It Cm \&:localtime[=utc] The value is a format string for .Xr strftime 3 , -using the current +using .Xr localtime 3 . +If a +.Va utc +value is not provided or is 0, the current time is used. .It Cm \&:tA Attempt to convert variable to an absolute path using .Xr realpath 3 , @@ -1232,7 +1313,7 @@ it is anchored at the end of each word. Inside .Ar new_string , an ampersand -.Pq Ql \*[Am] +.Pq Ql & is replaced by .Ar old_string (without any @@ -1371,6 +1452,27 @@ For example. .Pp However a single character variable is often more readable: .Dl ${MAKE_PRINT_VAR_ON_ERROR:@v@$v='${$v}'${.newline}@} +.It Cm \&:_[=var] +Save the current variable value in +.Ql $_ +or the named +.Va var +for later reference. +Example usage: +.Bd -literal -offset indent +M_cmpv.units = 1 1000 1000000 +M_cmpv = S,., ,g:_:range:@i@+ $${_:[-$$i]} \&\\ +\\* $${M_cmpv.units:[$$i]}@:S,^,expr 0 ,1:sh + +.Dv .if ${VERSION:${M_cmpv}} < ${3.1.12:L:${M_cmpv}} *** DIFF OUTPUT TRUNCATED AT 1000 LINES ***