Page Menu
Home
FreeBSD
Search
Configure Global Search
Log In
Files
F139395728
D54150.diff
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Flag For Later
Award Token
Size
28 KB
Referenced Files
None
Subscribers
None
D54150.diff
View Options
diff --git a/share/mk/auto.obj.mk b/share/mk/auto.obj.mk
--- a/share/mk/auto.obj.mk
+++ b/share/mk/auto.obj.mk
@@ -1,15 +1,8 @@
-# SPDX-License-Identifier: BSD-2-Clause
-#
-# $Id: auto.obj.mk,v 1.20 2025/05/17 15:29:55 sjg Exp $
+# $Id: auto.obj.mk,v 1.21 2025/08/09 22:42:24 sjg Exp $
#
# @(#) Copyright (c) 2004-2025, 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
-# the above copyright notice and this notice are
-# left intact.
+# SPDX-License-Identifier: BSD-2-Clause
#
# Please send copies of changes and bug-fixes to:
# sjg@crufty.net
diff --git a/share/mk/bsd.progs.mk b/share/mk/bsd.progs.mk
--- a/share/mk/bsd.progs.mk
+++ b/share/mk/bsd.progs.mk
@@ -2,12 +2,7 @@
#
# @(#) Copyright (c) 2006, 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
-# the above copyright notice and this notice are
-# left intact.
+# SPDX-License-Identifier: BSD-2-Clause
#
# Please send copies of changes and bug-fixes to:
# sjg@crufty.net
diff --git a/share/mk/dirdeps-options.mk b/share/mk/dirdeps-options.mk
--- a/share/mk/dirdeps-options.mk
+++ b/share/mk/dirdeps-options.mk
@@ -1,15 +1,8 @@
-# SPDX-License-Identifier: BSD-2-Clause
-#
-# $Id: dirdeps-options.mk,v 1.22 2024/02/17 17:26:57 sjg Exp $
+# $Id: dirdeps-options.mk,v 1.23 2025/08/09 22:42:24 sjg Exp $
#
# @(#) Copyright (c) 2018-2022, 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
-# the above copyright notice and this notice are
-# left intact.
+# SPDX-License-Identifier: BSD-2-Clause
#
# Please send copies of changes and bug-fixes to:
# sjg@crufty.net
diff --git a/share/mk/dirdeps-targets.mk b/share/mk/dirdeps-targets.mk
--- a/share/mk/dirdeps-targets.mk
+++ b/share/mk/dirdeps-targets.mk
@@ -1,19 +1,11 @@
-# SPDX-License-Identifier: BSD-2-Clause
+# $Id: dirdeps-targets.mk,v 1.29 2025/08/09 22:42:24 sjg Exp $
#
-# RCSid:
-# $Id: dirdeps-targets.mk,v 1.28 2024/10/19 00:47:38 sjg Exp $
+# @(#) Copyright (c) 2019-2020 Simon J. Gerraty
#
-# @(#) Copyright (c) 2019-2020 Simon J. Gerraty
+# SPDX-License-Identifier: BSD-2-Clause
#
-# 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
-# the above copyright notice and this notice are
-# left intact.
-#
-# Please send copies of changes and bug-fixes to:
-# sjg@crufty.net
+# Please send copies of changes and bug-fixes to:
+# sjg@crufty.net
#
##
diff --git a/share/mk/gendirdeps.mk b/share/mk/gendirdeps.mk
--- a/share/mk/gendirdeps.mk
+++ b/share/mk/gendirdeps.mk
@@ -1,8 +1,8 @@
-# $Id: gendirdeps.mk,v 1.51 2025/01/05 01:16:19 sjg Exp $
+# $Id: gendirdeps.mk,v 1.54 2025/08/12 21:36:43 sjg Exp $
# SPDX-License-Identifier: BSD-2-Clause
#
-# Copyright (c) 2011-2020, Simon J. Gerraty
+# Copyright (c) 2011-2025, Simon J. Gerraty
# Copyright (c) 2010-2018, Juniper Networks, Inc.
# All rights reserved.
#
@@ -76,6 +76,12 @@
#
.MAIN: all
+.if ${DEBUG_GENDIRDEPS:Uno:@m@${RELDIR:M$m}@} != ""
+_debug.gendirdeps = 1
+.else
+_debug.gendirdeps = 0
+.endif
+
# keep this simple
.MAKE.MODE = compat
@@ -108,6 +114,9 @@
.endif
.if !empty(META_FILES)
+.if ${_debug.gendirdeps} && ${DEBUG_GENDIRDEPS:Mmeta*} != ""
+.info ${RELDIR}: META_FILES=${META_FILES}
+.endif
.if ${.MAKE.LEVEL} > 0 && !empty(GENDIRDEPS_FILTER)
# so we can compare below
@@ -146,7 +155,7 @@
META2DEPS ?= ${.PARSEDIR}/meta2deps.sh
META2DEPS := ${META2DEPS}
-.if ${DEBUG_GENDIRDEPS:Uno:@x@${RELDIR:M$x}@} != "" && ${DEBUG_GENDIRDEPS:Uno:Mmeta2d*} != ""
+.if ${_debug.gendirdeps} && ${DEBUG_GENDIRDEPS:Mmeta2d*} != ""
_time = time
_sh_x = sh -x
_py_d = -ddd
@@ -260,7 +269,7 @@
ddeps != cat ${ddep_list:O:u} | ${META2DEPS_FILTER} ${_skip_gendirdeps} \
sed ${GENDIRDEPS_SEDCMDS}
-.if ${DEBUG_GENDIRDEPS:Uno:@x@${RELDIR:M$x}@} != ""
+.if ${_debug.gendirdeps}
.info ${RELDIR}: raw_dir_list='${dir_list}'
.info ${RELDIR}: ddeps='${ddeps}'
.endif
@@ -289,12 +298,13 @@
# anything we use from an object dir other than ours
# needs to be qualified with its .<machine> suffix
# (we used the pseudo machine "host" for the HOST_TARGET).
-skip_ql= ${SRCTOP}* ${_objtops:@o@$o*@}
+skip_ql = ${SRCTOP}* ${_objtops:@o@$o*@}
+M_ListToSkip ?= O:u:S,^,N,:ts:
.for o in ${M2D_OBJROOTS:${skip_ql:${M_ListToSkip}}}
# we need := so only skip_ql to this point applies
ql.$o := ${dir_list:${skip_ql:${M_ListToSkip}}:M$o*/*/*:C,$o([^/]+)/(.*),\2.\1,:S,.${HOST_TARGET},.host,}
qualdir_list += ${ql.$o}
-.if ${DEBUG_GENDIRDEPS:Uno:@x@${RELDIR:M$x}@} != ""
+.if ${_debug.gendirdeps}
.info ${RELDIR}: o=$o ${ql.$o qualdir_list:L:@v@$v=${$v}@}
.endif
skip_ql+= $o*
@@ -323,7 +333,7 @@
GENDIRDEPS_FILTER_MASK += @CMNS
DIRDEPS := ${DIRDEPS:${GENDIRDEPS_FILTER:UNno:M[${GENDIRDEPS_FILTER_MASK:O:u:ts}]*:ts:}:C,//+,/,g:O:u}
-.if ${DEBUG_GENDIRDEPS:Uno:@x@${RELDIR:M$x}@} != ""
+.if ${_debug.gendirdeps}
.info ${RELDIR}: M2D_OBJROOTS=${M2D_OBJROOTS}
.info ${RELDIR}: M2D_EXCLUDES=${M2D_EXCLUDES}
.info ${RELDIR}: dir_list='${dir_list}'
diff --git a/share/mk/install-new.mk b/share/mk/install-new.mk
--- a/share/mk/install-new.mk
+++ b/share/mk/install-new.mk
@@ -1,53 +1,41 @@
-# $Id: install-new.mk,v 1.3 2012/03/24 18:25:49 sjg Exp $
+# $Id: install-new.mk,v 1.9 2025/11/19 17:44:15 sjg Exp $
#
# @(#) Copyright (c) 2009, 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
-# the above copyright notice and this notice are
-# left intact.
-#
+# SPDX-License-Identifier: BSD-2-Clause
+#
# Please send copies of changes and bug-fixes to:
# sjg@crufty.net
#
.if !defined(InstallNew)
-# copy if src and target are different making a backup if desired
-CmpCp= CmpCp() { \
+# How do we want CmpCpMv to do the final operation?
+# the backup (if any) will use the opposite.
+CPMV_OP ?= mv
+# clear this if not supported
+CPMV_f ?= -f
+
+# copy/move if src and target are different making a backup if desired
+CmpCpMv= CmpCpMv() { \
src=$$1 target=$$2 _bak=$$3; \
if ! test -s $$target || ! cmp -s $$target $$src; then \
trap "" 1 2 3 15; \
+ case "/${CPMV_OP}" in */cp) bop=mv;; */mv) bop=cp;; esac; \
if test -s $$target; then \
if test "x$$_bak" != x; then \
rm -f $$target$$_bak; \
- mv $$target $$target$$_bak; \
+ $$bop ${CPMV_f} $$target $$target$$_bak; \
else \
rm -f $$target; \
fi; \
fi; \
- cp $$src $$target; \
- fi; }
-
-# Replace the file if they are different and make a backup if desired
-CmpReplace= CmpReplace() { \
- src=$$1 target=$$2 _bak=$$3; \
- if ! test -s $$target || ! cmp -s $$target $$src; then \
- trap "" 1 2 3 15; \
- if test -s $$target; then \
- if test "x$$_bak" != x; then \
- rm -f $$target$$_bak; \
- cp -f $$target $$target$$_bak; \
- fi; \
- fi; \
- mv -f $$src $$target; \
+ ${CPMV_OP} ${CPMV_f} $$src $$target; \
fi; }
# If the .new file is different, we want it.
# Note: this function will work as is for *.new$RANDOM"
-InstallNew= ${CmpReplace}; InstallNew() { \
+InstallNew= ${CmpCpMv}; InstallNew() { \
_t=-e; _bak=; \
while :; do \
case "$$1" in \
@@ -58,8 +46,12 @@
done; \
for new in "$$@"; do \
if test $$_t $$new; then \
- target=`expr $$new : '\(.*\).new'`; \
- CmpReplace $$new $$target $$_bak; \
+ if ${isPOSIX_SHELL:Ufalse}; then \
+ target=$${new%.new}; \
+ else \
+ target=`expr $$new : '\(.*\).new'`; \
+ fi; \
+ CmpCpMv $$new $$target $$_bak; \
fi; \
rm -f $$new; \
done; :; }
diff --git a/share/mk/jobs.mk b/share/mk/jobs.mk
--- a/share/mk/jobs.mk
+++ b/share/mk/jobs.mk
@@ -1,15 +1,8 @@
-# SPDX-License-Identifier: BSD-2-Clause
-#
-# $Id: jobs.mk,v 1.19 2025/02/03 21:18:44 sjg Exp $
+# $Id: jobs.mk,v 1.20 2025/08/09 22:42:24 sjg Exp $
#
# @(#) Copyright (c) 2012-2025, 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
-# the above copyright notice and this notice are
-# left intact.
+# SPDX-License-Identifier: BSD-2-Clause
#
# Please send copies of changes and bug-fixes to:
# sjg@crufty.net
diff --git a/share/mk/local.sys.env.mk b/share/mk/local.sys.env.mk
--- a/share/mk/local.sys.env.mk
+++ b/share/mk/local.sys.env.mk
@@ -22,9 +22,16 @@
# NskipFoo = ${Foo:${M_ListToSkip}}
M_ListToSkip= O:u:ts::S,:,:N,g:S,^,N,
+# :sh1 evaluates command only once and caches the result.
+.if ${MAKE_VERSION} < 20251111
+M_sh1 = sh
+.else
+M_sh1 = sh1
+.endif
+
# type should be a builtin in any sh since about 1980,
# AUTOCONF := ${autoconf:L:${M_whence}}
-M_type = @x@(type $$x 2> /dev/null); echo;@:sh:[0]:N* found*:[@]:C,[()],,g
+M_type = @x@(type $$x 2> /dev/null); echo;@:${M_sh1:Ush}:[0]:N* found*:[@]:C,[()],,g
M_whence = ${M_type}:M/*:[1]
# convert a path to a valid shell variable
diff --git a/share/mk/meta.autodep.mk b/share/mk/meta.autodep.mk
--- a/share/mk/meta.autodep.mk
+++ b/share/mk/meta.autodep.mk
@@ -1,16 +1,8 @@
-# SPDX-License-Identifier: BSD-2-Clause
+# $Id: meta.autodep.mk,v 1.71 2025/08/09 22:42:24 sjg Exp $
#
-# $Id: meta.autodep.mk,v 1.63 2024/04/24 18:56:41 sjg Exp $
-
-#
-# @(#) Copyright (c) 2010, Simon J. Gerraty
+# @(#) Copyright (c) 2010-2025, 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
-# the above copyright notice and this notice are
-# left intact.
+# SPDX-License-Identifier: BSD-2-Clause
#
# Please send copies of changes and bug-fixes to:
# sjg@crufty.net
@@ -22,6 +14,12 @@
.-include <local.autodep.mk>
+.if ${DEBUG_AUTODEP:Uno:@m@${RELDIR:M$m}@} != ""
+_debug.autodep = 1
+.else
+_debug.autodep = 0
+.endif
+
PICO?= .pico
.if defined(SRCS)
@@ -85,9 +83,9 @@
_bootstrap_dirdeps = yes
.endif
_bootstrap_dirdeps ?= no
-UPDATE_DEPENDFILE ?= yes
+UPDATE_DEPENDFILE ?= ${MK_UPDATE_DEPENDFILE:Uyes}
-.if ${DEBUG_AUTODEP:Uno:@m@${RELDIR:M$m}@} != ""
+.if ${_debug.autodep}
.info ${_DEPENDFILE:S,${SRCTOP}/,,} update=${UPDATE_DEPENDFILE}
.endif
@@ -111,7 +109,7 @@
UPDATE_DEPENDFILE = no
.endif
-.if ${DEBUG_AUTODEP:Uno:@m@${RELDIR:M$m}@} != ""
+.if ${_debug.autodep}
.info ${_DEPENDFILE:S,${SRCTOP}/,,} update=${UPDATE_DEPENDFILE}
.endif
@@ -207,7 +205,7 @@
_depend =
.endif
-.if ${DEBUG_AUTODEP:Uno:@m@${RELDIR:M$m}@} != ""
+.if ${_debug.autodep}
.info ${_DEPENDFILE:S,${SRCTOP}/,,} _depend=${_depend}
.endif
@@ -253,19 +251,33 @@
# but we need to behave as if we did.
# Avoid adding glob patterns to .MAKE.META.CREATED though.
.MAKE.META.CREATED += ${META_XTRAS:N*\**:O:u}
-
-.if make(gendirdeps)
-META_FILES = *.meta
-.elif ${OPTIMIZE_OBJECT_META_FILES:Uno:tl} == "no"
-META_FILES = ${.MAKE.META.FILES:T:N.depend*:O:u}
+OPTIMIZE_OBJECT_META_FILES ?= no
+
+.if ${OPTIMIZE_OBJECT_META_FILES} == "yes"
+# If we have lots of .o.meta, ${PICO}.meta etc we need only look at one set.
+# If META_FILE_OBJ_FILTER is not already set, we default it to a
+# .SUFFIX which matches the first *o.meta.
+# There is no guarantee it will be just .o or .So etc,
+META_FILE_OBJ_FILTER ?= \
+ ${.SUFFIXES:M*o:@o@${"${.MAKE.META.FILES:T:M*$o.meta:[1]}":?M*$o.meta:}@:[1]}
+.endif
+
+# parent may have set META_FILE_OBJ_FILTER
+.if ${OPTIMIZE_OBJECT_META_FILES} == "yes" || !empty(META_FILE_OBJ_FILTER)
+META_FILES = \
+ ${.MAKE.META.FILES:N.depend*:N*o.meta} \
+ ${.MAKE.META.FILES:${META_FILE_OBJ_FILTER}}
.else
-# if we have 1000's of .o.meta, ${PICO}.meta etc we need only look at one set
-# it is left as an exercise for the reader to work out what this does
-META_FILES = ${.MAKE.META.FILES:T:N.depend*:N*o.meta:O:u} \
- ${.MAKE.META.FILES:T:M*.${.MAKE.META.FILES:M*o.meta:R:E:O:u:[1]}.meta:O:u}
+META_FILES = ${.MAKE.META.FILES:N.depend*}
.endif
+# ensure this is not empty (this will sort after any M and N
+# we use S,${_OBJDIR}/,, rather than :T since some makefiles have
+# objects in subdirs
+META_FILE_FILTER += S,${_OBJDIR}/,,:O:u
+# we have to defer evaluation until the target script runs
+GENDIRDEPS_ENV += META_FILES="${META_FILES:${META_FILE_FILTER:O:u:ts:}}}"
-.if ${DEBUG_AUTODEP:Uno:@m@${RELDIR:M$m}@} != ""
+.if ${_debug.autodep}
.info ${_DEPENDFILE:S,${SRCTOP}/,,}: ${_depend} ${.PARSEDIR}/gendirdeps.mk ${META2DEPS} xtras=${META_XTRAS}
.endif
@@ -276,20 +288,29 @@
.if !empty(GENDIRDEPS_FILTER)
.export GENDIRDEPS_FILTER
.endif
-# export to avoid blowing command line limit
-META_FILES := ${META_XTRAS:U:O:u} ${META_FILES:U:T:O:u:${META_FILE_FILTER:ts:}}
-.export META_FILES
.endif
+_this_dir := ${_PARSEDIR}
+.if ${MAKE_VERSION} < 20230123
# we might have .../ in MAKESYSPATH
-_makesyspath:= ${_PARSEDIR}
+_makesyspath := ${MAKESYSPATH:U${_this_dir}}
+.if ${.MAKEFLAGS:M-m} != ""
+_makesyspath := ${.MAKEFLAGS:S,-m ,-m,gW:M-m*:S,-m, ,:ts:}:${_makesyspath}
+.endif
+_makesyspath := ${_makesyspath:C,\.\.\./[^:]*,${_this_dir},}
+GENDIRDEPS_ENV += MAKESYSPATH=${_makesyspath}
+.else
+# add this if not already there
+.SYSPATH: ${_this_dir}
+GENDIRDEPS_ENV += MAKESYSPATH=${.SYSPATH:ts:}
+.endif
+
${_DEPENDFILE}: ${_depend} ${.PARSEDIR}/gendirdeps.mk ${META2DEPS} $${.MAKE.META.CREATED}
@echo Checking $@: ${.OODATE:T:[1..8]}
@(cd . && ${GENDIRDEPS_ENV} \
SKIP_GENDIRDEPS='${SKIP_GENDIRDEPS:O:u}' \
DPADD='${FORCE_DPADD:O:u}' ${_gendirdeps_mutex} \
- MAKESYSPATH=${_makesyspath} \
- ${.MAKE} -f gendirdeps.mk RELDIR=${RELDIR} _DEPENDFILE=${_DEPENDFILE})
+ ${.MAKE} -B -f gendirdeps.mk RELDIR=${RELDIR} _DEPENDFILE=${_DEPENDFILE})
@test -s $@ && touch $@; :
.endif
diff --git a/share/mk/meta.stage.mk b/share/mk/meta.stage.mk
--- a/share/mk/meta.stage.mk
+++ b/share/mk/meta.stage.mk
@@ -1,15 +1,8 @@
-# SPDX-License-Identifier: BSD-2-Clause
+# $Id: meta.stage.mk,v 1.75 2025/12/08 17:44:57 sjg Exp $
#
-# $Id: meta.stage.mk,v 1.69 2024/02/17 17:26:57 sjg Exp $
+# @(#) Copyright (c) 2011-2025, Simon J. Gerraty
#
-# @(#) Copyright (c) 2011-2017, 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
-# the above copyright notice and this notice are
-# left intact.
+# SPDX-License-Identifier: BSD-2-Clause
#
# Please send copies of changes and bug-fixes to:
# sjg@crufty.net
@@ -38,12 +31,14 @@
@echo '${_dirdep}' > $@
.endif
-.if defined(NO_POSIX_SHELL) || ${type printf:L:sh:Mbuiltin} == ""
-_stage_file_basename = `basename $$f`
-_stage_target_dirname = `dirname $$t`
-.else
+.if ${isPOSIX_SHELL:U:Nfalse}
_stage_file_basename = $${f\#\#*/}
+_stage_file_dirname = $${f%/*}
_stage_target_dirname = $${t%/*}
+.else
+_stage_file_basename = `basename $$f`
+_stage_file_dirname = `dirname $$f`
+_stage_target_dirname = `dirname $$t`
.endif
_OBJROOT ?= ${OBJROOT:U${OBJTOP:H}}
@@ -86,22 +81,37 @@
if [ -s $$t.dirdep ]; then \
cmp -s .dirdep $$t.dirdep && return; \
x=`cat $$t.dirdep`; \
- case "${RELDIR}:${_dirdep}" in $${x%.*}:$${x}*) ;; \
+ case "${RELDIR}:${_dirdep}" in \
+ $${x%.*}:$${x}*) ;; \
*) echo "${STAGE_CONFLICT}: $$t installed by $$x not ${_dirdep}" >&2; \
- ${STAGE_CONFLICT_ACTION} ;; esac; \
+ ${STAGE_CONFLICT_ACTION} ;; \
+ esac; \
fi; \
LnCp .dirdep $$t.dirdep || exit 1; }
# common logic for staging files
# this all relies on RELDIR being set to a subdir of SRCTOP
# we use ln(1) if we can, else cp(1)
+# if --subdir is given the dirname part of each file will be preserved
STAGE_FILE_SCRIPT = ${STAGE_DIRDEP_SCRIPT}; StageFiles() { \
- case "$$1" in "") return;; -m) mode=$$2; shift 2;; *) mode=;; esac; \
+ mode= subdir=; \
+ while : ; do \
+ case "$$1" in \
+ "") return;; \
+ -m) mode=$$2; shift 2;; \
+ --subdir) subdir=1; shift;; \
+ *) break;; \
+ esac; \
+ done; \
dest=$$1; shift; \
mkdir -p $$dest; \
[ -s .dirdep ] || echo '${_dirdep}' > .dirdep; \
for f in "$$@"; do \
- case "$$f" in */*) t=$$dest/${_stage_file_basename};; *) t=$$dest/$$f;; esac; \
+ case "$$subdir,$$f" in \
+ 1,*/*) t=$$dest/$$f; mkdir -p $$dest/${_stage_file_dirname};; \
+ */*) t=$$dest/${_stage_file_basename};; \
+ *) t=$$dest/$$f;; \
+ esac; \
StageDirdep $$t; \
LnCp $$f $$t || exit 1; \
[ -z "$$mode" ] || chmod $$mode $$t; \
diff --git a/share/mk/meta.subdir.mk b/share/mk/meta.subdir.mk
--- a/share/mk/meta.subdir.mk
+++ b/share/mk/meta.subdir.mk
@@ -1,16 +1,8 @@
-# SPDX-License-Identifier: BSD-2-Clause
-#
-# $Id: meta.subdir.mk,v 1.15 2024/04/19 15:10:22 sjg Exp $
-
+# $Id: meta.subdir.mk,v 1.16 2025/08/09 22:42:24 sjg Exp $
#
# @(#) Copyright (c) 2010, 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
-# the above copyright notice and this notice are
-# left intact.
+# SPDX-License-Identifier: BSD-2-Clause
#
# Please send copies of changes and bug-fixes to:
# sjg@crufty.net
diff --git a/share/mk/meta.sys.mk b/share/mk/meta.sys.mk
--- a/share/mk/meta.sys.mk
+++ b/share/mk/meta.sys.mk
@@ -1,16 +1,8 @@
-# SPDX-License-Identifier: BSD-2-Clause
-#
-# $Id: meta.sys.mk,v 1.56 2024/11/22 23:51:48 sjg Exp $
-
+# $Id: meta.sys.mk,v 1.57 2025/08/09 22:42:24 sjg Exp $
#
# @(#) Copyright (c) 2010-2023, 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
-# the above copyright notice and this notice are
-# left intact.
+# SPDX-License-Identifier: BSD-2-Clause
#
# Please send copies of changes and bug-fixes to:
# sjg@crufty.net
diff --git a/share/mk/meta2deps.py b/share/mk/meta2deps.py
--- a/share/mk/meta2deps.py
+++ b/share/mk/meta2deps.py
@@ -39,9 +39,9 @@
SPDX-License-Identifier: BSD-2-Clause
RCSid:
- $Id: meta2deps.py,v 1.50 2024/09/27 00:08:36 sjg Exp $
+ $Id: meta2deps.py,v 1.54 2025/07/24 16:05:48 sjg Exp $
- Copyright (c) 2011-2020, Simon J. Gerraty
+ Copyright (c) 2011-2025, Simon J. Gerraty
Copyright (c) 2011-2017, Juniper Networks, Inc.
All rights reserved.
@@ -441,7 +441,7 @@
# Bye bye
We go to some effort to avoid processing a dependency more than once.
- Of the above record types only C,E,F,L,R,V and W are of interest.
+ Of the above record types only C,E,F,L,M,R,V,W and X are of interest.
"""
version = 0 # unknown
@@ -465,8 +465,8 @@
if self.sb and self.name.startswith(self.sb):
error_name = self.name.replace(self.sb+'/','')
else:
- error_name = self.name
- interesting = '#CEFLRVX'
+ error_name = self.name
+ interesting = '#CEFLMRVX'
for line in f:
self.line += 1
# ignore anything we don't care about
@@ -475,6 +475,7 @@
if self.debug > 2:
print("input:", line, end=' ', file=self.debug_out)
w = line.split()
+ wlen = len(w)
if skip:
if w[0] == 'V':
@@ -498,6 +499,23 @@
if line.find('Bye') > 0:
eof_token = True
continue
+ else:
+ # before we go further check we have a sane number of args
+ # the Linux filemon module is rather unreliable.
+ if w[0] in 'LM':
+ elen = 4
+ elif w[0] == 'X':
+ # at least V4 on Linux does 3 args
+ if wlen == 3:
+ elen = 3
+ else:
+ elen = 4
+ else:
+ elen = 3
+ if self.debug > 2:
+ print('op={} elen={} wlen={} line="{}"'.format(w[0], elen, wlen, line.strip()), file=self.debug_out)
+ if wlen != elen:
+ raise AssertionError('corrupted filemon data: wrong number of words: expected {} got {} in: {}'.format(elen, wlen, line))
pid = int(w[1])
if pid != last_pid:
@@ -540,11 +558,11 @@
print("seen:", w[2], file=self.debug_out)
continue
# file operations
- if w[0] in 'ML':
+ if w[0] in 'LM':
# these are special, tread src as read and
# target as write
- self.parse_path(w[2].strip("'"), cwd, 'R', w)
self.parse_path(w[3].strip("'"), cwd, 'W', w)
+ self.parse_path(w[2].strip("'"), cwd, 'R', w)
continue
elif w[0] in 'ERWS':
path = w[2]
@@ -611,9 +629,19 @@
return
# we don't want to resolve the last component if it is
# a symlink
- path = resolve(path, cwd, self.last_dir, self.debug, self.debug_out)
- if not path:
- return
+ npath = resolve(path, cwd, self.last_dir, self.debug, self.debug_out)
+ if not npath:
+ if len(w) > 3 and w[0] in 'ML' and op == 'R' and path.startswith('../'):
+ # we already resolved the target of the M/L
+ # so it makes sense to try and resolve relative to that dir.
+ if os.path.isdir(self.last_path):
+ dir = self.last_path
+ else:
+ dir,junk = os.path.split(self.last_path)
+ npath = resolve(path, cwd, dir, self.debug, self.debug_out)
+ if not npath:
+ return
+ path = npath
dir,base = os.path.split(path)
if dir in self.seen:
if self.debug > 2:
@@ -631,6 +659,7 @@
rdir = None
# now put path back together
path = '/'.join([dir,base])
+ self.last_path = path
if self.debug > 1:
print("raw=%s rdir=%s dir=%s path=%s" % (w[2], rdir, dir, path), file=self.debug_out)
if op in 'RWS':
diff --git a/share/mk/meta2deps.sh b/share/mk/meta2deps.sh
--- a/share/mk/meta2deps.sh
+++ b/share/mk/meta2deps.sh
@@ -49,8 +49,10 @@
# The output, is a set of absolute paths with "SB" like:
#.nf
#
+# $SB/obj-i386/bsd/gnu/lib/csu
+# $SB/obj-i386/bsd/gnu/lib/libgcc
# $SB/obj-i386/bsd/include
-# $SB/obj-i386/bsd/lib/csu/i386
+# $SB/obj-i386/bsd/lib/csu/i386-elf
# $SB/obj-i386/bsd/lib/libc
# $SB/src/bsd/include
# $SB/src/bsd/sys/i386/include
@@ -75,10 +77,11 @@
# RCSid:
-# $Id: meta2deps.sh,v 1.21 2024/02/17 17:26:57 sjg Exp $
+# $Id: meta2deps.sh,v 1.26 2025/12/08 17:34:02 sjg Exp $
# SPDX-License-Identifier: BSD-2-Clause
#
+# Copyright (c) 2011-2025, Simon J. Gerraty
# Copyright (c) 2010-2013, Juniper Networks, Inc.
# All rights reserved.
#
@@ -103,6 +106,10 @@
# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+case ",$DEBUG_SH," in
+*,meta2deps*) set -x;;
+esac
+
meta2src() {
cat /dev/null "$@" |
sed -n '/^R .*\.[chyl]$/s,^..[0-9]* ,,p' |
@@ -248,13 +255,31 @@
;;
*) cat /dev/null "$@";;
esac 2> /dev/null |
- sed -e 's,^CWD,C C,;/^[#CREFLMVX] /!d' -e "s,',,g" |
+ sed -e 's,^CWD,C C,;/^[#CREFLMVWX] /!d' -e "s,',,g" |
$_excludes | ( version=no epids= xpids= eof_token=no
- while read op pid path junk
+ while read op pid path path2
do
- : op=$op pid=$pid path=$path
+ : op=$op pid=$pid path=$path path2=$path2
+ # first a sanity check - filemon on Linux is not very reliable
+ # path2 should only be non-empty for op L or M
+ # and it should not contain spaces.
+ # It will also be non-empty for # Meta line
+ # which tells us which meta_file we are processing
+ case "$op,$path2" in
+ \#*,*.meta) # new file, reset some vars
+ version=no epids= xpids= eof_token=no lpid=
+ meta_file=`set -- $path2; echo $2`
+ continue
+ ;;
+ \#*) ;; # ok
+ [LM],) error "missing path2 in: '$op $pid $path'";;
+ [LMX],*" "*) error "wrong number of words in: '$op $pid $path $path2'";;
+ *,|[LMX],*) ;; # ok
+ *) error "wrong number of words in: '$op $pid $path $path2'";;
+ esac
# we track cwd and ldir (of interest) per pid
# CWD is bmake's cwd
+ : lpid=$lpid,pid=$pid
case "$lpid,$pid" in
,C) CWD=$path cwd=$path ldir=$path
if [ -z "$SB" ]; then
@@ -263,13 +288,13 @@
SRCTOP=${SRCTOP:-$SB/src}
case "$verion" in
no) ;; # ignore
- 0) error "no filemon data";;
+ 0) error "no filemon data: $meta_file";;
*) ;;
esac
version=0
case "$eof_token" in
no) ;; # ignore
- 0) error "truncated filemon data";;
+ 0) error "truncated filemon data: $meta_file";;
esac
eof_token=0
continue
@@ -319,9 +344,14 @@
$src_re|$obj_re) ;;
/*/stage/*) ;;
/*) continue;;
- *) for path in $ldir/$path $cwd/$path
+ *)
+ rlist="$ldir/$path $cwd/$path"
+ case "$op,$path" in
+ [ML],../*) rlist="$rlist $path2/$path `dirname $path2`/$path";;
+ esac
+ for path in $rlist
do
- test -e $path && break
+ test -e $path && break
done
dir=${path%/*}
;;
@@ -406,18 +436,18 @@
done > $tf.dirdep
: version=$version
case "$version" in
- 0) error "no filemon data";;
+ 0) error "no filemon data: $meta_file";;
esac
: eof_token=$eof_token
case "$eof_token" in
- 0) error "truncated filemon data";;
+ 0) error "truncated filemon data: $meta_file";;
esac
for p in $epids
do
: p=$p
case " $xpids " in
*" $p "*) ;;
- *) error "missing eXit for pid $p";;
+ *) error "missing eXit for pid $p: $meta_file";;
esac
done ) || exit 1
_nl=echo
diff --git a/share/mk/stage-install.sh b/share/mk/stage-install.sh
--- a/share/mk/stage-install.sh
+++ b/share/mk/stage-install.sh
@@ -37,18 +37,13 @@
#
# RCSid:
-# $Id: stage-install.sh,v 1.11 2024/02/17 17:26:57 sjg Exp $
+# $Id: stage-install.sh,v 1.12 2025/08/09 22:42:24 sjg Exp $
#
# SPDX-License-Identifier: BSD-2-Clause
#
# @(#) Copyright (c) 2013-2020, 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
-# the above copyright notice and this notice are
-# left intact.
+# SPDX-License-Identifier: BSD-2-Clause
#
# Please send copies of changes and bug-fixes to:
# sjg@crufty.net
diff --git a/share/mk/sys.dependfile.mk b/share/mk/sys.dependfile.mk
--- a/share/mk/sys.dependfile.mk
+++ b/share/mk/sys.dependfile.mk
@@ -1,15 +1,8 @@
-# SPDX-License-Identifier: BSD-2-Clause
-#
-# $Id: sys.dependfile.mk,v 1.11 2024/02/17 17:26:57 sjg Exp $
+# $Id: sys.dependfile.mk,v 1.12 2025/08/09 22:42:24 sjg Exp $
#
# @(#) Copyright (c) 2012-2023, 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
-# the above copyright notice and this notice are
-# left intact.
+# SPDX-License-Identifier: BSD-2-Clause
#
# Please send copies of changes and bug-fixes to:
# sjg@crufty.net
diff --git a/share/mk/sys.dirdeps.mk b/share/mk/sys.dirdeps.mk
--- a/share/mk/sys.dirdeps.mk
+++ b/share/mk/sys.dirdeps.mk
@@ -1,15 +1,8 @@
-# SPDX-License-Identifier: BSD-2-Clause
-#
-# $Id: sys.dirdeps.mk,v 1.15 2024/04/18 17:18:31 sjg Exp $
+# $Id: sys.dirdeps.mk,v 1.16 2025/08/09 22:42:24 sjg Exp $
#
# @(#) Copyright (c) 2012-2023, 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
-# the above copyright notice and this notice are
-# left intact.
+# SPDX-License-Identifier: BSD-2-Clause
#
# Please send copies of changes and bug-fixes to:
# sjg@crufty.net
diff --git a/share/mk/sys.mk b/share/mk/sys.mk
--- a/share/mk/sys.mk
+++ b/share/mk/sys.mk
@@ -314,6 +314,9 @@
path=${__MAKE_SHELL}
.endif
+# We expect .SHELL to be POSIX
+isPOSIX_SHELL?= :
+
# Hack for ports compatibility. Historically, ports makefiles have
# assumed they can examine MACHINE_CPU without including anything
# because this was automatically included in sys.mk. For /usr/src,
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Fri, Dec 12, 3:55 PM (19 h, 34 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
26901517
Default Alt Text
D54150.diff (28 KB)
Attached To
Mode
D54150: Update share/mk files from bmake
Attached
Detach File
Event Timeline
Log In to Comment