aboutsummaryrefslogtreecommitdiff
path: root/mk
diff options
context:
space:
mode:
Diffstat (limited to 'mk')
-rw-r--r--mk/ChangeLog49
-rw-r--r--mk/auto.dep.mk12
-rw-r--r--mk/auto.obj.mk11
-rw-r--r--mk/autoconf.mk11
-rw-r--r--mk/autodep.mk12
-rw-r--r--mk/cc-wrap.mk11
-rw-r--r--mk/ccm.dep.mk12
-rw-r--r--mk/compiler.mk11
-rw-r--r--mk/cython.mk12
-rw-r--r--mk/dirdeps-cache-update.mk11
-rw-r--r--mk/dirdeps-options.mk11
-rw-r--r--mk/dirdeps-targets.mk18
-rw-r--r--mk/dpadd.mk11
-rw-r--r--mk/files.mk11
-rw-r--r--mk/gendirdeps.mk5
-rw-r--r--mk/genfiles.mk11
-rw-r--r--mk/host-target.mk12
-rw-r--r--mk/host.libnames.mk9
-rw-r--r--mk/inc.mk11
-rw-r--r--mk/init.mk11
-rw-r--r--[-rwxr-xr-x]mk/install-mk11
-rw-r--r--mk/install-new.mk36
-rwxr-xr-xmk/install-sh11
-rw-r--r--mk/java.mk12
-rw-r--r--mk/jobs.mk11
-rw-r--r--mk/ldorder.mk11
-rw-r--r--mk/libnames.mk11
-rw-r--r--mk/libs.mk11
-rw-r--r--mk/links.mk11
-rw-r--r--mk/manifest.mk11
-rw-r--r--mk/meta.autodep.mk12
-rw-r--r--mk/meta.stage.mk26
-rw-r--r--mk/meta.subdir.mk12
-rw-r--r--mk/meta.sys.mk12
-rwxr-xr-xmk/meta2deps.sh24
-rw-r--r--mk/mkopt.sh10
-rwxr-xr-xmk/newlog.sh11
-rw-r--r--mk/obj.mk11
-rw-r--r--mk/options.mk148
-rw-r--r--mk/posix.mk11
-rw-r--r--mk/prlist.mk11
-rw-r--r--mk/progs.mk11
-rw-r--r--mk/rst2htm.mk11
-rw-r--r--mk/rust.mk12
-rw-r--r--mk/scripts.mk11
-rw-r--r--mk/setopts.sh9
-rw-r--r--mk/srctop.mk11
-rwxr-xr-xmk/stage-install.sh9
-rw-r--r--mk/subdir.mk11
-rw-r--r--mk/suffixes.mk11
-rw-r--r--mk/sys.clean-env.mk11
-rw-r--r--mk/sys.debug.mk11
-rw-r--r--mk/sys.dependfile.mk11
-rw-r--r--mk/sys.dirdeps.mk11
-rw-r--r--mk/sys.mk11
-rw-r--r--mk/sys.vars.mk36
-rw-r--r--mk/target-flags.mk13
-rw-r--r--mk/warnings.mk12
-rw-r--r--mk/whats.mk11
-rw-r--r--mk/yacc.mk12
60 files changed, 340 insertions, 581 deletions
diff --git a/mk/ChangeLog b/mk/ChangeLog
index fda6d8b02158..daacc97ec045 100644
--- a/mk/ChangeLog
+++ b/mk/ChangeLog
@@ -1,3 +1,52 @@
+2025-11-18 Simon J Gerraty <sjg@beast.crufty.net>
+
+ * sys.vars.mk: set MAKE_POSIX_SHELL to 1 if .SHELL is POSIX, 0 if not.
+ set isPOSIX_SHELL for use in target scripts.
+
+ * meta.stage.mk: set MAKE_POSIX_SHELL if needed.
+
+ * install-new.mk: use ${isPOSIX_SHELL:Ufalse} to see if we can
+ avoid running 'expr'.
+
+ * install-new.mk: Allow use of cp or mv - controlled by CPMV_OP
+ (default mv).
+
+2025-11-13 Simon J Gerraty <sjg@beast.crufty.net>
+
+ * sys.vars.mk: add M_sh1 so we can handle older bmake that does
+ not support :sh1
+
+2025-11-11 Simon J Gerraty <sjg@beast.crufty.net>
+
+ * install-mk (MK_VERSION): 20251111
+
+ * meta2deps.sh: reset some vars for each new meta file
+ set meta_file to path of meta file.
+ If meta2deps appears in DEBUG_SH set -x.
+
+2025-09-16 Simon J Gerraty <sjg@beast.crufty.net>
+
+ * options.mk: Add OPTIONS_DEFAULT_DEPENDENT_REQUIRED of the form
+ OPTION/REQUIRED[/VALUE]
+ if OPTION is $VALUE (default is "yes"), then REQUIRED must be too.
+ We add OPTIONS_DEFAULT_DEPENDENT_REQUIRED (sans any /{yes,no}) to
+ OPTIONS_DEFAULT_DEPENDENT so DEPENDENT/REQUIRED follow the same
+ processing.
+
+ Also add OPTIONS_FORCED_VALUES of the form OPTION/{yes,no}
+ we add any OPTIONS_FORCED_NO and OPTIONS_FORCED_YES before
+ processing.
+
+ Simplify the processing of OPTIONS_DEFAULT_VALUES and
+ OPTIONS_DEFAULT_DEPENDENT by splitting the tuples and use two
+ iterator variables in the .for loops.
+
+2025-08-09 Simon J Gerraty <sjg@beast.crufty.net>
+
+ * install-mk (MK_VERSION): 20250808
+
+ * replace sjg license with just BSD-2-Clause SPDX tag
+
2025-07-24 Simon J Gerraty <sjg@beast.crufty.net>
* install-mk (MK_VERSION): 20250724
diff --git a/mk/auto.dep.mk b/mk/auto.dep.mk
index 400789a37366..ffd0d528dbcb 100644
--- a/mk/auto.dep.mk
+++ b/mk/auto.dep.mk
@@ -1,16 +1,8 @@
-# SPDX-License-Identifier: BSD-2-Clause
-#
-# RCSid:
-# $Id: auto.dep.mk,v 1.12 2024/02/17 17:26:57 sjg Exp $
+# $Id: auto.dep.mk,v 1.13 2025/08/09 22:42:24 sjg Exp $
#
# @(#) Copyright (c) 2010-2021, 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/mk/auto.obj.mk b/mk/auto.obj.mk
index 4b8c5325b71f..140764860de3 100644
--- a/mk/auto.obj.mk
+++ b/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/mk/autoconf.mk b/mk/autoconf.mk
index 24532c4e9eab..26e9515d680c 100644
--- a/mk/autoconf.mk
+++ b/mk/autoconf.mk
@@ -1,15 +1,8 @@
-# SPDX-License-Identifier: BSD-2-Clause
-#
-# $Id: autoconf.mk,v 1.20 2024/02/17 17:26:57 sjg Exp $
+# $Id: autoconf.mk,v 1.21 2025/08/09 22:42:24 sjg Exp $
#
# @(#) Copyright (c) 1996-2024, 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/mk/autodep.mk b/mk/autodep.mk
index 88a2643bccff..ab04419ba808 100644
--- a/mk/autodep.mk
+++ b/mk/autodep.mk
@@ -1,16 +1,8 @@
-# SPDX-License-Identifier: BSD-2-Clause
-#
-# RCSid:
-# $Id: autodep.mk,v 1.43 2024/02/17 17:26:57 sjg Exp $
+# $Id: autodep.mk,v 1.44 2025/08/09 22:42:24 sjg Exp $
#
# @(#) Copyright (c) 1999-2024, 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/mk/cc-wrap.mk b/mk/cc-wrap.mk
index 7c1d6165e9df..f8287c30025e 100644
--- a/mk/cc-wrap.mk
+++ b/mk/cc-wrap.mk
@@ -1,15 +1,8 @@
-# SPDX-License-Identifier: BSD-2-Clause
-#
-# $Id: cc-wrap.mk,v 1.7 2024/02/17 17:26:57 sjg Exp $
+# $Id: cc-wrap.mk,v 1.8 2025/08/09 22:42:24 sjg Exp $
#
# @(#) Copyright (c) 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/mk/ccm.dep.mk b/mk/ccm.dep.mk
index 1809a72e7310..1b31832b8ea9 100644
--- a/mk/ccm.dep.mk
+++ b/mk/ccm.dep.mk
@@ -1,16 +1,8 @@
-# SPDX-License-Identifier: BSD-2-Clause
-#
-# RCSid:
-# $Id: ccm.dep.mk,v 1.3 2024/02/17 17:26:57 sjg Exp $
+# $Id: ccm.dep.mk,v 1.4 2025/08/09 22:42:24 sjg Exp $
#
# @(#) Copyright (c) 2024, 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/mk/compiler.mk b/mk/compiler.mk
index e7a13f0f11d7..32bf55834d03 100644
--- a/mk/compiler.mk
+++ b/mk/compiler.mk
@@ -1,15 +1,8 @@
-# SPDX-License-Identifier: BSD-2-Clause
-#
-# $Id: compiler.mk,v 1.14 2024/02/19 00:05:50 sjg Exp $
+# $Id: compiler.mk,v 1.15 2025/08/09 22:42:24 sjg Exp $
#
# @(#) Copyright (c) 2019, 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/mk/cython.mk b/mk/cython.mk
index 8eda318e187c..d6ef8de0b3d6 100644
--- a/mk/cython.mk
+++ b/mk/cython.mk
@@ -1,16 +1,8 @@
-# SPDX-License-Identifier: BSD-2-Clause
-#
-# RCSid:
-# $Id: cython.mk,v 1.10 2024/09/20 06:16:41 sjg Exp $
+# $Id: cython.mk,v 1.11 2025/08/09 22:42:24 sjg Exp $
#
# @(#) Copyright (c) 2014-2024, 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/mk/dirdeps-cache-update.mk b/mk/dirdeps-cache-update.mk
index 9e7cb8281110..b046b0c04f3f 100644
--- a/mk/dirdeps-cache-update.mk
+++ b/mk/dirdeps-cache-update.mk
@@ -1,15 +1,8 @@
-# SPDX-License-Identifier: BSD-2-Clause
-#
-# $Id: dirdeps-cache-update.mk,v 1.23 2024/02/17 17:26:57 sjg Exp $
+# $Id: dirdeps-cache-update.mk,v 1.24 2025/08/09 22:42:24 sjg Exp $
#
# @(#) Copyright (c) 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/mk/dirdeps-options.mk b/mk/dirdeps-options.mk
index e12dcec40ac7..d173cb7d1e97 100644
--- a/mk/dirdeps-options.mk
+++ b/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/mk/dirdeps-targets.mk b/mk/dirdeps-targets.mk
index a8a547c0ce9b..1d00c5f418d2 100644
--- a/mk/dirdeps-targets.mk
+++ b/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/mk/dpadd.mk b/mk/dpadd.mk
index 4e430b97b3b8..bf37c335f8c6 100644
--- a/mk/dpadd.mk
+++ b/mk/dpadd.mk
@@ -1,15 +1,8 @@
-# SPDX-License-Identifier: BSD-2-Clause
-#
-# $Id: dpadd.mk,v 1.33 2024/02/17 17:26:57 sjg Exp $
+# $Id: dpadd.mk,v 1.34 2025/08/09 22:42:24 sjg Exp $
#
# @(#) Copyright (c) 2004-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/mk/files.mk b/mk/files.mk
index e8de8600d2c6..e16a1c9f480e 100644
--- a/mk/files.mk
+++ b/mk/files.mk
@@ -1,15 +1,8 @@
-# SPDX-License-Identifier: BSD-2-Clause
-#
-# $Id: files.mk,v 1.8 2024/02/17 17:26:57 sjg Exp $
+# $Id: files.mk,v 1.9 2025/08/09 22:42:24 sjg Exp $
#
# @(#) Copyright (c) 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
diff --git a/mk/gendirdeps.mk b/mk/gendirdeps.mk
index b52c9ca0eba3..ab1786f3603f 100644
--- a/mk/gendirdeps.mk
+++ b/mk/gendirdeps.mk
@@ -1,4 +1,4 @@
-# $Id: gendirdeps.mk,v 1.53 2025/05/20 17:42:49 sjg Exp $
+# $Id: gendirdeps.mk,v 1.54 2025/08/12 21:36:43 sjg Exp $
# SPDX-License-Identifier: BSD-2-Clause
#
@@ -298,7 +298,8 @@ M2D_OBJROOTS := ${M2D_OBJROOTS:O:u:[-1..1]}
# 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,}
diff --git a/mk/genfiles.mk b/mk/genfiles.mk
index 4299206cca9f..1c375e8eefe4 100644
--- a/mk/genfiles.mk
+++ b/mk/genfiles.mk
@@ -1,15 +1,8 @@
-# SPDX-License-Identifier: BSD-2-Clause
-#
-# $Id: genfiles.mk,v 1.4 2025/04/18 00:04:41 sjg Exp $
+# $Id: genfiles.mk,v 1.5 2025/08/09 22:42:24 sjg Exp $
#
# @(#) Copyright (c) 2024-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/mk/host-target.mk b/mk/host-target.mk
index 0316cacb2713..65342d577d5b 100644
--- a/mk/host-target.mk
+++ b/mk/host-target.mk
@@ -1,16 +1,8 @@
-# SPDX-License-Identifier: BSD-2-Clause
-#
-# RCSid:
-# $Id: host-target.mk,v 1.20 2024/02/17 17:26:57 sjg Exp $
+# $Id: host-target.mk,v 1.21 2025/08/09 22:42:24 sjg Exp $
#
# @(#) Copyright (c) 2007-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/mk/host.libnames.mk b/mk/host.libnames.mk
index 3afa73f9d2a3..9631052f9dda 100644
--- a/mk/host.libnames.mk
+++ b/mk/host.libnames.mk
@@ -1,13 +1,8 @@
-# $Id: host.libnames.mk,v 1.5 2020/08/19 17:51:53 sjg Exp $
+# $Id: host.libnames.mk,v 1.6 2025/08/09 22:42:24 sjg Exp $
#
# @(#) Copyright (c) 2007-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
diff --git a/mk/inc.mk b/mk/inc.mk
index 9ea93bd1573d..a9e028077723 100644
--- a/mk/inc.mk
+++ b/mk/inc.mk
@@ -1,15 +1,8 @@
-# SPDX-License-Identifier: BSD-2-Clause
-#
-# $Id: inc.mk,v 1.9 2024/02/17 17:26:57 sjg Exp $
+# $Id: inc.mk,v 1.10 2025/08/09 22:42:24 sjg Exp $
#
# @(#) Copyright (c) 2008, 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/mk/init.mk b/mk/init.mk
index 7d044af3d791..487af452910e 100644
--- a/mk/init.mk
+++ b/mk/init.mk
@@ -1,15 +1,8 @@
-# SPDX-License-Identifier: BSD-2-Clause
-#
-# $Id: init.mk,v 1.41 2025/04/18 20:49:54 sjg Exp $
+# $Id: init.mk,v 1.42 2025/08/09 22:42:24 sjg Exp $
#
# @(#) Copyright (c) 2002-2024, 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/mk/install-mk b/mk/install-mk
index 3ed5fd63ee5c..f61d38947b11 100755..100644
--- a/mk/install-mk
+++ b/mk/install-mk
@@ -59,22 +59,17 @@
# Simon J. Gerraty <sjg@crufty.net>
# RCSid:
-# $Id: install-mk,v 1.268 2025/07/24 15:55:48 sjg Exp $
+# $Id: install-mk,v 1.271 2025/11/11 18:08:02 sjg Exp $
#
# @(#) Copyright (c) 1994-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
#
-MK_VERSION=20250724
+MK_VERSION=20251111
OWNER=
GROUP=
MODE=444
diff --git a/mk/install-new.mk b/mk/install-new.mk
index 0f2e395a8238..2fb9725a7a47 100644
--- a/mk/install-new.mk
+++ b/mk/install-new.mk
@@ -1,15 +1,8 @@
-# SPDX-License-Identifier: BSD-2-Clause
-#
-# $Id: install-new.mk,v 1.5 2024/02/17 17:26:57 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
@@ -17,25 +10,32 @@
.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; \
+ ${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= ${CmpCp}; InstallNew() { \
+InstallNew= ${CmpCpMv}; InstallNew() { \
_t=-e; _bak=; \
while :; do \
case "$$1" in \
@@ -46,8 +46,12 @@ InstallNew= ${CmpCp}; InstallNew() { \
done; \
for new in "$$@"; do \
if test $$_t $$new; then \
- target=`expr $$new : '\(.*\).new'`; \
- CmpCp $$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/mk/install-sh b/mk/install-sh
index aa35fa94c83a..14ddc8ccd13a 100755
--- a/mk/install-sh
+++ b/mk/install-sh
@@ -53,19 +53,12 @@
# Simon J. Gerraty <sjg@crufty.net>
#
-# SPDX-License-Identifier: BSD-2-Clause
-#
# RCSid:
-# $Id: install-sh,v 1.26 2024/02/17 17:26:57 sjg Exp $
+# $Id: install-sh,v 1.27 2025/08/09 22:42:24 sjg Exp $
#
# @(#) Copyright (c) 1993-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/mk/java.mk b/mk/java.mk
index 752aea121953..5002c780ab84 100644
--- a/mk/java.mk
+++ b/mk/java.mk
@@ -1,16 +1,8 @@
-# SPDX-License-Identifier: BSD-2-Clause
+# $Id: java.mk,v 1.18 2025/08/09 22:42:24 sjg Exp $
#
-# RCSid:
-# $Id: java.mk,v 1.17 2024/02/17 17:26:57 sjg Exp $
-
# @(#) Copyright (c) 1998-2001, 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/mk/jobs.mk b/mk/jobs.mk
index e304e16a9c56..874e7deeb107 100644
--- a/mk/jobs.mk
+++ b/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/mk/ldorder.mk b/mk/ldorder.mk
index b612b1b9d3be..bdcac61a3e72 100644
--- a/mk/ldorder.mk
+++ b/mk/ldorder.mk
@@ -1,15 +1,8 @@
-# SPDX-License-Identifier: BSD-2-Clause
-#
-# $Id: ldorder.mk,v 1.27 2024/02/17 17:26:57 sjg Exp $
+# $Id: ldorder.mk,v 1.28 2025/08/09 22:42:24 sjg Exp $
#
# @(#) Copyright (c) 2015, 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/mk/libnames.mk b/mk/libnames.mk
index f2d99d337675..83548b31c820 100644
--- a/mk/libnames.mk
+++ b/mk/libnames.mk
@@ -1,15 +1,8 @@
-# SPDX-License-Identifier: BSD-2-Clause
-#
-# $Id: libnames.mk,v 1.10 2024/02/17 17:26:57 sjg Exp $
+# $Id: libnames.mk,v 1.11 2025/08/09 22:42:24 sjg Exp $
#
# @(#) Copyright (c) 2007-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
diff --git a/mk/libs.mk b/mk/libs.mk
index 6814916657ec..348444fd4149 100644
--- a/mk/libs.mk
+++ b/mk/libs.mk
@@ -1,15 +1,8 @@
-# SPDX-License-Identifier: BSD-2-Clause
-#
-# $Id: libs.mk,v 1.8 2025/05/19 19:15:22 sjg Exp $
+# $Id: libs.mk,v 1.9 2025/08/09 22:42:24 sjg Exp $
#
# @(#) 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/mk/links.mk b/mk/links.mk
index dfcedec7a434..60b0ffebc8f1 100644
--- a/mk/links.mk
+++ b/mk/links.mk
@@ -1,15 +1,8 @@
-# SPDX-License-Identifier: BSD-2-Clause
-#
-# $Id: links.mk,v 1.10 2024/08/23 21:24:27 sjg Exp $
+# $Id: links.mk,v 1.11 2025/08/09 22:42:24 sjg Exp $
#
# @(#) Copyright (c) 2005-2024, 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/mk/manifest.mk b/mk/manifest.mk
index d619d17432bd..2a8f5d790f1a 100644
--- a/mk/manifest.mk
+++ b/mk/manifest.mk
@@ -1,15 +1,8 @@
-# SPDX-License-Identifier: BSD-2-Clause
-#
-# $Id: manifest.mk,v 1.4 2024/02/17 17:26:57 sjg Exp $
+# $Id: manifest.mk,v 1.5 2025/08/09 22:42:24 sjg Exp $
#
# @(#) Copyright (c) 2014, 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/mk/meta.autodep.mk b/mk/meta.autodep.mk
index ce16ac843dc3..2120c0892475 100644
--- a/mk/meta.autodep.mk
+++ b/mk/meta.autodep.mk
@@ -1,16 +1,8 @@
-# SPDX-License-Identifier: BSD-2-Clause
-#
-# $Id: meta.autodep.mk,v 1.70 2025/05/28 20:03:00 sjg Exp $
-
+# $Id: meta.autodep.mk,v 1.71 2025/08/09 22:42:24 sjg Exp $
#
# @(#) 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
diff --git a/mk/meta.stage.mk b/mk/meta.stage.mk
index 97e4dce83e5d..c98f0c251c67 100644
--- a/mk/meta.stage.mk
+++ b/mk/meta.stage.mk
@@ -1,15 +1,8 @@
-# SPDX-License-Identifier: BSD-2-Clause
-#
-# $Id: meta.stage.mk,v 1.71 2025/03/14 20:28:42 sjg Exp $
+# $Id: meta.stage.mk,v 1.74 2025/11/19 17:44:15 sjg Exp $
#
# @(#) Copyright (c) 2011-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
@@ -38,14 +31,19 @@ CLEANFILES+= .dirdep
@echo '${_dirdep}' > $@
.endif
-.if defined(NO_POSIX_SHELL) || ${type printf:L:sh:Mbuiltin} == ""
-_stage_file_basename = `basename $$f`
-_stage_file_dirname = `dirname $$f`
-_stage_target_dirname = `dirname $$t`
-.else
+.ifndef MAKE_POSIX_SHELL
+MAKE_POSIX_SHELL != (echo $${PATH%:*}) > /dev/null 2>&1 && echo 1 || echo 0
+.export MAKE_POSIX_SHELL
+.endif
+
+.if ${MAKE_POSIX_SHELL}
_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}}
diff --git a/mk/meta.subdir.mk b/mk/meta.subdir.mk
index aee8a1a9a39b..a1c2b66f2f9d 100644
--- a/mk/meta.subdir.mk
+++ b/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/mk/meta.sys.mk b/mk/meta.sys.mk
index 1104204dc8c9..c5fcdaa801e4 100644
--- a/mk/meta.sys.mk
+++ b/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/mk/meta2deps.sh b/mk/meta2deps.sh
index 83478ae5b876..75ef1a4314eb 100755
--- a/mk/meta2deps.sh
+++ b/mk/meta2deps.sh
@@ -77,7 +77,7 @@
# RCSid:
-# $Id: meta2deps.sh,v 1.24 2025/07/24 15:55:48 sjg Exp $
+# $Id: meta2deps.sh,v 1.25 2025/11/11 18:08:02 sjg Exp $
# SPDX-License-Identifier: BSD-2-Clause
#
@@ -106,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' |
@@ -259,7 +263,14 @@ meta2deps() {
# 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'";;
@@ -268,6 +279,7 @@ meta2deps() {
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
@@ -276,13 +288,13 @@ meta2deps() {
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
@@ -424,18 +436,18 @@ meta2deps() {
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/mk/mkopt.sh b/mk/mkopt.sh
index ec425440570b..47b858216fe8 100644
--- a/mk/mkopt.sh
+++ b/mk/mkopt.sh
@@ -1,17 +1,11 @@
#!/bin/sh
-# SPDX-License-Identifier: BSD-2-Clause
#
-# $Id: mkopt.sh,v 1.17 2025/05/22 22:35:14 sjg Exp $
+# $Id: mkopt.sh,v 1.18 2025/08/07 21:59:54 sjg Exp $
#
# @(#) Copyright (c) 2014-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/mk/newlog.sh b/mk/newlog.sh
index fbf347ee2746..1aa1f6b7dc75 100755
--- a/mk/newlog.sh
+++ b/mk/newlog.sh
@@ -81,18 +81,11 @@
#
# RCSid:
-# $Id: newlog.sh,v 1.30 2025/06/01 05:07:48 sjg Exp $
-#
-# SPDX-License-Identifier: BSD-2-Clause
+# $Id: newlog.sh,v 1.31 2025/08/07 22:07:13 sjg Exp $
#
# @(#) Copyright (c) 1993-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/mk/obj.mk b/mk/obj.mk
index eac8e9e05891..c5207f22260a 100644
--- a/mk/obj.mk
+++ b/mk/obj.mk
@@ -1,15 +1,8 @@
-# SPDX-License-Identifier: BSD-2-Clause
-#
-# $Id: obj.mk,v 1.19 2024/02/19 00:06:19 sjg Exp $
+# $Id: obj.mk,v 1.20 2025/08/09 22:42:24 sjg Exp $
#
# @(#) Copyright (c) 1999-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/mk/options.mk b/mk/options.mk
index 07a6e0e340b2..2ee49c7c2f77 100644
--- a/mk/options.mk
+++ b/mk/options.mk
@@ -1,15 +1,8 @@
-# SPDX-License-Identifier: BSD-2-Clause
+# $Id: options.mk,v 1.25 2025/09/18 05:11:59 sjg Exp $
#
-# $Id: options.mk,v 1.22 2024/10/27 17:33:03 sjg Exp $
+# @(#) Copyright (c) 2012-2025, Simon J. Gerraty
#
-# @(#) Copyright (c) 2012, 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
@@ -17,6 +10,31 @@
# Inspired by FreeBSD bsd.own.mk, but intentionally simpler and more flexible.
+OPTION_PREFIX ?= MK_
+
+# Options to be forced either "yes" or "no"
+OPTIONS_FORCED_VALUES += \
+ ${OPTIONS_BROKEN:U:O:u:S,$,/no,:N/no} \
+ ${OPTIONS_FORCED_NO:U:O:u:S,$,/no,:N/no} \
+ ${OPTIONS_FORCED_YES:U:O:u:S,$,/yes,:N/yes} \
+ ${OPTIONS_REQUIRED:U:O:u:S,$,/yes,:N/yes} \
+
+.for o v in ${OPTIONS_FORCED_VALUES:M*/*:S,/, ,g}
+.if !make(show-options)
+.if ${v:tl} == "yes"
+.if defined(WITHOUT_$o)
+.warning WITHOUT_$o ignored
+.endif
+.elif defined(WITH_$o)
+.warning WITH_$o ignored
+.endif
+.endif
+${OPTION_PREFIX}$o := ${v:tl}
+.if defined(DEBUG_OPTIONS) && ${DEBUG_OPTIONS:@x@${o:M$x}@} != ""
+.info ${.INCLUDEDFROMFILE}: ${OPTION_PREFIX}$o=${${OPTION_PREFIX}$o}
+.endif
+.endfor
+
# Options are normally listed in either OPTIONS_DEFAULT_{YES,NO}
# We convert these to ${OPTION}/{yes,no} in OPTIONS_DEFAULT_VALUES.
# We add the OPTIONS_DEFAULT_NO first so they take precedence.
@@ -28,72 +46,104 @@
# User sets WITH_* and WITHOUT_* to indicate what they want.
# We set ${OPTION_PREFIX:UMK_}* which is then all we need care about.
OPTIONS_DEFAULT_VALUES += \
- ${OPTIONS_DEFAULT_NO:U:O:u:S,$,/no,} \
- ${OPTIONS_DEFAULT_YES:U:O:u:S,$,/yes,}
-
-OPTION_PREFIX ?= MK_
+ ${OPTIONS_DEFAULT_NO:U:O:u:S,$,/no,:N/no} \
+ ${OPTIONS_DEFAULT_YES:U:O:u:S,$,/yes,:N/yes} \
# NO_* takes precedence
# If both WITH_* and WITHOUT_* are defined, WITHOUT_ wins unless
-# DOMINANT_* is set to "yes"
+# OPTION_DOMINANT_* is set to "yes"
# Otherwise WITH_* and WITHOUT_* override the default.
-.for o in ${OPTIONS_DEFAULT_VALUES:M*/*}
-.if defined(WITH_${o:H}) && ${WITH_${o:H}} == "no"
+.for o v in ${OPTIONS_DEFAULT_VALUES:M*/*:S,/, ,}
+.if defined(WITH_$o) && ${WITH_$o:tl} == "no"
# a common miss-use - point out correct usage
-.warning use WITHOUT_${o:H}=1 not WITH_${o:H}=no
+.warning use WITHOUT_$o=1 not WITH_$o=no
+WITHOUT_$o = 1
.endif
-.if defined(NO_${o:H}) || defined(NO${o:H})
+.if defined(NO_$o) || defined(NO$o)
# we cannot do it
-${OPTION_PREFIX}${o:H} ?= no
-.elif defined(WITH_${o:H}) && defined(WITHOUT_${o:H})
+${OPTION_PREFIX}$o ?= no
+.elif defined(WITH_$o) && defined(WITHOUT_$o)
# normally WITHOUT_ wins
-DOMINANT_${o:H} ?= no
-${OPTION_PREFIX}${o:H} ?= ${DOMINANT_${o:H}}
-.elif ${o:T:tl} == "no"
-.if defined(WITH_${o:H})
-${OPTION_PREFIX}${o:H} ?= yes
+OPTION_DOMINANT_$o ?= no
+${OPTION_PREFIX}$o ?= ${OPTION_DOMINANT_$o}
+.elif ${v:tl} == "no"
+.if defined(WITH_$o)
+${OPTION_PREFIX}$o ?= yes
.else
-${OPTION_PREFIX}${o:H} ?= no
+${OPTION_PREFIX}$o ?= no
.endif
.else
-.if defined(WITHOUT_${o:H})
-${OPTION_PREFIX}${o:H} ?= no
+.if defined(WITHOUT_$o)
+${OPTION_PREFIX}$o ?= no
.else
-${OPTION_PREFIX}${o:H} ?= yes
+${OPTION_PREFIX}$o ?= yes
.endif
.endif
-.if defined(DEBUG_OPTIONS) && ${DEBUG_OPTIONS:@x@${o:H:M$x}@} != ""
-.info ${.INCLUDEDFROMFILE}: ${OPTION_PREFIX}${o:H}=${${OPTION_PREFIX}${o:H}}
+.if defined(DEBUG_OPTIONS) && ${DEBUG_OPTIONS:@x@${o:M$x}@} != ""
+.info ${.INCLUDEDFROMFILE}: ${OPTION_PREFIX}$o=${${OPTION_PREFIX}$o}
.endif
.endfor
# OPTIONS_DEFAULT_DEPENDENT += FOO_UTILS/FOO
# If neither WITH[OUT]_FOO_UTILS is set, (see rules above)
# use the value of ${OPTION_PREFIX}FOO
-.for o in ${OPTIONS_DEFAULT_DEPENDENT:M*/*:O:u}
-.if defined(NO_${o:H}) || defined(NO${o:H})
+# Add OPTIONS_DEFAULT_DEPENDENT_REQUIRED (sans any trailing /{yes,no})
+# to OPTIONS_DEFAULT_DEPENDENT to avoid the need to duplicate entries
+OPTIONS_DEFAULT_DEPENDENT += ${OPTIONS_DEFAULT_DEPENDENT_REQUIRED:U:S,/yes$,,:S,/no$,,}
+
+.for o d in ${OPTIONS_DEFAULT_DEPENDENT:M*/*:S,/, ,}
+.if defined(NO_$o) || defined(NO$o)
# we cannot do it
-${OPTION_PREFIX}${o:H} ?= no
-.elif defined(WITH_${o:H}) && defined(WITHOUT_${o:H})
+${OPTION_PREFIX}$o ?= no
+.elif defined(WITH_$o) && defined(WITHOUT_$o)
# normally WITHOUT_ wins
-DOMINANT_${o:H} ?= no
-${OPTION_PREFIX}${o:H} ?= ${DOMINANT_${o:H}}
-.elif defined(WITH_${o:H})
-${OPTION_PREFIX}${o:H} ?= yes
-.elif defined(WITHOUT_${o:H})
-${OPTION_PREFIX}${o:H} ?= no
+OPTION_DOMINANT_$o ?= no
+${OPTION_PREFIX}$o ?= ${OPTION_DOMINANT_$o}
+.elif defined(WITH_$o)
+${OPTION_PREFIX}$o ?= yes
+.elif defined(WITHOUT_$o)
+${OPTION_PREFIX}$o ?= no
+.else
+${OPTION_PREFIX}$o ?= ${${OPTION_PREFIX}$d}
+.endif
+.if defined(DEBUG_OPTIONS) && ${DEBUG_OPTIONS:@x@${o:M$x}@} != ""
+.info ${.INCLUDEDFROMFILE}: ${OPTION_PREFIX}$o=${${OPTION_PREFIX}$o} (${OPTION_PREFIX}$d=${${OPTION_PREFIX}$d})
+.endif
+.endfor
+
+# OPTIONS_DEFAULT_DEPENDENT_REQUIRED += FOO_UTILS/FOO[/{yes,no}]
+# first processed with OPTIONS_DEFAULT_DEPENDENT above,
+# but if ${OPTION_PREFIX}${o:H:H} is ${o:T},
+# then ${OPTION_PREFIX}${o:H:T} must be too
+.for o in ${OPTIONS_DEFAULT_DEPENDENT_REQUIRED:M*/*:O:u}
+# This dance allows /{yes,no} to be optional
+.if ${o:T:tl:Nno:Nyes} == ""
+$o.H := ${o:H:H}
+$o.R := ${o:T}
+$o.T := ${o:H:T}
.else
-${OPTION_PREFIX}${o:H} ?= ${${OPTION_PREFIX}${o:T}}
+$o.H := ${o:H}
+$o.R := ${OPTION_REQUIRED_${o:H}:Uyes}
+$o.T := ${o:T}
+.endif
+.if defined(DEBUG_OPTIONS) && ${DEBUG_OPTIONS:@x@${$o.H:M$x}@} != ""
+.info ${.INCLUDEDFROMFILE}: ${OPTION_PREFIX}${$o.H}=${${OPTION_PREFIX}${$o.H}} (${OPTION_PREFIX}${$o.T}=${${OPTION_PREFIX}${$o.T}} require=${$o.R})
+.endif
+.if ${${OPTION_PREFIX}${$o.H}} != ${${OPTION_PREFIX}${$o.T}}
+.if ${${OPTION_PREFIX}${$o.H}} == ${$o.R}
+.error ${OPTION_PREFIX}${$o.H}=${${OPTION_PREFIX}${$o.H}} requires ${OPTION_PREFIX}${$o.T}=${${OPTION_PREFIX}${$o.H}}
.endif
-.if defined(DEBUG_OPTIONS) && ${DEBUG_OPTIONS:@x@${o:H:M$x}@} != ""
-.info ${.INCLUDEDFROMFILE}: ${OPTION_PREFIX}${o:H}=${${OPTION_PREFIX}${o:H}} (${OPTION_PREFIX}${o:T}=${${OPTION_PREFIX}${o:T}})
.endif
+.undef $o.H
+.undef $o.R
+.undef $o.T
.endfor
# allow displaying/describing set options
.set_options := ${.set_options} \
- ${OPTIONS_DEFAULT_VALUES:H:N.} \
+ ${OPTIONS_DEFAULT_VALUES:U:H:N.} \
${OPTIONS_DEFAULT_DEPENDENT:U:H:N.} \
+ ${OPTIONS_FORCED_VALUES:U:H:N.} \
# this can be used in .info as well as target below
OPTIONS_SHOW ?= ${.set_options:O:u:@o@${OPTION_PREFIX}$o=${${OPTION_PREFIX}$o}@}
@@ -114,7 +164,13 @@ describe-options: .NOTMAIN .PHONY
.endif
# we expect to be included more than once
+.undef OPTIONS_BROKEN
.undef OPTIONS_DEFAULT_DEPENDENT
+.undef OPTIONS_DEFAULT_DEPENDENT_REQUIRED
.undef OPTIONS_DEFAULT_NO
.undef OPTIONS_DEFAULT_VALUES
.undef OPTIONS_DEFAULT_YES
+.undef OPTIONS_FORCED_NO
+.undef OPTIONS_FORCED_VALUES
+.undef OPTIONS_FORCED_YES
+.undef OPTIONS_REQUIRED
diff --git a/mk/posix.mk b/mk/posix.mk
index b7cb9ef32108..fd33ea985d5a 100644
--- a/mk/posix.mk
+++ b/mk/posix.mk
@@ -1,15 +1,8 @@
-# SPDX-License-Identifier: BSD-2-Clause
-#
-# $Id: posix.mk,v 1.3 2024/02/17 17:26:57 sjg Exp $
+# $Id: posix.mk,v 1.4 2025/08/09 22:42:24 sjg Exp $
#
# @(#) Copyright (c) 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/mk/prlist.mk b/mk/prlist.mk
index b6912a8d9601..844957152e4d 100644
--- a/mk/prlist.mk
+++ b/mk/prlist.mk
@@ -1,15 +1,8 @@
-# SPDX-License-Identifier: BSD-2-Clause
-#
-# $Id: prlist.mk,v 1.6 2024/02/17 17:26:57 sjg Exp $
+# $Id: prlist.mk,v 1.7 2025/08/09 22:42:24 sjg Exp $
#
# @(#) 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/mk/progs.mk b/mk/progs.mk
index fe8cad4b5c26..7753088dc6c8 100644
--- a/mk/progs.mk
+++ b/mk/progs.mk
@@ -1,15 +1,8 @@
-# SPDX-License-Identifier: BSD-2-Clause
-#
-# $Id: progs.mk,v 1.19 2025/05/19 19:15:22 sjg Exp $
+# $Id: progs.mk,v 1.20 2025/08/09 22:42:24 sjg Exp $
#
# @(#) 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/mk/rst2htm.mk b/mk/rst2htm.mk
index 5dbc8ddaf960..5e2567bd4ac1 100644
--- a/mk/rst2htm.mk
+++ b/mk/rst2htm.mk
@@ -1,15 +1,8 @@
-# SPDX-License-Identifier: BSD-2-Clause
-#
-# $Id: rst2htm.mk,v 1.16 2025/04/16 00:42:07 sjg Exp $
+# $Id: rst2htm.mk,v 1.17 2025/08/09 22:42:24 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
diff --git a/mk/rust.mk b/mk/rust.mk
index 5fc340239c30..8a3c90116c6e 100644
--- a/mk/rust.mk
+++ b/mk/rust.mk
@@ -1,16 +1,8 @@
-# SPDX-License-Identifier: BSD-2-Clause
-#
-# RCSid:
-# $Id: rust.mk,v 1.37 2025/01/11 03:17:36 sjg Exp $
+# $Id: rust.mk,v 1.38 2025/08/09 22:42:24 sjg Exp $
#
# @(#) Copyright (c) 2024, 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/mk/scripts.mk b/mk/scripts.mk
index 36d8f2901397..58d9989f1e23 100644
--- a/mk/scripts.mk
+++ b/mk/scripts.mk
@@ -1,15 +1,8 @@
-# SPDX-License-Identifier: BSD-2-Clause
-#
-# $Id: scripts.mk,v 1.5 2024/02/17 17:26:57 sjg Exp $
+# $Id: scripts.mk,v 1.6 2025/08/09 22:42:24 sjg Exp $
#
# @(#) 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/mk/setopts.sh b/mk/setopts.sh
index 5fccb0bcb6fe..f8f66b5ff963 100644
--- a/mk/setopts.sh
+++ b/mk/setopts.sh
@@ -50,16 +50,11 @@
#
# RCSid:
-# $Id: setopts.sh,v 1.15 2025/06/01 02:10:31 sjg Exp $
+# $Id: setopts.sh,v 1.16 2025/08/07 21:59:54 sjg Exp $
#
# @(#) Copyright (c) 1995-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/mk/srctop.mk b/mk/srctop.mk
index ba4034e6d802..487c2e3c788e 100644
--- a/mk/srctop.mk
+++ b/mk/srctop.mk
@@ -1,15 +1,8 @@
-# SPDX-License-Identifier: BSD-2-Clause
-#
-# $Id: srctop.mk,v 1.5 2024/02/17 17:26:57 sjg Exp $
+# $Id: srctop.mk,v 1.6 2025/08/09 22:42:24 sjg Exp $
#
# @(#) Copyright (c) 2012, 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/mk/stage-install.sh b/mk/stage-install.sh
index d9182e32feff..b6ab4abc8201 100755
--- a/mk/stage-install.sh
+++ b/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/mk/subdir.mk b/mk/subdir.mk
index 09542f147826..f7faea674afa 100644
--- a/mk/subdir.mk
+++ b/mk/subdir.mk
@@ -1,15 +1,8 @@
-# SPDX-License-Identifier: BSD-2-Clause
-#
-# $Id: subdir.mk,v 1.27 2024/09/01 05:02:43 sjg Exp $
+# $Id: subdir.mk,v 1.28 2025/08/09 22:42:24 sjg Exp $
#
# @(#) Copyright (c) 2002-2024, 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/mk/suffixes.mk b/mk/suffixes.mk
index 4c4c85e68220..01f4187c9a03 100644
--- a/mk/suffixes.mk
+++ b/mk/suffixes.mk
@@ -1,15 +1,8 @@
-# SPDX-License-Identifier: BSD-2-Clause
-#
-# $Id: suffixes.mk,v 1.3 2024/02/17 17:26:57 sjg Exp $
+# $Id: suffixes.mk,v 1.4 2025/08/09 22:42:24 sjg Exp $
#
# @(#) Copyright (c) 2024, 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/mk/sys.clean-env.mk b/mk/sys.clean-env.mk
index 6cdb42718da0..242e3f53ec63 100644
--- a/mk/sys.clean-env.mk
+++ b/mk/sys.clean-env.mk
@@ -1,15 +1,8 @@
-# SPDX-License-Identifier: BSD-2-Clause
-#
-# $Id: sys.clean-env.mk,v 1.26 2024/02/17 17:26:57 sjg Exp $
+# $Id: sys.clean-env.mk,v 1.27 2025/08/09 22:42:24 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
diff --git a/mk/sys.debug.mk b/mk/sys.debug.mk
index 3b253ad73ed4..84588ec7a971 100644
--- a/mk/sys.debug.mk
+++ b/mk/sys.debug.mk
@@ -1,15 +1,8 @@
-# SPDX-License-Identifier: BSD-2-Clause
-#
-# $Id: sys.debug.mk,v 1.3 2024/02/17 17:26:57 sjg Exp $
+# $Id: sys.debug.mk,v 1.4 2025/08/09 22:42:24 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
diff --git a/mk/sys.dependfile.mk b/mk/sys.dependfile.mk
index 3c13b1c92bff..84c5c898b6af 100644
--- a/mk/sys.dependfile.mk
+++ b/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/mk/sys.dirdeps.mk b/mk/sys.dirdeps.mk
index 4d2dfa8416fa..66b7f900697c 100644
--- a/mk/sys.dirdeps.mk
+++ b/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/mk/sys.mk b/mk/sys.mk
index d05bd62e10c0..4cbe976b439f 100644
--- a/mk/sys.mk
+++ b/mk/sys.mk
@@ -1,15 +1,8 @@
-# SPDX-License-Identifier: BSD-2-Clause
-#
-# $Id: sys.mk,v 1.62 2025/05/19 19:15:22 sjg Exp $
+# $Id: sys.mk,v 1.66 2025/11/19 03:38:20 sjg Exp $
#
# @(#) Copyright (c) 2003-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/mk/sys.vars.mk b/mk/sys.vars.mk
index c3daf745fb5c..f8e6dd7f2c87 100644
--- a/mk/sys.vars.mk
+++ b/mk/sys.vars.mk
@@ -1,15 +1,8 @@
-# SPDX-License-Identifier: BSD-2-Clause
-#
-# $Id: sys.vars.mk,v 1.18 2025/03/09 02:47:59 sjg Exp $
+# $Id: sys.vars.mk,v 1.24 2025/11/19 17:44:15 sjg Exp $
#
# @(#) Copyright (c) 2003-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
@@ -37,6 +30,22 @@ _this = ${.PARSEDIR}/${.PARSEFILE}
_this = ${.PARSEDIR:tA}/${.PARSEFILE}
.endif
+# This is a boolean we can use in makefiles as below
+.ifndef MAKE_POSIX_SHELL
+MAKE_POSIX_SHELL != (echo $${PATH%:*}) > /dev/null 2>&1 && echo 1 || echo 0
+.export MAKE_POSIX_SHELL
+.endif
+
+# This is a boolean we can use in target scripts
+.ifndef isPOSIX_SHELL
+.if ${MAKE_POSIX_SHELL}
+isPOSIX_SHELL = :
+.else
+isPOSIX_SHELL = false
+.endif
+.export isPOSIX_SHELL
+.endif
+
# some useful modifiers
# A useful trick for testing multiple :M's against something
@@ -56,8 +65,15 @@ M_ListToSkip= O:u:S,^,N,:ts:
_type_sh = which
.endif
+# :sh1 evaluates command only once and caches the result.
+.if ${MAKE_VERSION} < 20251111
+M_sh1 = sh
+.else
+M_sh1 = sh1
+.endif
+
# AUTOCONF := ${autoconf:L:${M_whence}}
-M_type = @x@(${_type_sh:Utype} $$x) 2> /dev/null; echo;@:sh:[0]:N* found*:[@]:C,[()],,g
+M_type = @x@(${_type_sh:Utype} $$x) 2> /dev/null; echo;@:${M_sh1:Ush}:[0]:N* found*:[@]:C,[()],,g
M_whence = ${M_type}:M/*:[1]
# produce similar output to jot(1) or seq(1)
diff --git a/mk/target-flags.mk b/mk/target-flags.mk
index d31e200f7ebf..b0b5354a3e74 100644
--- a/mk/target-flags.mk
+++ b/mk/target-flags.mk
@@ -34,21 +34,12 @@
#
# Only works with a make(1) that does nested evaluation correctly.
-
-
-# SPDX-License-Identifier: BSD-2-Clause
-#
# RCSid:
-# $Id: target-flags.mk,v 1.11 2024/02/17 17:26:57 sjg Exp $
+# $Id: target-flags.mk,v 1.12 2025/08/09 22:42:24 sjg Exp $
#
# @(#) Copyright (c) 1998-2002, 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/mk/warnings.mk b/mk/warnings.mk
index 8fd9a2ea2048..db151fd86524 100644
--- a/mk/warnings.mk
+++ b/mk/warnings.mk
@@ -1,16 +1,8 @@
-# SPDX-License-Identifier: BSD-2-Clause
-#
-# RCSid:
-# $Id: warnings.mk,v 1.18 2024/02/17 17:26:57 sjg Exp $
+# $Id: warnings.mk,v 1.19 2025/08/09 22:42:24 sjg Exp $
#
# @(#) Copyright (c) 2002-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/mk/whats.mk b/mk/whats.mk
index 81708c2225b1..d05a10fb20aa 100644
--- a/mk/whats.mk
+++ b/mk/whats.mk
@@ -1,15 +1,8 @@
-# SPDX-License-Identifier: BSD-2-Clause
-#
-# $Id: whats.mk,v 1.12 2024/02/17 17:26:57 sjg Exp $
+# $Id: whats.mk,v 1.13 2025/08/09 22:42:24 sjg Exp $
#
# @(#) Copyright (c) 2014-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/mk/yacc.mk b/mk/yacc.mk
index 30e377d1991c..b3c3293ce9c9 100644
--- a/mk/yacc.mk
+++ b/mk/yacc.mk
@@ -1,16 +1,8 @@
-# SPDX-License-Identifier: BSD-2-Clause
-#
-# $Id: yacc.mk,v 1.9 2024/02/17 17:26:57 sjg Exp $
-
+# $Id: yacc.mk,v 1.10 2025/08/09 22:42:24 sjg Exp $
#
# @(#) Copyright (c) 1999-2011, 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