summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSimon J. Gerraty <sjg@FreeBSD.org>2025-12-03 09:57:57 -0800
committerSimon J. Gerraty <sjg@FreeBSD.org>2025-12-03 09:57:57 -0800
commit638c66de4a0faa4c2e815e81cd4021c2387c7e0f (patch)
tree501a9007f873e948a69c658104c34838ddaac038
parent787302bde4d89279180303b753eb73b9bc6820b9 (diff)
Intersting/relevant changes since bmake-20250804 ChangeLog since bmake-20250804 2025-11-15 Simon J Gerraty <sjg@beast.crufty.net> * boot-strap: unset more things from env and save a copy to env.out for debugging. 2025-11-12 Simon J Gerraty <sjg@beast.crufty.net> * VERSION (_MAKE_VERSION): 20251111 Merge with NetBSD make, pick up o var.c: add :sh1 which only evaluates command on first reference. 2025-11-11 Simon J Gerraty <sjg@beast.crufty.net> * configure.in: Force filemon=no for Cygwin and MINGW64_NT 2025-11-10 Simon J Gerraty <sjg@beast.crufty.net> * unit-tests/Makefile: handle MINGW64_NT mark some tests broken, filter others as per Cygwin. 2025-10-23 Simon J Gerraty <sjg@beast.crufty.net> * make.1: document MAKE_VERSION. 2025-10-22 Simon J Gerraty <sjg@beast.crufty.net> * VERSION (_MAKE_VERSION): 20251022 * configure.in: Add a check that lua is version 5.2 or later if not we want to skip running check-expect.lua 2025-09-16 Simon J Gerraty <sjg@beast.crufty.net> * VERSION (_MAKE_VERSION): 20250916 Merge with NetBSD make, pick up o var.c: avoid compiler warning from hexdigits mk/ChangeLog since bmake-20250804 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
-rw-r--r--ChangeLog37
-rw-r--r--FILES2
-rw-r--r--LICENSE6
-rw-r--r--VERSION2
-rw-r--r--bmake.113
-rw-r--r--bmake.cat112
-rwxr-xr-xboot-strap23
-rwxr-xr-xconfigure53
-rw-r--r--configure.in36
-rwxr-xr-xinstall-sh11
-rw-r--r--main.c13
-rw-r--r--make.113
-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
-rwxr-xr-xos.sh9
-rw-r--r--sigaction.c14
-rw-r--r--sigcompat.c14
-rw-r--r--unit-tests/Makefile31
-rw-r--r--unit-tests/Makefile.config.in7
-rwxr-xr-xunit-tests/directive-dinclude.mk2
-rwxr-xr-xunit-tests/directive-hyphen-include.mk2
-rw-r--r--unit-tests/directive-include-guard.mk4
-rwxr-xr-xunit-tests/directive-include.mk2
-rwxr-xr-xunit-tests/directive-sinclude.mk2
-rw-r--r--unit-tests/opt-debug-file.exp2
-rw-r--r--unit-tests/opt-debug-file.mk6
-rw-r--r--unit-tests/varmod-sun-shell1.exp14
-rw-r--r--unit-tests/varmod-sun-shell1.mk25
-rw-r--r--unit-tests/varname-circumflex.mk4
-rw-r--r--var.c46
-rw-r--r--wait.h14
89 files changed, 656 insertions, 684 deletions
diff --git a/ChangeLog b/ChangeLog
index e8f1567733e4..11b1684bf7d5 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,40 @@
+2025-11-15 Simon J Gerraty <sjg@beast.crufty.net>
+
+ * boot-strap: unset more things from env and save a copy
+ to env.out for debugging.
+
+2025-11-12 Simon J Gerraty <sjg@beast.crufty.net>
+
+ * VERSION (_MAKE_VERSION): 20251111
+ Merge with NetBSD make, pick up
+ o var.c: add :sh1 which only evaluates command on first reference.
+
+2025-11-11 Simon J Gerraty <sjg@beast.crufty.net>
+
+ * configure.in: Force filemon=no for Cygwin and MINGW64_NT
+
+2025-11-10 Simon J Gerraty <sjg@beast.crufty.net>
+
+ * unit-tests/Makefile: handle MINGW64_NT
+ mark some tests broken, filter others as per Cygwin.
+
+2025-10-23 Simon J Gerraty <sjg@beast.crufty.net>
+
+ * make.1: document MAKE_VERSION.
+
+2025-10-22 Simon J Gerraty <sjg@beast.crufty.net>
+
+ * VERSION (_MAKE_VERSION): 20251022
+
+ * configure.in: Add a check that lua is version 5.2 or later
+ if not we want to skip running check-expect.lua
+
+2025-09-16 Simon J Gerraty <sjg@beast.crufty.net>
+
+ * VERSION (_MAKE_VERSION): 20250916
+ Merge with NetBSD make, pick up
+ o var.c: avoid compiler warning from hexdigits
+
2025-08-04 Simon J Gerraty <sjg@beast.crufty.net>
* VERSION (_MAKE_VERSION): 20250804
diff --git a/FILES b/FILES
index 28465b6a8c39..7f6024418d94 100644
--- a/FILES
+++ b/FILES
@@ -760,6 +760,8 @@ unit-tests/varmod-subst.exp
unit-tests/varmod-subst.mk
unit-tests/varmod-sun-shell.exp
unit-tests/varmod-sun-shell.mk
+unit-tests/varmod-sun-shell1.exp
+unit-tests/varmod-sun-shell1.mk
unit-tests/varmod-sysv.exp
unit-tests/varmod-sysv.mk
unit-tests/varmod-tail.exp
diff --git a/LICENSE b/LICENSE
index 0d460e91d230..28832d20a6ef 100644
--- a/LICENSE
+++ b/LICENSE
@@ -2,11 +2,11 @@ The individual files in this distribution are copyright their
original contributors or assignees.
Including:
- Copyright (c) 1993-2021, Simon J Gerraty
- Copyright (c) 2020, Roland Illig <rillig@NetBSD.org>
+ Copyright (c) 1993-2025, Simon J Gerraty
+ Copyright (c) 2020-2021, Roland Illig <rillig@NetBSD.org>
Copyright (c) 2009-2016, Juniper Networks, Inc.
Copyright (c) 2009, John Birrell.
- Copyright (c) 1997-2021 The NetBSD Foundation, Inc.
+ Copyright (c) 1997-2025 The NetBSD Foundation, Inc.
Copyright (c) 1998 Todd C. Miller <Todd.Miller@courtesan.com>
Copyright (c) 1989 by Berkeley Softworks
Copyright (c) 1988, 1989, 1990, 1992, 1993
diff --git a/VERSION b/VERSION
index e301cfafab72..2c7c307f2a90 100644
--- a/VERSION
+++ b/VERSION
@@ -1,2 +1,2 @@
# keep this compatible with sh and make
-_MAKE_VERSION=20250804
+_MAKE_VERSION=20251111
diff --git a/bmake.1 b/bmake.1
index 01f173bc1a69..a9de459de862 100644
--- a/bmake.1
+++ b/bmake.1
@@ -1,4 +1,4 @@
-.\" $NetBSD: make.1,v 1.387 2025/07/02 17:11:56 rillig Exp $
+.\" $NetBSD: make.1,v 1.388 2025/11/12 22:14:07 sjg Exp $
.\"
.\" Copyright (c) 1990, 1993
.\" The Regents of the University of California. All rights reserved.
@@ -29,7 +29,7 @@
.\"
.\" from: @(#)make.1 8.4 (Berkeley) 3/19/94
.\"
-.Dd July 2, 2025
+.Dd November 11, 2025
.Dt BMAKE 1
.Os
.Sh NAME
@@ -945,6 +945,11 @@ include additional unexpanded variable references) are shown.
.It Va .MAKE.EXPORTED
The list of variables exported by
.Nm .
+.It Va MAKE_VERSION
+This variable indicates the version of
+.Nm .
+It is typically the date of last import from NetBSD.
+It is useful for checking whether certain features are available.
.It Va MAKEFILE
The top-level makefile that is currently read,
as given in the command line.
@@ -1881,6 +1886,10 @@ The output of running
is the value.
.It Cm \&:sh
The value is run as a command, and the output becomes the new value.
+.It Cm \&:sh1
+The value is run as a command, for the first reference only, and
+the output is cached for subsequent references.
+This modifier is useful when the result is not expected to change.
.It Cm \&::= Ns Ar str
The variable is assigned the value
.Ar str
diff --git a/bmake.cat1 b/bmake.cat1
index 950437a8db9c..baaad7b4ed70 100644
--- a/bmake.cat1
+++ b/bmake.cat1
@@ -607,6 +607,11 @@ VVAARRIIAABBLLEE AASSSSIIGGNNMMEENNTTSS
_._M_A_K_E_._E_X_P_O_R_T_E_D
The list of variables exported by bbmmaakkee.
+ _M_A_K_E___V_E_R_S_I_O_N
+ This variable indicates the version of bbmmaakkee. It is typically
+ the date of last import from NetBSD. It is useful for checking
+ whether certain features are available.
+
_M_A_K_E_F_I_L_E
The top-level makefile that is currently read, as given in the
command line.
@@ -1190,6 +1195,11 @@ VVAARRIIAABBLLEE AASSSSIIGGNNMMEENNTTSS
::sshh The value is run as a command, and the output becomes the new value.
+ ::sshh11
+ The value is run as a command, for the first reference only, and the
+ output is cached for subsequent references. This modifier is useful
+ when the result is not expected to change.
+
::::==_s_t_r
The variable is assigned the value _s_t_r after substitution. This
modifier and its variations are useful in obscure situations such as
@@ -1864,4 +1874,4 @@ BBUUGGSS
attempt to suppress a cascade of unnecessary errors, can result in a
seemingly unexplained `*** Error code 6'
-FreeBSD 14.2-RELEASE-p1 July 2, 2025 FreeBSD 14.2-RELEASE-p1
+FreeBSD 14.3-RELEASE-p3 November 11, 2025 FreeBSD 14.3-RELEASE-p3
diff --git a/boot-strap b/boot-strap
index b025de52a82b..51e81083b95b 100755
--- a/boot-strap
+++ b/boot-strap
@@ -133,7 +133,7 @@
# Simon J. Gerraty <sjg@crufty.net>
# RCSid:
-# $Id: boot-strap,v 1.61 2024/03/10 17:51:10 sjg Exp $
+# $Id: boot-strap,v 1.62 2025/11/15 16:53:14 sjg Exp $
#
# @(#) Copyright (c) 2001 Simon J. Gerraty
#
@@ -179,12 +179,25 @@ source_rc() {
done
}
+have() {
+ case `(type "$1") 2>&1` in
+ *" found") return 1;;
+ esac
+ return 0
+}
+
+Env() {
+ have env && env || set
+}
+
cmd_args="$@"
# clear some things from the environment that we care about
-unset MAKEOBJDIR MAKEOBJDIRPREFIX
-# or that might be incompatible
-unset MAKE MAKEFLAGS
+# any variable starting with any of these prefixes will be unset
+for p in MAKE OBJ SB WITH
+do
+ unset ENV `Env | sed -n "/^$p/s,=.*,,p"`
+done
# --install[-host-target] will set this
INSTALL_PREFIX=
@@ -381,6 +394,8 @@ objdir="${objdir:-$OBJROOT$HOST_TARGET}"
cd "$objdir" || exit 1
# make it absolute
objdir=`'pwd'`
+# save a copy of our env for debugging
+Env > env.out
ShareDir() {
case "/$1" in
diff --git a/configure b/configure
index e34740cd2cfa..9bbdb8d2b36b 100755
--- a/configure
+++ b/configure
@@ -1,6 +1,6 @@
#! /bin/sh
# Guess values for system-dependent variables and create Makefiles.
-# Generated by GNU Autoconf 2.72 for bmake 20240711.
+# Generated by GNU Autoconf 2.72 for bmake 20251111.
#
# Report bugs to <sjg@NetBSD.org>.
#
@@ -603,8 +603,8 @@ MAKEFLAGS=
# Identity of this package.
PACKAGE_NAME='bmake'
PACKAGE_TARNAME='bmake'
-PACKAGE_VERSION='20240711'
-PACKAGE_STRING='bmake 20240711'
+PACKAGE_VERSION='20251111'
+PACKAGE_STRING='bmake 20251111'
PACKAGE_BUGREPORT='sjg@NetBSD.org'
PACKAGE_URL=''
@@ -644,6 +644,7 @@ ac_func_c_list=
ac_subst_vars='LTLIBOBJS
UTC_1
_MAKE_VERSION
+lua
filemon_h
use_filemon
use_meta
@@ -720,6 +721,7 @@ with_makefile
with_meta
with_filemon
with_bmake_strftime
+with_lua
with_machine
with_force_machine
with_force_machine_arch
@@ -1286,7 +1288,7 @@ if test "$ac_init_help" = "long"; then
# Omit some internal or obsolete options to make the list less imposing.
# This message is too long to be a string in the A/UX 3.1 sh.
cat <<_ACEOF
-'configure' configures bmake 20240711 to adapt to many kinds of systems.
+'configure' configures bmake 20251111 to adapt to many kinds of systems.
Usage: $0 [OPTION]... [VAR=VALUE]...
@@ -1348,7 +1350,7 @@ fi
if test -n "$ac_init_help"; then
case $ac_init_help in
- short | recursive ) echo "Configuration of bmake 20240711:";;
+ short | recursive ) echo "Configuration of bmake 20251111:";;
esac
cat <<\_ACEOF
@@ -1371,6 +1373,7 @@ Optional Packages:
--without-meta disable use of meta-mode
--with-filemon={no,dev,ktrace,path/filemon.h} indicate filemon method for meta-mode. Path to filemon.h implies dev
--with-bmake-strftime force use of bmake strftime
+ --without-lua do not use check-expect.lua
--with-machine=MACHINE explicitly set MACHINE
--with-force-machine=MACHINE set FORCE_MACHINE
--with-force-machine-arch=MACHINE set FORCE_MACHINE_ARCH
@@ -1458,7 +1461,7 @@ fi
test -n "$ac_init_help" && exit $ac_status
if $ac_init_version; then
cat <<\_ACEOF
-bmake configure 20240711
+bmake configure 20251111
generated by GNU Autoconf 2.72
Copyright (C) 2023 Free Software Foundation, Inc.
@@ -1981,7 +1984,7 @@ cat >config.log <<_ACEOF
This file contains any messages produced by compilers while
running configure, to aid debugging if configure makes a mistake.
-It was created by bmake $as_me 20240711, which was
+It was created by bmake $as_me 20251111, which was
generated by GNU Autoconf 2.72. Invocation command line was
$ $0$ac_configure_args_raw
@@ -2772,6 +2775,13 @@ esac
. $srcdir/VERSION
OS=`uname -s`
+have() {
+ case `(type "$1") 2>&1` in
+ *" found") return 1;;
+ esac
+ return 0
+}
+
use_defshell() {
case "$defshell_path$DEFSHELL_INDEX" in
"") ;;
@@ -2867,6 +2877,7 @@ esac
else case e in #(
e)
case "$OS" in
+Cygwin*|MINGW*) use_filemon=no;;
NetBSD) filemon_h=no use_filemon=ktrace;;
*)
for d in "/usr/include/dev/filemon" "$prefix/include/dev/filemon" "$srcdir/../../sys/dev/filemon"
@@ -2943,6 +2954,29 @@ do
PATH=$PATH:$d
done
export PATH
+lua=$LUA
+
+# Check whether --with-lua was given.
+if test ${with_lua+y}
+then :
+ withval=$with_lua; case "${withval}" in
+no) lua=:;;
+yes) lua= ;;
+/*lua*) lua=$withval;;
+*) as_fn_error $? "bad value ${withval} given for lua" "$LINENO" 5;;
+esac
+fi
+
+if test "x$lua" != x:; then
+ if have lua; then
+ lua_version=`${lua:-lua} -v | sed 's/Lua //;s/ *Copy.*//;'`
+ echo $ECHO_N "checking whether lua version ($lua_version) > 5.2... $ECHO_C" >&6
+ case "$lua_version" in
+ 4.*|5.1.*) lua=:; echo no >&6;;
+ *) echo yes >&6;;
+ esac
+ fi
+fi
@@ -7277,6 +7311,7 @@ esac
+
bm_outfiles="Makefile.config unit-tests/Makefile.config make-bootstrap.sh"
if test $use_makefile = yes; then
bm_outfiles="makefile $bm_outfiles"
@@ -7798,7 +7833,7 @@ cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1
# report actual input values of CONFIG_FILES etc. instead of their
# values after options handling.
ac_log="
-This file was extended by bmake $as_me 20240711, which was
+This file was extended by bmake $as_me 20251111, which was
generated by GNU Autoconf 2.72. Invocation command line was
CONFIG_FILES = $CONFIG_FILES
@@ -7862,7 +7897,7 @@ ac_cs_config_escaped=`printf "%s\n" "$ac_cs_config" | sed "s/^ //; s/'/'\\\\\\\\
cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1
ac_cs_config='$ac_cs_config_escaped'
ac_cs_version="\\
-bmake config.status 20240711
+bmake config.status 20251111
configured by $0, generated by GNU Autoconf 2.72,
with options \\"\$ac_cs_config\\"
diff --git a/configure.in b/configure.in
index 294246dea60d..f378b57fd14a 100644
--- a/configure.in
+++ b/configure.in
@@ -1,11 +1,11 @@
dnl
dnl RCSid:
-dnl $Id: configure.in,v 1.108 2024/07/13 15:27:00 sjg Exp $
+dnl $Id: configure.in,v 1.111 2025/11/11 18:43:59 sjg Exp $
dnl
dnl Process this file with autoconf to produce a configure script
dnl
AC_PREREQ([2.71])
-AC_INIT([bmake],[20240711],[sjg@NetBSD.org])
+AC_INIT([bmake],[20251111],[sjg@NetBSD.org])
AC_CONFIG_HEADERS(config.h)
dnl make srcdir absolute
@@ -18,6 +18,14 @@ dnl get _MAKE_VERSION
. $srcdir/VERSION
OS=`uname -s`
+dnl do not trust return from type
+have() {
+ case `(type "$1") 2>&1` in
+ *" found") return 1;;
+ esac
+ return 0
+}
+
dnl function to set DEFSHELL_INDEX
use_defshell() {
case "$defshell_path$DEFSHELL_INDEX" in
@@ -107,6 +115,7 @@ esac
],
[
case "$OS" in
+Cygwin*|MINGW*) use_filemon=no;;
NetBSD) filemon_h=no use_filemon=ktrace;;
*)
for d in "/usr/include/dev/filemon" "$prefix/include/dev/filemon" "$srcdir/../../sys/dev/filemon"
@@ -187,6 +196,28 @@ do
PATH=$PATH:$d
done
export PATH
+dnl
+dnl if lua is available check it is version 5.2 or later
+lua=$LUA
+AC_ARG_WITH(lua,
+[ --without-lua do not use check-expect.lua],
+[case "${withval}" in
+no) lua=:;;
+yes) lua= ;;
+/*lua*) lua=$withval;;
+*) AC_MSG_ERROR(bad value ${withval} given for lua);;
+esac])
+if test "x$lua" != x:; then
+ if have lua; then
+ lua_version=`${lua:-lua} -v | sed 's/Lua //;s/ *Copy.*//;'`
+ echo $ECHO_N "checking whether lua version ($lua_version) > 5.2... $ECHO_C" >&6
+ case "$lua_version" in
+ 4.*|5.1.*) lua=:; echo no >&6;;
+ *) echo yes >&6;;
+ esac
+ fi
+fi
+dnl
dnl Solaris's signal.h only privides sigset_t etc if one of
dnl _EXTENSIONS_ _POSIX_C_SOURCE or _XOPEN_SOURCE are defined.
dnl The later two seem to cause more problems than they solve so if we
@@ -580,6 +611,7 @@ AC_SUBST(diff_u)
AC_SUBST(use_meta)
AC_SUBST(use_filemon)
AC_SUBST(filemon_h)
+AC_SUBST(lua)
AC_SUBST(_MAKE_VERSION)
AC_SUBST(UTC_1)
bm_outfiles="Makefile.config unit-tests/Makefile.config make-bootstrap.sh"
diff --git a/install-sh b/install-sh
index aa35fa94c83a..14ddc8ccd13a 100755
--- a/install-sh
+++ b/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/main.c b/main.c
index a773b44f42c4..24a1caef4291 100644
--- a/main.c
+++ b/main.c
@@ -1,4 +1,4 @@
-/* $NetBSD: main.c,v 1.661 2025/07/06 07:11:31 rillig Exp $ */
+/* $NetBSD: main.c,v 1.662 2025/08/09 23:13:28 rillig Exp $ */
/*
* Copyright (c) 1988, 1989, 1990, 1993
@@ -111,7 +111,7 @@
#include "trace.h"
/* "@(#)main.c 8.3 (Berkeley) 3/19/94" */
-MAKE_RCSID("$NetBSD: main.c,v 1.661 2025/07/06 07:11:31 rillig Exp $");
+MAKE_RCSID("$NetBSD: main.c,v 1.662 2025/08/09 23:13:28 rillig Exp $");
#if defined(MAKE_NATIVE)
__COPYRIGHT("@(#) Copyright (c) 1988, 1989, 1990, 1993 "
"The Regents of the University of California. "
@@ -390,8 +390,8 @@ MainParseArgJobsInternal(const char *argvalue)
progname, argvalue, curdir);
exit(2);
}
- if ((fcntl(tokenPoolReader, F_GETFD, 0) < 0) ||
- (fcntl(tokenPoolWriter, F_GETFD, 0) < 0)) {
+ if (fcntl(tokenPoolReader, F_GETFD, 0) < 0 ||
+ fcntl(tokenPoolWriter, F_GETFD, 0) < 0) {
tokenPoolReader = -1;
tokenPoolWriter = -1;
bogusJflag = true;
@@ -601,7 +601,7 @@ MainParseArgs(int argc, char **argv)
bool inOption, dashDash = false;
const char *optspecs = "BC:D:I:J:NST:V:WXd:ef:ij:km:nqrstv:w";
-/* Can't actually use getopt(3) because rescanning is not portable */
+ /* Can't actually use getopt(3) because rescanning is not portable */
rearg:
inOption = false;
@@ -1709,7 +1709,7 @@ ReadMakefile(const char *fname)
* placement of the setting here means it gets set to the last
* makefile specified, as it is set by SysV make.
*/
-found:
+ found:
if (!doing_depend)
Var_Set(SCOPE_INTERNAL, "MAKEFILE", fname);
Parse_File(fname, fd);
@@ -1802,7 +1802,6 @@ Cmd_Exec(const char *cmd, char **error)
(void)execv(shellPath, UNCONST(args));
_exit(1);
- /* NOTREACHED */
case -1:
*error = str_concat3("Couldn't exec \"", cmd, "\"");
diff --git a/make.1 b/make.1
index 1ac72f11aa83..59cd1bd99e2c 100644
--- a/make.1
+++ b/make.1
@@ -1,4 +1,4 @@
-.\" $NetBSD: make.1,v 1.387 2025/07/02 17:11:56 rillig Exp $
+.\" $NetBSD: make.1,v 1.388 2025/11/12 22:14:07 sjg Exp $
.\"
.\" Copyright (c) 1990, 1993
.\" The Regents of the University of California. All rights reserved.
@@ -29,7 +29,7 @@
.\"
.\" from: @(#)make.1 8.4 (Berkeley) 3/19/94
.\"
-.Dd July 2, 2025
+.Dd November 11, 2025
.Dt MAKE 1
.Os
.Sh NAME
@@ -945,6 +945,11 @@ include additional unexpanded variable references) are shown.
.It Va .MAKE.EXPORTED
The list of variables exported by
.Nm .
+.It Va MAKE_VERSION
+This variable indicates the version of
+.Nm .
+It is typically the date of last import from NetBSD.
+It is useful for checking whether certain features are available.
.It Va MAKEFILE
The top-level makefile that is currently read,
as given in the command line.
@@ -1881,6 +1886,10 @@ The output of running
is the value.
.It Cm \&:sh
The value is run as a command, and the output becomes the new value.
+.It Cm \&:sh1
+The value is run as a command, for the first reference only, and
+the output is cached for subsequent references.
+This modifier is useful when the result is not expected to change.
.It Cm \&::= Ns Ar str
The variable is assigned the value
.Ar str
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
diff --git a/os.sh b/os.sh
index 13b0730464e9..86ec86bc4929 100755
--- a/os.sh
+++ b/os.sh
@@ -17,16 +17,11 @@
# Simon J. Gerraty <sjg@crufty.net>
# RCSid:
-# $Id: os.sh,v 1.67 2025/02/13 21:04:34 sjg Exp $
+# $Id: os.sh,v 1.68 2025/08/07 21:59:54 sjg Exp $
#
# @(#) Copyright (c) 1994 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/sigaction.c b/sigaction.c
index dc647e7b058f..ad1696306667 100644
--- a/sigaction.c
+++ b/sigaction.c
@@ -104,24 +104,16 @@
* Simon J. Gerraty <sjg@crufty.net>
*/
/* COPYRIGHT:
- * @(#)Copyright (c) 1992-2021, Simon J. Gerraty
+ * @(#)Copyright (c) 1992-2025, Simon J. Gerraty
*
- * This is free software. It comes with NO WARRANTY.
- * Permission to use, modify and distribute this source code
- * is granted subject to the following conditions.
- * 1/ that that the above copyright notice and this notice
- * are preserved in all copies and that due credit be given
- * to the author.
- * 2/ that any changes to this code are clearly commented
- * as such so that the author does get blamed for bugs
- * other than his own.
+ * SPDX-License-Identifier: BSD-2-Clause
*
* Please send copies of changes and bug-fixes to:
* sjg@crufty.net
*
*/
#ifndef lint
-static char *RCSid = "$Id: sigact.c,v 1.8 2021/10/14 19:39:17 sjg Exp $";
+static char *RCSid = "$Id: sigact.c,v 1.9 2025/08/09 22:11:45 sjg Exp $";
#endif
#undef _ANSI_SOURCE /* causes problems */
diff --git a/sigcompat.c b/sigcompat.c
index c720eeba92e5..9c6a7db89733 100644
--- a/sigcompat.c
+++ b/sigcompat.c
@@ -37,17 +37,9 @@
* Simon J. Gerraty <sjg@crufty.net>
*/
/*
- * @(#)Copyright (c) 1994, Simon J. Gerraty.
+ * @(#)Copyright (c) 1994-2025, Simon J. Gerraty.
*
- * This is free software. It comes with NO WARRANTY.
- * Permission to use, modify and distribute this source code
- * is granted subject to the following conditions.
- * 1/ that the above copyright notice and this notice
- * are preserved in all copies and that due credit be given
- * to the author.
- * 2/ that any changes to this code are clearly commented
- * as such so that the author does not get blamed for bugs
- * other than his own.
+ * SPDX-License-Identifier: BSD-2-Clause
*
* Please send copies of changes and bug-fixes to:
* sjg@crufty.net
@@ -104,7 +96,7 @@
#if defined(LIBC_SCCS) && !defined(lint)
/*static char *sccsid = "from: @(#)sigcompat.c 5.3 (Berkeley) 2/24/91";*/
-static char *rcsid = "$Id: sigcompat.c,v 1.24 2022/09/26 17:38:10 sjg Exp $";
+static char *rcsid = "$Id: sigcompat.c,v 1.25 2025/08/09 22:11:45 sjg Exp $";
#endif /* LIBC_SCCS and not lint */
#undef signal
diff --git a/unit-tests/Makefile b/unit-tests/Makefile
index f6c298679a62..63671a6d9b74 100644
--- a/unit-tests/Makefile
+++ b/unit-tests/Makefile
@@ -1,6 +1,6 @@
-# $Id: Makefile,v 1.245 2025/08/05 16:18:07 sjg Exp $
+# $Id: Makefile,v 1.251 2025/11/15 17:17:18 sjg Exp $
#
-# $NetBSD: Makefile,v 1.372 2025/08/04 22:44:49 sjg Exp $
+# $NetBSD: Makefile,v 1.373 2025/11/12 22:14:08 sjg Exp $
#
# Unit tests for make(1)
#
@@ -403,6 +403,7 @@ TESTS+= varmod-shell
TESTS+= varmod-subst
TESTS+= varmod-subst-regex
TESTS+= varmod-sun-shell
+TESTS+= varmod-sun-shell1
TESTS+= varmod-sysv
TESTS+= varmod-tail
TESTS+= varmod-to-abs
@@ -519,6 +520,14 @@ BROKEN_TESTS+= \
.endif
+.if ${.MAKE.OS:NMINGW*} == ""
+BROKEN_TESTS+= \
+ cmdline \
+ objdir-writable \
+ varname-dot-make-level \
+
+.endif
+
.if ${.MAKE.OS} == "SCO_SV"
BROKEN_TESTS+= \
opt-debug-graph[23] \
@@ -594,8 +603,12 @@ SED_CMDS.directive-include-guard= \
-e '/^ParseEOF:/d'
SED_CMDS.export= -e '/^[^=_A-Za-z0-9]*=/d'
SED_CMDS.export+= -e '/^DIFF/d'
-.if ${.MAKE.OS:NCygwin} == ""
-SED_CMDS.export+= -e '/^WINDIR=/d' -e '/^SYSTEMROOT=/d'
+.if ${.MAKE.OS:NCygwin:NMINGW*} == ""
+SED_CMDS.export+= \
+ -e '/MSYSTEM=/d' \
+ -e '/^SYSTEMROOT=/d' \
+ -e '/^WINDIR=/d' \
+
.endif
SED_CMDS.export-all= ${SED_CMDS.export}
SED_CMDS.export-env= ${SED_CMDS.export}
@@ -847,6 +860,12 @@ _SED_CMDS+= -e 's,${.CURDIR},<curdir>,g'
# which we get depending on how MAKEOBJDIR is set.
_SED_CMDS+= -e 's,${.OBJDIR},<curdir>,g' -e 's,${.OBJDIR:tA},<curdir>,g'
.endif
+
+# At the end, make sure we cleanup any dregs...
+.for d in ${MAKEOBJDIRPREFIX:S,/$,,} /usr/obj
+_SED_CMDS_LAST+= -e 's,$d,,'
+.endfor
+
# always pretend .MAKE was called 'make'
_SED_CMDS+= -e 's,^${TEST_MAKE:T:S,.,\\.,g}[][0-9]*:,make:,'
_SED_CMDS+= -e 's,${TEST_MAKE:S,.,\\.,g},make,'
@@ -868,7 +887,7 @@ SED_CMDS.opt-debug-jobs+= -e 's,Command: <shell> -v,Command: <shell>,'
.endif
.rawout.out:
- @${TOOL_SED} ${_SED_CMDS} ${SED_CMDS.${.PREFIX:T}} \
+ @${TOOL_SED} ${_SED_CMDS} ${SED_CMDS.${.PREFIX:T}} ${_SED_CMDS_LAST} \
< ${.IMPSRC} > ${.TARGET}.tmp
@${POSTPROC.${.PREFIX:T}:D \
${POSTPROC.${.PREFIX:T}} < ${.TARGET}.tmp > ${.TARGET}.post \
@@ -895,7 +914,7 @@ test: ${OUTFILES} .PHONY
echo "Failed tests: $${failed}" ; false ; \
else \
echo "All tests passed" ; \
- lua=${LUA:Ulua} ; \
+ lua=${LUA} ; lua=$${lua:-lua}; \
have_lua=$$("$$lua" -e 'print "yes"' 2>&1) ; \
if [ "$$have_lua" = "yes" -a -s ${.CURDIR}/check-expect.lua ]; then \
(cd ${.CURDIR} && "$$lua" ./check-expect.lua *.mk); \
diff --git a/unit-tests/Makefile.config.in b/unit-tests/Makefile.config.in
index 30049eaa7c26..4ecd8efe7059 100644
--- a/unit-tests/Makefile.config.in
+++ b/unit-tests/Makefile.config.in
@@ -1,7 +1,8 @@
-# $Id: Makefile.config.in,v 1.4 2022/09/09 18:44:56 sjg Exp $
+# $Id: Makefile.config.in,v 1.5 2025/10/22 23:20:41 sjg Exp $
-srcdir= @srcdir@
+DIFF_FLAGS?= @diff_u@
EGREP= @egrep@
+LUA?= @lua@
TOOL_DIFF?= @diff@
-DIFF_FLAGS?= @diff_u@
UTC_1= @UTC_1@
+srcdir= @srcdir@
diff --git a/unit-tests/directive-dinclude.mk b/unit-tests/directive-dinclude.mk
index da063083235f..c05d1a55f51b 100755
--- a/unit-tests/directive-dinclude.mk
+++ b/unit-tests/directive-dinclude.mk
@@ -18,7 +18,7 @@
# Errors that are not related to opening the file are still reported.
# expect: make: directive-dinclude-error.inc:1: Invalid line "syntax error"
_!= echo 'syntax error' > directive-dinclude-error.inc
-.dinclude "${.CURDIR}/directive-dinclude-error.inc"
+.dinclude "${.OBJDIR}/directive-dinclude-error.inc"
_!= rm directive-dinclude-error.inc
all: .PHONY
diff --git a/unit-tests/directive-hyphen-include.mk b/unit-tests/directive-hyphen-include.mk
index de438dfaffac..e3817ef15539 100755
--- a/unit-tests/directive-hyphen-include.mk
+++ b/unit-tests/directive-hyphen-include.mk
@@ -17,7 +17,7 @@
# Errors that are not related to opening the file are still reported.
# expect: make: directive-hyphen-include-error.inc:1: Invalid line "syntax error"
_!= echo 'syntax error' > directive-hyphen-include-error.inc
-.-include "${.CURDIR}/directive-hyphen-include-error.inc"
+.-include "${.OBJDIR}/directive-hyphen-include-error.inc"
_!= rm directive-hyphen-include-error.inc
all: .PHONY
diff --git a/unit-tests/directive-include-guard.mk b/unit-tests/directive-include-guard.mk
index 702d0f4ab9dc..5dc7f1aac178 100644
--- a/unit-tests/directive-include-guard.mk
+++ b/unit-tests/directive-include-guard.mk
@@ -636,9 +636,9 @@ LINES.multiline= \
_:= ${fname:H:N.:@dir@${:!mkdir -p ${dir}!}@}
_!= printf '%s\n' ${LINES.$i} > ${fname}
.MAKEFLAGS: -dp
-.include "${.CURDIR}/${fname}"
+.include "${.OBJDIR}/${fname}"
.undef ${UNDEF_BETWEEN.$i:U}
-.include "${.CURDIR}/${fname}"
+.include "${.OBJDIR}/${fname}"
.MAKEFLAGS: -d0
_!= rm ${fname}
_:= ${fname:H:N.:@dir@${:!rmdir ${dir}!}@}
diff --git a/unit-tests/directive-include.mk b/unit-tests/directive-include.mk
index ad6936ab2f3c..a694b9ca4e91 100755
--- a/unit-tests/directive-include.mk
+++ b/unit-tests/directive-include.mk
@@ -82,7 +82,7 @@ include
# Buf_InitSize, which assumes that bmake_malloc never returns NULL, just like
# all other places in the code.
_!= > directive-include-empty
-.include "${.CURDIR}/directive-include-empty"
+.include "${.OBJDIR}/directive-include-empty"
_!= rm directive-include-empty
diff --git a/unit-tests/directive-sinclude.mk b/unit-tests/directive-sinclude.mk
index 4c856d22be4f..3c2ffbdc9f6c 100755
--- a/unit-tests/directive-sinclude.mk
+++ b/unit-tests/directive-sinclude.mk
@@ -17,7 +17,7 @@
# Errors that are not related to opening the file are still reported.
# expect: make: directive-include-error.inc:1: Invalid line "syntax error"
_!= echo 'syntax error' > directive-include-error.inc
-.sinclude "${.CURDIR}/directive-include-error.inc"
+.sinclude "${.OBJDIR}/directive-include-error.inc"
_!= rm directive-include-error.inc
all: .PHONY
diff --git a/unit-tests/opt-debug-file.exp b/unit-tests/opt-debug-file.exp
index 4a497f3011d9..2ea5f084f8d6 100644
--- a/unit-tests/opt-debug-file.exp
+++ b/unit-tests/opt-debug-file.exp
@@ -1,4 +1,4 @@
-make: opt-debug-file.mk:54: This goes to stderr only, once.
+make: opt-debug-file.mk:54: This goes to stdout only, once.
make: opt-debug-file.mk:57: This goes to stderr only, once.
make: opt-debug-file.mk:60: This goes to stderr, and in addition to the debug log.
CondParser_Eval: ${:!cat opt-debug-file.debuglog!:Maddition:[#]} != 1
diff --git a/unit-tests/opt-debug-file.mk b/unit-tests/opt-debug-file.mk
index d107f177dae3..73a1dac1f6be 100644
--- a/unit-tests/opt-debug-file.mk
+++ b/unit-tests/opt-debug-file.mk
@@ -1,4 +1,4 @@
-# $NetBSD: opt-debug-file.mk,v 1.12 2025/07/06 08:48:34 rillig Exp $
+# $NetBSD: opt-debug-file.mk,v 1.13 2025/08/09 23:09:55 rillig Exp $
#
# Tests for the -dF command line option, which redirects the debug log
# to a file instead of writing it to stderr.
@@ -50,8 +50,8 @@ DEBUG_OUTPUT:= ${:!cat opt-debug-file.debuglog!:S,\$,\$\$,g}
# See Parse_Error.
.MAKEFLAGS: -dFstdout
-# expect+1: This goes to stderr only, once.
-. info This goes to stderr only, once.
+# expect+1: This goes to stdout only, once.
+. info This goes to stdout only, once.
.MAKEFLAGS: -dFstderr
# expect+1: This goes to stderr only, once.
. info This goes to stderr only, once.
diff --git a/unit-tests/varmod-sun-shell1.exp b/unit-tests/varmod-sun-shell1.exp
new file mode 100644
index 000000000000..28fd1fa3d481
--- /dev/null
+++ b/unit-tests/varmod-sun-shell1.exp
@@ -0,0 +1,14 @@
+Global: _ = # (empty)
+Var_Parse: ${THE_ANSWER} (eval-keep-dollar-and-undefined)
+Var_Parse: ${ANSWER:sh1} (eval-keep-dollar-and-undefined)
+Evaluating modifier ${ANSWER:s...} on value "echo 42; (exit 13)" (eval-keep-dollar-and-undefined, regular)
+Capturing the output of command "echo 42; (exit 13)"
+Global: ignoring delete '.SHELL' as it is not found
+Command: .SHELL = /bin/sh
+make: varmod-sun-shell1.mk:17: warning: Command "echo 42; (exit 13)" exited with status 13
+Global: .MAKE.SH1.ANSWER = 42
+Result of ${ANSWER:sh1} is "42" (eval-keep-dollar-and-undefined, regular)
+Global: _ = 42
+Global: .MAKEFLAGS = -r -k -d v -d
+Global: .MAKEFLAGS = -r -k -d v -d 0
+exit status 0
diff --git a/unit-tests/varmod-sun-shell1.mk b/unit-tests/varmod-sun-shell1.mk
new file mode 100644
index 000000000000..a15c93450e76
--- /dev/null
+++ b/unit-tests/varmod-sun-shell1.mk
@@ -0,0 +1,25 @@
+# $NetBSD: varmod-sun-shell1.mk,v 1.1 2025/11/12 22:14:08 sjg Exp $
+#
+# Tests for the :sh1 variable modifier, which runs the shell command
+# given by the variable value only on first reference and caches its output.
+#
+# This modifier has been added on 2025-11-11
+#
+# See also:
+# ApplyModifier_SunShell1
+
+ANSWER= echo 42; (exit 13)
+THE_ANSWER= ${ANSWER:sh1}
+
+# first reference will warn
+.MAKEFLAGS: -dv # to see the "Capturing" debug output
+# expect+1: warning: Command "echo 42; (exit 13)" exited with status 13
+_:= ${THE_ANSWER}
+.MAKEFLAGS: -d0
+
+# subsequent references will not, since we do not execute a command
+.if ${THE_ANSWER} != "42"
+. error
+.endif
+
+all:
diff --git a/unit-tests/varname-circumflex.mk b/unit-tests/varname-circumflex.mk
index 270f7123781b..4825db5794f5 100644
--- a/unit-tests/varname-circumflex.mk
+++ b/unit-tests/varname-circumflex.mk
@@ -1,7 +1,9 @@
-# $NetBSD: varname-circumflex.mk,v 1.1 2025/06/27 20:20:56 rillig Exp $
+# $NetBSD: varname-circumflex.mk,v 1.2 2025/08/09 23:13:29 rillig Exp $
#
# Tests for the target-local variable "^", which is required by POSIX 2024
# and provided by GNU make.
+#
+# https://gnats.netbsd.org/59018
# TODO: Support $^.
diff --git a/var.c b/var.c
index 66b18f769371..09ae6744e001 100644
--- a/var.c
+++ b/var.c
@@ -1,4 +1,4 @@
-/* $NetBSD: var.c,v 1.1171 2025/06/29 11:02:17 rillig Exp $ */
+/* $NetBSD: var.c,v 1.1173 2025/11/12 22:14:07 sjg Exp $ */
/*
* Copyright (c) 1988, 1989, 1990, 1993
@@ -143,7 +143,7 @@
#endif
/* "@(#)var.c 8.3 (Berkeley) 3/19/94" */
-MAKE_RCSID("$NetBSD: var.c,v 1.1171 2025/06/29 11:02:17 rillig Exp $");
+MAKE_RCSID("$NetBSD: var.c,v 1.1173 2025/11/12 22:14:07 sjg Exp $");
/*
* Variables are defined using one of the VAR=value assignments. Their
@@ -1866,7 +1866,7 @@ QuoteShell(const char *str, bool quoteDollar, LazyBuf *buf)
static char *
Hash(const char *str)
{
- static const char hexdigits[16] = "0123456789abcdef";
+ static const char hexdigits[] = "0123456789abcdef";
const unsigned char *ustr = (const unsigned char *)str;
uint32_t h = 0x971e137bU;
@@ -3810,6 +3810,44 @@ ApplyModifier_SunShell(const char **pp, ModChain *ch)
return AMR_OK;
}
+/* :sh1 */
+static ApplyModifierResult
+ApplyModifier_SunShell1(const char **pp, ModChain *ch)
+{
+ Expr *expr = ch->expr;
+ const char *p = *pp;
+
+ if (!(p[1] == 'h' && p[2] == '1' && IsDelimiter(p[3], ch)))
+ return AMR_UNKNOWN;
+ *pp = p + 3;
+
+ if (Expr_ShouldEval(expr)) {
+ char *cache_varname;
+ Var *v;
+
+ cache_varname = str_concat2(".MAKE.SH1.", expr->name);
+ v = VarFind(cache_varname, SCOPE_GLOBAL, false);
+ if (v == NULL) {
+ char *output, *error;
+
+ output = Cmd_Exec(Expr_Str(expr), &error);
+ if (error != NULL) {
+ Parse_Error(PARSE_WARNING, "%s", error);
+ free(error);
+ }
+ Var_SetWithFlags(SCOPE_GLOBAL, cache_varname, output,
+ VAR_SET_NO_EXPORT);
+ Expr_SetValueOwn(expr, output);
+ } else {
+ Expr_SetValueRefer(expr, v->val.data);
+ }
+ free(cache_varname);
+ }
+
+ return AMR_OK;
+}
+
+
/*
* In cases where the evaluation mode and the definedness are the "standard"
* ones, don't log them, to keep the logs readable.
@@ -3925,6 +3963,8 @@ ApplyModifier(const char **pp, ModChain *ch)
case 'S':
return ApplyModifier_Subst(pp, ch);
case 's':
+ if ((*pp)[1] == 'h' && (*pp)[2] == '1')
+ return ApplyModifier_SunShell1(pp, ch);
return ApplyModifier_SunShell(pp, ch);
case 'T':
return ApplyModifier_WordFunc(pp, ch, ModifyWord_Tail);
diff --git a/wait.h b/wait.h
index 7408d15fb070..d117938babc8 100644
--- a/wait.h
+++ b/wait.h
@@ -6,19 +6,11 @@
*/
/*
* RCSid:
- * $Id: wait.h,v 1.6 2002/11/26 07:53:06 sjg Exp $
+ * $Id: wait.h,v 1.7 2025/08/09 22:11:45 sjg Exp $
*
- * @(#)Copyright (c) 1994, Simon J. Gerraty.
+ * @(#)Copyright (c) 1994-2025, Simon J. Gerraty.
*
- * This is free software. It comes with NO WARRANTY.
- * Permission to use, modify and distribute this source code
- * is granted subject to the following conditions.
- * 1/ that the above copyright notice and this notice
- * are preserved in all copies and that due credit be given
- * to the author.
- * 2/ that any changes to this code are clearly commented
- * as such so that the author does not get blamed for bugs
- * other than his own.
+ * SPDX-License-Identifier: BSD-2-Clause
*
* Please send copies of changes and bug-fixes to:
* sjg@crufty.net