The branch main has been updated by sjg:

URL: 
https://cgit.FreeBSD.org/src/commit/?id=c8245ceb47565e864a350e6aa33ba9a6461ebe02

commit c8245ceb47565e864a350e6aa33ba9a6461ebe02
Author:     Simon J. Gerraty <s...@freebsd.org>
AuthorDate: 2025-02-10 22:20:06 +0000
Commit:     Simon J. Gerraty <s...@freebsd.org>
CommitDate: 2025-02-10 22:20:06 +0000

    Update dirdeps.mk et al
    
    Update dirdeps.mk and friends to match latest contrib/bmake/mk
    
    Reviewed by:    stevek
    Differential Revision:  https://reviews.freebsd.org/D48855
---
 share/mk/auto.obj.mk        | 14 ++++++++------
 share/mk/dirdeps-targets.mk |  5 ++++-
 share/mk/dirdeps.mk         | 13 +++++++------
 share/mk/gendirdeps.mk      |  4 ++--
 share/mk/meta.sys.mk        | 13 ++++++++++++-
 share/mk/meta2deps.py       | 16 ++++++++++++----
 share/mk/sys.dependfile.mk  |  4 +++-
 7 files changed, 48 insertions(+), 21 deletions(-)

diff --git a/share/mk/auto.obj.mk b/share/mk/auto.obj.mk
index 21aa8e4a40d0..cfe60ef9c4d6 100644
--- a/share/mk/auto.obj.mk
+++ b/share/mk/auto.obj.mk
@@ -1,14 +1,16 @@
-# $Id: auto.obj.mk,v 1.12 2015/12/16 01:57:06 sjg Exp $
+# SPDX-License-Identifier: BSD-2-Clause
+#
+# $Id: auto.obj.mk,v 1.17 2024/02/17 17:26:57 sjg Exp $
 #
 #      @(#) Copyright (c) 2004, Simon J. Gerraty
 #
 #      This file is provided in the hope that it will
 #      be of use.  There is absolutely NO WARRANTY.
 #      Permission to copy, redistribute or otherwise
-#      use this file is hereby granted provided that 
+#      use this file is hereby granted provided that
 #      the above copyright notice and this notice are
-#      left intact. 
-#      
+#      left intact.
+#
 #      Please send copies of changes and bug-fixes to:
 #      s...@crufty.net
 #
@@ -16,7 +18,7 @@
 ECHO_TRACE ?= echo
 
 .ifndef Mkdirs
-# A race condition in some versions of mkdir, means that it can bail 
+# A race condition in some versions of mkdir, means that it can bail
 # if another process made a dir that mkdir expected to.
 # We repeat the mkdir -p a number of times to try and work around this.
 # We stop looping as soon as the dir exists.
@@ -53,7 +55,7 @@ __objdir:= ${__objdir}
 # We need to chdir, make the directory if needed
 .if !exists(${__objdir}/) && \
        (${.TARGETS} == "" || ${.TARGETS:Nclean*:N*clean:Ndestroy*} != "")
-# This will actually make it... 
+# This will actually make it...
 __objdir_made != echo ${__objdir}/; umask ${OBJDIR_UMASK:U002}; \
         ${ECHO_TRACE} "[Creating objdir ${__objdir}...]" >&2; \
         ${Mkdirs}; Mkdirs ${__objdir}
diff --git a/share/mk/dirdeps-targets.mk b/share/mk/dirdeps-targets.mk
index 9e3fb814fada..a8a547c0ce9b 100644
--- a/share/mk/dirdeps-targets.mk
+++ b/share/mk/dirdeps-targets.mk
@@ -1,7 +1,7 @@
 # SPDX-License-Identifier: BSD-2-Clause
 #
 # RCSid:
-#       $Id: dirdeps-targets.mk,v 1.27 2024/02/25 19:12:13 sjg Exp $
+#       $Id: dirdeps-targets.mk,v 1.28 2024/10/19 00:47:38 sjg Exp $
 #
 #       @(#) Copyright (c) 2019-2020 Simon J. Gerraty
 #
@@ -160,6 +160,9 @@ MK_DIRDEPS_CACHE = yes
 .endfor
 .if defined(STATIC_DIRDEPS_CACHE)
 .export STATIC_DIRDEPS_CACHE
+.if !empty(DEBUG_DIRDEPS_TARGETS)
+.info STATIC_DIRDEPS_CACHE=${STATIC_DIRDEPS_CACHE:S,${SRCTOP}/,,}
+.endif
 .endif
 .endif
 
