svn commit: r361674 - in stable/12: contrib/bmake contrib/bmake/filemon contrib/bmake/mk contrib/bmake/mk/sys contrib/bmake/unit-tests usr.bin/bmake usr.bin/bmake/unit-tests

Simon J. Gerraty sjg at FreeBSD.org
Sun May 31 21:44:03 UTC 2020


Author: sjg
Date: Sun May 31 21:43:59 2020
New Revision: 361674
URL: https://svnweb.freebsd.org/changeset/base/361674

Log:
  Update to bmake-20200517
  
  MFC of r341652, r342376, r361307
  
  Changes since 20180512 are mostly portability related
  hence the large gap in versions imported.
  
  There are however some bug fixes, and a rework of filemon handling.
  In NetBSD make/filemon/filemon_ktrace.c allows use of fktrace
  and elimination of filemon(4) which has not had the TLC it needs.
  
  FreeBSD filemon(4) is in much better shape, so bmake/filemon/filemon_dev.c
  allows use of that, with a bit less overhead than the ktrace model.
  
  Summary of changes from ChangeLog
  
  	o str.c: empty string does not match % pattern
  	  plus unit-test changes
  	o var.c: import handling of old sysV style modifier using '%'
  	o str.c: refactor brk_string
  	o meta.c: meta_oodate, CHECK_VALID_META is too aggressive for CMD
  	  a blank command is perfectly valid.
  	o meta.c: meta_oodate, check for corrupted meta file
  	  earlier and more often.
  	* meta.c: meta_compat_parent check for USE_FILEMON
  	  patch from Soeren Tempel
  	o meta.c: fix compat mode, need to call meta_job_output()
  	o job.c: extra fds for meta mode not needed if using filemon_dev
  	o meta.c: avoid passing NULL to filemon_*() when meta_needed()
  	  returns FALSE.
  	o filemon/filemon_{dev,ktrace}.c: allow selection of
  	  filemon implementation.  filemon_dev.c uses the kernel module
  	  while filemon_ktrace.c leverages the fktrace api available in
  	  NetBSD.  filemon_ktrace.c can hopefully form the basis for
  	  adding support for other tracing mechanisms such as strace on
  	  Linux.
  	o meta.c: when target is out-of-date per normal make rules
  	  record value of .OODATE in meta file.
  	o parse.c: don't pass NULL to realpath(3)
  	  some versions cannot handle it.
  	o parse.c: ParseDoDependency: free paths rather than assert
  	o parse.c: ParseVErrorInternal use .PARSEDIR
  	  and apply if relative, and then use .PARSEFILE
  	  for consistent result.
  	o parse.c: ParseVErrorInternal use .CURDIR if .PARSEDIR
  	  is relative
  	o var.c: avoid SEGFAULT in .unexport-env
  	  when MAKELEVEL is not set
  	o var.c: add :q
  	o dir.c: cleanup caching of stats
  
  plus more unit-tests

Added:
  stable/12/contrib/bmake/filemon/
     - copied from r361307, head/contrib/bmake/filemon/
  stable/12/contrib/bmake/mk/compiler.mk
     - copied unchanged from r361307, head/contrib/bmake/mk/compiler.mk
  stable/12/contrib/bmake/mk/dirdeps-targets.mk
     - copied unchanged from r361307, head/contrib/bmake/mk/dirdeps-targets.mk
  stable/12/contrib/bmake/unit-tests/Makefile
     - copied unchanged from r361307, head/contrib/bmake/unit-tests/Makefile
  stable/12/contrib/bmake/unit-tests/Makefile.config.in
     - copied unchanged from r361307, head/contrib/bmake/unit-tests/Makefile.config.in
  stable/12/contrib/bmake/unit-tests/cond-late.exp
     - copied unchanged from r361307, head/contrib/bmake/unit-tests/cond-late.exp
  stable/12/contrib/bmake/unit-tests/cond-late.mk
     - copied unchanged from r361307, head/contrib/bmake/unit-tests/cond-late.mk
  stable/12/contrib/bmake/unit-tests/dollar.exp
     - copied unchanged from r361307, head/contrib/bmake/unit-tests/dollar.exp
  stable/12/contrib/bmake/unit-tests/dollar.mk
     - copied unchanged from r361307, head/contrib/bmake/unit-tests/dollar.mk
  stable/12/contrib/bmake/unit-tests/include-main.exp
     - copied unchanged from r361307, head/contrib/bmake/unit-tests/include-main.exp
  stable/12/contrib/bmake/unit-tests/include-main.mk
     - copied unchanged from r361307, head/contrib/bmake/unit-tests/include-main.mk
  stable/12/contrib/bmake/unit-tests/include-sub.mk
     - copied unchanged from r361307, head/contrib/bmake/unit-tests/include-sub.mk
  stable/12/contrib/bmake/unit-tests/include-subsub.mk
     - copied unchanged from r361307, head/contrib/bmake/unit-tests/include-subsub.mk
  stable/12/contrib/bmake/unit-tests/varmod-edge.exp
     - copied unchanged from r361307, head/contrib/bmake/unit-tests/varmod-edge.exp
  stable/12/contrib/bmake/unit-tests/varmod-edge.mk
     - copied unchanged from r361307, head/contrib/bmake/unit-tests/varmod-edge.mk
  stable/12/contrib/bmake/unit-tests/varquote.exp
     - copied unchanged from r341652, head/contrib/bmake/unit-tests/varquote.exp
  stable/12/contrib/bmake/unit-tests/varquote.mk
     - copied, changed from r341652, head/contrib/bmake/unit-tests/varquote.mk
Deleted:
  stable/12/contrib/bmake/unit-tests/Makefile.in
