Skip site navigation (1)Skip section navigation (2)
Date:      Wed, 20 May 2020 22:25:46 +0000 (UTC)
From:      "Simon J. Gerraty" <sjg@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org
Subject:   svn commit: r361307 - in head: contrib/bmake contrib/bmake/filemon contrib/bmake/mk contrib/bmake/mk/sys contrib/bmake/unit-tests usr.bin/bmake
Message-ID:  <202005202225.04KMPkUp033338@repo.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: sjg
Date: Wed May 20 22:25:46 2020
New Revision: 361307
URL: https://svnweb.freebsd.org/changeset/base/361307

Log:
  Merge bmake-20200517
  
  Changes since 20181221 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
  
  plus more unit-tests

Added:
  head/contrib/bmake/filemon/
     - copied from r361291, vendor/NetBSD/bmake/dist/filemon/
  head/contrib/bmake/mk/compiler.mk
     - copied unchanged from r361291, vendor/NetBSD/bmake/dist/mk/compiler.mk
  head/contrib/bmake/mk/dirdeps-targets.mk
     - copied unchanged from r361291, vendor/NetBSD/bmake/dist/mk/dirdeps-targets.mk
  head/contrib/bmake/unit-tests/Makefile
     - copied unchanged from r361291, vendor/NetBSD/bmake/dist/unit-tests/Makefile
  head/contrib/bmake/unit-tests/Makefile.config.in
     - copied unchanged from r361291, vendor/NetBSD/bmake/dist/unit-tests/Makefile.config.in
  head/contrib/bmake/unit-tests/cond-late.exp
     - copied unchanged from r361291, vendor/NetBSD/bmake/dist/unit-tests/cond-late.exp
  head/contrib/bmake/unit-tests/cond-late.mk
     - copied unchanged from r361291, vendor/NetBSD/bmake/dist/unit-tests/cond-late.mk
  head/contrib/bmake/unit-tests/dollar.exp
     - copied unchanged from r361291, vendor/NetBSD/bmake/dist/unit-tests/dollar.exp
  head/contrib/bmake/unit-tests/dollar.mk
     - copied unchanged from r361291, vendor/NetBSD/bmake/dist/unit-tests/dollar.mk
  head/contrib/bmake/unit-tests/include-main.exp
     - copied unchanged from r361291, vendor/NetBSD/bmake/dist/unit-tests/include-main.exp
  head/contrib/bmake/unit-tests/include-main.mk
     - copied unchanged from r361291, vendor/NetBSD/bmake/dist/unit-tests/include-main.mk
  head/contrib/bmake/unit-tests/include-sub.mk
     - copied unchanged from r361291, vendor/NetBSD/bmake/dist/unit-tests/include-sub.mk
  head/contrib/bmake/unit-tests/include-subsub.mk
     - copied unchanged from r361291, vendor/NetBSD/bmake/dist/unit-tests/include-subsub.mk
  head/contrib/bmake/unit-tests/varmod-edge.exp
     - copied unchanged from r361291, vendor/NetBSD/bmake/dist/unit-tests/varmod-edge.exp
  head/contrib/bmake/unit-tests/varmod-edge.mk
     - copied unchanged from r361291, vendor/NetBSD/bmake/dist/unit-tests/varmod-edge.mk
Deleted:
  head/contrib/bmake/unit-tests/Makefile.in
