Date: Sat, 10 Jan 2026 21:34:05 +0000 From: Simon J. Gerraty <sjg@FreeBSD.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org Subject: git: 812d0cb17de0 - stable/14 - Merge bmake-20250125 Message-ID: <6962c5cd.23ddb.5b399734@gitrepo.freebsd.org>
index | next in thread | raw e-mail
The branch stable/14 has been updated by sjg: URL: https://cgit.FreeBSD.org/src/commit/?id=812d0cb17de0da39e3eb2fa0c3a365f4ea1cb71a commit 812d0cb17de0da39e3eb2fa0c3a365f4ea1cb71a Author: Simon J. Gerraty <sjg@FreeBSD.org> AuthorDate: 2025-01-30 23:40:08 +0000 Commit: Simon J. Gerraty <sjg@FreeBSD.org> CommitDate: 2026-01-10 21:33:12 +0000 Merge bmake-20250125 Merge commit '5ad769f660f3d00853bc739f82d9bc62f6a682cb' (cherry picked from commit 6a7405f5a6b639682cacf01e35d561411ff556aa) --- contrib/bmake/ChangeLog | 139 ++++++++++++ contrib/bmake/FILES | 2 + contrib/bmake/Makefile | 139 +++++++----- contrib/bmake/VERSION | 2 +- contrib/bmake/arch.c | 9 +- contrib/bmake/bmake.1 | 47 +++-- contrib/bmake/bmake.cat1 | 34 +-- contrib/bmake/bsd.after-import.mk | 5 +- contrib/bmake/compat.c | 13 +- contrib/bmake/cond.c | 29 ++- contrib/bmake/job.c | 84 ++------ contrib/bmake/job.h | 4 +- contrib/bmake/main.c | 44 ++-- contrib/bmake/make.1 | 35 +++- contrib/bmake/make.h | 21 +- contrib/bmake/mk/ChangeLog | 117 +++++++++++ contrib/bmake/mk/FILES | 3 + contrib/bmake/mk/README | 10 +- contrib/bmake/mk/cython.mk | 43 ++-- contrib/bmake/mk/dirdeps-targets.mk | 5 +- contrib/bmake/mk/dirdeps.mk | 20 +- contrib/bmake/mk/gendirdeps.mk | 4 +- contrib/bmake/mk/genfiles.mk | 26 +++ contrib/bmake/mk/init.mk | 11 +- contrib/bmake/mk/install-mk | 4 +- contrib/bmake/mk/lib.mk | 14 +- contrib/bmake/mk/links.mk | 34 +-- contrib/bmake/mk/meta.sys.mk | 13 +- contrib/bmake/mk/meta2deps.py | 16 +- contrib/bmake/mk/options.mk | 8 +- contrib/bmake/mk/own.mk | 7 +- contrib/bmake/mk/prog.mk | 12 +- contrib/bmake/mk/rust.mk | 203 ++++++++++++++++++ contrib/bmake/mk/setopts.sh | 175 ++++++++++++++++ contrib/bmake/mk/subdir.mk | 10 +- contrib/bmake/mk/sys.mk | 3 +- contrib/bmake/mk/sys.vars.mk | 7 +- contrib/bmake/os.sh | 8 +- contrib/bmake/parse.c | 49 +---- contrib/bmake/suff.c | 6 +- contrib/bmake/unit-tests/Makefile | 23 +- contrib/bmake/unit-tests/archive.exp | 12 ++ contrib/bmake/unit-tests/archive.mk | 20 +- contrib/bmake/unit-tests/cmd-errors-jobs.exp | 76 ++++++- contrib/bmake/unit-tests/cmd-errors-jobs.mk | 123 ++++++++--- contrib/bmake/unit-tests/cmd-errors-lint.exp | 14 +- contrib/bmake/unit-tests/cmd-errors-lint.mk | 17 +- contrib/bmake/unit-tests/cmd-errors.exp | 14 +- contrib/bmake/unit-tests/cmd-errors.mk | 17 +- contrib/bmake/unit-tests/cmd-interrupt.exp | 1 + contrib/bmake/unit-tests/cmd-interrupt.mk | 24 ++- contrib/bmake/unit-tests/cmdline.exp | 4 +- contrib/bmake/unit-tests/cmdline.mk | 8 +- contrib/bmake/unit-tests/cond-cmp-numeric-eq.exp | 4 +- contrib/bmake/unit-tests/cond-cmp-numeric-eq.mk | 6 +- contrib/bmake/unit-tests/cond-cmp-numeric.exp | 2 +- contrib/bmake/unit-tests/cond-cmp-numeric.mk | 4 +- contrib/bmake/unit-tests/cond-cmp-string.exp | 8 +- contrib/bmake/unit-tests/cond-cmp-string.mk | 10 +- contrib/bmake/unit-tests/cond-eof.exp | 6 +- contrib/bmake/unit-tests/cond-eof.mk | 8 +- contrib/bmake/unit-tests/cond-func-commands.mk | 7 +- contrib/bmake/unit-tests/cond-func-defined.exp | 4 +- contrib/bmake/unit-tests/cond-func-defined.mk | 11 +- contrib/bmake/unit-tests/cond-func-empty.exp | 3 +- contrib/bmake/unit-tests/cond-func-empty.mk | 9 +- contrib/bmake/unit-tests/cond-func-exists.mk | 7 +- contrib/bmake/unit-tests/cond-func-make.mk | 7 +- contrib/bmake/unit-tests/cond-func-target.mk | 7 +- contrib/bmake/unit-tests/cond-func.exp | 9 +- contrib/bmake/unit-tests/cond-func.mk | 17 +- contrib/bmake/unit-tests/cond-late.exp | 4 +- contrib/bmake/unit-tests/cond-late.mk | 4 +- contrib/bmake/unit-tests/cond-op-and.exp | 6 +- contrib/bmake/unit-tests/cond-op-and.mk | 8 +- contrib/bmake/unit-tests/cond-op-not.exp | 2 +- contrib/bmake/unit-tests/cond-op-not.mk | 4 +- contrib/bmake/unit-tests/cond-op-or.exp | 6 +- contrib/bmake/unit-tests/cond-op-or.mk | 8 +- contrib/bmake/unit-tests/cond-op-parentheses.exp | 6 +- contrib/bmake/unit-tests/cond-op-parentheses.mk | 8 +- contrib/bmake/unit-tests/cond-op.exp | 14 +- contrib/bmake/unit-tests/cond-op.mk | 16 +- contrib/bmake/unit-tests/cond-token-number.exp | 8 +- contrib/bmake/unit-tests/cond-token-number.mk | 10 +- contrib/bmake/unit-tests/cond-token-plain.exp | 12 +- contrib/bmake/unit-tests/cond-token-plain.mk | 14 +- contrib/bmake/unit-tests/cond-token-string.exp | 20 +- contrib/bmake/unit-tests/cond-token-string.mk | 7 +- contrib/bmake/unit-tests/cond-token-var.exp | 22 +- contrib/bmake/unit-tests/cond-token-var.mk | 65 +++++- contrib/bmake/unit-tests/cond-undef-lint.exp | 10 +- contrib/bmake/unit-tests/cond-undef-lint.mk | 21 +- contrib/bmake/unit-tests/dep-var.exp | 8 +- contrib/bmake/unit-tests/dep-var.mk | 20 +- contrib/bmake/unit-tests/deptgt-makeflags.exp | 2 +- contrib/bmake/unit-tests/deptgt-order.exp | 4 +- contrib/bmake/unit-tests/deptgt.exp | 28 ++- contrib/bmake/unit-tests/deptgt.mk | 12 +- contrib/bmake/unit-tests/directive-export-impl.exp | 38 ++-- contrib/bmake/unit-tests/directive-for-errors.exp | 3 +- contrib/bmake/unit-tests/directive-for-errors.mk | 4 +- contrib/bmake/unit-tests/directive-for-escape.exp | 12 +- contrib/bmake/unit-tests/directive-for-escape.mk | 6 +- contrib/bmake/unit-tests/directive-for.exp | 3 +- contrib/bmake/unit-tests/directive-for.mk | 4 +- contrib/bmake/unit-tests/directive-if-nested.mk | 4 +- contrib/bmake/unit-tests/directive-if.exp | 2 +- contrib/bmake/unit-tests/directive-if.mk | 4 +- .../bmake/unit-tests/directive-include-fatal.exp | 2 +- .../bmake/unit-tests/directive-include-fatal.mk | 4 +- .../bmake/unit-tests/directive-include-guard.exp | 6 +- .../bmake/unit-tests/directive-include-guard.mk | 26 ++- contrib/bmake/unit-tests/directive-include.exp | 3 +- contrib/bmake/unit-tests/directive-include.mk | 6 +- contrib/bmake/unit-tests/directive-undef.exp | 3 +- contrib/bmake/unit-tests/directive-undef.mk | 4 +- contrib/bmake/unit-tests/include-main.exp | 4 +- contrib/bmake/unit-tests/lint.exp | 6 +- contrib/bmake/unit-tests/moderrs.exp | 233 ++++++++++++--------- contrib/bmake/unit-tests/moderrs.mk | 175 +++++++++------- contrib/bmake/unit-tests/opt-debug-lint.exp | 15 +- contrib/bmake/unit-tests/opt-debug-lint.mk | 10 +- contrib/bmake/unit-tests/opt-debug-parse.exp | 14 +- contrib/bmake/unit-tests/opt-debug-var.exp | 8 +- contrib/bmake/unit-tests/opt-debug-var.mk | 19 +- contrib/bmake/unit-tests/suff-incomplete.exp | 12 +- contrib/bmake/unit-tests/suff-main-several.exp | 30 +-- contrib/bmake/unit-tests/suff-rebuild.exp | 22 +- contrib/bmake/unit-tests/suff.exp | 146 +++++++++++++ contrib/bmake/unit-tests/suff.mk | 41 ++++ contrib/bmake/unit-tests/var-eval-short.exp | 12 +- contrib/bmake/unit-tests/var-eval-short.mk | 5 +- contrib/bmake/unit-tests/var-op-expand.exp | 8 +- contrib/bmake/unit-tests/var-op-expand.mk | 6 +- contrib/bmake/unit-tests/var-op-shell.exp | 6 + contrib/bmake/unit-tests/var-op-shell.mk | 11 +- contrib/bmake/unit-tests/var-recursive.exp | 41 ++-- contrib/bmake/unit-tests/var-recursive.mk | 77 +++---- contrib/bmake/unit-tests/vardebug.exp | 51 +++-- contrib/bmake/unit-tests/vardebug.mk | 21 +- contrib/bmake/unit-tests/varmisc.exp | 45 ++-- contrib/bmake/unit-tests/varmisc.mk | 30 +-- contrib/bmake/unit-tests/varmod-assign-shell.exp | 2 +- contrib/bmake/unit-tests/varmod-assign-shell.mk | 4 +- contrib/bmake/unit-tests/varmod-assign.exp | 38 ++-- contrib/bmake/unit-tests/varmod-assign.mk | 27 ++- contrib/bmake/unit-tests/varmod-edge.exp | 29 ++- contrib/bmake/unit-tests/varmod-edge.mk | 20 +- contrib/bmake/unit-tests/varmod-gmtime.exp | 20 +- contrib/bmake/unit-tests/varmod-gmtime.mk | 17 +- contrib/bmake/unit-tests/varmod-hash.exp | 15 +- contrib/bmake/unit-tests/varmod-hash.mk | 9 +- contrib/bmake/unit-tests/varmod-ifelse.exp | 63 +++--- contrib/bmake/unit-tests/varmod-ifelse.mk | 28 ++- contrib/bmake/unit-tests/varmod-indirect.exp | 22 +- contrib/bmake/unit-tests/varmod-indirect.mk | 10 +- contrib/bmake/unit-tests/varmod-localtime.exp | 20 +- contrib/bmake/unit-tests/varmod-localtime.mk | 17 +- contrib/bmake/unit-tests/varmod-loop-delete.exp | 4 +- contrib/bmake/unit-tests/varmod-loop-delete.mk | 4 +- contrib/bmake/unit-tests/varmod-loop-varname.exp | 16 +- contrib/bmake/unit-tests/varmod-loop-varname.mk | 14 +- contrib/bmake/unit-tests/varmod-loop.exp | 10 +- contrib/bmake/unit-tests/varmod-match-escape.exp | 29 +-- contrib/bmake/unit-tests/varmod-match-escape.mk | 8 +- contrib/bmake/unit-tests/varmod-match.exp | 31 ++- contrib/bmake/unit-tests/varmod-match.mk | 23 +- contrib/bmake/unit-tests/varmod-mtime.exp | 23 +- contrib/bmake/unit-tests/varmod-mtime.mk | 19 +- contrib/bmake/unit-tests/varmod-order.exp | 49 +++-- contrib/bmake/unit-tests/varmod-order.mk | 43 ++-- contrib/bmake/unit-tests/varmod-range.exp | 22 +- contrib/bmake/unit-tests/varmod-range.mk | 19 +- contrib/bmake/unit-tests/varmod-select-words.exp | 60 +++--- contrib/bmake/unit-tests/varmod-select-words.mk | 66 +++++- contrib/bmake/unit-tests/varmod-shell.exp | 6 +- contrib/bmake/unit-tests/varmod-shell.mk | 8 +- contrib/bmake/unit-tests/varmod-subst-regex.exp | 73 ++++--- contrib/bmake/unit-tests/varmod-subst-regex.mk | 16 +- contrib/bmake/unit-tests/varmod-subst.exp | 5 +- contrib/bmake/unit-tests/varmod-subst.mk | 3 +- contrib/bmake/unit-tests/varmod-sun-shell.exp | 4 +- contrib/bmake/unit-tests/varmod-sun-shell.mk | 6 +- contrib/bmake/unit-tests/varmod-sysv.exp | 8 +- contrib/bmake/unit-tests/varmod-sysv.mk | 8 +- contrib/bmake/unit-tests/varmod-to-separator.exp | 52 ++--- contrib/bmake/unit-tests/varmod-to-separator.mk | 41 ++-- contrib/bmake/unit-tests/varmod.exp | 65 +++--- contrib/bmake/unit-tests/varmod.mk | 48 ++--- .../bmake/unit-tests/varname-dot-make-level.exp | 10 +- contrib/bmake/unit-tests/varname-dot-make-level.mk | 9 +- contrib/bmake/unit-tests/varname-dot-shell.exp | 30 +-- contrib/bmake/unit-tests/varname-dot-suffixes.exp | 14 +- contrib/bmake/unit-tests/varname.exp | 8 +- contrib/bmake/unit-tests/varname.mk | 6 +- contrib/bmake/unit-tests/varparse-dynamic.exp | 4 +- contrib/bmake/unit-tests/varparse-dynamic.mk | 6 +- contrib/bmake/unit-tests/varparse-errors.exp | 64 ++++-- contrib/bmake/unit-tests/varparse-errors.mk | 44 ++-- contrib/bmake/var.c | 149 ++++++------- usr.bin/bmake/Makefile | 119 ++++++----- usr.bin/bmake/Makefile.config | 2 +- usr.bin/bmake/unit-tests/Makefile | 29 ++- 204 files changed, 3242 insertions(+), 1804 deletions(-) diff --git a/contrib/bmake/ChangeLog b/contrib/bmake/ChangeLog index 12774bb5598c..212b0fcfaacb 100644 --- a/contrib/bmake/ChangeLog +++ b/contrib/bmake/ChangeLog @@ -1,3 +1,142 @@ +2025-01-25 Simon J Gerraty <sjg@beast.crufty.net> + + * VERSION (_MAKE_VERSION): 20250125 + Merge with NetBSD make, sync up below change. + + * unit-tests/Makefile: remove $TMPDIR via .END + to avoid failure in test on NFS - since the temp file for the + target script is open and thus gets renamed by the server rather + than removed. + +2025-01-20 Simon J Gerraty <sjg@beast.crufty.net> + + * VERSION (_MAKE_VERSION): 20250120 + Merge with NetBSD make, pick up + o use FORK_FUNCTION so it can be forced to fork when doing coverage. + o main.c: avoid memory allocation in error path after exec failure. + +2025-01-16 Simon J Gerraty <sjg@beast.crufty.net> + + * VERSION (_MAKE_VERSION): 20250116 + Merge with NetBSD make, pick up + o clarify that undefined expressions are allowed in dependencies + o simplify code for evaluating the '!=' variable assignment + +2025-01-11 Simon J Gerraty <sjg@beast.crufty.net> + + * VERSION (_MAKE_VERSION): 20250111 + Merge with NetBSD make, pick up + o replace "Malformed conditional" with "Variable is undefined" + when appropriate + +2025-01-10 Simon J Gerraty <sjg@beast.crufty.net> + + * VERSION (_MAKE_VERSION): 20250110 + Merge with NetBSD make, pick up + o job.c: remove some unnecessary layers in job handling + o unit-tests: test expressions based on undefined variables + +2025-01-01 Simon J Gerraty <sjg@beast.crufty.net> + + * VERSION (_MAKE_VERSION): 20250101 + Merge with NetBSD make, pick up + o var.c: reduce pointer indirections when unexporting a variable + +2024-12-12 Simon J Gerraty <sjg@beast.crufty.net> + + * VERSION (_MAKE_VERSION): 20241212 + * mk/ updates + +2024-11-24 Simon J Gerraty <sjg@beast.crufty.net> + + * VERSION (_MAKE_VERSION): 20241124 + Merge with NetBSD make, pick up + o var.c: fix confusing error message when overriding a read-only + variable + +2024-11-22 Simon J Gerraty <sjg@beast.crufty.net> + + * VERSION (_MAKE_VERSION): 20241122 + Merge with NetBSD make, pick up + o unit-tests/Makefile: optimize running of tests skip extra cat + in 99% of cases. + +2024-11-15 Simon J Gerraty <sjg@beast.crufty.net> + + * VERSION (_MAKE_VERSION): 20241114 + Merge with NetBSD make, pick up + o make.1: note that MAKEOBJPREFIX should be absolute path + also that it can be set via makefile if suitable care taken. + +2024-11-10 Simon J Gerraty <sjg@beast.crufty.net> + + * VERSION (_MAKE_VERSION): 20241110 + Merge with NetBSD make, pick up + o make: allow .../ (search here and above) in + .MAKE.MAKEFILE_PREFERENCE and -f argument. + +2024-11-03 Simon J Gerraty <sjg@beast.crufty.net> + + * VERSION (_MAKE_VERSION): 20241101 + Merge with NetBSD make, pick up + o parse.c: report filename:linenumber in parse debug output + +2024-09-21 Simon J Gerraty <sjg@beast.crufty.net> + + * VERSION (_MAKE_VERSION): 20240921 + Merge with NetBSD make, pick up + o make.1: Only list the defaults for MAKEFILE_PREFERENCE once. + + * Makefile: use genfiles.mk to generate ${MAN} + so that it can be tuned for local site. + Ensure MAN is defined before including Makefile.inc + + * Makefile: use MK_GEN_MAN to make it easier to control whether we + generate ${MAN} + +2024-09-16 Simon J Gerraty <sjg@beast.crufty.net> + + * VERSION (_MAKE_VERSION): 20240909 + + * arch.c: fix NetBSD PR 58597 + +2024-09-01 Simon J Gerraty <sjg@beast.crufty.net> + + * Makefile: use SUBDIR.${MK_TESTS} so that we skip + unit-tests for obj and clean when FreeBSD is building WITHOUT_TESTS + + * VERSION (_MAKE_VERSION): 20240901 + Merge with NetBSD make, pick up + o reduce line length in error messages + o var.c: simplify printing of an evaluation stack element + +2024-08-29 Simon J Gerraty <sjg@beast.crufty.net> + + * VERSION (_MAKE_VERSION): 20240828 + Merge with NetBSD make, pick up + o add more context to error message about recursive variables + o treat recursive variables non-fatally - continue parsing to end + of makefile + +2024-08-12 Simon J Gerraty <sjg@beast.crufty.net> + + * VERSION (_MAKE_VERSION): 20240808 + Merge with NetBSD make, pick up + o improve some error messages for better clarify and readability + +2024-07-22 Simon J Gerraty <sjg@beast.crufty.net> + + * VERSION (_MAKE_VERSION): 20240722 + Merge with NetBSD make, pick up + o job.c: remove dead code + +2024-07-21 Simon J Gerraty <sjg@beast.crufty.net> + + * VERSION (_MAKE_VERSION): 20240720 + Merge with NetBSD make, pick up + o compat.c: do not run commands that have parse or evaluation errors. + o var.c: remove wrong error message about an undefined variable + 2024-07-13 Simon J Gerraty <sjg@beast.crufty.net> * cleanup redundant differences from NetBSD make diff --git a/contrib/bmake/FILES b/contrib/bmake/FILES index bfe95a9b6b47..c8937c610a4d 100644 --- a/contrib/bmake/FILES +++ b/contrib/bmake/FILES @@ -593,6 +593,8 @@ unit-tests/shell-ksh.exp unit-tests/shell-ksh.mk unit-tests/shell-sh.exp unit-tests/shell-sh.mk +unit-tests/suff.exp +unit-tests/suff.mk unit-tests/suff-add-later.exp unit-tests/suff-add-later.mk unit-tests/suff-clear-regular.exp diff --git a/contrib/bmake/Makefile b/contrib/bmake/Makefile index 65730df7e3df..939b71c5e12c 100644 --- a/contrib/bmake/Makefile +++ b/contrib/bmake/Makefile @@ -1,8 +1,8 @@ -# $Id: Makefile,v 1.127 2024/03/19 16:03:23 sjg Exp $ +# $Id: Makefile,v 1.132 2024/09/22 19:56:26 sjg Exp $ -PROG= bmake +PROG = bmake -SRCS= \ +SRCS = \ arch.c \ buf.c \ compat.c \ @@ -25,6 +25,11 @@ SRCS= \ util.c \ var.c +.MAIN: all + +MAN = ${PROG}.1 +SRCS.${MAN} = ${srcdir}/make.1 + .-include "VERSION" .-include "Makefile.inc" @@ -32,25 +37,26 @@ SRCS= \ .-include "Makefile.config" .if !empty(LIBOBJS) -SRCS+= ${LIBOBJS:T:.o=.c} +SRCS += ${LIBOBJS:T:.o=.c} .endif # just in case -prefix?= /usr -srcdir?= ${.CURDIR} +prefix ?= /usr +srcdir ?= ${.PARSEDIR} +srcdir := ${srcdir} -DEFAULT_SYS_PATH?= ${prefix}/share/mk +DEFAULT_SYS_PATH ?= ${prefix}/share/mk -CPPFLAGS+= -DUSE_META -CFLAGS+= ${CPPFLAGS} -CFLAGS+= -D_PATH_DEFSYSPATH=\"${DEFAULT_SYS_PATH}\" -CFLAGS+= -I. -I${srcdir} ${XDEFS} -DMAKE_NATIVE -CFLAGS+= ${COPTS.${.ALLSRC:M*.c:T:u}} -COPTS.main.c+= "-DMAKE_VERSION=\"${_MAKE_VERSION}\"" +CPPFLAGS += -DUSE_META +CFLAGS += ${CPPFLAGS} +CFLAGS += -D_PATH_DEFSYSPATH=\"${DEFAULT_SYS_PATH}\" +CFLAGS += -I. -I${srcdir} ${XDEFS} -DMAKE_NATIVE +CFLAGS += ${COPTS.${.ALLSRC:M*.c:T:u}} +COPTS.main.c += "-DMAKE_VERSION=\"${_MAKE_VERSION}\"" .for x in FORCE_MAKE_OS FORCE_MACHINE FORCE_MACHINE_ARCH .ifdef $x -COPTS.main.c+= "-D$x=\"${$x}\"" +COPTS.main.c += "-D$x=\"${$x}\"" .endif .endfor @@ -60,8 +66,8 @@ USE_FILEMON ?= no .if ${USE_FILEMON:tl} != "no" .PATH: ${srcdir}/filemon SRCS+= filemon_${USE_FILEMON}.c -COPTS.meta.c+= -DUSE_FILEMON -DUSE_FILEMON_${USE_FILEMON:tu} -COPTS.job.c+= ${COPTS.meta.c} +COPTS.meta.c += -DUSE_FILEMON -DUSE_FILEMON_${USE_FILEMON:tu} +COPTS.job.c += ${COPTS.meta.c} .if ${USE_FILEMON} == "dev" FILEMON_H ?= /usr/include/dev/filemon/filemon.h @@ -76,65 +82,82 @@ COPTS.filemon_ktrace.c += -Wno-error=unused-parameter .PATH: ${srcdir} -.if make(obj) || make(clean) -SUBDIR+= unit-tests -.endif - # start-delete1 for bsd.after-import.mk # we skip a lot of this when building as part of FreeBSD etc. # list of OS's which are derrived from BSD4.4 -BSD44_LIST= NetBSD FreeBSD OpenBSD DragonFly MirBSD Bitrig +BSD44_LIST = NetBSD FreeBSD OpenBSD DragonFly MirBSD Bitrig # we are... OS := ${.MAKE.OS:U${uname -s:L:sh}} # are we 4.4BSD ? -isBSD44:=${BSD44_LIST:M${OS}} +isBSD44 := ${BSD44_LIST:M${OS}} .if ${isBSD44} == "" && ${OS:NCygwin:NDarwin:NLinux} != "" -MANTARGET?= cat +MANTARGET ?= cat .if ${MACHINE} == "sun386" # even I don't have one of these anymore :-) -CFLAGS+= -DPORTAR +CFLAGS += -DPORTAR .elif ${OS} != "SunOS" # assume the worst -SRCS+= sigcompat.c -CFLAGS+= -DSIGNAL_FLAGS=SA_RESTART +SRCS += sigcompat.c +CFLAGS += -DSIGNAL_FLAGS=SA_RESTART .endif .else -MANTARGET?= man +MANTARGET ?= man .endif # turn this on by default - ignored if we are root -WITH_INSTALL_AS_USER= +WITH_INSTALL_AS_USER = # suppress with -DWITHOUT_* -OPTIONS_DEFAULT_YES+= \ +OPTIONS_DEFAULT_YES += \ AUTOCONF_MK \ INSTALL_MK \ - PROG_LINK + PROG_LINK \ + TESTS \ + +OPTIONS_DEFAULT_NO += \ + GEN_MAN \ + PROG_VERSION \ -OPTIONS_DEFAULT_NO+= \ - PROG_VERSION +.if ${PROG} != "make" || ${srcdir} != ${.CURDIR} || !exists(${srcdir}/${MAN}) +WITH_GEN_MAN = 1 +.endif # process options now .include <own.mk> .if ${MK_PROG_VERSION} == "yes" -PROG_NAME= ${PROG}-${_MAKE_VERSION} +PROG_NAME = ${PROG}-${_MAKE_VERSION} .if ${MK_PROG_LINK} == "yes" -SYMLINKS+= ${PROG_NAME} ${BINDIR}/${PROG} +SYMLINKS += ${PROG_NAME} ${BINDIR}/${PROG} .endif .endif EXTRACT_MAN=no # end-delete1 -MAN= ${PROG}.1 -MAN1= ${MAN} +.if make(obj) || make(clean) +SUBDIR.${MK_TESTS} += unit-tests +.endif + +MAN1 = ${MAN} + +.if ${MK_GEN_MAN:Uno} == "yes" + +# we use this to generate ${MAN} +.include <${srcdir}/mk/genfiles.mk> .if ${PROG} != "make" -CLEANFILES+= my.history -.if make(${MAN}) || !exists(${srcdir}/${MAN}) +CLEANFILES += my.history +SED_CMDS.${MAN} += \ + -e '/^.Dt/s/MAKE/${PROG:tu}/' \ + -e '/^.Nm/s/make/${PROG}/' \ + +.endif + +.if ${CLEANFILES:U:Mmy.history} != "" +${MAN}: my.history my.history: @(echo ".Nm"; \ echo "is derived from NetBSD"; \ @@ -142,40 +165,46 @@ my.history: echo "It uses autoconf to facilitate portability to other platforms."; \ echo ".Pp") > $@ -.NOPATH: ${MAN} -${MAN}: make.1 my.history - @echo making $@ - @sed \ - -e '/^.Dt/s/MAKE/${PROG:tu}/' \ - -e 's/^.Nx/NetBSD/' \ - -e '/^.Nm/s/make/${PROG}/' \ +SED_CMDS.${MAN} += \ -e '/^.Sh HISTORY/rmy.history' \ - -e '/^.Sh HISTORY/,$$s,^.Nm,make,' ${srcdir}/make.1 > $@ + -e '/^.Sh HISTORY/,/BUGS/s,^.Nm,make,' \ -all beforeinstall: ${MAN} -_mfromdir=. .endif + +.if ${.MAKE.OS:N*BSD} != "" +# assume .Nx is not supported +SED_CMDS.${MAN} += -e 's/^\.Nx/NetBSD/' +.endif + +# watch out for a late change of PROG +.if !empty(SRCS.${MAN}) +.NOPATH: ${MAN} +${MAN}: ${SRCS.${MAN}} _GENFILES_USE + +all man beforeinstall: ${MAN} +_mfromdir=. .endif +.endif # MK_GEN_MAN -MANTARGET?= cat -MANDEST?= ${MANDIR}/${MANTARGET}1 +MANTARGET ?= cat +MANDEST ?= ${MANDIR}/${MANTARGET}1 .if ${MANTARGET} == "cat" -_mfromdir=${srcdir} +_mfromdir = ${srcdir} .endif .include <prog.mk> -CPPFLAGS+= -DMAKE_NATIVE -DHAVE_CONFIG_H +CPPFLAGS += -DMAKE_NATIVE -DHAVE_CONFIG_H COPTS.var.c += -Wno-cast-qual COPTS.job.c += -Wno-format-nonliteral COPTS.parse.c += -Wno-format-nonliteral COPTS.var.c += -Wno-format-nonliteral # Force these -SHAREDIR= ${SHAREDIR.bmake:U${prefix}/share} -BINDIR= ${BINDIR.bmake:U${prefix}/bin} -MANDIR= ${MANDIR.bmake:U${SHAREDIR}/man} +SHAREDIR = ${SHAREDIR.bmake:U${prefix}/share} +BINDIR = ${BINDIR.bmake:U${prefix}/bin} +MANDIR = ${MANDIR.bmake:U${SHAREDIR}/man} ${OBJS}: config.h diff --git a/contrib/bmake/VERSION b/contrib/bmake/VERSION index f55bfabc9103..9d1a987f65d6 100644 --- a/contrib/bmake/VERSION +++ b/contrib/bmake/VERSION @@ -1,2 +1,2 @@ # keep this compatible with sh and make -_MAKE_VERSION=20240711 +_MAKE_VERSION=20250125 diff --git a/contrib/bmake/arch.c b/contrib/bmake/arch.c index 00c72261707f..77ac7f3c5707 100644 --- a/contrib/bmake/arch.c +++ b/contrib/bmake/arch.c @@ -1,4 +1,4 @@ -/* $NetBSD: arch.c,v 1.221 2024/07/07 07:50:57 rillig Exp $ */ +/* $NetBSD: arch.c,v 1.222 2024/08/06 17:46:01 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.221 2024/07/07 07:50:57 rillig Exp $"); +MAKE_RCSID("$NetBSD: arch.c,v 1.222 2024/08/06 17:46:01 rillig Exp $"); typedef struct List ArchList; typedef struct ListNode ArchListNode; @@ -314,8 +314,7 @@ Arch_ParseArchive(char **pp, GNodeList *gns, GNode *scope) if (*cp == '\0') { Parse_Error(PARSE_FATAL, - "No closing parenthesis " - "in archive specification"); + "Missing ')' in archive specification"); return false; } @@ -416,7 +415,7 @@ Arch_ParseArchive(char **pp, GNodeList *gns, GNode *scope) static struct ar_hdr * ArchStatMember(const char *archive, const char *member, bool addToCache) { -#define AR_MAX_NAME_LEN (sizeof arh.ar_name - 1) +#define AR_MAX_NAME_LEN (sizeof arh.AR_NAME - 1) FILE *arch; size_t size; /* Size of archive member */ char magic[SARMAG]; diff --git a/contrib/bmake/bmake.1 b/contrib/bmake/bmake.1 index f7cc15b16c41..eef2d799b960 100644 --- a/contrib/bmake/bmake.1 +++ b/contrib/bmake/bmake.1 @@ -1,4 +1,4 @@ -.\" $NetBSD: make.1,v 1.378 2024/07/01 21:02:26 sjg Exp $ +.\" $NetBSD: make.1,v 1.381 2024/11/14 19:30:13 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 1, 2024 +.Dd November 14, 2024 .Dt BMAKE 1 .Os .Sh NAME @@ -60,10 +60,11 @@ If no .Fl f Ar makefile option is given, .Nm -tries to open -.Sq Pa makefile -then -.Sq Pa Makefile +looks for the makefiles listed in +.Va .MAKE.MAKEFILE_PREFERENCE +(default +.Sq Pa makefile , +.Sq Pa Makefile ) in order to find the specifications. If the file .Sq Pa .depend @@ -233,15 +234,20 @@ so the actual commands are printed as they are executed. .It Fl e Let environment variables override global variables within makefiles. .It Fl f Ar makefile -Specify a makefile to read instead of the default -.Pa makefile -or -.Pa Makefile . +Specify a makefile to read instead of one of the defaults listed in +.Va .MAKE.MAKEFILE_PREFERENCE . If .Ar makefile is .Ql \&- , standard input is read. +If +.Ar makefile +starts with the string +.Ql \&.../ , +.Nm +searches for the specified path in the rest of the argument +in the current directory and its parents. Multiple makefiles may be specified, and are read in the order specified. .It Fl I Ar directory Specify a directory in which to search for makefiles and included makefiles. @@ -1159,6 +1165,7 @@ to help debug. .It Va MAKEOBJDIRPREFIX Used to create files in a separate directory, see .Va .OBJDIR . +It should be an absolute path. .It Va .MAKE.OS The name of the operating system, see .Xr uname 1 . @@ -2636,12 +2643,18 @@ and .Ev MAKEOBJDIRPREFIX and .Ev MAKEOBJDIR -may only be set in the environment or on the command line to +should be set in the environment or on the command line to .Nm and not as makefile variables; see the description of .Sq Va .OBJDIR for more details. +It is possible to set these via makefile variables but unless done +very early and the +.Sq Ic .OBJDIR +target is used to reset +.Sq Va .OBJDIR , +there may be unexpected side effects. .Sh FILES .Bl -tag -width /usr/share/mk -compact .It .depend @@ -2663,13 +2676,13 @@ An incomplete list of changes in older versions of .Nm : .Pp The way that .for loop variables are substituted changed after -NetBSD 5.0 +.Nx 5.0 so that they still appear to be variable expansions. In particular this stops them being treated as syntax, and removes some obscure problems using them in .if statements. .Pp The way that parallel makes are scheduled changed in -NetBSD 4.0 +.Nx 4.0 so that .ORDER and .WAIT apply recursively to the dependent nodes. The algorithms used may change again in the future. .Ss Other make dialects @@ -2767,21 +2780,21 @@ does not exist ... unless someone creates an file). .Sh BUGS The -make +.Nm syntax is difficult to parse. For instance, finding the end of a variable's use should involve scanning each of the modifiers, using the correct terminator for each field. In many places -make +.Nm just counts {} and () in order to find the end of a variable expansion. .Pp There is no way of escaping a space character in a filename. .Pp In jobs mode, when a target fails; -make +.Nm will put an error token into the job token pool. This will cause all other instances of -make +.Nm using that token pool to abort the build and exit with error code 6. Sometimes the attempt to suppress a cascade of unnecessary errors, can result in a seemingly unexplained diff --git a/contrib/bmake/bmake.cat1 b/contrib/bmake/bmake.cat1 index f46f6681320a..8a1909e684ed 100644 --- a/contrib/bmake/bmake.cat1 +++ b/contrib/bmake/bmake.cat1 @@ -13,9 +13,9 @@ DDEESSCCRRIIPPTTIIOONN bbmmaakkee is a program designed to simplify the maintenance of other programs. Its input is a list of specifications as to the files upon which programs and other files depend. If no --ff _m_a_k_e_f_i_l_e option is - given, bbmmaakkee tries to open `_m_a_k_e_f_i_l_e' then `_M_a_k_e_f_i_l_e' in order to find - the specifications. If the file `_._d_e_p_e_n_d' exists, it is read, see - mkdep(1). + given, bbmmaakkee looks for the makefiles listed in _._M_A_K_E_._M_A_K_E_F_I_L_E___P_R_E_F_E_R_E_N_C_E + (default `_m_a_k_e_f_i_l_e', `_M_a_k_e_f_i_l_e') in order to find the specifications. If + the file `_._d_e_p_e_n_d' exists, it is read, see mkdep(1). This manual page is intended as a reference document only. For a more thorough description of bbmmaakkee and makefiles, please refer to _P_M_a_k_e _- _A @@ -138,9 +138,12 @@ DDEESSCCRRIIPPTTIIOONN makefiles. --ff _m_a_k_e_f_i_l_e - Specify a makefile to read instead of the default _m_a_k_e_f_i_l_e or - _M_a_k_e_f_i_l_e. If _m_a_k_e_f_i_l_e is `-', standard input is read. Multiple - makefiles may be specified, and are read in the order specified. + Specify a makefile to read instead of one of the defaults listed + in _._M_A_K_E_._M_A_K_E_F_I_L_E___P_R_E_F_E_R_E_N_C_E. If _m_a_k_e_f_i_l_e is `-', standard input + is read. If _m_a_k_e_f_i_l_e starts with the string `.../', bbmmaakkee + searches for the specified path in the rest of the argument in + the current directory and its parents. Multiple makefiles may be + specified, and are read in the order specified. --II _d_i_r_e_c_t_o_r_y Specify a directory in which to search for makefiles and included @@ -765,7 +768,8 @@ VVAARRIIAABBLLEE AASSSSIIGGNNMMEENNTTSS debug. _M_A_K_E_O_B_J_D_I_R_P_R_E_F_I_X - Used to create files in a separate directory, see _._O_B_J_D_I_R. + Used to create files in a separate directory, see _._O_B_J_D_I_R. It + should be an absolute path. _._M_A_K_E_._O_S The name of the operating system, see uname(1). It is read-only. @@ -1691,9 +1695,11 @@ EENNVVIIRROONNMMEENNTT MACHINE_ARCH, MAKE, MAKEFLAGS, MAKEOBJDIR, MAKEOBJDIRPREFIX, MAKESYSPATH, PWD, and TMPDIR. - MAKEOBJDIRPREFIX and MAKEOBJDIR may only be set in the environment or on + MAKEOBJDIRPREFIX and MAKEOBJDIR should be set in the environment or on the command line to bbmmaakkee and not as makefile variables; see the - description of `_._O_B_J_D_I_R' for more details. + description of `_._O_B_J_D_I_R' for more details. It is possible to set these + via makefile variables but unless done very early and the `..OOBBJJDDIIRR' + target is used to reset `_._O_B_J_D_I_R', there may be unexpected side effects. FFIILLEESS .depend list of dependencies @@ -1774,17 +1780,17 @@ HHIISSTTOORRYY _F_R_C file). BBUUGGSS - The make syntax is difficult to parse. For instance, finding the end of + The bbmmaakkee syntax is difficult to parse. For instance, finding the end of a variable's use should involve scanning each of the modifiers, using the - correct terminator for each field. In many places make just counts {} + correct terminator for each field. In many places bbmmaakkee just counts {} and () in order to find the end of a variable expansion. There is no way of escaping a space character in a filename. - In jobs mode, when a target fails; make will put an error token into the - job token pool. This will cause all other instances of make using that + In jobs mode, when a target fails; bbmmaakkee will put an error token into the + job token pool. This will cause all other instances of bbmmaakkee using that token pool to abort the build and exit with error code 6. Sometimes the attempt to suppress a cascade of unnecessary errors, can result in a seemingly unexplained `*** Error code 6' -FreeBSD 14.1-RELEASE July 1, 2024 FreeBSD 14.1-RELEASE +FreeBSD 14.1-RELEASE-p5 November 14, 2024 FreeBSD 14.1-RELEASE-p5 diff --git a/contrib/bmake/bsd.after-import.mk b/contrib/bmake/bsd.after-import.mk index 418caeaa58a6..f2948b855753 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.18 2023/09/18 05:29:23 sjg Exp $ +# $Id: bsd.after-import.mk,v 1.19 2024/09/21 22:44:55 sjg Exp $ # This makefile is for use when integrating bmake into a BSD build # system. Use this makefile after importing bmake. @@ -61,8 +61,7 @@ MAKEFILE_SED = sed -e '/^MACHINE/d' \ -e '/include.*VERSION/d' \ -e '/^CC=/s,=,?=,' \ -e '/^PROG/ { s,=,?=,;s,bmake,$${.CURDIR:T},; }' \ - -e 's,^.-include,.sinclude,' \ - -e '/^\..*include *</ { s,<,<bsd.,;/autoconf/d; }' \ + -e '/^\..*include *</ { s,<\([a-z]\),<bsd.\1,;/autoconf/d; }' \ -e 's,${SRCTOP},$${SRCTOP},g' # These are the simple files we want to capture diff --git a/contrib/bmake/compat.c b/contrib/bmake/compat.c index 23ece245c8a6..0da929e35b82 100644 --- a/contrib/bmake/compat.c +++ b/contrib/bmake/compat.c @@ -1,4 +1,4 @@ -/* $NetBSD: compat.c,v 1.260 2024/07/11 20:09:16 sjg Exp $ */ +/* $NetBSD: compat.c,v 1.262 2025/01/19 10:57:10 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.260 2024/07/11 20:09:16 sjg Exp $"); +MAKE_RCSID("$NetBSD: compat.c,v 1.262 2025/01/19 10:57:10 rillig Exp $"); static GNode *curTarg = NULL; static pid_t compatChild; @@ -206,7 +206,7 @@ UseShell(const char *cmd MAKE_ATTR_UNUSED) static int Compat_Spawn(const char **av) { - int pid = vfork(); + int pid = FORK_FUNCTION(); if (pid < 0) Fatal("Could not fork"); @@ -251,13 +251,18 @@ Compat_RunCommand(const char *cmdp, GNode *gn, StringListNode *ln) const char *cmd = cmdp; char cmd_file[MAXPATHLEN]; size_t cmd_len; + int parseErrorsBefore; silent = (gn->type & OP_SILENT) != OP_NONE; errCheck = !(gn->type & OP_IGNORE); doIt = false; + parseErrorsBefore = parseErrors; cmdStart = Var_SubstInTarget(cmd, gn); - /* TODO: handle errors */ + if (parseErrors != parseErrorsBefore) { + free(cmdStart); + return false; + } if (cmdStart[0] == '\0') { free(cmdStart); diff --git a/contrib/bmake/cond.c b/contrib/bmake/cond.c index 58c0069555e1..a724ba7ecf26 100644 --- a/contrib/bmake/cond.c +++ b/contrib/bmake/cond.c @@ -1,4 +1,4 @@ -/* $NetBSD: cond.c,v 1.366 2024/07/06 21:21:09 rillig Exp $ */ +/* $NetBSD: cond.c,v 1.371 2025/01/11 21:21:33 rillig Exp $ */ /* * Copyright (c) 1988, 1989, 1990 The Regents of the University of California. @@ -91,7 +91,7 @@ #include "dir.h" /* "@(#)cond.c 8.2 (Berkeley) 1/2/94" */ -MAKE_RCSID("$NetBSD: cond.c,v 1.366 2024/07/06 21:21:09 rillig Exp $"); +MAKE_RCSID("$NetBSD: cond.c,v 1.371 2025/01/11 21:21:33 rillig Exp $"); /* * Conditional expressions conform to this grammar: @@ -221,13 +221,7 @@ ParseWord(const char **pp, bool doEval) if ((ch == '&' || ch == '|') && depth == 0) break; if (ch == '$') { - VarEvalMode emode = doEval - ? VARE_EVAL_DEFINED - : VARE_PARSE; - /* - * TODO: make Var_Parse complain about undefined - * variables. - */ + VarEvalMode emode = doEval ? VARE_EVAL : VARE_PARSE; FStr nestedVal = Var_Parse(&p, SCOPE_CMDLINE, emode); /* TODO: handle errors */ Buf_AddStr(&word, nestedVal.str); @@ -242,7 +236,6 @@ ParseWord(const char **pp, bool doEval) *** 9437 LINES SKIPPED ***home | help
Want to link to this message? Use this
URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?6962c5cd.23ddb.5b399734>
