diff options
| author | Simon J. Gerraty <sjg@FreeBSD.org> | 2026-04-06 18:25:05 +0000 |
|---|---|---|
| committer | Simon J. Gerraty <sjg@FreeBSD.org> | 2026-04-06 18:25:05 +0000 |
| commit | fe271bdb43cf88ee129d94c0e286fe618fd28e89 (patch) | |
| tree | f8a53c5b636b2af4eaa7ac94683cb00033588454 /mk | |
| parent | 638c66de4a0faa4c2e815e81cd4021c2387c7e0f (diff) | |
Diffstat (limited to 'mk')
| -rw-r--r-- | mk/ChangeLog | 38 | ||||
| -rw-r--r-- | mk/dirdeps.mk | 7 | ||||
| -rw-r--r-- | mk/install-mk | 4 | ||||
| -rw-r--r-- | mk/meta.autodep.mk | 4 | ||||
| -rw-r--r-- | mk/meta.stage.mk | 9 | ||||
| -rwxr-xr-x | mk/meta2deps.py | 19 | ||||
| -rwxr-xr-x | mk/meta2deps.sh | 6 | ||||
| -rw-r--r-- | mk/rust.mk | 21 | ||||
| -rw-r--r-- | mk/sys.dirdeps.mk | 15 | ||||
| -rw-r--r-- | mk/sys.mk | 5 | ||||
| -rw-r--r-- | mk/sys.vars.mk | 38 |
11 files changed, 108 insertions, 58 deletions
diff --git a/mk/ChangeLog b/mk/ChangeLog index daacc97ec045..0322cae09232 100644 --- a/mk/ChangeLog +++ b/mk/ChangeLog @@ -1,3 +1,41 @@ +2026-03-12 Simon J Gerraty <sjg@beast.crufty.net> + + * install-mk (MK_VERSION): 20260313 + + * sys.vars.mk: use .MAKE.VERSION + M_type can simply use '$x' + +2026-02-22 Simon J Gerraty <sjg@beast.crufty.net> + + * install-mk (MK_VERSION): 20260222 + + * dirdeps.mk, sys.mk: add dependent option + UPDATE_DIRDEPS_CACHE/DIRDEPS_CACHE. + It can be useful to use -DWITHOUT_UPDATE_DIRDEPS_CACHE to + temporarily treat dynamic DIRDEPS_CACHE as static. + +2026-01-10 Simon J Gerraty <sjg@beast.crufty.net> + + * meta.autodep.mk (${_DEPENDFILE}): add .NOMETA + +2026-01-08 Simon J Gerraty <sjg@beast.crufty.net> + + * rust.mk: better accommodation for RUST_LIBS. + Set RUST_{LIBS,PROGS}_CARGO_BUILD_OUTPUT_LIST to + simplify staging. + +2025-12-08 Simon J Gerraty <sjg@beast.crufty.net> + + * install-mk (MK_VERSION): 20251207 + + * sys.vars.mk: replace MAKE_POSIX_SHELL usage with isPOSIX_SHELL + Using ${isPOSIX_SHELL:U:Nfalse} provides a boolean for make + and ${isPOSIX_SHELL:Ufalse} does the same for target scripts. + Both will be false if isPOSIX_SHELL is not set or set to false. + + This has the advantage that if only POSIX shells are expected + sys.mk (or something it includes) can simply do isPOSIX_SHELL?=: + 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. diff --git a/mk/dirdeps.mk b/mk/dirdeps.mk index b281d15ec346..9f51713cc5d5 100644 --- a/mk/dirdeps.mk +++ b/mk/dirdeps.mk @@ -1,4 +1,4 @@ -# $Id: dirdeps.mk,v 1.175 2025/01/05 01:16:19 sjg Exp $ +# $Id: dirdeps.mk,v 1.176 2026/02/23 21:37:10 sjg Exp $ # SPDX-License-Identifier: BSD-2-Clause # @@ -585,6 +585,11 @@ BUILD_DIRDEPS_MAKEFILE ?= BUILD_DIRDEPS_OVERRIDES ?= BUILD_DIRDEPS_TARGETS ?= ${.TARGETS} +# sometimes we temporarily want to block updating of DIRDEPS_CACHE +.if ${MK_UPDATE_DIRDEPS_CACHE:Uyes} == "no" && exists(${DIRDEPS_CACHE}) +STATIC_DIRDEPS_CACHE ?= ${DIRDEPS_CACHE} +.endif + .if ${DIRDEPS_CACHE} != ${STATIC_DIRDEPS_CACHE:Uno} && ${DIRDEPS_CACHE:M${SRCTOP}/*} == "" # export this for dirdeps-cache-update.mk DYNAMIC_DIRDEPS_CACHE := ${DIRDEPS_CACHE} diff --git a/mk/install-mk b/mk/install-mk index f61d38947b11..20b24ca92ee0 100644 --- a/mk/install-mk +++ b/mk/install-mk @@ -59,7 +59,7 @@ # Simon J. Gerraty <sjg@crufty.net> # RCSid: -# $Id: install-mk,v 1.271 2025/11/11 18:08:02 sjg Exp $ +# $Id: install-mk,v 1.274 2026/03/13 05:13:00 sjg Exp $ # # @(#) Copyright (c) 1994-2025 Simon J. Gerraty # @@ -69,7 +69,7 @@ # sjg@crufty.net # -MK_VERSION=20251111 +MK_VERSION=20260313 OWNER= GROUP= MODE=444 diff --git a/mk/meta.autodep.mk b/mk/meta.autodep.mk index 2120c0892475..1998689306d4 100644 --- a/mk/meta.autodep.mk +++ b/mk/meta.autodep.mk @@ -1,4 +1,4 @@ -# $Id: meta.autodep.mk,v 1.71 2025/08/09 22:42:24 sjg Exp $ +# $Id: meta.autodep.mk,v 1.72 2026/01/11 05:32:29 sjg Exp $ # # @(#) Copyright (c) 2010-2025, Simon J. Gerraty # @@ -305,7 +305,7 @@ GENDIRDEPS_ENV += MAKESYSPATH=${_makesyspath} GENDIRDEPS_ENV += MAKESYSPATH=${.SYSPATH:ts:} .endif -${_DEPENDFILE}: ${_depend} ${.PARSEDIR}/gendirdeps.mk ${META2DEPS} $${.MAKE.META.CREATED} +${_DEPENDFILE}: .NOMETA ${_depend} ${.PARSEDIR}/gendirdeps.mk ${META2DEPS} $${.MAKE.META.CREATED} @echo Checking $@: ${.OODATE:T:[1..8]} @(cd . && ${GENDIRDEPS_ENV} \ SKIP_GENDIRDEPS='${SKIP_GENDIRDEPS:O:u}' \ diff --git a/mk/meta.stage.mk b/mk/meta.stage.mk index c98f0c251c67..b4d1ea4d6773 100644 --- a/mk/meta.stage.mk +++ b/mk/meta.stage.mk @@ -1,4 +1,4 @@ -# $Id: meta.stage.mk,v 1.74 2025/11/19 17:44:15 sjg Exp $ +# $Id: meta.stage.mk,v 1.75 2025/12/08 17:44:57 sjg Exp $ # # @(#) Copyright (c) 2011-2025, Simon J. Gerraty # @@ -31,12 +31,7 @@ CLEANFILES+= .dirdep @echo '${_dirdep}' > $@ .endif -.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} +.if ${isPOSIX_SHELL:U:Nfalse} _stage_file_basename = $${f\#\#*/} _stage_file_dirname = $${f%/*} _stage_target_dirname = $${t%/*} diff --git a/mk/meta2deps.py b/mk/meta2deps.py index 77ed86397a0f..42085e9e7f7d 100755 --- a/mk/meta2deps.py +++ b/mk/meta2deps.py @@ -39,7 +39,7 @@ We only pay attention to a subset of the information in the SPDX-License-Identifier: BSD-2-Clause RCSid: - $Id: meta2deps.py,v 1.54 2025/07/24 16:05:48 sjg Exp $ + $Id: meta2deps.py,v 1.55 2026/01/13 04:32:45 sjg Exp $ Copyright (c) 2011-2025, Simon J. Gerraty Copyright (c) 2011-2017, Juniper Networks, Inc. @@ -446,7 +446,7 @@ class MetaFile: version = 0 # unknown if name: - self.name = name; + self.name = name if file: f = file cwd = self.last_dir = self.cwd @@ -669,7 +669,7 @@ class MetaFile: return if os.path.isdir(path): if op in 'RW': - self.last_dir = path; + self.last_dir = path if self.debug > 1: print("ldir=", self.last_dir, file=self.debug_out) return @@ -703,7 +703,7 @@ class MetaFile: self.seenit(dir) -def main(argv, klass=MetaFile, xopts='', xoptf=None): +def main(argv, klass=MetaFile, xopts='', xoptf=None, conf=None): """Simple driver for class MetaFile. Usage: @@ -743,11 +743,12 @@ def main(argv, klass=MetaFile, xopts='', xoptf=None): except: pass - conf = { - 'SRCTOPS': [], - 'OBJROOTS': [], - 'EXCLUDES': [], - } + if not conf: + conf = {} + + for k in ['EXCLUDES', 'OBJROOTS', 'SRCTOPS']: + if k not in conf: + conf[k] = [] conf['SB'] = os.getenv('SB', '') diff --git a/mk/meta2deps.sh b/mk/meta2deps.sh index 75ef1a4314eb..293ebdab6e7c 100755 --- a/mk/meta2deps.sh +++ b/mk/meta2deps.sh @@ -77,7 +77,7 @@ # RCSid: -# $Id: meta2deps.sh,v 1.25 2025/11/11 18:08:02 sjg Exp $ +# $Id: meta2deps.sh,v 1.26 2025/12/08 17:34:02 sjg Exp $ # SPDX-License-Identifier: BSD-2-Clause # @@ -263,8 +263,8 @@ 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 + # 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= diff --git a/mk/rust.mk b/mk/rust.mk index 8a3c90116c6e..eab6d8b10181 100644 --- a/mk/rust.mk +++ b/mk/rust.mk @@ -1,6 +1,6 @@ -# $Id: rust.mk,v 1.38 2025/08/09 22:42:24 sjg Exp $ +# $Id: rust.mk,v 1.40 2026/01/08 20:34:30 sjg Exp $ # -# @(#) Copyright (c) 2024, Simon J. Gerraty +# @(#) Copyright (c) 2024-2026, Simon J. Gerraty # # SPDX-License-Identifier: BSD-2-Clause # @@ -180,15 +180,24 @@ all: cargo.clippy .if !defined(RUST_LIBS) RUST_PROGS ?= ${RUST_PROJECT_DIR:T} .endif -.if !empty(RUST_PROGS) -BINDIR ?= ${prefix}/bin +.if !empty(RUST_LIBS) || !empty(RUST_PROGS) # there could be a target triple involved RUST_CARGO_TARGET_DIR ?= ${CARGO_TARGET_DIR} RUST_CARGO_OUTPUT_DIR ?= ${RUST_CARGO_TARGET_DIR}/${RUST_CARGO_TARGET} -RUST_CARGO_BUILD_OUTPUT_LIST := ${RUST_PROGS:S,^,${RUST_CARGO_OUTPUT_DIR}/,} +.if !empty(RUST_LIBS) +LIBDIR ?= ${prefix}/lib +RUST_LIBS_CARGO_BUILD_OUTPUT_LIST := ${RUST_LIBS:S,^,${RUST_CARGO_OUTPUT_DIR}/,} + +${RUST_LIBS_CARGO_BUILD_OUTPUT_LIST}: cargo.build +.endif + +.if !empty(RUST_PROGS) +BINDIR ?= ${prefix}/bin +RUST_PROGS_CARGO_BUILD_OUTPUT_LIST := ${RUST_PROGS:S,^,${RUST_CARGO_OUTPUT_DIR}/,} -${RUST_CARGO_BUILD_OUTPUT_LIST}: cargo.build +${RUST_PROGS_CARGO_BUILD_OUTPUT_LIST}: cargo.build +.endif .endif # for late customizations diff --git a/mk/sys.dirdeps.mk b/mk/sys.dirdeps.mk index 66b7f900697c..2d68c0490d81 100644 --- a/mk/sys.dirdeps.mk +++ b/mk/sys.dirdeps.mk @@ -1,4 +1,4 @@ -# $Id: sys.dirdeps.mk,v 1.16 2025/08/09 22:42:24 sjg Exp $ +# $Id: sys.dirdeps.mk,v 1.17 2026/02/15 17:04:27 sjg Exp $ # # @(#) Copyright (c) 2012-2023, Simon J. Gerraty # @@ -96,10 +96,15 @@ TARGET_SPEC = ${TARGET_SPEC_VARS:@v@${$v:U}@:ts,} .if ${TARGET_SPEC_VARS:[#]} > 1 TARGET_SPEC_VARSr := ${TARGET_SPEC_VARS:[-1..1]} -# alternatives might be -# TARGET_OBJ_SPEC = ${TARGET_SPEC_VARSr:@v@${$v:U}@:ts/} -# TARGET_OBJ_SPEC = ${TARGET_SPEC_VARS:@v@${$v:U}@:ts/} -TARGET_OBJ_SPEC ?= ${TARGET_SPEC_VARS:@v@${$v:U}@:ts.} +# +# local.sys.*mk can control the format of TARGET_OBJ_SPEC +# by setting eg. +# TARGET_OBJ_SPEC_VARS = ${TARGET_SPEC_VARSr} +# TARGET_OBJ_SPEC_SEP = / +# +TARGET_OBJ_SPEC_VARS ?= ${TARGET_SPEC_VARS} +TARGET_OBJ_SPEC_SEP ?= . +TARGET_OBJ_SPEC = ${TARGET_OBJ_SPEC_VARS:@v@${$v:U}@:ts${TARGET_OBJ_SPEC_SEP}} .else TARGET_OBJ_SPEC ?= ${MACHINE} .endif diff --git a/mk/sys.mk b/mk/sys.mk index 4cbe976b439f..5b8d55e53604 100644 --- a/mk/sys.mk +++ b/mk/sys.mk @@ -1,4 +1,4 @@ -# $Id: sys.mk,v 1.66 2025/11/19 03:38:20 sjg Exp $ +# $Id: sys.mk,v 1.67 2026/02/23 21:37:10 sjg Exp $ # # @(#) Copyright (c) 2003-2023, Simon J. Gerraty # @@ -86,7 +86,7 @@ EGREP ?= egrep # some options we need to know early OPTIONS_DEFAULT_NO += \ DIRDEPS_BUILD \ - DIRDEPS_CACHE + DIRDEPS_CACHE \ OPTIONS_DEFAULT_DEPENDENT += \ AUTO_OBJ/DIRDEPS_BUILD \ @@ -95,6 +95,7 @@ OPTIONS_DEFAULT_DEPENDENT += \ STAGING/DIRDEPS_BUILD \ STATIC_DIRDEPS_CACHE/DIRDEPS_CACHE \ UPDATE_DEPENDFILE/DIRDEPS_BUILD \ + UPDATE_DIRDEPS_CACHE/DIRDEPS_CACHE \ .-include <options.mk> diff --git a/mk/sys.vars.mk b/mk/sys.vars.mk index f8e6dd7f2c87..7d9cd2f6641f 100644 --- a/mk/sys.vars.mk +++ b/mk/sys.vars.mk @@ -1,4 +1,4 @@ -# $Id: sys.vars.mk,v 1.24 2025/11/19 17:44:15 sjg Exp $ +# $Id: sys.vars.mk,v 1.27 2026/03/13 16:02:44 sjg Exp $ # # @(#) Copyright (c) 2003-2023, Simon J. Gerraty # @@ -24,25 +24,21 @@ MAKE_VERSION ?= 0 MAKE_VERSION := ${MAKE_VERSION:[1]:C,.*-,,} .endif -.if ${MAKE_VERSION} < 20100414 +# from (20260210) .MAKE.VERSION is read-only +.MAKE.VERSION ?= ${MAKE_VERSION} + +.if ${.MAKE.VERSION} < 20100414 _this = ${.PARSEDIR}/${.PARSEFILE} .else _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 +# This is a boolean we can use in makefiles: +# .if ${isPOSIX_SHELL:U:Nfalse} +# as well as in target scripts: +# if ${isPOSIX_SHELL:Ufalse}; then +.if empty(isPOSIX_SHELL) +isPOSIX_SHELL != (echo $${PATH%:*}) > /dev/null 2>&1 && echo : || echo false .export isPOSIX_SHELL .endif @@ -66,14 +62,14 @@ _type_sh = which .endif # :sh1 evaluates command only once and caches the result. -.if ${MAKE_VERSION} < 20251111 +.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;@:${M_sh1:Ush}:[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) @@ -98,7 +94,7 @@ M_JOT = [1]:@x@i=1;while [ $$$$i -le $$x ]; do echo $$$$i; i=$$$$((i + 1)); done .endif # ${LIST:${M_RANGE}} is 1 2 3 4 5 if LIST has 5 words -.if ${MAKE_VERSION} < 20170130 +.if ${.MAKE.VERSION} < 20170130 M_RANGE = [#]:${M_JOT} .else M_RANGE = range @@ -108,7 +104,7 @@ M_RANGE = range M_P2V = tu:C,[./-],_,g # convert path to absolute -.if ${MAKE_VERSION} < 20100414 +.if ${.MAKE.VERSION} < 20100414 M_tA = C,.*,('cd' & \&\& 'pwd') 2> /dev/null || echo &,:sh .else M_tA = tA @@ -117,7 +113,7 @@ M_tA = tA # absoulte path to what we are reading. _PARSEDIR = ${.PARSEDIR:${M_tA}} -.if ${MAKE_VERSION} >= 20170130 +.if ${.MAKE.VERSION} >= 20170130 # M_cmpv allows comparing dotted versions like 3.1.2 # ${3.1.2:L:${M_cmpv}} -> 3001002 # we use big jumps to handle 3 digits per dot: @@ -132,7 +128,7 @@ M_cmpv = S,., ,g:C,^0*([0-9]),\1,:_:range:@i@+ $${_:[-$$i]} \* $${M_cmpv.units:[ M_M.M.P_VERSION = L:@v@$${MAJOR MINOR PATCH:L:@t@$${$$v_$$t_VERSION:U0}@}@:ts. # numeric sort -.if ${MAKE_VERSION} < 20210803 +.if ${.MAKE.VERSION} < 20210803 M_On = O M_Onr = O .else |