Modified:
  head/contrib/bmake/ChangeLog
  head/contrib/bmake/FILES
  head/contrib/bmake/Makefile
  head/contrib/bmake/Makefile.config.in
  head/contrib/bmake/VERSION
  head/contrib/bmake/arch.c
  head/contrib/bmake/boot-strap
  head/contrib/bmake/bsd.after-import.mk
  head/contrib/bmake/compat.c
  head/contrib/bmake/config.h.in
  head/contrib/bmake/configure
  head/contrib/bmake/configure.in
  head/contrib/bmake/job.c
  head/contrib/bmake/make-bootstrap.sh.in
  head/contrib/bmake/make.1
  head/contrib/bmake/make.h
  head/contrib/bmake/meta.c
  head/contrib/bmake/meta.h
  head/contrib/bmake/mk/ChangeLog
  head/contrib/bmake/mk/FILES
  head/contrib/bmake/mk/autodep.mk
  head/contrib/bmake/mk/dirdeps.mk
  head/contrib/bmake/mk/doc.mk
  head/contrib/bmake/mk/dpadd.mk
  head/contrib/bmake/mk/gendirdeps.mk
  head/contrib/bmake/mk/init.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/options.mk
  head/contrib/bmake/mk/sys.mk
  head/contrib/bmake/mk/sys.vars.mk
  head/contrib/bmake/mk/sys/AIX.mk
  head/contrib/bmake/mk/sys/Darwin.mk
  head/contrib/bmake/mk/sys/Generic.mk
  head/contrib/bmake/mk/sys/HP-UX.mk
  head/contrib/bmake/mk/sys/IRIX.mk
  head/contrib/bmake/mk/sys/Linux.mk
  head/contrib/bmake/mk/sys/NetBSD.mk
  head/contrib/bmake/mk/sys/OSF1.mk
  head/contrib/bmake/mk/sys/OpenBSD.mk
  head/contrib/bmake/mk/sys/SunOS.mk
  head/contrib/bmake/mk/sys/UnixWare.mk
  head/contrib/bmake/mk/whats.mk
  head/contrib/bmake/nonints.h
  head/contrib/bmake/parse.c
  head/contrib/bmake/str.c
  head/contrib/bmake/unit-tests/escape.mk
  head/contrib/bmake/unit-tests/forloop.exp
  head/contrib/bmake/unit-tests/forloop.mk
  head/contrib/bmake/unit-tests/modorder.mk
  head/contrib/bmake/unit-tests/sysv.exp
  head/contrib/bmake/unit-tests/sysv.mk
  head/contrib/bmake/util.c
  head/contrib/bmake/var.c
  head/usr.bin/bmake/Makefile
  head/usr.bin/bmake/Makefile.config
  head/usr.bin/bmake/Makefile.depend
  head/usr.bin/bmake/config.h
Directory Properties:
  head/contrib/bmake/   (props changed)

Modified: head/contrib/bmake/ChangeLog
==============================================================================
--- head/contrib/bmake/ChangeLog	Wed May 20 22:25:41 2020	(r361306)
+++ head/contrib/bmake/ChangeLog	Wed May 20 22:25:46 2020	(r361307)
@@ -1,3 +1,138 @@
+2020-05-17  Simon J Gerraty  <sjg@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@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@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@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@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@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@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@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@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@beast.crufty.net>
+
+	* VERSION (_MAKE_VERSION): 20200220
+
+2020-02-19  Simon J Gerraty  <sjg@beast.crufty.net>
+
+	* boot-strap: unset MAKEFLAGS
+
+2020-02-12  Simon J Gerraty  <sjg@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@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@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@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@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@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@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@beast.crufty.net>
 
 	* VERSION: 20181221

Modified: head/contrib/bmake/FILES
==============================================================================
--- head/contrib/bmake/FILES	Wed May 20 22:25:41 2020	(r361306)
+++ head/contrib/bmake/FILES	Wed May 20 22:25:46 2020	(r361307)
@@ -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,8 @@ 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

Modified: head/contrib/bmake/Makefile
==============================================================================
--- head/contrib/bmake/Makefile	Wed May 20 22:25:41 2020	(r361306)
+++ head/contrib/bmake/Makefile	Wed May 20 22:25:46 2020	(r361307)
@@ -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: head/contrib/bmake/Makefile.config.in
==============================================================================
--- head/contrib/bmake/Makefile.config.in	Wed May 20 22:25:41 2020	(r361306)
+++ head/contrib/bmake/Makefile.config.in	Wed May 20 22:25:46 2020	(r361307)
@@ -14,7 +14,8 @@ CFLAGS+= ${CPPFLAGS} @DEFS@
 LDFLAGS+= @LDFLAGS@
 LIBOBJS+= @LIBOBJS@
 LDADD+= @LIBS@
-USE_META= @use_meta@
+USE_META?= @use_meta@
+USE_FILEMON?= @use_filemon@
 FILEMON_H?= @filemon_h@
 BMAKE_PATH_MAX?= @bmake_path_max@
 # used if MAXPATHLEN not defined

Modified: head/contrib/bmake/VERSION
==============================================================================
--- head/contrib/bmake/VERSION	Wed May 20 22:25:41 2020	(r361306)
+++ head/contrib/bmake/VERSION	Wed May 20 22:25:46 2020	(r361307)
@@ -1,2 +1,2 @@
 # keep this compatible with sh and make
-_MAKE_VERSION=20181221
+_MAKE_VERSION=20200517