Modified:
  stable/12/contrib/bmake/ChangeLog
  stable/12/contrib/bmake/FILES
  stable/12/contrib/bmake/Makefile
  stable/12/contrib/bmake/Makefile.config.in
  stable/12/contrib/bmake/VERSION
  stable/12/contrib/bmake/arch.c
  stable/12/contrib/bmake/bmake.1
  stable/12/contrib/bmake/boot-strap
  stable/12/contrib/bmake/bsd.after-import.mk
  stable/12/contrib/bmake/compat.c
  stable/12/contrib/bmake/config.h.in
  stable/12/contrib/bmake/configure
  stable/12/contrib/bmake/configure.in
  stable/12/contrib/bmake/dir.c
  stable/12/contrib/bmake/dirname.c
  stable/12/contrib/bmake/job.c
  stable/12/contrib/bmake/make-bootstrap.sh.in
  stable/12/contrib/bmake/make.1
  stable/12/contrib/bmake/make.h
  stable/12/contrib/bmake/meta.c
  stable/12/contrib/bmake/meta.h
  stable/12/contrib/bmake/mk/ChangeLog
  stable/12/contrib/bmake/mk/FILES
  stable/12/contrib/bmake/mk/autodep.mk
  stable/12/contrib/bmake/mk/dirdeps-options.mk
  stable/12/contrib/bmake/mk/dirdeps.mk
  stable/12/contrib/bmake/mk/doc.mk
  stable/12/contrib/bmake/mk/dpadd.mk
  stable/12/contrib/bmake/mk/gendirdeps.mk
  stable/12/contrib/bmake/mk/init.mk
  stable/12/contrib/bmake/mk/install-mk
  stable/12/contrib/bmake/mk/lib.mk
  stable/12/contrib/bmake/mk/meta.autodep.mk
  stable/12/contrib/bmake/mk/meta.stage.mk
  stable/12/contrib/bmake/mk/meta.sys.mk
  stable/12/contrib/bmake/mk/meta2deps.py
  stable/12/contrib/bmake/mk/mk-files.txt
  stable/12/contrib/bmake/mk/options.mk
  stable/12/contrib/bmake/mk/sys.mk
  stable/12/contrib/bmake/mk/sys.vars.mk
  stable/12/contrib/bmake/mk/sys/AIX.mk
  stable/12/contrib/bmake/mk/sys/Darwin.mk
  stable/12/contrib/bmake/mk/sys/Generic.mk
  stable/12/contrib/bmake/mk/sys/HP-UX.mk
  stable/12/contrib/bmake/mk/sys/IRIX.mk
  stable/12/contrib/bmake/mk/sys/Linux.mk
  stable/12/contrib/bmake/mk/sys/NetBSD.mk
  stable/12/contrib/bmake/mk/sys/OSF1.mk
  stable/12/contrib/bmake/mk/sys/OpenBSD.mk
  stable/12/contrib/bmake/mk/sys/SunOS.mk
  stable/12/contrib/bmake/mk/sys/UnixWare.mk
  stable/12/contrib/bmake/mk/whats.mk
  stable/12/contrib/bmake/nonints.h
  stable/12/contrib/bmake/parse.c
  stable/12/contrib/bmake/str.c
  stable/12/contrib/bmake/unit-tests/escape.mk
  stable/12/contrib/bmake/unit-tests/forloop.exp
  stable/12/contrib/bmake/unit-tests/forloop.mk
  stable/12/contrib/bmake/unit-tests/modorder.mk
  stable/12/contrib/bmake/unit-tests/sysv.exp
  stable/12/contrib/bmake/unit-tests/sysv.mk
  stable/12/contrib/bmake/util.c
  stable/12/contrib/bmake/var.c
  stable/12/usr.bin/bmake/Makefile
  stable/12/usr.bin/bmake/Makefile.config
  stable/12/usr.bin/bmake/Makefile.depend
  stable/12/usr.bin/bmake/config.h
  stable/12/usr.bin/bmake/unit-tests/Makefile
Directory Properties:
  stable/12/   (props changed)

Modified: stable/12/contrib/bmake/ChangeLog
==============================================================================
--- stable/12/contrib/bmake/ChangeLog	Sun May 31 21:38:33 2020	(r361673)
+++ stable/12/contrib/bmake/ChangeLog	Sun May 31 21:43:59 2020	(r361674)
@@ -1,3 +1,172 @@
+2020-05-17  Simon J Gerraty  <sjg at beast.crufty.net>
+
+	* VERSION (_MAKE_VERSION): 20200517
+	Merge with NetBSD make, pick up
+	o modified dollar tests to avoid shell dependencies
+	o new tests for .INCLUDEFROM
+
+2020-05-16  Simon J Gerraty  <sjg at beast.crufty.net>
+
+	* unit-tests/dollar.mk: tweak  '1 dollar literal' test
+	to not depend so much on shell behavior
+
+2020-05-10  Simon J Gerraty  <sjg at beast.crufty.net>
+
+	* VERSION (_MAKE_VERSION): 20200510
+	Merge with NetBSD make, pick up
+	o unit test for dollar handling
+
+2020-05-06  Simon J Gerraty  <sjg at beast.crufty.net>
+
+	* VERSION (_MAKE_VERSION): 20200506
+	Merge with NetBSD make, pick up
+	o str.c: empty string does not match % pattern
+	  plus unit-test changes
+
+2020-05-04  Simon J Gerraty  <sjg at beast.crufty.net>
+
+	* VERSION (_MAKE_VERSION): 20200504
+	May the 4th be with you
+	Merge with NetBSD make, pick up
+	o var.c: import handling of old sysV style modifier using '%'
+	o str.c: refactor brk_string
+	o unit-tests: add test case for lazy conditions
+
+2020-04-18  Simon J Gerraty  <sjg at beast.crufty.net>
+
+	* VERSION (_MAKE_VERSION): 20200418
+
+	* configure.in: use_makefile=no for cygwin et al.
+	case insensitive filesystems just don't work if both
+	makefile and Makefile exist.
+	NOTE: bmake does not support cygwin and likely never will,
+	but if brave souls want to try it - help them out.
+
+2020-04-02  Simon J Gerraty  <sjg at beast.crufty.net>
+
+	* VERSION (_MAKE_VERSION): 20200402
+	Merge with NetBSD make, pick up
+	o meta.c: meta_oodate, CHECK_VALID_META is too aggressive for CMD
+	  a blank command is perfectly valid.
+
+2020-03-30  Simon J Gerraty  <sjg at beast.crufty.net>
+
+	* VERSION (_MAKE_VERSION): 20200330
+	Merge with NetBSD make, pick up
+	o make.h: extern debug_file
+
+2020-03-18  Simon J Gerraty  <sjg at beast.crufty.net>
+
+	* VERSION (_MAKE_VERSION): 20200318
+	Merge with NetBSD make, pick up
+	o meta.c: meta_oodate, check for corrupted meta file
+	  earlier and more often.
+
+2020-02-20  Simon J Gerraty  <sjg at beast.crufty.net>
+
+	* VERSION (_MAKE_VERSION): 20200220
+
+2020-02-19  Simon J Gerraty  <sjg at beast.crufty.net>
+
+	* boot-strap: unset MAKEFLAGS
+
+2020-02-12  Simon J Gerraty  <sjg at beast.crufty.net>
+
+	* VERSION (_MAKE_VERSION): 20200212
+	* meta.c: meta_compat_parent check for USE_FILEMON
+	  patch from Soeren Tempel
+
+2020-02-05  Simon J Gerraty  <sjg at beast.crufty.net>
+
+	* VERSION: 20200205
+	Merge with NetBSD make, pick up
+	o meta.c: fix compat mode, need to call meta_job_output()
+	o job.c: extra fds for meta mode not needed if using filemon_dev
+
+2020-01-22  Simon J Gerraty  <sjg at beast.crufty.net>
+
+	* VERSION: 20200122
+	Merge with NetBSD make, pick up
+	o meta.c: avoid passing NULL to filemon_*() when meta_needed()
+	  returns FALSE.
+
+2020-01-21  Simon J Gerraty  <sjg at beast.crufty.net>
+
+	* VERSION: 20200121
+	Merge with NetBSD make, pick up
+	o filemon/filemon_{dev,ktrace}.c: allow selection of
+	  filemon implementation.  filemon_dev.c uses the kernel module
+	  while filemon_ktrace.c leverages the fktrace api available in
+	  NetBSD.  filemon_ktrace.c can hopefully form the basis for
+	  adding support for other tracing mechanisms such as strace on
+	  Linux.
+	o meta.c: when target is out-of-date per normal make rules
+	  record value of .OODATE in meta file.
+
+2019-09-26  Simon J Gerraty  <sjg at beast.crufty.net>
+
+	* VERSION: 20190926
+	  Merge with NetBSD make, pick up
+	  o parse.c: don't pass NULL to realpath(3)
+	    some versions cannot handle it.
+
+2019-04-09  Simon J Gerraty  <sjg at beast.crufty.net>
+
+	* VERSION: 20190409
+	  Merge with NetBSD make, pick up
+	  o parse.c: ParseDoDependency: free paths rather than assert
+
+2018-12-22  Simon J Gerraty  <sjg at beast.crufty.net>
+
+	* VERSION: 20181222
+
+	* configure.in: add --without-makefile to avoid generating
+	  makefile and make-bootstrap.sh
+
+	* include Makefile.inc if it exists
+
+	* Use Makefile and Makefile.config.in in unit-tests
+	  so we can use just: make obj && make && make test
+	  when bmake is already available.
+	  We add --without-makefile to CONFIGURE_ARGS in this case.
+
+	* tweak bsd.after-import.mk (captures Makefile.config etc
+	  after import to FreeBSD for example) to cope with all the above. 
+
+2018-12-21  Simon J Gerraty  <sjg at beast.crufty.net>
+
+	* VERSION: 20181221
+	  Merge with NetBSD make, pick up
+	  o parse.c: ParseVErrorInternal use .PARSEDIR
+	    and apply if relative, and then use .PARSEFILE
+	    for consistent result.
+
+2018-12-20  Simon J Gerraty  <sjg at beast.crufty.net>
+
+	* VERSION: 20181220
+	  Merge with NetBSD make, pick up
+	  o parse.c: ParseVErrorInternal use .CURDIR if .PARSEDIR
+	    is relative
+	  o var.c: avoid SEGFAULT in .unexport-env
+	    when MAKELEVEL is not set
+
+2018-12-16  Simon J Gerraty  <sjg at beast.crufty.net>
+
+	* VERSION: 20181216
+	  Merge with NetBSD make, pick up
+	  o fix for unit-tests/varquote.mk on Debian
+
+2018-09-21  Simon J. Gerraty  <sjg at bad.crufty.net>
+
+	* VERSION: 20180919
+	  Merge with NetBSD make, pick up
+	  o var.c: add :q
+	  o dir.c: cleanup caching of stats
+
+2018-09-21  Simon J Gerraty  <sjg at beast.crufty.net>
+
+	* Makefile.config.in: use += where it makes sense.
+
 2018-05-12  Simon J. Gerraty  <sjg at bad.crufty.net>
 
 	* VERSION: 20180512

