git: 4b2e33e48152 - stable/14 - Update to bmake-20240108
- Go to: [ bottom of page ] [ top of archives ] [ this month ]
Date: Sat, 10 Jan 2026 21:33:57 UTC
The branch stable/14 has been updated by sjg:
URL: https://cgit.FreeBSD.org/src/commit/?id=4b2e33e4815262757f998a188821b58b1fe1feea
commit 4b2e33e4815262757f998a188821b58b1fe1feea
Author: Simon J. Gerraty <sjg@FreeBSD.org>
AuthorDate: 2024-01-14 01:31:01 +0000
Commit: Simon J. Gerraty <sjg@FreeBSD.org>
CommitDate: 2026-01-10 21:33:11 +0000
Update to bmake-20240108
(cherry picked from commit d5e0a182cf153f8993a633b93d9220c99a89e760)
---
contrib/bmake/ChangeLog | 102 +++
contrib/bmake/README | 17 +-
contrib/bmake/VERSION | 2 +-
contrib/bmake/arch.c | 10 +-
contrib/bmake/bmake.1 | 6 +-
contrib/bmake/bmake.cat1 | 6 +-
contrib/bmake/boot-strap | 16 +-
contrib/bmake/bsd.after-import.mk | 17 +-
contrib/bmake/buf.c | 6 +-
contrib/bmake/buf.h | 4 +-
contrib/bmake/compat.c | 65 +-
contrib/bmake/cond.c | 111 ++--
contrib/bmake/configure | 34 +-
contrib/bmake/configure.in | 16 +-
contrib/bmake/dir.c | 330 +++-------
contrib/bmake/for.c | 14 +-
contrib/bmake/hash.c | 28 +-
contrib/bmake/hash.h | 21 +-
contrib/bmake/job.c | 139 ++--
contrib/bmake/job.h | 6 +-
contrib/bmake/lst.c | 22 +-
contrib/bmake/lst.h | 8 +-
contrib/bmake/main.c | 156 ++---
contrib/bmake/make.1 | 6 +-
contrib/bmake/make.c | 28 +-
contrib/bmake/make.h | 5 +-
contrib/bmake/meta.c | 6 +-
contrib/bmake/mk/ChangeLog | 42 ++
contrib/bmake/mk/compiler.mk | 4 +-
contrib/bmake/mk/dirdeps.mk | 17 +-
contrib/bmake/mk/dpadd.mk | 14 +-
contrib/bmake/mk/gendirdeps.mk | 6 +-
contrib/bmake/mk/host-target.mk | 7 +-
contrib/bmake/mk/init.mk | 8 +-
contrib/bmake/mk/install-mk | 4 +-
contrib/bmake/mk/jobs.mk | 5 +-
contrib/bmake/mk/lib.mk | 25 +-
contrib/bmake/mk/man.mk | 93 ++-
contrib/bmake/mk/meta.autodep.mk | 4 +-
contrib/bmake/mk/own.mk | 3 +-
contrib/bmake/mk/prog.mk | 5 +-
contrib/bmake/mk/rst2htm.mk | 3 +-
contrib/bmake/os.sh | 0
contrib/bmake/parse.c | 279 +++------
contrib/bmake/str.c | 77 ++-
contrib/bmake/str.h | 29 +-
contrib/bmake/suff.c | 168 ++---
contrib/bmake/unit-tests/Makefile | 9 +-
contrib/bmake/unit-tests/cmd-errors-jobs.exp | 2 +-
contrib/bmake/unit-tests/cmd-errors-lint.exp | 2 +-
contrib/bmake/unit-tests/cmd-errors.exp | 2 +-
contrib/bmake/unit-tests/cmdline-undefined.mk | 4 +-
contrib/bmake/unit-tests/comment.mk | 4 +-
contrib/bmake/unit-tests/cond-cmp-string.mk | 14 +-
contrib/bmake/unit-tests/cond-cmp-unary.mk | 8 +-
contrib/bmake/unit-tests/cond-eof.mk | 4 +-
contrib/bmake/unit-tests/cond-func-defined.exp | 2 +-
contrib/bmake/unit-tests/cond-func-defined.mk | 8 +-
contrib/bmake/unit-tests/cond-func-empty.mk | 16 +-
contrib/bmake/unit-tests/cond-func-exists.mk | 6 +-
contrib/bmake/unit-tests/cond-func.mk | 4 +-
contrib/bmake/unit-tests/cond-late.exp | 2 +-
contrib/bmake/unit-tests/cond-late.mk | 6 +-
contrib/bmake/unit-tests/cond-op-and.mk | 8 +-
contrib/bmake/unit-tests/cond-op-or.mk | 8 +-
contrib/bmake/unit-tests/cond-short.exp | 2 +-
contrib/bmake/unit-tests/cond-short.mk | 23 +-
contrib/bmake/unit-tests/cond-token-number.mk | 6 +-
contrib/bmake/unit-tests/cond-token-plain.exp | 4 +-
contrib/bmake/unit-tests/cond-token-plain.mk | 16 +-
contrib/bmake/unit-tests/cond-token-string.exp | 2 +-
contrib/bmake/unit-tests/cond-token-string.mk | 10 +-
contrib/bmake/unit-tests/cond-token-var.mk | 16 +-
contrib/bmake/unit-tests/dep-var.exp | 2 +-
contrib/bmake/unit-tests/dep-var.mk | 10 +-
contrib/bmake/unit-tests/depsrc-ignore.exp | 2 +-
.../bmake/unit-tests/deptgt-delete_on_error.exp | 2 +-
contrib/bmake/unit-tests/deptgt-makeflags.exp | 2 +-
contrib/bmake/unit-tests/deptgt-makeflags.mk | 6 +-
contrib/bmake/unit-tests/deptgt.mk | 6 +-
contrib/bmake/unit-tests/dir.mk | 4 +-
contrib/bmake/unit-tests/directive-else.mk | 4 +-
.../bmake/unit-tests/directive-export-gmake.exp | 1 +
contrib/bmake/unit-tests/directive-export-gmake.mk | 25 +-
contrib/bmake/unit-tests/directive-export.exp | 6 +-
contrib/bmake/unit-tests/directive-export.mk | 10 +-
contrib/bmake/unit-tests/directive-for-empty.mk | 12 +-
contrib/bmake/unit-tests/directive-for-errors.mk | 14 +-
contrib/bmake/unit-tests/directive-for-escape.exp | 4 +-
contrib/bmake/unit-tests/directive-for-escape.mk | 12 +-
contrib/bmake/unit-tests/directive-for-if.mk | 4 +-
contrib/bmake/unit-tests/directive-for.exp | 19 +-
contrib/bmake/unit-tests/directive-for.mk | 27 +-
contrib/bmake/unit-tests/directive-ifmake.mk | 4 +-
contrib/bmake/unit-tests/directive-ifndef.mk | 36 +-
.../bmake/unit-tests/directive-include-guard.exp | 16 +
.../bmake/unit-tests/directive-include-guard.mk | 188 ++++--
contrib/bmake/unit-tests/directive-warning.mk | 4 +-
contrib/bmake/unit-tests/directive.mk | 4 +-
contrib/bmake/unit-tests/escape.exp | 36 +-
contrib/bmake/unit-tests/escape.mk | 7 +-
contrib/bmake/unit-tests/hanoi-include.mk | 7 +-
contrib/bmake/unit-tests/jobs-error-indirect.exp | 2 +-
.../bmake/unit-tests/jobs-error-nested-make.exp | 2 +-
contrib/bmake/unit-tests/jobs-error-nested.exp | 4 +-
contrib/bmake/unit-tests/lint.mk | 4 +-
contrib/bmake/unit-tests/moderrs.exp | 20 +-
contrib/bmake/unit-tests/moderrs.mk | 6 +-
contrib/bmake/unit-tests/opt-debug-file.mk | 4 +-
contrib/bmake/unit-tests/opt-debug-jobs.mk | 4 +-
contrib/bmake/unit-tests/opt-debug-lint.mk | 6 +-
contrib/bmake/unit-tests/opt-debug-loud.mk | 6 +-
contrib/bmake/unit-tests/opt-debug-var.mk | 4 +-
contrib/bmake/unit-tests/parse-var.mk | 6 +-
contrib/bmake/unit-tests/recursive.exp | 4 +-
contrib/bmake/unit-tests/recursive.mk | 15 +-
contrib/bmake/unit-tests/sh-dots.mk | 6 +-
contrib/bmake/unit-tests/sh-leading-hyphen.exp | 2 +-
contrib/bmake/unit-tests/shell-sh.mk | 4 +-
contrib/bmake/unit-tests/unexport.mk | 4 +-
contrib/bmake/unit-tests/var-eval-short.mk | 4 +-
contrib/bmake/unit-tests/var-op-append.mk | 33 +-
contrib/bmake/unit-tests/var-op-assign.mk | 4 +-
contrib/bmake/unit-tests/var-op-default.mk | 8 +-
contrib/bmake/unit-tests/var-op-expand.mk | 6 +-
contrib/bmake/unit-tests/var-op-shell.mk | 20 +-
contrib/bmake/unit-tests/var-readonly.exp | 3 +
contrib/bmake/unit-tests/var-readonly.mk | 4 +-
contrib/bmake/unit-tests/var-recursive.exp | 8 +-
contrib/bmake/unit-tests/var-recursive.mk | 4 +-
contrib/bmake/unit-tests/var-scope-cmdline.mk | 4 +-
.../bmake/unit-tests/var-scope-local-legacy.exp | 2 +-
contrib/bmake/unit-tests/var-scope-local-legacy.mk | 22 +-
contrib/bmake/unit-tests/var-scope-local.exp | 4 +-
contrib/bmake/unit-tests/var-scope-local.mk | 12 +-
contrib/bmake/unit-tests/vardebug.exp | 20 +-
contrib/bmake/unit-tests/vardebug.mk | 29 +-
contrib/bmake/unit-tests/varmisc.exp | 5 +-
contrib/bmake/unit-tests/varmisc.mk | 28 +-
contrib/bmake/unit-tests/varmod-assign.exp | 32 +
contrib/bmake/unit-tests/varmod-assign.mk | 71 ++-
contrib/bmake/unit-tests/varmod-defined.exp | 2 +-
contrib/bmake/unit-tests/varmod-defined.mk | 10 +-
contrib/bmake/unit-tests/varmod-edge.exp | 2 +-
contrib/bmake/unit-tests/varmod-edge.mk | 8 +-
contrib/bmake/unit-tests/varmod-gmtime.mk | 15 +-
contrib/bmake/unit-tests/varmod-ifelse.exp | 20 +-
contrib/bmake/unit-tests/varmod-ifelse.mk | 36 +-
contrib/bmake/unit-tests/varmod-indirect.mk | 24 +-
contrib/bmake/unit-tests/varmod-l-name-to-value.mk | 4 +-
contrib/bmake/unit-tests/varmod-localtime.mk | 4 +-
contrib/bmake/unit-tests/varmod-loop-varname.mk | 4 +-
contrib/bmake/unit-tests/varmod-loop.mk | 6 +-
contrib/bmake/unit-tests/varmod-match-escape.mk | 20 +-
contrib/bmake/unit-tests/varmod-match.exp | 33 +-
contrib/bmake/unit-tests/varmod-match.mk | 317 ++++++----
contrib/bmake/unit-tests/varmod-mtime.exp | 16 +-
contrib/bmake/unit-tests/varmod-mtime.mk | 45 +-
contrib/bmake/unit-tests/varmod-order.exp | 6 +-
contrib/bmake/unit-tests/varmod-range.exp | 21 +-
contrib/bmake/unit-tests/varmod-range.mk | 26 +-
contrib/bmake/unit-tests/varmod-subst-regex.mk | 57 +-
contrib/bmake/unit-tests/varmod-subst.mk | 46 +-
contrib/bmake/unit-tests/varmod-sysv.mk | 10 +-
contrib/bmake/unit-tests/varmod-to-separator.mk | 4 +-
contrib/bmake/unit-tests/varmod-undefined.mk | 6 +-
contrib/bmake/unit-tests/varmod.mk | 6 +-
contrib/bmake/unit-tests/varname-dot-shell.exp | 10 +-
contrib/bmake/unit-tests/varname-dot-suffixes.exp | 20 +-
contrib/bmake/unit-tests/varname-dot-suffixes.mk | 19 +-
contrib/bmake/unit-tests/varname-empty.exp | 24 +-
contrib/bmake/unit-tests/varname-empty.mk | 4 +-
.../varname-make_print_var_on_error-jobs.mk | 4 +-
contrib/bmake/unit-tests/varname.mk | 4 +-
contrib/bmake/unit-tests/varparse-dynamic.mk | 4 +-
contrib/bmake/unit-tests/varparse-errors.exp | 28 +-
contrib/bmake/unit-tests/varparse-errors.mk | 8 +-
contrib/bmake/unit-tests/varparse-mod.mk | 6 +-
contrib/bmake/unit-tests/varparse-undef-partial.mk | 13 +-
contrib/bmake/util.c | 96 ++-
contrib/bmake/var.c | 696 +++++++++------------
usr.bin/bmake/Makefile.config | 2 +-
usr.bin/bmake/config.h | 4 +-
usr.bin/bmake/unit-tests/Makefile | 9 +-
184 files changed, 2585 insertions(+), 2176 deletions(-)
diff --git a/contrib/bmake/ChangeLog b/contrib/bmake/ChangeLog
index ec0be0f4027c..4bd41562fb30 100644
--- a/contrib/bmake/ChangeLog
+++ b/contrib/bmake/ChangeLog
@@ -1,3 +1,105 @@
+2024-01-08 Simon J Gerraty <sjg@beast.crufty.net>
+
+ * VERSION (_MAKE_VERSION): 20240108
+ Merge with NetBSD make, pick up
+ o miscellaneous cleanups
+
+2024-01-06 Simon J Gerraty <sjg@beast.crufty.net>
+
+ * VERSION (_MAKE_VERSION): 20240106
+ Merge with NetBSD make, pick up
+ o fix duplicate progname when reporting an unknown target
+ o unit tests for Cmd_Exec using temp file
+
+2024-01-05 Simon J Gerraty <sjg@beast.crufty.net>
+
+ * VERSION (_MAKE_VERSION): 20240105
+ Merge with NetBSD make, pick up
+ o main.c: Cmd_Exec write cmd to a file if too big
+ avoid blowing commandline/env limits
+
+2024-01-02 Simon J Gerraty <sjg@beast.crufty.net>
+
+ * VERSION (_MAKE_VERSION): 20240101
+ o util.c: flesh out more of strftime
+ * configure.in: add --with-bmake-strftime
+ it is not a full implementation but enough to pass all
+ the unit-tests.
+ * parse.c: LoadFile do not append \n to empty buffer.
+
+2023-12-30 Simon J Gerraty <sjg@beast.crufty.net>
+
+ * VERSION (_MAKE_VERSION): 20231230
+ Merge with NetBSD make, pick up
+ o simplify memory allocation for string buffers
+ o fix declared types of list nodes
+ o suff.c: clean up freeing of suffixes
+ o var.c: simplify debug message for the ':@var@...@' modifier
+ clean up variable handling
+
+2023-12-26 Simon J Gerraty <sjg@beast.crufty.net>
+
+ * VERSION (_MAKE_VERSION): 20231226
+ Merge with NetBSD make, pick up
+ o compat.c: ensure make's output is correctly ordered with that of
+ the target when not going to a tty
+ o main.c: check for shellPath whether to call Shell_Init()
+
+2023-12-24 Simon J Gerraty <sjg@beast.crufty.net>
+
+ * VERSION (_MAKE_VERSION): 20231224
+ Merge with NetBSD make, pick up
+ o compat.c: check for shellPath whether to call Shell_Init()
+ tweak the unit test to detect the bug thus fixed.
+ o make.1: do not claim .SHELL is only used by jobs mode.
+
+2023-12-22 Simon J Gerraty <sjg@beast.crufty.net>
+
+ * VERSION (_MAKE_VERSION): 20231220
+ Merge with NetBSD make, pick up
+ o str.c: speed up pattern matching in the ':M' modifier
+ o var.c: fix confusing debug logging when deleting a variable
+ use consistent debug messages style when ignoring variables
+
+2023-12-10 Simon J Gerraty <sjg@beast.crufty.net>
+
+ * VERSION (_MAKE_VERSION): 20231210
+ Merge with NetBSD make, pick up
+ o var.c: avoid segfault on empty :C match expression
+ explain in debug log why variable assignment is ignored.
+
+2023-12-08 Simon J Gerraty <sjg@beast.crufty.net>
+
+ * VERSION (_MAKE_VERSION): 20231208
+ Merge with NetBSD make, pick up
+ o var.c: ensure fromCmd is set correctly for variables set on
+ command line.
+
+2023-11-26 Simon J Gerraty <sjg@beast.crufty.net>
+
+ * configure.in: disable generation of 'makefile' for
+ Darwin by default.
+
+ * boot-strap: docuement --without-makefile
+
+2023-11-24 Simon J Gerraty <sjg@beast.crufty.net>
+
+ * VERSION (_MAKE_VERSION): 20231124
+ Merge with NetBSD make, pick up
+ o main.c: cleanup processing of -j
+ fix lint warning about strchr
+ o var.c: more accurate error message for invalid ':mtime' argument
+ cleanup :[...] modifier
+ avoid reading beyond substring when comparing
+ o unit-tests cover all cases of :mtime, test and explain exporting
+ of variables
+ o cleanup comments
+
+2023-09-17 Simon J Gerraty <sjg@beast.crufty.net>
+
+ * bsd.after-import.mk (ECHO_TAG): FreeBSD no longer uses
+ $FreeBSD$ tag, so avoid adding it.
+
2023-09-09 Simon J Gerraty <sjg@beast.crufty.net>
* VERSION (_MAKE_VERSION): 20230909
diff --git a/contrib/bmake/README b/contrib/bmake/README
index a782f6dfc5b5..bf59107db2d3 100644
--- a/contrib/bmake/README
+++ b/contrib/bmake/README
@@ -6,12 +6,12 @@ Since 1993 I have run it on AIX, BSDi, Darwin, FreeBSD, HP-UX, IRIX,
Linux, Minix, OSF, Solaris, SunOS and even UTS.
Others have run it on many more systems.
-Currently each release is tested on NetBSD, FreeBSD, Solaris and Linux.
+Currently each release is tested on Darwin, NetBSD, FreeBSD and Linux.
Since 2003 bmake switched to a date based version (first was 20030714)
which generally represents the date it was last merged with NetBSD's
make. Since then, NetBSD's make is imported within a week of any
-interesting changes, so that bmake tracks it very closely.
+*interesting* changes, so that bmake tracks it very closely.
Building
========
@@ -33,20 +33,27 @@ the GNU standard process of::
./configure; make; make install
+This will *not* work on Darwin or any other system with a case
+insensitive filesystem. It depends on a generated ``makefile`` which
+is disabled by default on Darwin.
+
To make much use of bmake you will need the bsd.*.mk macros or my
portable *.mk macros which are included with bmake since 20121212
and separately available from
-http://www.crufty.net/ftp/pub/sjg/mk.tar.gz
-which will be links to the latest versions.
+https://www.crufty.net/ftp/pub/sjg/mk.tar.gz
+both that and
+https://www.crufty.net/ftp/pub/sjg/bmake.tar.gz
+will be links to the latest versions.
Porting
=======
If you encounter a system that bmake does not build or work on *out of
the box*, I welcome patches.
+Even a report of unit tests which fail is appreciated.
If you can provide access to a suitable machine - even better.
-More info can be found at http://www.crufty.net/help/sjg/bmake.htm
+More info can be found at https://www.crufty.net/help/sjg/bmake.htm
--sjg <sjg@crufty.net>
diff --git a/contrib/bmake/VERSION b/contrib/bmake/VERSION
index 0cc67de7b22d..ca636f3ab1e2 100644
--- a/contrib/bmake/VERSION
+++ b/contrib/bmake/VERSION
@@ -1,2 +1,2 @@
# keep this compatible with sh and make
-_MAKE_VERSION=20230909
+_MAKE_VERSION=20240108
diff --git a/contrib/bmake/arch.c b/contrib/bmake/arch.c
index 6d2c6e0f1875..b90452149c99 100644
--- a/contrib/bmake/arch.c
+++ b/contrib/bmake/arch.c
@@ -1,4 +1,4 @@
-/* $NetBSD: arch.c,v 1.213 2023/02/14 21:08:00 rillig Exp $ */
+/* $NetBSD: arch.c,v 1.214 2023/11/19 22:50:11 rillig Exp $ */
/*
* Copyright (c) 1988, 1989, 1990, 1993
@@ -147,7 +147,7 @@ struct ar_hdr {
#include "dir.h"
/* "@(#)arch.c 8.2 (Berkeley) 1/2/94" */
-MAKE_RCSID("$NetBSD: arch.c,v 1.213 2023/02/14 21:08:00 rillig Exp $");
+MAKE_RCSID("$NetBSD: arch.c,v 1.214 2023/11/19 22:50:11 rillig Exp $");
typedef struct List ArchList;
typedef struct ListNode ArchListNode;
@@ -253,7 +253,7 @@ Arch_ParseArchive(char **pp, GNodeList *gns, GNode *scope)
FStr lib; /* Library-part of specification */
FStr mem; /* Member-part of specification */
char saveChar; /* Ending delimiter of member-name */
- bool expandLib; /* Whether the parsed lib contains variable
+ bool expandLib; /* Whether the parsed lib contains
* expressions that need to be expanded */
spec = *pp;
@@ -262,7 +262,7 @@ Arch_ParseArchive(char **pp, GNodeList *gns, GNode *scope)
for (cp = lib.str; *cp != '(' && *cp != '\0';) {
if (*cp == '$') {
- /* Expand nested variable expressions. */
+ /* Expand nested expressions. */
/* XXX: This code can probably be shortened. */
const char *nested_p = cp;
FStr result;
@@ -299,7 +299,7 @@ Arch_ParseArchive(char **pp, GNodeList *gns, GNode *scope)
mem = FStr_InitRefer(cp);
while (*cp != '\0' && *cp != ')' && !ch_isspace(*cp)) {
if (*cp == '$') {
- /* Expand nested variable expressions. */
+ /* Expand nested expressions. */
/*
* XXX: This code can probably be shortened.
*/
diff --git a/contrib/bmake/bmake.1 b/contrib/bmake/bmake.1
index a658eab6700e..55d910b3b204 100644
--- a/contrib/bmake/bmake.1
+++ b/contrib/bmake/bmake.1
@@ -1,4 +1,4 @@
-.\" $NetBSD: make.1,v 1.371 2023/09/10 21:52:36 rillig Exp $
+.\" $NetBSD: make.1,v 1.372 2023/12/24 16:48:30 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 September 9, 2023
+.Dd December 24, 2023
.Dt BMAKE 1
.Os
.Sh NAME
@@ -2523,7 +2523,7 @@ set the read-only attribute on the global variables specified as sources.
.It Ic .SHELL
Sets the shell that
.Nm
-uses to execute commands in jobs mode.
+uses to execute commands.
The sources are a set of
.Ar field\| Ns Cm \&= Ns Ar value
pairs.
diff --git a/contrib/bmake/bmake.cat1 b/contrib/bmake/bmake.cat1
index bdd48dda11db..61138ea0f2b6 100644
--- a/contrib/bmake/bmake.cat1
+++ b/contrib/bmake/bmake.cat1
@@ -1599,8 +1599,8 @@ BMAKE(1) FreeBSD General Commands Manual BMAKE(1)
set the read-only attribute on the global variables specified as
sources.
- [1m.SHELL [22mSets the shell that [1mbmake [22muses to execute commands in jobs mode.
- The sources are a set of [4mfield[24m[1m=[4m[22mvalue[24m pairs.
+ [1m.SHELL [22mSets the shell that [1mbmake [22muses to execute commands. The sources
+ are a set of [4mfield[24m[1m=[4m[22mvalue[24m pairs.
name This is the minimal specification, used to select
one of the built-in shell specs; sh, ksh, and csh.
@@ -1759,4 +1759,4 @@ BMAKE(1) FreeBSD General Commands Manual BMAKE(1)
attempt to suppress a cascade of unnecessary errors, can result in a
seemingly unexplained `*** Error code 6'
-FreeBSD 13.0 September 9, 2023 FreeBSD 13.0
+FreeBSD 13.0 December 24, 2023 FreeBSD 13.0
diff --git a/contrib/bmake/boot-strap b/contrib/bmake/boot-strap
index f47f0c4fdecd..00fa04a0e08b 100755
--- a/contrib/bmake/boot-strap
+++ b/contrib/bmake/boot-strap
@@ -82,9 +82,23 @@
#
# Possibly useful configure_args:
#
+# --without-makefile
+# do not generate 'makefile'.
+#
+# 'makefile' is used to enable the classic
+# './configure; make; make install' dance, but on
+# systems with case insensitive filesystems it can lead
+# to infinite recursion.
+#
+# It is disabled by default on Darwin, and Cygwin.
+#
# --without-meta
# disable use of meta mode.
#
+# Even without filemon(9) meta mode is very useful
+# both for debugging build and improving reliability of
+# update builds.
+#
# --without-filemon
# disable use of filemon(9) which is currently only
# available for NetBSD and FreeBSD.
@@ -119,7 +133,7 @@
# Simon J. Gerraty <sjg@crufty.net>
# RCSid:
-# $Id: boot-strap,v 1.58 2023/06/27 21:02:19 sjg Exp $
+# $Id: boot-strap,v 1.59 2023/11/26 18:19:43 sjg Exp $
#
# @(#) Copyright (c) 2001 Simon J. Gerraty
#
diff --git a/contrib/bmake/bsd.after-import.mk b/contrib/bmake/bsd.after-import.mk
index fec42c9deeed..418caeaa58a6 100644
--- a/contrib/bmake/bsd.after-import.mk
+++ b/contrib/bmake/bsd.after-import.mk
@@ -1,4 +1,4 @@
-# $Id: bsd.after-import.mk,v 1.17 2021/10/22 06:31:32 sjg Exp $
+# $Id: bsd.after-import.mk,v 1.18 2023/09/18 05:29:23 sjg Exp $
# This makefile is for use when integrating bmake into a BSD build
# system. Use this makefile after importing bmake.
@@ -68,18 +68,25 @@ MAKEFILE_SED = sed -e '/^MACHINE/d' \
# These are the simple files we want to capture
configured_files= config.h Makefile.config unit-tests/Makefile.config
+# FreeBSD has dropped their tag with svn
+.if ${HOST_OS:NFreeBSD} == ""
+ECHO_TAG= :
+.else
+ECHO_TAG?= echo
+.endif
+
after-import: bootstrap ${MAKEFILE}
.for f in ${configured_files:M*.[ch]}
@echo Capturing $f
@mkdir -p ${${.CURDIR}/$f:L:H}
- @(echo '/* $$${HOST_OS}$$ */'; cat ${HOST_OS}/$f) > ${.CURDIR}/$f
+ @(${ECHO_TAG} '/* $$${HOST_OS}$$ */'; cat ${HOST_OS}/$f) > ${.CURDIR}/$f
.endfor
.for f in ${configured_files:M*Makefile*}
@echo Capturing $f
@mkdir -p ${${.CURDIR}/$f:L:H}
@(echo '# This is a generated file, do NOT edit!'; \
echo '# See ${_this:S,${SRCTOP}/,,}'; \
- echo '#'; echo '# $$${HOST_OS}$$'; echo; \
+ echo '#'; ${ECHO_TAG} '# $$${HOST_OS}$$'; echo; \
echo 'SRCTOP?= $${.CURDIR:${${.CURDIR}/$f:L:H:S,${SRCTOP}/,,:C,[^/]+,H,g:S,/,:,g}}'; echo; \
${MAKEFILE_SED} ${HOST_OS}/$f ) > ${.CURDIR}/$f
.endfor
@@ -89,7 +96,7 @@ _makefile: bootstrap ${MAKEFILE}
@echo Generating ${.CURDIR}/Makefile
@(echo '# This is a generated file, do NOT edit!'; \
echo '# See ${_this:S,${SRCTOP}/,,}'; \
- echo '#'; echo '# $$${HOST_OS}$$'; \
+ echo '#'; ${ECHO_TAG} '# $$${HOST_OS}$$'; \
echo; echo 'SRCTOP?= $${.CURDIR:${.CURDIR:S,${SRCTOP}/,,:C,[^/]+,H,g:S,/,:,g}}'; \
echo; echo '# look here first for config.h'; \
echo 'CFLAGS+= -I$${.CURDIR}'; echo; \
@@ -115,7 +122,7 @@ _utmakefile: bootstrap ${MAKEFILE}
@mkdir -p ${.CURDIR}/unit-tests
@(echo '# This is a generated file, do NOT edit!'; \
echo '# See ${_this:S,${SRCTOP}/,,}'; \
- echo '#'; echo '# $$${HOST_OS}$$'; \
+ echo '#'; ${ECHO_TAG} '# $$${HOST_OS}$$'; \
${MAKEFILE_SED} \
-e '/^UNIT_TESTS/s,=.*,= $${srcdir},' \
${BMAKE_SRC}/unit-tests/Makefile ) > ${.TARGET}
diff --git a/contrib/bmake/buf.c b/contrib/bmake/buf.c
index 845a68c46330..fdc6c8ec2b60 100644
--- a/contrib/bmake/buf.c
+++ b/contrib/bmake/buf.c
@@ -1,4 +1,4 @@
-/* $NetBSD: buf.c,v 1.56 2023/06/01 07:44:10 rillig Exp $ */
+/* $NetBSD: buf.c,v 1.57 2023/12/19 19:33:39 rillig Exp $ */
/*
* Copyright (c) 1988, 1989, 1990 The Regents of the University of California.
@@ -69,13 +69,13 @@
* SUCH DAMAGE.
*/
-/* Automatically-expanding null-terminated character buffers. */
+/* Automatically growing null-terminated buffers of characters. */
#include <limits.h>
#include "make.h"
/* "@(#)buf.c 8.1 (Berkeley) 6/6/93" */
-MAKE_RCSID("$NetBSD: buf.c,v 1.56 2023/06/01 07:44:10 rillig Exp $");
+MAKE_RCSID("$NetBSD: buf.c,v 1.57 2023/12/19 19:33:39 rillig Exp $");
/* Make space in the buffer for adding at least 16 more bytes. */
void
diff --git a/contrib/bmake/buf.h b/contrib/bmake/buf.h
index ccd7d513b211..c5e7d539de9e 100644
--- a/contrib/bmake/buf.h
+++ b/contrib/bmake/buf.h
@@ -1,4 +1,4 @@
-/* $NetBSD: buf.h,v 1.48 2023/06/01 07:44:10 rillig Exp $ */
+/* $NetBSD: buf.h,v 1.49 2023/12/19 19:33:39 rillig Exp $ */
/*
* Copyright (c) 1988, 1989, 1990 The Regents of the University of California.
@@ -96,7 +96,7 @@ Buf_Clear(Buffer *buf)
buf->data[0] = '\0';
}
-/* Buf_AddByte adds a single byte to a buffer. */
+/* Adds a single byte to a buffer. */
MAKE_INLINE void
Buf_AddByte(Buffer *buf, char byte)
{
diff --git a/contrib/bmake/compat.c b/contrib/bmake/compat.c
index 221eb64959e6..6f55880cbc54 100644
--- a/contrib/bmake/compat.c
+++ b/contrib/bmake/compat.c
@@ -1,4 +1,4 @@
-/* $NetBSD: compat.c,v 1.247 2023/05/04 22:31:17 sjg Exp $ */
+/* $NetBSD: compat.c,v 1.252 2024/01/05 23:22:06 rillig Exp $ */
/*
* Copyright (c) 1988, 1989, 1990 The Regents of the University of California.
@@ -94,7 +94,7 @@
#include "pathnames.h"
/* "@(#)compat.c 8.2 (Berkeley) 3/19/94" */
-MAKE_RCSID("$NetBSD: compat.c,v 1.247 2023/05/04 22:31:17 sjg Exp $");
+MAKE_RCSID("$NetBSD: compat.c,v 1.252 2024/01/05 23:22:06 rillig Exp $");
static GNode *curTarg = NULL;
static pid_t compatChild;
@@ -110,10 +110,8 @@ CompatDeleteTarget(GNode *gn)
if (gn != NULL && !GNode_IsPrecious(gn) &&
(gn->type & OP_PHONY) == 0) {
const char *file = GNode_VarTarget(gn);
-
- if (!opts.noExecute && unlink_file(file) == 0) {
+ if (!opts.noExecute && unlink_file(file) == 0)
Error("*** %s removed", file);
- }
}
}
@@ -132,14 +130,11 @@ CompatInterrupt(int signo)
CompatDeleteTarget(curTarg);
if (curTarg != NULL && !GNode_IsPrecious(curTarg)) {
- /*
- * Run .INTERRUPT only if hit with interrupt signal
- */
+ /* Run .INTERRUPT only if hit with interrupt signal. */
if (signo == SIGINT) {
GNode *gn = Targ_FindNode(".INTERRUPT");
- if (gn != NULL) {
+ if (gn != NULL)
Compat_Make(gn, gn);
- }
}
}
@@ -280,11 +275,9 @@ Compat_RunCommand(const char *cmdp, GNode *gn, StringListNode *ln)
silent = !DEBUG(LOUD);
else if (*cmd == '-')
errCheck = false;
- else if (*cmd == '+') {
+ else if (*cmd == '+')
doIt = true;
- if (shellName == NULL) /* we came here from jobs */
- Shell_Init();
- } else if (!ch_isspace(*cmd))
+ else if (!ch_isspace(*cmd))
/* Ignore whitespace for compatibility with gnu make */
break;
cmd++;
@@ -292,37 +285,25 @@ Compat_RunCommand(const char *cmdp, GNode *gn, StringListNode *ln)
while (ch_isspace(*cmd))
cmd++;
-
- /*
- * If we did not end up with a command, just skip it.
- */
if (cmd[0] == '\0')
return true;
useShell = UseShell(cmd);
- /*
- * Print the command before echoing if we're not supposed to be quiet
- * for this one. We also print the command if -n given.
- */
+
if (!silent || !GNode_ShouldExecute(gn)) {
printf("%s\n", cmd);
fflush(stdout);
}
- /*
- * If we're not supposed to execute any commands, this is as far as
- * we go...
- */
if (!doIt && !GNode_ShouldExecute(gn))
return true;
DEBUG1(JOB, "Execute: '%s'\n", cmd);
+ if (useShell && shellPath == NULL)
+ Shell_Init(); /* we need shellPath */
+
if (useShell) {
- /*
- * We need to pass the command off to the shell, typically
- * because the command contains a "meta" character.
- */
static const char *shargv[5];
/* The following work for any of the builtin shell specs. */
@@ -337,11 +318,6 @@ Compat_RunCommand(const char *cmdp, GNode *gn, StringListNode *ln)
bp = NULL;
mav = NULL;
} else {
- /*
- * No meta-characters, so no need to exec a shell. Break the
- * command into words to form an argument vector we can
- * execute.
- */
Words words = Str_Words(cmd, false);
mav = words.words;
bp = words.freeIt;
@@ -380,24 +356,21 @@ Compat_RunCommand(const char *cmdp, GNode *gn, StringListNode *ln)
meta_compat_parent(cpid);
#endif
- /*
- * The child is off and running. Now all we can do is wait...
- */
+ /* The child is off and running. Now all we can do is wait... */
while ((retstat = wait(&reason)) != cpid) {
if (retstat > 0)
JobReapChild(retstat, reason, false); /* not ours? */
- if (retstat == -1 && errno != EINTR) {
+ if (retstat == -1 && errno != EINTR)
break;
- }
}
if (retstat < 0)
Fatal("error in wait: %d: %s", retstat, strerror(errno));
if (WIFSTOPPED(reason)) {
- status = WSTOPSIG(reason); /* stopped */
+ status = WSTOPSIG(reason);
} else if (WIFEXITED(reason)) {
- status = WEXITSTATUS(reason); /* exited */
+ status = WEXITSTATUS(reason);
#if defined(USE_META) && defined(USE_FILEMON_ONCE)
if (useMeta)
meta_cmd_finish(NULL);
@@ -408,7 +381,7 @@ Compat_RunCommand(const char *cmdp, GNode *gn, StringListNode *ln)
printf("*** Error code %d", status);
}
} else {
- status = WTERMSIG(reason); /* signaled */
+ status = WTERMSIG(reason);
printf("*** Signal %d", status);
}
@@ -439,6 +412,7 @@ Compat_RunCommand(const char *cmdp, GNode *gn, StringListNode *ln)
printf(" (ignored)\n");
status = 0;
}
+ fflush(stdout);
}
free(cmdStart);
@@ -594,10 +568,6 @@ MakeUnmade(GNode *gn, GNode *pgn)
gn->type |= OP_SILENT;
if (Job_CheckCommands(gn, Fatal)) {
- /*
- * Our commands are ok, but we still have to worry about
- * the -t flag.
- */
if (!opts.touch || (gn->type & OP_MAKE)) {
curTarg = gn;
#ifdef USE_META
@@ -781,7 +751,6 @@ Compat_MakeAll(GNodeList *targs)
errorNode = gn;
}
- /* If the user has defined a .END target, run its commands. */
if (errorNode == NULL) {
GNode *endNode = Targ_GetEndNode();
Compat_Make(endNode, endNode);
diff --git a/contrib/bmake/cond.c b/contrib/bmake/cond.c
index 4ed15ff26184..843abc9a92f8 100644
--- a/contrib/bmake/cond.c
+++ b/contrib/bmake/cond.c
@@ -1,4 +1,4 @@
-/* $NetBSD: cond.c,v 1.354 2023/08/11 04:56:31 rillig Exp $ */
+/* $NetBSD: cond.c,v 1.359 2023/12/29 12:59:43 rillig Exp $ */
/*
* Copyright (c) 1988, 1989, 1990 The Regents of the University of California.
@@ -81,8 +81,7 @@
* of one of the .if directives or the condition in a
* ':?then:else' variable modifier.
*
- * Cond_EndFile
- * At the end of reading a makefile, ensure that the
+ * Cond_EndFile At the end of reading a makefile, ensure that the
* conditional directives are well-balanced.
*/
@@ -92,7 +91,7 @@
#include "dir.h"
/* "@(#)cond.c 8.2 (Berkeley) 1/2/94" */
-MAKE_RCSID("$NetBSD: cond.c,v 1.354 2023/08/11 04:56:31 rillig Exp $");
+MAKE_RCSID("$NetBSD: cond.c,v 1.359 2023/12/29 12:59:43 rillig Exp $");
/*
* Conditional expressions conform to this grammar:
@@ -154,10 +153,10 @@ typedef struct CondParser {
* expanded before it is evaluated, due to ease of implementation.
* This means that at the point where the condition is evaluated,
* make cannot know anymore whether the left-hand side had originally
- * been a variable expression or a plain word.
+ * been an expression or a plain word.
*
* In conditional directives like '.if', the left-hand side must
- * either be a variable expression, a quoted string or a number.
+ * either be an expression, a quoted string or a number.
*/
bool leftUnquotedOK;
@@ -166,9 +165,7 @@ typedef struct CondParser {
/*
* Whether an error message has already been printed for this
- * condition. The first available error message is usually the most
- * specific one, therefore it makes sense to suppress the standard
- * "Malformed conditional" message.
+ * condition.
*/
bool printedError;
} CondParser;
@@ -212,16 +209,16 @@ ParseWord(const char **pp, bool doEval)
{
const char *p = *pp;
Buffer word;
- int paren_depth;
+ int depth;
- Buf_InitSize(&word, 16);
+ Buf_Init(&word);
- paren_depth = 0;
+ depth = 0;
for (;;) {
char ch = *p;
if (ch == '\0' || ch == ' ' || ch == '\t')
break;
- if ((ch == '&' || ch == '|') && paren_depth == 0)
+ if ((ch == '&' || ch == '|') && depth == 0)
break;
if (ch == '$') {
VarEvalMode emode = doEval
@@ -238,8 +235,8 @@ ParseWord(const char **pp, bool doEval)
continue;
}
if (ch == '(')
- paren_depth++;
- else if (ch == ')' && --paren_depth < 0)
+ depth++;
+ else if (ch == ')' && --depth < 0)
break;
Buf_AddByte(&word, ch);
p++;
@@ -258,7 +255,7 @@ ParseFuncArg(CondParser *par, const char **pp, bool doEval, const char *func)
const char *p = *pp;
char *res;
- p++; /* Skip opening '(' - verified by caller */
+ p++; /* skip the '(' */
cpp_skip_hspace(&p);
res = ParseWord(&p, doEval);
cpp_skip_hspace(&p);
@@ -383,7 +380,7 @@ is_separator(char ch)
}
/*
- * In a quoted or unquoted string literal or a number, parse a variable
+ * In a quoted or unquoted string literal or a number, parse an
* expression and add its value to the buffer.
*
* Return whether to continue parsing the leaf.
@@ -429,7 +426,7 @@ CondParser_StringExpr(CondParser *par, const char *start,
}
/*
- * Parse a string from a variable expression or an optionally quoted string,
+ * Parse a string from an expression or an optionally quoted string,
* on the left-hand and right-hand sides of comparisons.
*
* Results:
@@ -487,10 +484,6 @@ CondParser_Leaf(CondParser *par, bool doEval, bool unquotedOK,
default:
if (!unquotedOK && !quoted && *start != '$' &&
!ch_isdigit(*start)) {
- /*
- * The left-hand side must be quoted,
- * a variable expression or a number.
- */
str = FStr_InitRefer(NULL);
goto return_str;
}
@@ -635,7 +628,6 @@ CondParser_Comparison(CondParser *par, bool doEval)
CondParser_SkipWhitespace(par);
if (!CondParser_ComparisonOp(par, &op)) {
- /* Unknown operator, compare against an empty string or 0. */
t = ToToken(doEval && EvalTruthy(par, lhs.str, lhsQuoted));
goto done_lhs;
}
@@ -667,19 +659,19 @@ done_lhs:
static bool
CondParser_FuncCallEmpty(CondParser *par, bool doEval, Token *out_token)
{
- const char *cp = par->p;
+ const char *p = par->p;
Token tok;
FStr val;
- if (!skip_string(&cp, "empty"))
+ if (!skip_string(&p, "empty"))
return false;
- cpp_skip_whitespace(&cp);
- if (*cp != '(')
+ cpp_skip_whitespace(&p);
+ if (*p != '(')
return false;
- cp--; /* Make cp[1] point to the '('. */
- val = Var_Parse(&cp, SCOPE_CMDLINE,
+ p--; /* Make p[1] point to the '('. */
+ val = Var_Parse(&p, SCOPE_CMDLINE,
doEval ? VARE_WANTRES : VARE_PARSE_ONLY);
/* TODO: handle errors */
@@ -692,7 +684,7 @@ CondParser_FuncCallEmpty(CondParser *par, bool doEval, Token *out_token)
FStr_Done(&val);
*out_token = tok;
- par->p = cp;
+ par->p = p;
return true;
}
@@ -734,7 +726,7 @@ CondParser_FuncCall(CondParser *par, bool doEval, Token *out_token)
/*
* Parse a comparison that neither starts with '"' nor '$', such as the
* unusual 'bare == right' or '3 == ${VAR}', or a simple leaf without
- * operator, which is a number, a variable expression or a string literal.
+ * operator, which is a number, an expression or a string literal.
*
* TODO: Can this be merged into CondParser_Comparison?
*/
@@ -743,37 +735,36 @@ CondParser_ComparisonOrLeaf(CondParser *par, bool doEval)
{
Token t;
char *arg;
- const char *cp;
+ const char *p;
- /* Push anything numeric through the compare expression */
- cp = par->p;
- if (ch_isdigit(cp[0]) || cp[0] == '-' || cp[0] == '+')
+ p = par->p;
+ if (ch_isdigit(p[0]) || p[0] == '-' || p[0] == '+')
return CondParser_Comparison(par, doEval);
/*
- * Most likely we have a naked token to apply the default function to.
- * However ".if a == b" gets here when the "a" is unquoted and doesn't
- * start with a '$'. This surprises people.
+ * Most likely we have a bare word to apply the default function to.
+ * However, ".if a == b" gets here when the "a" is unquoted and
+ * doesn't start with a '$'. This surprises people.
* If what follows the function argument is a '=' or '!' then the
* syntax would be invalid if we did "defined(a)" - so instead treat
* as an expression.
*/
/*
- * XXX: In edge cases, a variable expression may be evaluated twice,
+ * XXX: In edge cases, an expression may be evaluated twice,
* see cond-token-plain.mk, keyword 'twice'.
*/
*** 11098 LINES SKIPPED ***