Modified: head/contrib/bmake/arch.c
==============================================================================
--- head/contrib/bmake/arch.c	Wed May 20 22:25:41 2020	(r361306)
+++ head/contrib/bmake/arch.c	Wed May 20 22:25:46 2020	(r361307)
@@ -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: head/contrib/bmake/boot-strap
==============================================================================
--- head/contrib/bmake/boot-strap	Wed May 20 22:25:41 2020	(r361306)
+++ head/contrib/bmake/boot-strap	Wed May 20 22:25:46 2020	(r361307)
@@ -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@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: head/contrib/bmake/bsd.after-import.mk
==============================================================================
--- head/contrib/bmake/bsd.after-import.mk	Wed May 20 22:25:41 2020	(r361306)
+++ head/contrib/bmake/bsd.after-import.mk	Wed May 20 22:25:46 2020	(r361307)
@@ -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: head/contrib/bmake/compat.c
==============================================================================
--- head/contrib/bmake/compat.c	Wed May 20 22:25:41 2020	(r361306)
+++ head/contrib/bmake/compat.c	Wed May 20 22:25:46 2020	(r361307)
@@ -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: head/contrib/bmake/config.h.in
==============================================================================
--- head/contrib/bmake/config.h.in	Wed May 20 22:25:41 2020	(r361306)
+++ head/contrib/bmake/config.h.in	Wed May 20 22:25:46 2020	(r361307)
@@ -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: head/contrib/bmake/configure
==============================================================================
Binary file (source and/or target). No diff available.

Modified: head/contrib/bmake/configure.in
==============================================================================
--- head/contrib/bmake/configure.in	Wed May 20 22:25:41 2020	(r361306)
+++ head/contrib/bmake/configure.in	Wed May 20 22:25:46 2020	(r361307)
@@ -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@NetBSD.org])
+AC_INIT([bmake], [20200418], [sjg@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: head/contrib/bmake/job.c
==============================================================================
--- head/contrib/bmake/job.c	Wed May 20 22:25:41 2020	(r361306)
+++ head/contrib/bmake/job.c	Wed May 20 22:25:46 2020	(r361307)
@@ -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: head/contrib/bmake/make-bootstrap.sh.in
==============================================================================
--- head/contrib/bmake/make-bootstrap.sh.in	Wed May 20 22:25:41 2020	(r361306)
+++ head/contrib/bmake/make-bootstrap.sh.in	Wed May 20 22:25:46 2020	(r361307)
@@ -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@,@filemon_h@" in
+		dev,*/filemon.h) FDEFS="-DHAVE_FILEMON_H -I`dirname @filemon_h@`";;
+		*) FDEFS=;;
+		esac
+		do_compile filemon_@use_filemon@.o filemon/filemon_@use_filemon@.c ${FDEFS}
+		BASE_OBJECTS="filemon_@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: head/contrib/bmake/make.1
==============================================================================
--- head/contrib/bmake/make.1	Wed May 20 22:25:41 2020	(r361306)
+++ head/contrib/bmake/make.1	Wed May 20 22:25:46 2020	(r361307)
@@ -1,4 +1,4 @@
-.\"	$NetBSD: make.1,v 1.273 2018/05/27 01:14:51 christos 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 December 5, 2018
+.Dd April 27, 2020
 .Dt MAKE 1
 .Os
 .Sh NAME
@@ -272,7 +272,7 @@ that do not depend on the target whose creation caused
 .It Fl m Ar directory
 Specify a directory in which to search for sys.mk and makefiles included
 via the
-.Ao Ar file Ac Ns -style
+.Li \&< Ns Ar file Ns Li \&> Ns -style
 include statement.
 The
 .Fl m
@@ -280,7 +280,7 @@ option can be used multiple times to form a search pat
 This path will override the default system include path: /usr/share/mk.
 Furthermore the system include path will be appended to the search path used
 for
-.Qo Ar file Qc Ns -style
+.Li \*q Ns Ar file Ns Li \*q Ns -style
 include statements (see the
 .Fl I
 option).
@@ -1245,7 +1245,7 @@ Quotes every shell meta-character in the variable, and
 characters so that it can be passed
 safely through recursive invocations of
 .Nm .
-This is equivalent to: 
+This is equivalent to:
 .Sq \&:S/\e\&$/&&/g:Q .
 .It Cm \&:R
 Replaces each word in the variable with everything but its suffix.
