From nobody Mon May 15 20:25:19 2023 X-Original-To: dev-commits-src-all@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4QKrTW603hz4B31K; Mon, 15 May 2023 20:25:19 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4QKrTW5RWhz4GZl; Mon, 15 May 2023 20:25:19 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1684182319; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=ED93y+bLt6igNHtKO/5kjOtnVsYos+GPoXC6oeOVz4g=; b=cN6xZeKRzDYP4uFTXpupIloc9cIPn4A46gkmkdnxLvQrfen96oxq7g/3ZBg5oG4xp/SxOe Su4A37Ea4Br6u2vm9pNCv01VyXBXVXMocjXXzpRB3A5kut6T651KAc1gGzrkgeljfJkcO0 rjHTURfr/hkJvblnJ6l1Flo8L0yYha6R2JUhtfWmeJ4j2cOgFA4D/MtiJhn7uXMYfbmlrj ZP+Hes6qSW+aNjMxBGVjdVlIoRMRXO8qkj7ywahwe6oh9PB5b+I8oGhOHzwWfuydJN39Ox oPR06d3fkXAA2JZZK9Qmnd42zBCcX+e3Z6PswX9SlnChfTvOAWMOu338XaYW/Q== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1684182319; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=ED93y+bLt6igNHtKO/5kjOtnVsYos+GPoXC6oeOVz4g=; b=xZlPACIYI6rOLYch4gg0YTApc84x0wF60rcQbBrQNwklGAJps2aiX6HaIWjNsu4Qu7sqhM NGb1hijYRp4LDFL+nRprnKG/JwtAt4E5c0PD7FHsT1qsHpNM3dPPhW0TWx59rA0V3Jd5aO IJjwHR9cwDv5L9DiuJHaozv7YR4r1ena3zAPvqRM2NAjY5WE06TwKyKePYfNXfyVGzB7Iw 7Mqfr/9UVciEBailLlmN+IxeO+ge1zOeRia50GA55+7wBnHMd1liBUHj4PaUcbwoLInZwN ETVfGS7GFgwzWibbwdQlcrR4+3NZ8MW+xueuQEDd5+tc66eeFrqjU/5AsxeblA== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1684182319; a=rsa-sha256; cv=none; b=C0o70MentnS0GydMv/DDvNbXMpSKoAF+VYsaCGVrpLb/4Elh+cxYZU13ueZkFPBXeMvJ0p VDxbKiR5X/39QjuewspzMemIr7Gqj2m567fkl6VaPvV6gQLGDFmnjMHZisvZDXyi0fE0B5 Rprb6QmsiKvMcvLQHEXcWMqCv4lp7rtBszOOVy6IIiUyRMsz1fHohEqBPpxPCASUu2wIX0 gt02LOn5VN8YWXFOEvPZfRWW3WK4Me5dkcMSv+p9E5flrONOhv4T5sXWLCY2xcMN2u971k AqCRauKOMRU4tn5jadyW6Zh5sSZUW0oweyAtk+glsstG6JqA4fh3cBrYoBf1lg== Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 4QKrTW4MKJztx9; Mon, 15 May 2023 20:25:19 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 34FKPJRl034919; Mon, 15 May 2023 20:25:19 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 34FKPJMs034918; Mon, 15 May 2023 20:25:19 GMT (envelope-from git) Date: Mon, 15 May 2023 20:25:19 GMT Message-Id: <202305152025.34FKPJMs034918@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: "Simon J. Gerraty" Subject: git: 92a4e8b34814 - main - dirdeps.mk allow for TARGET_SPEC_VARS.host List-Id: Commit messages for all branches of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-all List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-all@freebsd.org X-BeenThere: dev-commits-src-all@freebsd.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: sjg X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 92a4e8b348143c2988179be15e73b221d56195ac Auto-Submitted: auto-generated X-ThisMailContainsUnwantedMimeParts: N The branch main has been updated by sjg: URL: https://cgit.FreeBSD.org/src/commit/?id=92a4e8b348143c2988179be15e73b221d56195ac commit 92a4e8b348143c2988179be15e73b221d56195ac Author: Simon J. Gerraty AuthorDate: 2023-05-15 20:25:10 +0000 Commit: Simon J. Gerraty CommitDate: 2023-05-15 20:25:10 +0000 dirdeps.mk allow for TARGET_SPEC_VARS.host While *most* projects need only DEP_MACHINE for host, there is always an exception. So we allow for TARGET_SPEC_VARS.host to be a subset of TARGET_SPEC_VARS. The default will *just work* for most projects. We set DEP_TARGET_SPEC_VARS and hence DEP_TARGET_SPEC based on DEP_MACHINE. Allow for M_dep_qual_fixes.host to be different too and take care to apply the right set. --- share/mk/dirdeps.mk | 64 ++++++++++++++++++++++++++++++----------------------- 1 file changed, 36 insertions(+), 28 deletions(-) diff --git a/share/mk/dirdeps.mk b/share/mk/dirdeps.mk index da5350be480f..2cf62bed3d9e 100644 --- a/share/mk/dirdeps.mk +++ b/share/mk/dirdeps.mk @@ -1,4 +1,4 @@ -# $Id: dirdeps.mk,v 1.161 2023/05/13 21:02:14 sjg Exp $ +# $Id: dirdeps.mk,v 1.162 2023/05/15 17:37:46 sjg Exp $ # SPDX-License-Identifier: BSD-2-Clause # @@ -212,12 +212,16 @@ _DEP_TARGET_SPEC = # it should be set by sys.mk or similar by now. # TARGET_SPEC must not contain any '.'s. TARGET_SPEC_VARS ?= MACHINE +# we allow for this to be a subset +TARGET_SPEC_VARS.host ?= MACHINE +TARGET_SPEC_VARS.host32 = ${TARGET_SPEC_VARS.host} # this is what we started with TARGET_SPEC = ${TARGET_SPEC_VARS:@v@${$v:U}@:ts,} # this is what we mostly use below -DEP_TARGET_SPEC = ${TARGET_SPEC_VARS:S,^,DEP_,:@v@${$v:U}@:ts,} +DEP_TARGET_SPEC_VARS = ${TARGET_SPEC_VARS.${DEP_MACHINE}:U${TARGET_SPEC_VARS}} +DEP_TARGET_SPEC = ${DEP_TARGET_SPEC_VARS:S,^,DEP_,:@v@${$v:U}@:ts,} # make sure we have defaults -.for v in ${TARGET_SPEC_VARS} +.for v in ${DEP_TARGET_SPEC_VARS} DEP_$v ?= ${$v} .endfor @@ -227,12 +231,7 @@ DEP_$v ?= ${$v} # we compute below are fully qualified wrt DEP_TARGET_SPEC. # The makefiles may only partially specify (eg. MACHINE only), # so we need to construct a set of modifiers to fill in the gaps. -.if ${MAKE_VERSION} >= 20170130 -_tspec_x := ${TARGET_SPEC_VARS:range} -.else -# do it the hard way -_tspec_x := ${TARGET_SPEC_VARS:[#]:@x@i=1;while [ $$i -le $x ]; do echo $$i; i=$$((i + 1)); done;@:sh} -.endif +_tspec_x := ${TARGET_SPEC_VARS:${M_RANGE:Urange}} # this handles unqualified entries M_dep_qual_fixes = C;(/[^/.,]+)$$;\1.$${DEP_TARGET_SPEC}; # there needs to be at least one item missing for these to make sense @@ -242,10 +241,27 @@ _tspec_a$i := ,${TARGET_SPEC_VARS:[$i..-1]:@v@$$$${DEP_$v}@:ts,} M_dep_qual_fixes += C;(\.${_tspec_m$i})$$;\1${_tspec_a$i}; .endfor TARGET_SPEC_VARSr := ${TARGET_SPEC_VARS:[-1..1]} +.if ${TARGET_SPEC_VARS.host} == ${TARGET_SPEC_VARS} +M_dep_qual_fixes.host = ${M_dep_qual_fixes} +.elif ${TARGET_SPEC_VARS.host:[#]} > 1 +_htspec_x := ${TARGET_SPEC_VARS.host:${M_RANGE:Urange}} +# this handles unqualified entries +M_dep_qual_fixes.host = C;(/[^/.,]+)$$;\1.$${DEP_TARGET_SPEC}; +# there needs to be at least one item missing for these to make sense +.for i in ${_htspec_x:[2..-1]} +_htspec_m$i := ${TARGET_SPEC_VARS.host:[2..$i]:@w@[^,]+@:ts,} +_htspec_a$i := ,${TARGET_SPEC_VARS.host:[$i..-1]:@v@$$$${DEP_$v}@:ts,} +M_dep_qual_fixes.host += C;(\.${_htspec_m$i})$$;\1${_htspec_a$i}; +.endfor +.else +M_dep_qual_fixes.host = U +.endif .else # A harmless? default. M_dep_qual_fixes = U .endif +M_dep_qual_fixes.host ?= ${M_dep_qual_fixes} +M_dep_qual_fixes.host32 = ${M_dep_qual_fixes.host} .if !defined(.MAKE.DEPENDFILE_PREFERENCE) # .MAKE.DEPENDFILE_PREFERENCE makes the logic below neater? @@ -328,7 +344,7 @@ _tspec := ${_DEP_TARGET_SPEC:S/,/ /g} .for i in ${_tspec_x} DEP_${TARGET_SPEC_VARS:[$i]} := ${_tspec:[$i]} .endfor -.for v in ${TARGET_SPEC_VARS:O:u} +.for v in ${DEP_TARGET_SPEC_VARS:O:u} .if empty(DEP_$v) .undef DEP_$v .endif @@ -337,14 +353,6 @@ DEP_${TARGET_SPEC_VARS:[$i]} := ${_tspec:[$i]} DEP_MACHINE := ${_DEP_TARGET_SPEC} .endif -# host is special -.if ${DEP_MACHINE:Mhost*} != "" -DEP_TARGET_SPEC = ${DEP_MACHINE} -.for v in ${TARGET_SPEC_VARS:O:u:NMACHINE} -.undef DEP_$v -.endfor -.endif - # reset each time through _build_all_dirs = _build_xtra_dirs = @@ -651,7 +659,7 @@ _machines += host _machines := ${_machines:O:u} .endif -.if ${TARGET_SPEC_VARS:[#]} > 1 +.if ${DEP_TARGET_SPEC_VARS:[#]} > 1 # we need to tweak _machines _dm := ${DEP_MACHINE} # apply the same filtering that we do when qualifying DIRDEPS. @@ -659,7 +667,7 @@ _dm := ${DEP_MACHINE} # Again we expect that any already qualified machines are fully qualified. _machines := ${_machines:M*,*} ${_machines:N*,*:@DEP_MACHINE@${DEP_TARGET_SPEC}@:S,^,.,:S,^.,,} DEP_MACHINE := ${_dm} -_machines := ${_machines:${M_dep_qual_fixes:ts:}:O:u} +_machines := ${_machines:${M_dep_qual_fixes.${DEP_MACHINE}:U${M_dep_qual_fixes}:ts:}:O:u} .endif # reset each time through @@ -721,7 +729,7 @@ _build_dirs += \ .info _build_dirs=${_build_dirs} .endif # make sure we do not mess with qualifying "host" entries -_build_dirs := ${_build_dirs:M*.host*} \ +_build_dirs := ${_build_dirs:M*.host*:${M_dep_qual_fixes.host:ts:}} \ ${_build_dirs:N*.host*:${M_dep_qual_fixes:ts:}} _build_dirs := ${_build_dirs:O:u} .if ${_debug_reldir} @@ -776,9 +784,10 @@ _cache_script += echo; echo 'DIRDEPS.${_this_dir}.$m = \'; .endif # it would be nice to do :N${.TARGET} .if !empty(__qual_depdirs) -.for q in ${__qual_depdirs:${M_dep_qual_fixes:ts:}:E:O:u:N$m} +.for q in ${__qual_depdirs:M*.host*:${M_dep_qual_fixes.host:ts:}:E:O:u:N$m} \ + ${__qual_depdirs:N*.host*:${M_dep_qual_fixes:ts:}:E:O:u:N$m} .if ${_debug_reldir} || ${DEBUG_DIRDEPS:@x@${${DEP_RELDIR}.$m:L:M$x}${${DEP_RELDIR}.$q:L:M$x}@} != "" -.info ${DEP_RELDIR}.$m: graph: ${_build_dirs:M*.$q:S,^${SRCTOP}/,,} +.info ${DEP_RELDIR}.$m: q=$q graph: ${_build_dirs:M*.$q:S,^${SRCTOP}/,,} .endif .if ${BUILD_DIRDEPS_CACHE} == "yes" _cache_deps += ${_build_dirs:M*.$q:S,^${SRCTOP}/,,} @@ -825,14 +834,13 @@ _dr := ${d:S,^${SRCTOP}/,,} _DEP_TARGET_SPEC := ${d:E} # some makefiles may still look at this _DEP_MACHINE := ${d:E:C/,.*//} +DEP_MACHINE := ${_DEP_MACHINE} # set these too in case Makefile.depend* uses them -.if ${TARGET_SPEC_VARS:[#]} > 1 +.if ${DEP_TARGET_SPEC_VARS:[#]} > 1 _dtspec := ${_DEP_TARGET_SPEC:S/,/ /g} .for i in ${_tspec_x} -DEP_${TARGET_SPEC_VARS:[$i]} := ${_dtspec:[$i]} +DEP_${DEP_TARGET_SPEC_VARS:[$i]} := ${_dtspec:[$i]} .endfor -.else -DEP_MACHINE := ${_DEP_MACHINE} .endif # Warning: there is an assumption here that MACHINE is always # the first entry in TARGET_SPEC_VARS. @@ -840,7 +848,7 @@ DEP_MACHINE := ${_DEP_MACHINE} _m := ${.MAKE.DEPENDFILE_PREFERENCE:T:S;${TARGET_SPEC}$;${d:E};:C;${MACHINE}((,.+)?)$;${d:E:C/,.*//}\1;:@m@${exists(${d:R}/$m):?${d:R}/$m:}@:[1]} .if !empty(_m) # M_dep_qual_fixes isn't geared to Makefile.depend -_qm := ${_m:C;(\.depend)$;\1.${d:E};:${M_dep_qual_fixes:ts:}} +_qm := ${_m:C;(\.depend)$;\1.${d:E};:${M_dep_qual_fixes.${d:E}:U${M_dep_qual_fixes}:ts:}} .if ${_debug_search} .info Looking for ${_qm} .endif