diff --git a/share/mk/dirdeps.mk b/share/mk/dirdeps.mk
index 80720a7ca225..b281d15ec346 100644
--- a/share/mk/dirdeps.mk
+++ b/share/mk/dirdeps.mk
@@ -1,4 +1,4 @@
-# $Id: dirdeps.mk,v 1.171 2024/09/30 21:21:25 sjg Exp $
+# $Id: dirdeps.mk,v 1.175 2025/01/05 01:16:19 sjg Exp $
 
 # SPDX-License-Identifier: BSD-2-Clause
 #
@@ -152,7 +152,7 @@
 #      any other DIRDEP.
 #
 #      This allows for adding TESTS to the build, such that the build
-#      if any test fails, but without the risk of introducing
+#      will fail if any test fails, but without the risk of introducing
 #      circular dependencies.
 
 now_utc ?= ${%s:L:localtime}
@@ -445,6 +445,7 @@ _DIRDEP_USE:        .USE .MAKE
                TARGET_SPEC=${.TARGET:E} \
                MACHINE=${.TARGET:E} \
                ${DIRDEP_MAKE} -C ${DIRDEP_DIR} ${DIRDEP_TARGETS} || exit 1; \
+               ${DIRDEP_USE_EPILOGUE} \
                break; \
        done
 
@@ -568,7 +569,7 @@ BUILD_DIRDEPS = no
 dirdeps: dirdeps-cached
 dirdeps-cached:        ${DIRDEPS_CACHE} .MAKE
        @echo "${TRACER}Using ${DIRDEPS_CACHE}"
-       @MAKELEVEL=${.MAKE.LEVEL} \
+       @${DIRDEPS_CACHED_ENV} MAKELEVEL=${.MAKE.LEVEL} \
        TARGET_SPEC=${TARGET_SPEC} \
        ${TARGET_SPEC_VARS:@v@$v=${$v}@} \
        ${.MAKE} -C ${_CURDIR} -f ${DIRDEPS_CACHE} \
@@ -606,10 +607,10 @@ ${DIRDEPS_CACHE}: .META .NOMETA_CMP
        BUILD_DIRDEPS_CACHE=yes \
        .MAKE.DEPENDFILE=.none \
        ${"${DEBUG_DIRDEPS:Nno}":?DEBUG_DIRDEPS='${DEBUG_DIRDEPS}':} \
-       ${.MAKEFLAGS:tW:S,-D ,-D,g:tw:M*WITH*} \
-       ${.MAKEFLAGS:tW:S,-d ,-d,g:tw:M-d*} \
+       ${.MAKEFLAGS:S,-D ,-D,gW:M*WITH*} \
+       ${.MAKEFLAGS:S,-d ,-d,gW:M-d*} \
        3>&1 1>&2 | sed 
's,${SRCTOP},_{SRCTOP},g;s,_{SRCTOP}/_{SRCTOP},_{SRCTOP},g;s,_{,$${,g' >> 
${.TARGET}.new && \
-       mv ${.TARGET}.new ${.TARGET}
+       { ${BUILD_DIRDEPS_EPILOGUE} mv ${.TARGET}.new ${.TARGET}; }
 
 .endif
 .endif
diff --git a/share/mk/gendirdeps.mk b/share/mk/gendirdeps.mk
index 5d54aa232152..53e736da3391 100644
--- a/share/mk/gendirdeps.mk
+++ b/share/mk/gendirdeps.mk
@@ -1,4 +1,4 @@
-# $Id: gendirdeps.mk,v 1.50 2023/11/04 16:47:34 sjg Exp $
+# $Id: gendirdeps.mk,v 1.51 2025/01/05 01:16:19 sjg Exp $
 
 # SPDX-License-Identifier: BSD-2-Clause
 #
@@ -237,7 +237,7 @@ dir_list != cd ${_OBJDIR} && \
        sed ${GENDIRDEPS_SEDCMDS}
 
 .if ${dir_list:M*ERROR\:*} != ""
-.warning ${dir_list:tW:C,.*(ERROR),\1,}
+.warning ${dir_list:C,.*(ERROR),\1,W}
 .warning Skipping ${_DEPENDFILE:S,${SRCTOP}/,,}
 # we are not going to update anything
 .else
diff --git a/share/mk/meta.sys.mk b/share/mk/meta.sys.mk
index 6e4216ab5383..1104204dc8c9 100644
--- a/share/mk/meta.sys.mk
+++ b/share/mk/meta.sys.mk
@@ -1,6 +1,6 @@
 # SPDX-License-Identifier: BSD-2-Clause
 #
-# $Id: meta.sys.mk,v 1.54 2024/03/10 15:53:51 sjg Exp $
+# $Id: meta.sys.mk,v 1.56 2024/11/22 23:51:48 sjg Exp $
 
 #
 #      @(#) Copyright (c) 2010-2023, Simon J. Gerraty