@@ -1440,6 +1440,29 @@ is the substring of
 .Ar old_string
 to be replaced in
 .Ar new_string .
+If only
+.Ar old_string
+contains the pattern matching character
+.Ar % ,
+and 
+.Ar old_string
+matches, then the result is the
+.Ar new_string .
+If only the
+.Ar new_string
+contains the pattern matching character
+.Ar % ,
+then it is not treated specially and it is printed as a literal
+.Ar %
+on match.
+If there is more than one pattern matching character
+.Ar ( % )
+in either the
+.Ar new_string
+or
+.Ar old_string ,
+only the first instance is treated specially (as the pattern character);
+all subsequent instances are treated as regular characters
 .Pp
 Variable expansion occurs in the normal fashion inside both
 .Ar old_string
@@ -1634,9 +1657,9 @@ dot
 .Pq Ql \&.
 character.
 Files are included with either
-.Cm \&.include Aq Ar file
+.Cm \&.include \&< Ns Ar file Ns Cm \&>
 or
-.Cm \&.include Pf \*q Ar file Ns \*q .
+.Cm \&.include \&\*q Ns Ar file Ns Cm \&\*q .
 Variables between the angle brackets or double quotes are expanded
 to form the file name.
 If angle brackets are used, the included makefile is expected to be in
@@ -2416,9 +2439,9 @@ file).
 .Sh BUGS
 The
 .Nm
-syntax is difficult to parse without actually acting of the data.
-For instance finding the end of a variable use should involve scanning each
-the modifiers using the correct terminator for each field.
+syntax is difficult to parse without actually acting on the data.
+For instance, finding the end of a variable's use should involve scanning
+each of the modifiers, using the correct terminator for each field.
 In many places
 .Nm
 just counts {} and () in order to find the end of a variable expansion.

Modified: head/contrib/bmake/make.h
==============================================================================
--- head/contrib/bmake/make.h	Wed May 20 22:25:41 2020	(r361306)
+++ head/contrib/bmake/make.h	Wed May 20 22:25:46 2020	(r361307)
@@ -1,4 +1,4 @@
-/*	$NetBSD: make.h,v 1.105 2020/03/30 02:41:06 sjg Exp $	*/
+/*	$NetBSD: make.h,v 1.107 2020/04/03 03:35:16 sjg Exp $	*/
 
 /*
  * Copyright (c) 1988, 1989, 1990, 1993

Modified: head/contrib/bmake/meta.c
==============================================================================
--- head/contrib/bmake/meta.c	Wed May 20 22:25:41 2020	(r361306)
+++ head/contrib/bmake/meta.c	Wed May 20 22:25:46 2020	(r361307)
@@ -1,4 +1,4 @@
-/*      $NetBSD: meta.c,v 1.70 2018/02/13 19:37:30 sjg Exp $ */
+/*      $NetBSD: meta.c,v 1.81 2020/04/03 03:32:28 sjg Exp $ */
 
 /*
  * Implement 'meta' mode.
@@ -36,7 +36,6 @@
 # include "config.h"
 #endif
 #include <sys/stat.h>
-#include <sys/ioctl.h>
 #ifdef HAVE_LIBGEN_H
 #include <libgen.h>
 #elif !defined(HAVE_DIRNAME)
@@ -50,12 +49,9 @@ char * dirname(char *);
 #include "make.h"
 #include "job.h"
 
-#ifdef HAVE_FILEMON_H
-# include <filemon.h>
+#ifdef USE_FILEMON
+#include "filemon/filemon.h"
 #endif
-#if !defined(USE_FILEMON) && defined(FILEMON_SET_FD)
-# define USE_FILEMON
-#endif
 
 static BuildMon Mybm;			/* for compat */
 static Lst metaBailiwick;		/* our scope of control */
@@ -121,30 +117,24 @@ extern char    **environ;
  * the benefits are more limited.
  */
 #ifdef USE_FILEMON
-# ifndef _PATH_FILEMON
-#   define _PATH_FILEMON "/dev/filemon"
-# endif
 
 /*
  * Open the filemon device.
  */
 static void