Modified: stable/12/contrib/bmake/FILES
==============================================================================
--- stable/12/contrib/bmake/FILES	Sun May 31 21:38:33 2020	(r361673)
+++ stable/12/contrib/bmake/FILES	Sun May 31 21:43:59 2020	(r361674)
@@ -22,6 +22,9 @@ configure.in
 dir.c
 dir.h
 dirname.c
+filemon/filemon.h
+filemon/filemon_dev.c
+filemon/filemon_ktrace.c
 find_lib.sh
 for.c
 getopt.c
@@ -94,13 +97,18 @@ suff.c
 targ.c
 trace.c
 trace.h
-unit-tests/Makefile.in
+unit-tests/Makefile
+unit-tests/Makefile.config.in
 unit-tests/comment.exp
 unit-tests/comment.mk
 unit-tests/cond1.exp
 unit-tests/cond1.mk
 unit-tests/cond2.exp
 unit-tests/cond2.mk
+unit-tests/cond-late.mk
+unit-tests/cond-late.exp
+unit-tests/dollar.exp
+unit-tests/dollar.mk
 unit-tests/doterror.exp
 unit-tests/doterror.mk
 unit-tests/dotwait.exp
@@ -123,6 +131,10 @@ unit-tests/hash.exp
 unit-tests/hash.mk
 unit-tests/impsrc.exp
 unit-tests/impsrc.mk
+unit-tests/include-main.exp
+unit-tests/include-main.mk
+unit-tests/include-sub.mk
+unit-tests/include-subsub.mk
 unit-tests/misc.exp
 unit-tests/misc.mk
 unit-tests/moderrs.exp
@@ -163,6 +175,10 @@ unit-tests/varcmd.exp
 unit-tests/varcmd.mk
 unit-tests/varmisc.exp
 unit-tests/varmisc.mk
+unit-tests/varmod-edge.exp
+unit-tests/varmod-edge.mk
+unit-tests/varquote.exp
+unit-tests/varquote.mk
 unit-tests/varshell.exp
 unit-tests/varshell.mk
 util.c

Modified: stable/12/contrib/bmake/Makefile
==============================================================================
--- stable/12/contrib/bmake/Makefile	Sun May 31 21:38:33 2020	(r361673)
+++ stable/12/contrib/bmake/Makefile	Sun May 31 21:43:59 2020	(r361674)
@@ -1,4 +1,4 @@
-#	$Id: Makefile,v 1.99 2017/08/13 20:12:53 sjg Exp $
+#	$Id: Makefile,v 1.104 2020/02/06 01:33:54 sjg Exp $
 
 PROG=	bmake
 
@@ -56,6 +56,7 @@ SRCS+= \
 	lstSucc.c
 
 .-include "VERSION"
+.-include "Makefile.inc"
 
 # this file gets generated by configure
 .-include "Makefile.config"
@@ -77,12 +78,24 @@ CFLAGS+= -I. -I${srcdir} ${XDEFS} -DMAKE_NATIVE
 CFLAGS+= ${COPTS.${.ALLSRC:M*.c:T:u}}
 COPTS.main.c+= "-DMAKE_VERSION=\"${_MAKE_VERSION}\""
 
