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
This commit is contained in:
Simon J. Gerraty
2025-02-10 14:20:06 -08:00
parent bc7ee0b52a
commit c8245ceb47
7 changed files with 48 additions and 21 deletions
+8 -6
View File
@@ -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:
# sjg@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}
+4 -1
View File
@@ -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
+7 -6
View File
@@ -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
+2 -2
View File
@@ -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
+12 -1
View File
@@ -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
+12 -4
View File
@@ -39,7 +39,7 @@
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 @@ def __init__(self, name, conf={}):
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 @@ def parse(self, name=None, file=None):
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 @@ def parse(self, name=None, file=None):
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 @@ def parse(self, name=None, file=None):
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:
+3 -1
View File
@@ -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
#