-filemon_open(BuildMon *pbm)
+meta_open_filemon(BuildMon *pbm)
 {
-    int retry;
-    
-    pbm->mon_fd = pbm->filemon_fd = -1;
-    if (!useFilemon)
+    int dupfd;
+
+    pbm->mon_fd = -1;
+    pbm->filemon = NULL;
+    if (!useFilemon || !pbm->mfp)
 	return;
 
-    for (retry = 5; retry >= 0; retry--) {
-	if ((pbm->filemon_fd = open(_PATH_FILEMON, O_RDWR)) >= 0)
-	    break;
-    }
-
-    if (pbm->filemon_fd < 0) {
+    pbm->filemon = filemon_open();
+    if (pbm->filemon == NULL) {
 	useFilemon = FALSE;
-	warn("Could not open %s", _PATH_FILEMON);
+	warn("Could not open filemon %s", filemon_path());
 	return;
     }
 
@@ -155,12 +145,15 @@ filemon_open(BuildMon *pbm)
      * We only care about the descriptor.
      */
     pbm->mon_fd = mkTempFile("filemon.XXXXXX", NULL);
-    if (ioctl(pbm->filemon_fd, FILEMON_SET_FD, &pbm->mon_fd) < 0) {
+    if ((dupfd = dup(pbm->mon_fd)) == -1) {
+	err(1, "Could not dup filemon output!");
+    }
+    (void)fcntl(dupfd, F_SETFD, FD_CLOEXEC);
+    if (filemon_setfd(pbm->filemon, dupfd) == -1) {
 	err(1, "Could not set filemon file descriptor!");
     }
     /* we don't need these once we exec */
     (void)fcntl(pbm->mon_fd, F_SETFD, FD_CLOEXEC);
-    (void)fcntl(pbm->filemon_fd, F_SETFD, FD_CLOEXEC);
 }
 
 /*
@@ -473,7 +466,7 @@ meta_create(BuildMon *pbm, GNode *gn)
     const char *tname;
     char *fname;
     const char *cp;
-    char *p[4];				/* >= possible uses */
+    char *p[5];				/* >= possible uses */
     int i;
 
     mf.fp = NULL;
@@ -528,7 +521,10 @@ meta_create(BuildMon *pbm, GNode *gn)
 
     fprintf(mf.fp, "CWD %s\n", getcwd(buf, sizeof(buf)));
     fprintf(mf.fp, "TARGET %s\n", tname);
-
+    cp = Var_Value(".OODATE", gn, &p[i++]);
+    if (cp && *cp) {
+	    fprintf(mf.fp, "OODATE %s\n", cp);
+    }
     if (metaEnv) {
 	for (ptr = environ; *ptr != NULL; ptr++)
 	    fprintf(mf.fp, "ENV %s\n", *ptr);
@@ -574,7 +570,7 @@ meta_init(void)
 {
 #ifdef USE_FILEMON
 	/* this allows makefiles to test if we have filemon support */
-	Var_Set(".MAKE.PATH_FILEMON", _PATH_FILEMON, VAR_GLOBAL, 0);
+	Var_Set(".MAKE.PATH_FILEMON", filemon_path(), VAR_GLOBAL, 0);
 #endif
 }
 
@@ -684,9 +680,10 @@ meta_job_start(Job *job, GNode *gn)
 #endif
 #ifdef USE_FILEMON
     if (pbm->mfp != NULL && useFilemon) {
-	filemon_open(pbm);
+	meta_open_filemon(pbm);
     } else {
-	pbm->mon_fd = pbm->filemon_fd = -1;
+	pbm->mon_fd = -1;
+	pbm->filemon = NULL;
     }
 #endif
 }
@@ -708,11 +705,11 @@ meta_job_child(Job *job)
     }
     if (pbm->mfp != NULL) {
 	close(fileno(pbm->mfp));
-	if (useFilemon) {
+	if (useFilemon && pbm->filemon) {
 	    pid_t pid;
 
 	    pid = getpid();
-	    if (ioctl(pbm->filemon_fd, FILEMON_SET_PID, &pid) < 0) {
+	    if (filemon_setpid_child(pbm->filemon, pid) == -1) {
 		err(1, "Could not set filemon pid!");
 	    }
 	}
@@ -721,6 +718,59 @@ meta_job_child(Job *job)
 }
 
 void
+meta_job_parent(Job *job, pid_t pid)
+{
+#if defined(USE_FILEMON) && !defined(USE_FILEMON_DEV)
+    BuildMon *pbm;
+
+    if (job != NULL) {
+	pbm = &job->bm;
+    } else {
+	pbm = &Mybm;
+    }
+    if (useFilemon && pbm->filemon) {
+	filemon_setpid_parent(pbm->filemon, pid);
+    }

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



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?202005202225.04KMPkUp033338>