-# meta mode can be useful even without filemon 
+# meta mode can be useful even without filemon
+# should be set by now
+USE_FILEMON ?= no
+.if ${USE_FILEMON:tl} != "no"
+.PATH:	${.CURDIR}/filemon
+SRCS+=	filemon_${USE_FILEMON}.c
+COPTS.meta.c+= -DUSE_FILEMON -DUSE_FILEMON_${USE_FILEMON:tu}
+COPTS.job.c+= ${COPTS.meta.c}
+
+.if ${USE_FILEMON} == "dev"
 FILEMON_H ?= /usr/include/dev/filemon/filemon.h
 .if exists(${FILEMON_H}) && ${FILEMON_H:T} == "filemon.h"
-COPTS.meta.c += -DHAVE_FILEMON_H -I${FILEMON_H:H}
+COPTS.filemon_dev.c += -DHAVE_FILEMON_H -I${FILEMON_H:H}
 .endif
+.endif				# USE_FILEMON == dev
 
+.endif				# USE_FILEMON
+
 .PATH:	${srcdir}
 .PATH:	${srcdir}/lst.lib
 
@@ -198,6 +211,8 @@ main.o: ${SRCS} ${.CURDIR}/VERSION
 
 .if ${MK_AUTOCONF_MK} == "yes"
 CONFIGURE_DEPS += ${.CURDIR}/VERSION
+# we do not need or want the generated makefile
+CONFIGURE_ARGS += --without-makefile
 .include <autoconf.mk>
 .endif
 SHARE_MK?=${SHAREDIR}/mk

Modified: stable/12/contrib/bmake/Makefile.config.in
==============================================================================
--- stable/12/contrib/bmake/Makefile.config.in	Sun May 31 21:38:33 2020	(r361673)
+++ stable/12/contrib/bmake/Makefile.config.in	Sun May 31 21:43:59 2020	(r361674)
@@ -1,6 +1,6 @@
 # things set by configure
 
-_MAKE_VERSION=@_MAKE_VERSION@
+_MAKE_VERSION?=@_MAKE_VERSION@
 
 prefix?= @prefix@
 srcdir= @srcdir@
@@ -11,10 +11,11 @@ DEFAULT_SYS_PATH?= @default_sys_path@
 
 CPPFLAGS+= @CPPFLAGS@
 CFLAGS+= ${CPPFLAGS} @DEFS@
-LDFLAGS= @LDFLAGS@
-LIBOBJS= @LIBOBJS@
-LDADD= @LIBS@
-USE_META= @use_meta@
+LDFLAGS+= @LDFLAGS@
+LIBOBJS+= @LIBOBJS@
+LDADD+= @LIBS@
+USE_META?= @use_meta@
+USE_FILEMON?= @use_filemon@
 FILEMON_H?= @filemon_h@
 BMAKE_PATH_MAX?= @bmake_path_max@
 # used if MAXPATHLEN not defined

Modified: stable/12/contrib/bmake/VERSION
==============================================================================
--- stable/12/contrib/bmake/VERSION	Sun May 31 21:38:33 2020	(r361673)
+++ stable/12/contrib/bmake/VERSION	Sun May 31 21:43:59 2020	(r361674)
@@ -1,2 +1,2 @@
 # keep this compatible with sh and make
-_MAKE_VERSION=20180512
+_MAKE_VERSION=20200517

Modified: stable/12/contrib/bmake/arch.c
==============================================================================
--- stable/12/contrib/bmake/arch.c	Sun May 31 21:38:33 2020	(r361673)
+++ stable/12/contrib/bmake/arch.c	Sun May 31 21:43:59 2020	(r361674)
@@ -1,4 +1,4 @@
-/*	$NetBSD: arch.c,v 1.70 2017/04/16 20:49:09 riastradh Exp $	*/
+/*	$NetBSD: arch.c,v 1.71 2019/10/05 23:35:57 mrg Exp $	*/
 
 /*
  * Copyright (c) 1988, 1989, 1990, 1993
@@ -69,14 +69,14 @@
  */
 
 #ifndef MAKE_NATIVE
-static char rcsid[] = "$NetBSD: arch.c,v 1.70 2017/04/16 20:49:09 riastradh Exp $";
+static char rcsid[] = "$NetBSD: arch.c,v 1.71 2019/10/05 23:35:57 mrg Exp $";
 #else
 #include <sys/cdefs.h>
 #ifndef lint
 #if 0
 static char sccsid[] = "@(#)arch.c	8.2 (Berkeley) 1/2/94";
 #else
-__RCSID("$NetBSD: arch.c,v 1.70 2017/04/16 20:49:09 riastradh Exp $");
+__RCSID("$NetBSD: arch.c,v 1.71 2019/10/05 23:35:57 mrg Exp $");
 #endif
 #endif /* not lint */
 #endif