@@ -40,6 +40,11 @@ META_MODE += nofilemon
 MKDEP_MK ?= auto.dep.mk
 .endif
 
+# META_MODE_XTRAS makes it easier to add things like 'env'
+# from the command line when debugging
+# :U avoids problems from := below
+META_MODE += ${META_MODE_XTRAS:U}
+
 .MAKE.MODE ?= ${META_MODE}
 
 _filemon := ${.MAKE.PATH_FILEMON:U/dev/filemon}
@@ -101,6 +106,12 @@ SB = ${SRCTOP:H}
 ERROR_LOGDIR ?= ${SB}/error
 meta_error_log = ${ERROR_LOGDIR}/meta-${.MAKE.PID}.log
 
+.if ${.MAKE.LEVEL} == 0 && !empty(NEWLOG_SH) && exists(${ERROR_LOGDIR})
+.BEGIN:        _rotateErrorLog
+_rotateErrorLog: .NOMETA .NOTMAIN
+       @${NEWLOG_SH} -d -S -n ${ERROR_LOG_GENS:U4} ${ERROR_LOGDIR}
+.endif
+
 .ERROR: _metaError
 # We are interested here in the target(s) that caused the build to fail.
 # We want to ignore targets that were "aborted" due to failure
diff --git a/share/mk/meta2deps.py b/share/mk/meta2deps.py
index f188d0f01de8..44c752d0e7eb 100755
--- a/share/mk/meta2deps.py
+++ b/share/mk/meta2deps.py
@@ -39,7 +39,7 @@ We only pay attention to a subset of the information in the
 SPDX-License-Identifier: BSD-2-Clause
 
 RCSid:
-       $Id: meta2deps.py,v 1.47 2024/02/17 17:26:57 sjg Exp $
+       $Id: meta2deps.py,v 1.50 2024/09/27 00:08:36 sjg Exp $
 
        Copyright (c) 2011-2020, Simon J. Gerraty
        Copyright (c) 2011-2017, Juniper Networks, Inc.
@@ -294,6 +294,7 @@ class MetaFile:
                     if not _objroot in self.objroots:
                         self.objroots.append(_objroot)
 
+            self.sb = conf.get('SB', '')
             # we want the longest match
             self.srctops.sort(reverse=True)
             self.objroots.sort(reverse=True)
@@ -461,6 +462,10 @@ class MetaFile:
         if self.curdir:
             self.seenit(self.curdir)    # we ignore this
 
+        if self.sb and self.name.startswith(self.sb):
+            error_name = self.name.replace(self.sb+'/','')
+        else:
+            error_name = self.name 
         interesting = '#CEFLRVX'
         for line in f:
             self.line += 1
@@ -550,9 +555,9 @@ class MetaFile:
                 self.parse_path(path, cwd, w[0], w)
 
         if version == 0:
-            raise AssertionError('missing filemon data')
+            raise AssertionError('missing filemon data: {}'.format(error_name))
         if not eof_token:
-            raise AssertionError('truncated filemon data')
+            raise AssertionError('truncated filemon data: 
{}'.format(error_name))
 
         setid_pids = []
         # self.pids should be empty!
@@ -570,7 +575,8 @@ class MetaFile:
             print("ERROR: missing eXit for {} pid {}".format(path, pid))
         for pid in setid_pids:
             del self.pids[pid]
-        assert(len(self.pids) == 0)
+        if len(self.pids) > 0:
+            raise AssertionError('bad filemon data - missing eXits: 
{}'.format(error_name))
         if not file:
             f.close()
 
@@ -714,6 +720,8 @@ def main(argv, klass=MetaFile, xopts='', xoptf=None):
         'EXCLUDES': [],
         }
 
+    conf['SB'] = os.getenv('SB', '')
+
     try:
         machine = os.environ['MACHINE']
         if machine:
diff --git a/share/mk/sys.dependfile.mk b/share/mk/sys.dependfile.mk
index 49232646d569..3c13b1c92bff 100644
--- a/share/mk/sys.dependfile.mk
+++ b/share/mk/sys.dependfile.mk
@@ -1,4 +1,6 @@
-# $Id: sys.dependfile.mk,v 1.10 2023/05/10 19:23:26 sjg Exp $
+# SPDX-License-Identifier: BSD-2-Clause
+#
+# $Id: sys.dependfile.mk,v 1.11 2024/02/17 17:26:57 sjg Exp $
 #
 #      @(#) Copyright (c) 2012-2023, Simon J. Gerraty
 #

Reply via email to