@@ -682,7 +682,7 @@ ArchStatMember(char *archive, char *member, Boolean ha
 	    arh.AR_SIZE[sizeof(arh.AR_SIZE)-1] = '\0';
 	    size = (int)strtol(arh.AR_SIZE, NULL, 10);
 
-	    (void)strncpy(memName, arh.AR_NAME, sizeof(arh.AR_NAME));
+	    memcpy(memName, arh.AR_NAME, sizeof(arh.AR_NAME));
 	    for (cp = &memName[AR_MAX_NAME_LEN]; *cp == ' '; cp--) {
 		continue;
 	    }

Modified: stable/12/contrib/bmake/bmake.1
==============================================================================
--- stable/12/contrib/bmake/bmake.1	Sun May 31 21:38:33 2020	(r361673)
+++ stable/12/contrib/bmake/bmake.1	Sun May 31 21:43:59 2020	(r361674)
@@ -1,4 +1,4 @@
-.\"	$NetBSD: make.1,v 1.272 2018/04/02 04:26:17 dholland Exp $
+.\"	$NetBSD: make.1,v 1.273 2018/05/27 01:14:51 christos 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 June 22, 2017
+.Dd May 26, 2018
 .Dt BMAKE 1
 .Os
 .Sh NAME
@@ -1227,8 +1227,15 @@ due uno quattro tre
 .Ed
 .It Cm \&:Q
 Quotes every shell meta-character in the variable, so that it can be passed
+safely to the shell.
+.It Cm \&:q
+Quotes every shell meta-character in the variable, and also doubles
+.Sq $
+characters so that it can be passed
 safely through recursive invocations of
 .Nm .
+This is equivalent to: 
+.Sq \&:S/\e\&$/&&/g:Q .
 .It Cm \&:R
 Replaces each word in the variable with everything but its suffix.
 .It Cm \&:range[=count]

Modified: stable/12/contrib/bmake/boot-strap
==============================================================================
--- stable/12/contrib/bmake/boot-strap	Sun May 31 21:38:33 2020	(r361673)
+++ stable/12/contrib/bmake/boot-strap	Sun May 31 21:43:59 2020	(r361674)
@@ -89,6 +89,10 @@
 #		disable use of filemon(9) which is currently only
 #		available for NetBSD and FreeBSD.
 #
+#	--with-filemon=ktrace
+#		on NetBSD or others with fktrace(2), use ktrace
+#		version of filemon.
+#
 #	--with-filemon="path/to/filemon.h"
 #		enables use of filemon(9) by meta mode.
 #		
@@ -111,7 +115,7 @@
 #	Simon J. Gerraty <sjg at crufty.net>
 
 # RCSid:
-#	$Id: boot-strap,v 1.49 2016/05/29 00:09:14 sjg Exp $
+#	$Id: boot-strap,v 1.51 2020/02/19 16:46:23 sjg Exp $
 #
 #	@(#) Copyright (c) 2001 Simon J. Gerraty
 #
@@ -161,6 +165,8 @@ cmd_args="$@"
 
 # clear some things from the environment that we care about
 unset MAKEOBJDIR MAKEOBJDIRPREFIX
+# or that might be incompatible
+unset MAKE MAKEFLAGS
 
 # --install[-host-target] will set this
 INSTALL_PREFIX=

Modified: stable/12/contrib/bmake/bsd.after-import.mk
==============================================================================
--- stable/12/contrib/bmake/bsd.after-import.mk	Sun May 31 21:38:33 2020	(r361673)
+++ stable/12/contrib/bmake/bsd.after-import.mk	Sun May 31 21:43:59 2020	(r361674)
@@ -1,4 +1,4 @@
-# $Id: bsd.after-import.mk,v 1.13 2017/08/13 00:56:10 sjg Exp $
+# $Id: bsd.after-import.mk,v 1.15 2018/12/30 17:14:24 sjg Exp $
 
 # This makefile is for use when integrating bmake into a BSD build
 # system.  Use this makefile after importing bmake.
@@ -63,7 +63,7 @@ MAKEFILE_SED = 	sed -e '/^MACHINE/d' \
 	-e 's,${SRCTOP},$${SRCTOP},g'
 
 # These are the simple files we want to capture
-configured_files= config.h Makefile.config unit-tests/Makefile
+configured_files= config.h Makefile.config unit-tests/Makefile.config
 
 after-import: bootstrap ${MAKEFILE}
 .for f in ${configured_files:M*.[ch]}
@@ -87,7 +87,6 @@ _makefile:	bootstrap ${MAKEFILE}
 	@(echo '# This is a generated file, do NOT edit!'; \
 	echo '# See ${_this:S,${SRCTOP}/,,}'; \
 	echo '#'; echo '# $$${HOST_OS}$$'; \
-	echo; echo '.sinclude "Makefile.inc"'; \
 	echo; echo 'SRCTOP?= $${.CURDIR:${.CURDIR:S,${SRCTOP}/,,:C,[^/]+,H,g:S,/,:,g}}'; \
 	echo; echo '# look here first for config.h'; \
 	echo 'CFLAGS+= -I$${.CURDIR}'; echo; \

Modified: stable/12/contrib/bmake/compat.c
==============================================================================
--- stable/12/contrib/bmake/compat.c	Sun May 31 21:38:33 2020	(r361673)
+++ stable/12/contrib/bmake/compat.c	Sun May 31 21:43:59 2020	(r361674)
@@ -1,4 +1,4 @@
-/*	$NetBSD: compat.c,v 1.107 2017/07/20 19:29:54 sjg Exp $	*/
+/*	$NetBSD: compat.c,v 1.110 2020/01/19 19:42:32 riastradh 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.107 2017/07/20 19:29:54 sjg Exp $";
+static char rcsid[] = "$NetBSD: compat.c,v 1.110 2020/01/19 19:42:32 riastradh 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.107 2017/07/20 19:29:54 sjg Exp $");
+__RCSID("$NetBSD: compat.c,v 1.110 2020/01/19 19:42:32 riastradh Exp $");
 #endif
 #endif /* not lint */
 #endif
@@ -407,7 +407,7 @@ again:
 
 #ifdef USE_META
     if (useMeta) {
-	meta_compat_parent();
+	meta_compat_parent(cpid);
     }
 #endif
 

Modified: stable/12/contrib/bmake/config.h.in
==============================================================================
--- stable/12/contrib/bmake/config.h.in	Sun May 31 21:38:33 2020	(r361673)
+++ stable/12/contrib/bmake/config.h.in	Sun May 31 21:43:59 2020	(r361674)
@@ -143,7 +143,7 @@
 /* Define to 1 if you have the `strtol' function. */
 #undef HAVE_STRTOL
 
-/* Define to 1 if `struct stat' is a member of `st_rdev'. */
+/* Define to 1 if `st_rdev' is a member of `struct stat'. */
 #undef HAVE_STRUCT_STAT_ST_RDEV
 
 /* Define to 1 if your `struct stat' has `st_rdev'. Deprecated, use

Modified: stable/12/contrib/bmake/configure
==============================================================================
Binary file (source and/or target). No diff available.

Modified: stable/12/contrib/bmake/configure.in
==============================================================================
--- stable/12/contrib/bmake/configure.in	Sun May 31 21:38:33 2020	(r361673)
+++ stable/12/contrib/bmake/configure.in	Sun May 31 21:43:59 2020	(r361674)
@@ -1,11 +1,11 @@
 dnl
 dnl RCSid:
-dnl	$Id: configure.in,v 1.59 2017/11/26 22:39:20 sjg Exp $
+dnl	$Id: configure.in,v 1.63 2020/04/19 05:17:57 sjg Exp $
 dnl
 dnl Process this file with autoconf to produce a configure script
 dnl
 AC_PREREQ(2.50)
-AC_INIT([bmake], [20171126], [sjg at NetBSD.org])
+AC_INIT([bmake], [20200418], [sjg at NetBSD.org])
 AC_CONFIG_HEADERS(config.h)
 
 dnl make srcdir absolute
@@ -16,6 +16,7 @@ esac
 
 dnl get _MAKE_VERSION
 . $srcdir/VERSION
+OS=`uname -s`
 
 dnl
 AC_ARG_WITH(defshell,
@@ -32,6 +33,17 @@ no)    ;;
        ;;
        esac])
 dnl
+case "$OS" in
+CYGWIN*|MINGW*) use_makefile=no;;
+*) use_makefile=yes;;
+esac
+AC_ARG_WITH(makefile,
+[ --without-makefile dissable use of generated makefile],
+[case "${withval}" in
+yes|no) use_makefile=${withval};;
+*) AC_MSG_ERROR(bad value ${withval} given for makefile) ;;
+esac])
+dnl
 use_meta=yes
 AC_ARG_WITH(meta,
 [ --without-meta dissable use of meta-mode],
@@ -41,30 +53,41 @@ yes|no) use_meta=${withval};;
 esac])
 dnl
 AC_ARG_WITH(filemon,
-[ --with-filemon=path/filemon.h indicate path to filemon.h for meta-mode],
+[ --with-filemon={no,dev,ktrace,path/filemon.h} indicate filemon method for meta-mode. Path to filemon.h implies dev],
 [ case "/${withval}" in
-/no|*/filemon.h) filemon_h="${withval}";;
+/no) use_filemon=no;;
+/*trace) filemon_h=no use_filemon="${withval}";;
+*/filemon.h) filemon_h="${withval}";;
 */filemon*) filemon_h="${withval}/filemon.h";;
 *) AC_MSG_ERROR(bad value ${withval} given for filemon) ;;
 esac],
 [
-OS=`uname -s`
-for d in "/usr/include/dev/filemon" "$prefix/include/dev/filemon" "$srcdir/filemon" "$srcdir/../filemon" "$srcdir/../../sys/dev/filemon"
-do
-	for x in "/$OS" ""
-	do
-		filemon_h="$d$x/filemon.h"
-		test -s "$filemon_h" && break
-	done
-	test -s "$filemon_h" && break
-done
-test -s "${filemon_h:-/dev/null}" || filemon_h=no
+case "$OS" in
+NetBSD) filemon_h=no use_filemon=ktrace;;
+*)
+    for d in "/usr/include/dev/filemon" "$prefix/include/dev/filemon" "$srcdir/../../sys/dev/filemon"
+    do  
+        for x in "/$OS" ""
+        do
+            filemon_h="$d$x/filemon.h"
+            test -s "$filemon_h" && break
+        done
+        test -s "$filemon_h" && { use_filemon=dev; break; }
+    done
+    ;;
+esac
+use_filemon=${use_filemon:-no}
+case "$use_filemon" in
+dev) ;;
+*) filemon_h=no;;
+esac
 ])
-dnl echo "Note: use_meta=$use_meta filemon_h=$filemon_h" >&6
+dnl echo "Note: use_meta=$use_meta use_filemon=$use_filemon filemon_h=$filemon_h" >&6
 case "$use_meta" in
 yes)
-	case "$filemon_h" in
-	*.h) echo "Using: filemon=$filemon_h" >&6;;
+	case "$use_filemon" in
+	no) ;;
+	*) echo "Using: filemon_${use_filemon}.c" >&6;;
 	esac
 	;;
 esac
@@ -388,10 +411,14 @@ AC_SUBST(INSTALL)
 AC_SUBST(GCC)
 AC_SUBST(diff_u)
 AC_SUBST(use_meta)
+AC_SUBST(use_filemon)
 AC_SUBST(filemon_h)
 AC_SUBST(_MAKE_VERSION)
-AC_OUTPUT(makefile Makefile.config make-bootstrap.sh unit-tests/Makefile)
-
+bm_outfiles="Makefile.config unit-tests/Makefile.config make-bootstrap.sh"
+if test $use_makefile = yes; then
+   bm_outfiles="makefile $bm_outfiles"
+fi
+AC_OUTPUT($bm_outfiles)
 cat <<EOF
 
 You can now run

Modified: stable/12/contrib/bmake/dir.c
==============================================================================
--- stable/12/contrib/bmake/dir.c	Sun May 31 21:38:33 2020	(r361673)
+++ stable/12/contrib/bmake/dir.c	Sun May 31 21:43:59 2020	(r361674)
@@ -1,4 +1,4 @@
-/*	$NetBSD: dir.c,v 1.71 2017/04/16 21:14:47 riastradh Exp $	*/
+/*	$NetBSD: dir.c,v 1.73 2018/07/12 18:03:31 christos Exp $	*/
 
 /*
  * Copyright (c) 1988, 1989, 1990 The Regents of the University of California.
@@ -70,14 +70,14 @@
  */
 
 #ifndef MAKE_NATIVE
-static char rcsid[] = "$NetBSD: dir.c,v 1.71 2017/04/16 21:14:47 riastradh Exp $";
+static char rcsid[] = "$NetBSD: dir.c,v 1.73 2018/07/12 18:03:31 christos Exp $";
 #else
 #include <sys/cdefs.h>
 #ifndef lint
 #if 0
 static char sccsid[] = "@(#)dir.c	8.2 (Berkeley) 1/2/94";
 #else
-__RCSID("$NetBSD: dir.c,v 1.71 2017/04/16 21:14:47 riastradh Exp $");
+__RCSID("$NetBSD: dir.c,v 1.73 2018/07/12 18:03:31 christos Exp $");
 #endif
 #endif /* not lint */
 #endif
@@ -268,15 +268,6 @@ struct cache_st {
 };
 
 /* minimize changes below */
-static time_t
-Hash_GetTimeValue(Hash_Entry *entry)
-{
-    struct cache_st *cst;
-
-    cst = entry->clientPtr;
-    return cst->mtime;
-}
-
 #define CST_LSTAT 1
 #define CST_UPDATE 2
 
@@ -298,6 +289,10 @@ cached_stats(Hash_Table *htp, const char *pathname, st
 	memset(st, 0, sizeof(*st));
 	st->st_mtime = cst->mtime;
 	st->st_mode = cst->mode;
+        if (DEBUG(DIR)) {
+            fprintf(debug_file, "Using cached time %s for %s\n",
+		Targ_FmtTime(st->st_mtime), pathname);
+	}
 	return 0;
     }
 
@@ -315,6 +310,10 @@ cached_stats(Hash_Table *htp, const char *pathname, st
     cst = entry->clientPtr;
     cst->mtime = st->st_mtime;
     cst->mode = st->st_mode;
+    if (DEBUG(DIR)) {
+	fprintf(debug_file, "   Caching %s for %s\n",
+	    Targ_FmtTime(st->st_mtime), pathname);
+    }
 
     return 0;
 }
@@ -995,14 +994,6 @@ DirLookupSubdir(Path *p, const char *name)
     }
 
     if (cached_stat(file, &stb) == 0) {
-	/*
-	 * Save the modification time so if it's needed, we don't have
-	 * to fetch it again.
-	 */
-	if (DEBUG(DIR)) {
-	    fprintf(debug_file, "   Caching %s for %s\n", Targ_FmtTime(stb.st_mtime),
-		    file);
-	}
 	nearmisses += 1;
 	return (file);
     }
@@ -1134,7 +1125,6 @@ Dir_FindFile(const char *name, Lst path)
     Boolean	  hasLastDot = FALSE;	/* true we should search dot last */
     Boolean	  hasSlash;		/* true if 'name' contains a / */
     struct stat	  stb;			/* Buffer for stat, if necessary */
-    Hash_Entry	  *entry;		/* Entry for mtimes table */
     const char   *trailing_dot = ".";
 
     /*
@@ -1395,24 +1385,14 @@ Dir_FindFile(const char *name, Lst path)
     }
 
     bigmisses += 1;
-    entry = Hash_FindEntry(&mtimes, name);
-    if (entry != NULL) {
-	if (DEBUG(DIR)) {
-	    fprintf(debug_file, "   got it (in mtime cache)\n");
-	}
-	return(bmake_strdup(name));
-    } else if (cached_stat(name, &stb) == 0) {
-	if (DEBUG(DIR)) {
-	    fprintf(debug_file, "   Caching %s for %s\n", Targ_FmtTime(stb.st_mtime),
-		    name);
-	}
+    if (cached_stat(name, &stb) == 0) {
 	return (bmake_strdup(name));
-    } else {
-	if (DEBUG(DIR)) {
-	    fprintf(debug_file, "   failed. Returning NULL\n");
-	}
-	return NULL;
     }
+
+    if (DEBUG(DIR)) {
+	fprintf(debug_file, "   failed. Returning NULL\n");
+    }
+    return NULL;
 #endif /* notdef */
 }
 
@@ -1518,7 +1498,6 @@ Dir_MTime(GNode *gn, Boolean recheck)
 {
     char          *fullName;  /* the full pathname of name */
     struct stat	  stb;	      /* buffer for finding the mod time */
-    Hash_Entry	  *entry;
 
     if (gn->type & OP_ARCHV) {
 	return Arch_MTime(gn);
@@ -1569,17 +1548,7 @@ Dir_MTime(GNode *gn, Boolean recheck)
 	fullName = bmake_strdup(gn->name);
     }
 
-    if (!recheck)
-	entry = Hash_FindEntry(&mtimes, fullName);
-    else
-	entry = NULL;
-    if (entry != NULL) {
-	stb.st_mtime = Hash_GetTimeValue(entry);
-	if (DEBUG(DIR)) {
-	    fprintf(debug_file, "Using cached time %s for %s\n",
-		    Targ_FmtTime(stb.st_mtime), fullName);
-	}
-    } else if (cached_stats(&mtimes, fullName, &stb, recheck ? CST_UPDATE : 0) < 0) {
+    if (cached_stats(&mtimes, fullName, &stb, recheck ? CST_UPDATE : 0) < 0) {
 	if (gn->type & OP_MEMBER) {
 	    if (fullName != gn->path)
 		free(fullName);

Modified: stable/12/contrib/bmake/dirname.c
==============================================================================
--- stable/12/contrib/bmake/dirname.c	Sun May 31 21:38:33 2020	(r361673)
+++ stable/12/contrib/bmake/dirname.c	Sun May 31 21:43:59 2020	(r361674)
@@ -1,4 +1,4 @@
-/*	$NetBSD: dirname.c,v 1.13 2014/07/16 10:52:26 christos Exp $	*/
+/*	$NetBSD: dirname.c,v 1.14 2018/09/27 00:45:34 kre Exp $	*/
 
 /*-
  * Copyright (c) 1997, 2002 The NetBSD Foundation, Inc.
@@ -35,6 +35,11 @@
 #ifndef HAVE_DIRNAME
 
 #include <sys/cdefs.h>
+#if defined(LIBC_SCCS) && !defined(lint)
+__RCSID("$NetBSD: dirname.c,v 1.14 2018/09/27 00:45:34 kre Exp $");
+#endif /* !LIBC_SCCS && !lint */
+
+#include "namespace.h"
 #include <sys/param.h>
 #ifdef HAVE_LIBGEN_H
 #include <libgen.h>
@@ -92,7 +97,8 @@ xdirname_r(const char *path, char *buf, size_t buflen)
 out:
 	if (buf != NULL && buflen != 0) {
 		buflen = MIN(len, buflen - 1);
-		memcpy(buf, path, buflen);
+		if (buf != path)
+			memcpy(buf, path, buflen);
 		buf[buflen] = '\0';
 	}
 	return len;

Modified: stable/12/contrib/bmake/job.c
==============================================================================
--- stable/12/contrib/bmake/job.c	Sun May 31 21:38:33 2020	(r361673)
+++ stable/12/contrib/bmake/job.c	Sun May 31 21:43:59 2020	(r361674)
@@ -1,4 +1,4 @@
-/*	$NetBSD: job.c,v 1.195 2018/05/13 22:13:28 sjg Exp $	*/
+/*	$NetBSD: job.c,v 1.197 2020/02/06 01:13:19 sjg Exp $	*/
 
 /*
  * Copyright (c) 1988, 1989, 1990 The Regents of the University of California.
@@ -70,14 +70,14 @@
  */
 
 #ifndef MAKE_NATIVE
-static char rcsid[] = "$NetBSD: job.c,v 1.195 2018/05/13 22:13:28 sjg Exp $";
+static char rcsid[] = "$NetBSD: job.c,v 1.197 2020/02/06 01:13:19 sjg Exp $";
 #else
 #include <sys/cdefs.h>
 #ifndef lint
 #if 0
 static char sccsid[] = "@(#)job.c	8.2 (Berkeley) 3/19/94";
 #else
-__RCSID("$NetBSD: job.c,v 1.195 2018/05/13 22:13:28 sjg Exp $");
+__RCSID("$NetBSD: job.c,v 1.197 2020/02/06 01:13:19 sjg Exp $");
 #endif
 #endif /* not lint */
 #endif
@@ -358,6 +358,8 @@ static Job childExitJob;	/* child exit pseudo-job */
 #define	CHILD_EXIT	"."
 #define	DO_JOB_RESUME	"R"
 
+static const int npseudojobs = 2; /* number of pseudo-jobs */
+
 #define TARG_FMT  "%s %s ---\n" /* Default format */
 #define MESSAGE(fp, gn) \
 	if (maxJobs != 1 && targPrefix && *targPrefix) \
@@ -389,6 +391,16 @@ static void JobSigReset(void);
 #endif
 const char *malloc_options= MALLOC_OPTIONS;
 
+static unsigned
+nfds_per_job(void)
+{
+#if defined(USE_FILEMON) && !defined(USE_FILEMON_DEV)
+    if (useMeta)
+	return 2;
+#endif
+    return 1;
+}
+
 static void
 job_table_dump(const char *where)
 {
@@ -1475,6 +1487,12 @@ JobExec(Job *job, char **argv)
 
     Trace_Log(JOBSTART, job);
 
+#ifdef USE_META
+    if (useMeta) {
+	meta_job_parent(job, cpid);
+    }
+#endif
+
     /*
      * Set the current position in the buffer to the beginning
      * and mark another stream to watch in the outputs mask
@@ -2157,12 +2175,24 @@ Job_CatchOutput(void)
     if (nready == 0)
 	    return;
 
-    for (i = 2; i < nfds; i++) {
+    for (i = npseudojobs*nfds_per_job(); i < nfds; i++) {
 	if (!fds[i].revents)
 	    continue;
 	job = jobfds[i];
 	if (job->job_state == JOB_ST_RUNNING)
 	    JobDoOutput(job, FALSE);
+#if defined(USE_FILEMON) && !defined(USE_FILEMON_DEV)
+	/*
+	 * With meta mode, we may have activity on the job's filemon
+	 * descriptor too, which at the moment is any pollfd other than
+	 * job->inPollfd.
+	 */
+	if (useMeta && job->inPollfd != &fds[i]) {
+	    if (meta_job_event(job) <= 0) {
+		fds[i].events = 0; /* never mind */
+	    }
+	}
+#endif
 	if (--nready == 0)
 		return;
     }
@@ -2313,9 +2343,11 @@ Job_Init(void)
 
     JobCreatePipe(&childExitJob, 3);
 
-    /* We can only need to wait for tokens, children and output from each job */
-    fds = bmake_malloc(sizeof (*fds) * (2 + maxJobs));
-    jobfds = bmake_malloc(sizeof (*jobfds) * (2 + maxJobs));
+    /* Preallocate enough for the maximum number of jobs.  */
+    fds = bmake_malloc(sizeof(*fds) *
+	(npseudojobs + maxJobs) * nfds_per_job());
+    jobfds = bmake_malloc(sizeof(*jobfds) *
+	(npseudojobs + maxJobs) * nfds_per_job());
 
     /* These are permanent entries and take slots 0 and 1 */
     watchfd(&tokenWaitJob);
@@ -2834,6 +2866,14 @@ watchfd(Job *job)
     jobfds[nfds] = job;
     job->inPollfd = &fds[nfds];
     nfds++;
+#if defined(USE_FILEMON) && !defined(USE_FILEMON_DEV)
+    if (useMeta) {
+	fds[nfds].fd = meta_job_fd(job);
+	fds[nfds].events = fds[nfds].fd == -1 ? 0 : POLLIN;
+	jobfds[nfds] = job;
+	nfds++;
+    }
+#endif
 }
 
 static void
@@ -2844,6 +2884,18 @@ clearfd(Job *job)
 	Punt("Unwatching unwatched job");
     i = job->inPollfd - fds;
     nfds--;
+#if defined(USE_FILEMON) && !defined(USE_FILEMON_DEV)
+    if (useMeta) {
+	/*
+	 * Sanity check: there should be two fds per job, so the job's
+	 * pollfd number should be even.
+	 */
+	assert(nfds_per_job() == 2);
+	if (i % 2)
+	    Punt("odd-numbered fd with meta");
+	nfds--;
+    }
+#endif
     /*
      * Move last job in table into hole made by dead job.
      */
@@ -2851,6 +2903,12 @@ clearfd(Job *job)
 	fds[i] = fds[nfds];
 	jobfds[i] = jobfds[nfds];
 	jobfds[i]->inPollfd = &fds[i];
+#if defined(USE_FILEMON) && !defined(USE_FILEMON_DEV)
+	if (useMeta) {
+	    fds[i + 1] = fds[nfds + 1];
+	    jobfds[i + 1] = jobfds[nfds + 1];
+	}
+#endif
     }
     job->inPollfd = NULL;
 }

Modified: stable/12/contrib/bmake/make-bootstrap.sh.in
==============================================================================
--- stable/12/contrib/bmake/make-bootstrap.sh.in	Sun May 31 21:38:33 2020	(r361673)
+++ stable/12/contrib/bmake/make-bootstrap.sh.in	Sun May 31 21:43:59 2020	(r361674)
@@ -23,6 +23,10 @@ MDEFS="-DMAKE_VERSION=\"$MAKE_VERSION\" \
 LDFLAGS="@LDFLAGS@"
 LIBS="@LIBS@"
 
+toUpper() {
+    ${TR:-tr} abcdefghijklmnopqrstuvwxyz ABCDEFGHIJKLMNOPQRSTUVWXYZ
+}
+
 do_compile2() {
 	obj="$1"; shift
 	src="$1"; shift
@@ -32,7 +36,10 @@ do_compile2() {
 
 do_compile() {
 	obj="$1"; shift
-	src=`basename "$obj" .o`.c
+	case "$1" in
+	*.c) src=$1; shift;;
+	*) src=`basename "$obj" .o`.c;;
+	esac
 
 	for d in "$srcdir" "$srcdir/lst.lib"
 	do
@@ -52,7 +59,7 @@ do_link() {
 }
 
 BASE_OBJECTS="arch.o buf.o compat.o cond.o dir.o for.o getopt hash.o \
-job.o make.o make_malloc.o metachar.o parse.o sigcompat.o str.o strlist.o \
+make.o make_malloc.o metachar.o parse.o sigcompat.o str.o strlist.o \
 suff.o targ.o trace.o var.o util.o"
 
 LST_OBJECTS="lstAppend.o lstDupl.o lstInit.o lstOpen.o \
@@ -73,12 +80,22 @@ done
 
 case "@use_meta@" in
 yes)
-        case "@filemon_h@" in
-	*/filemon.h) FDEFS="-DHAVE_FILEMON_H -I`dirname @filemon_h@`";;
+	case "@use_filemon@" in
+	no) MDEFS=;;
+	*)
+		MDEFS="-DUSE_FILEMON -DUSE_FILEMON_`echo @use_filemon@ | toUpper`"
+		case "@use_filemon@, at filemon_h@" in
+		dev,*/filemon.h) FDEFS="-DHAVE_FILEMON_H -I`dirname @filemon_h@`";;
+		*) FDEFS=;;
+		esac
+		do_compile filemon_ at use_filemon@.o filemon/filemon_ at use_filemon@.c ${FDEFS}
+		BASE_OBJECTS="filemon_ at use_filemon@.o $BASE_OBJECTS"
+		;;
 	esac
-        do_compile meta.o ${FDEFS}
-        BASE_OBJECTS="meta.o ${BASE_OBJECTS}"
-        ;;
+	do_compile meta.o ${MDEFS}
+	BASE_OBJECTS="meta.o ${BASE_OBJECTS}"
+	;;
 esac
+do_compile job.o ${MDEFS}
 
-do_link bmake main.o ${BASE_OBJECTS} ${LST_OBJECTS} ${LIB_OBJECTS}
+do_link bmake main.o job.o ${BASE_OBJECTS} ${LST_OBJECTS} ${LIB_OBJECTS}

Modified: stable/12/contrib/bmake/make.1
==============================================================================
--- stable/12/contrib/bmake/make.1	Sun May 31 21:38:33 2020	(r361673)
+++ stable/12/contrib/bmake/make.1	Sun May 31 21:43:59 2020	(r361674)
@@ -1,4 +1,4 @@
-.\"	$NetBSD: make.1,v 1.272 2018/04/02 04:26:17 dholland Exp $
+.\"	$NetBSD: make.1,v 1.280 2020/04/27 20:03:08 christos 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 September 27, 2018

*** DIFF OUTPUT TRUNCATED AT 1000 LINES ***


More information about the svn-src-all mailing list