From nobody Fri Apr 21 03:39:42 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 4Q2gJG4XNgz472JM; Fri, 21 Apr 2023 03:39:42 +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 4Q2gJG39jWz3jp7; Fri, 21 Apr 2023 03:39:42 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1682048382; 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=anHUs+f5CnNC4ov0m8EAfyh/hMpfic2bSAXg7mBemCE=; b=Vzbr0lhQM2dVXq+AUmbyDNipr2lwp+5B548v7cMbjkrDxqXTh1XASu0nQ5jLeDcyoE5vSe XLVO1oFH0gW3jNeylJQI4+UrpPHcIzW/VbGhtAPGNLD8y7YTo7ari3PIx7c8YUwXJemVdD +7idaxc5b7p8M8vs/KuZkHCWFJaNPOnrv4dZaAatirIFkIrE8vPHTAE+MgwO6hP3sibPWi oFcpibkJyIH9v8UxrEWxv1rbpL90A8E7JiqnCTpaZWbRq9TpsslE7WasrDvZagBhw6Cnv2 MH7xCGd4MybYM+Wg5RhUGLKThGNE6VrnBkXZmf+XbgNKW8s3x5EIsVD6A2ZBRA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1682048382; 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=anHUs+f5CnNC4ov0m8EAfyh/hMpfic2bSAXg7mBemCE=; b=WnBVHxAavFErhpPP0JTpY37Qbr9u2KIiX1vomhO7Lhp2Exv8Akjrp8hwMS96hYtjkV9BB0 sKDncGY6a1FFf1+F8AFjlX8SiAVwl1FrGCkEHv34PCyKfBFZIhg3IkRShgh50uKcBrzfzZ m1wx9gHHP+NXh7o0ZNJL/c7Kb5/9Rh8qdDr2mgRXgSWnNuOwB8+JxA/MbIMovwIMcWdXJh 2BA4jV+KLyVQjm+aPXSqkgKy6iAPKvlffbCAIB48K2GHT00UkMXHBMjnoDqjW9I4hmEhFX vM9u0wuorcNGk3xm1vohf9AfKUGY5p2ZT9TN2zvhxPQqNJyE5kur7AC1ovc+Sw== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1682048382; a=rsa-sha256; cv=none; b=nD5arTs+TajlGtkLSqMnyD5Mea7eXN/9C6Z3HgQrXx9RI6aHgTayPzDqIiZKZlaj1kFM/y JsGU/BVQyqS3gdyCCMTvcq/t+MLkG63FiD+FlSF3+M8QLBr2u3NGfwSts6iaprmIRb9TEs dW0w/lpsg6D8eGXzQDbApVeYYUPrYP7gEq1DzITQKh0dRDyfshwOV4MkOy1dlpCX4/Lh+X LTMbwjaPpy3xgUYBsODew0jbH+f9Jn0q89VlaP3ae19n2eZ/n9PHORthnHxMNsOOQ4xTQ8 yXGG/Q8C5H+E2Qm0XV21Wac+W404UFfIoSHQQ17iHHaHIn5pw+vgQZsuEFxrBA== 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 4Q2gJG1wJpz14lT; Fri, 21 Apr 2023 03:39:42 +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 33L3dgho067539; Fri, 21 Apr 2023 03:39:42 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 33L3dgNI067538; Fri, 21 Apr 2023 03:39:42 GMT (envelope-from git) Date: Fri, 21 Apr 2023 03:39:42 GMT Message-Id: <202304210339.33L3dgNI067538@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: f957a32dacfd - main - Update meta.sys.mk and related local*mk 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: f957a32dacfd0e18e574d0797e4bec4bec9f15af Auto-Submitted: auto-generated X-ThisMailContainsUnwantedMimeParts: N The branch main has been updated by sjg: URL: https://cgit.FreeBSD.org/src/commit/?id=f957a32dacfd0e18e574d0797e4bec4bec9f15af commit f957a32dacfd0e18e574d0797e4bec4bec9f15af Author: Simon J. Gerraty AuthorDate: 2023-04-21 03:38:53 +0000 Commit: Simon J. Gerraty CommitDate: 2023-04-21 03:38:53 +0000 Update meta.sys.mk and related local*mk Move the setting of TARGET_SPEC_VARS to local.sys.env.mk so meta.sys.mk can do the processing, and include local.meta.sys.mk later. Move the setting of GENDIRDEPS_FILTER*_VARS from local.gendirdeps.mk to local.meta.sys.mk so we can automatically set DEP_* at level 1+ to avoid syntax errors when DEP_* variables are used in conditionals in Makefile.depend files. Update gendirdeps.mk just to get the documentation about the above. No functional change. local.dirdeps.mk be more careful about adding to DIRDEPS to avoid unnecessary overhead, and introducing cycles in the graph. Also set DEP_MACHINE_CPUARCH. Reviewed by: stevek Sponsored by: Juniper Networks, Inc. Differential Revision: https://reviews.freebsd.org/D39737 --- share/mk/gendirdeps.mk | 35 +++++++++++++++++++++++++- share/mk/local.dirdeps.mk | 3 ++- share/mk/local.gendirdeps.mk | 16 ++---------- share/mk/local.meta.sys.mk | 60 +++++++++++++++++++++----------------------- share/mk/local.sys.env.mk | 5 ++++ share/mk/meta.sys.mk | 44 +++++++++++++++++++++++++++++--- 6 files changed, 112 insertions(+), 51 deletions(-) diff --git a/share/mk/gendirdeps.mk b/share/mk/gendirdeps.mk index 1ff2036237ed..ec4e188cdf78 100644 --- a/share/mk/gendirdeps.mk +++ b/share/mk/gendirdeps.mk @@ -1,5 +1,7 @@ -# $Id: gendirdeps.mk,v 1.48 2022/09/09 17:44:29 sjg Exp $ +# $Id: gendirdeps.mk,v 1.49 2023/04/20 17:45:03 sjg Exp $ +# SPDX-License-Identifier: BSD-2-Clause +# # Copyright (c) 2011-2020, Simon J. Gerraty # Copyright (c) 2010-2018, Juniper Networks, Inc. # All rights reserved. @@ -41,6 +43,37 @@ # symlink to another filesystem. # _objroot must be a prefix match for _objtop +# If any of GENDIRDEPS_FILTER, GENDIRDEPS_FILTER_DIR_VARS +# or GENDIRDEPS_FILTER_VARS are set, we use them to filter the +# output from filemon(4). +# Any references to variables that dirdeps.mk will set +# such as DEP_MACHINE, DEP_RELDIR etc, should use that form. +# Thus we want ${DEP_MACHINE} not ${MACHINE} used in DIRDEPS. +# +# If any manually maintained Makefile.depend files will use any +# DEP_* variables in conditionals, precautions are needed to avoid +# errors when Makefile.depend is read at level 1+ (ie not via +# dirdeps.mk) +# Using MACHINE as an example; such makefiles can do: +# +# DEP_MACHINE ?= ${MACHINE} +# .if ${DEP_MACHINE} == "xyz" +# +# or: +# +# .if ${DEP_MACHINE:U${MACHINE}} == "xyz" +# +# but it might be safer to set GENDIRDEPS_FILTER_DIR_VARS and +# GENDIRDEPS_FILTER_VARS via local.meta.sys.mk rather than +# local.gendirdeps.mk and then: +# +# .if ${.MAKE.LEVEL} > 0 +# .for V in ${GENDIRDEPS_FILTER_DIR_VARS:MDEP_*} \ +# ${GENDIRDEPS_FILTER_VARS:MDEP_*} +# $V ?= ${${V:S,DEP_,,}} +# .endfor +# .endif +# .MAIN: all # keep this simple diff --git a/share/mk/local.dirdeps.mk b/share/mk/local.dirdeps.mk index d7e5396c81ed..246c9cdef114 100644 --- a/share/mk/local.dirdeps.mk +++ b/share/mk/local.dirdeps.mk @@ -207,12 +207,13 @@ DIRDEPS+= ${_lib${_lib}reldir} .if ${MK_STAGING} == "yes" # we need targets/pseudo/stage to prep the stage tree -.if ${DEP_RELDIR} != "targets/pseudo/stage" +.if ${DEP_RELDIR:N.:N${SRCTOP}:N*pseudo/stage} != "" DIRDEPS += targets/pseudo/stage .endif .endif DEP_MACHINE_ARCH = ${MACHINE_ARCH.${DEP_MACHINE}} +DEP_MACHINE_CPUARCH = ${DEP_MACHINE_ARCH:${__TO_CPUARCH}} CSU_DIR.${DEP_MACHINE_ARCH} ?= csu/${DEP_MACHINE_ARCH} CSU_DIR := ${CSU_DIR.${DEP_MACHINE_ARCH}} BOOT_MACHINE_DIR:= ${BOOT_MACHINE_DIR.${DEP_MACHINE}} diff --git a/share/mk/local.gendirdeps.mk b/share/mk/local.gendirdeps.mk index c8aa3ce05910..c224c7c64bd2 100644 --- a/share/mk/local.gendirdeps.mk +++ b/share/mk/local.gendirdeps.mk @@ -53,20 +53,8 @@ GENDIRDEPS_FILTER+= ${GENDIRDEPS_FILTER_HOST_TOOLS} GENDIRDEPS_FILTER+= ${GENDIRDEPS_FILTER.${MACHINE}:U} # gendirdeps.mk will turn _{VAR} into ${VAR} which keeps this simple -# order of this list matters! -GENDIRDEPS_FILTER_DIR_VARS+= \ - CSU_DIR \ - BOOT_MACHINE_DIR - -# order of this list matters! -GENDIRDEPS_FILTER_VARS+= \ - KERNEL_NAME \ - MACHINE_CPUARCH \ - MACHINE_ARCH \ - MACHINE - -GENDIRDEPS_FILTER+= ${GENDIRDEPS_FILTER_DIR_VARS:@v@S,${$v},_{${v}},@} -GENDIRDEPS_FILTER+= ${GENDIRDEPS_FILTER_VARS:@v@S,/${$v}/,/_{${v}}/,@:NS,//,*:u} +# see local.meta.sys.mk for GENDIRDEPS_FILTER_DIR_VARS and +# GENDIRDEPS_FILTER_VARS # avoid churn for now LOCAL_DEPENDS_GUARD= _{DEP_RELDIR} == _{_DEP_RELDIR} diff --git a/share/mk/local.meta.sys.mk b/share/mk/local.meta.sys.mk index 6d54d9c5881c..6e03a99d7dfe 100644 --- a/share/mk/local.meta.sys.mk +++ b/share/mk/local.meta.sys.mk @@ -1,7 +1,6 @@ # $FreeBSD$ # local configuration specific to meta mode -# XXX some of this should be in meta.sys.mk # we assume that MK_DIRDEPS_BUILD=yes # we need this until there is an alternative @@ -34,7 +33,6 @@ MACHINE_ARCH.$m?= ${MACHINE_ARCH_LIST.$m:[1]} BOOT_MACHINE_DIR.$m ?= boot/$m .endfor -.ifndef _TARGET_SPEC .if empty(MACHINE_ARCH) .if !empty(TARGET_ARCH) MACHINE_ARCH= ${TARGET_ARCH} @@ -44,36 +42,6 @@ MACHINE_ARCH= ${MACHINE_ARCH.${MACHINE}} .endif MACHINE_ARCH?= ${MACHINE_ARCH.${MACHINE}} MACHINE_ARCH:= ${MACHINE_ARCH} -.else -# we got here via dirdeps -MACHINE_ARCH:= ${MACHINE_ARCH.${MACHINE}} -.endif - -# now because for universe we want to potentially -# build for multiple MACHINE_ARCH per MACHINE -# we need more than MACHINE in TARGET_SPEC -TARGET_SPEC_VARS?= MACHINE MACHINE_ARCH -# see dirdeps.mk -.if ${TARGET_SPEC:Uno:M*,*} != "" -_tspec := ${TARGET_SPEC:S/,/ /g} -MACHINE := ${_tspec:[1]} -MACHINE_ARCH := ${_tspec:[2]} -# etc. -# We need to stop that TARGET_SPEC affecting any submakes -# and deal with MACHINE=${TARGET_SPEC} in the environment. -TARGET_SPEC= -# export but do not track -.export-env TARGET_SPEC -.export ${TARGET_SPEC_VARS} -.for v in ${TARGET_SPEC_VARS:O:u} -.if empty($v) -.undef $v -.endif -.endfor -.endif -# make sure we know what TARGET_SPEC is -# as we may need it to find Makefile.depend* -TARGET_SPEC = ${TARGET_SPEC_VARS:@v@${$v:U}@:ts,} # to be consistent with src/Makefile just concatenate with '.'s TARGET_OBJ_SPEC:= ${TARGET_SPEC:S;,;.;g} @@ -96,6 +64,7 @@ TARGET_MACHINE= host .endif .if ${MACHINE} == "host" OBJTOP := ${HOST_OBJTOP} +MACHINE_ARCH= ${MACHINE_ARCH.${MACHINE}} .endif .if ${.MAKE.LEVEL} == 0 || empty(PYTHON) @@ -267,3 +236,30 @@ META_MODE+= missing-meta=yes .if empty(META_MODE:Mnofilemon) META_MODE+= missing-filemon=yes .endif + +.if ${MK_DIRDEPS_BUILD} == "yes" +# we set these here, rather than local.gendirdeps.mk +# so we can ensure any DEP_* values that might be used in +# conditionals do not cause syntax errors when Makefile.depend +# is included at level 1+ + +# order of this list matters! +GENDIRDEPS_FILTER_DIR_VARS+= \ + CSU_DIR \ + BOOT_MACHINE_DIR + +# order of this list matters! +GENDIRDEPS_FILTER_VARS+= \ + KERNEL_NAME \ + DEP_MACHINE_CPUARCH \ + DEP_MACHINE_ARCH \ + DEP_MACHINE + +.if ${.MAKE.LEVEL} > 0 +.for V in ${GENDIRDEPS_FILTER_DIR_VARS:MDEP_*:O:u} \ + ${GENDIRDEPS_FILTER_VARS:MDEP_*:O:u} +$V?= ${${V:S,DEP_,,}} +.endfor +.endif + +.endif diff --git a/share/mk/local.sys.env.mk b/share/mk/local.sys.env.mk index e3348537db41..626aafe61270 100644 --- a/share/mk/local.sys.env.mk +++ b/share/mk/local.sys.env.mk @@ -50,3 +50,8 @@ ECHO_TRACE?= true .include "src.sys.env.mk" .-include + +# For universe we want to potentially +# build for multiple MACHINE_ARCH per MACHINE +# so we need more than MACHINE in TARGET_SPEC +TARGET_SPEC_VARS?= MACHINE MACHINE_ARCH diff --git a/share/mk/meta.sys.mk b/share/mk/meta.sys.mk index cccab7ca952d..1fc58a226cb1 100644 --- a/share/mk/meta.sys.mk +++ b/share/mk/meta.sys.mk @@ -1,5 +1,4 @@ -# $FreeBSD$ -# $Id: meta.sys.mk,v 1.42 2021/12/13 05:50:55 sjg Exp $ +# $Id: meta.sys.mk,v 1.46 2023/04/18 18:43:00 sjg Exp $ # # @(#) Copyright (c) 2010-2021, Simon J. Gerraty @@ -21,7 +20,44 @@ .if ${MAKE_VERSION:U0} > 20100901 .if !target(.ERROR) -.-include +.-include + +# If TARGET_SPEC_VARS is other than just MACHINE +# it should be set by now. +# TARGET_SPEC must not contain any '.'s. +TARGET_SPEC_VARS ?= MACHINE + +.if !target(_meta_tspec_env_done_) +_meta_tspec_env_done_: .NOTMAIN +# Allow for local.meta.sys.env.mk to have done this + +.if ${TARGET_SPEC:Uno:M*,*} != "" +# deal with TARGET_SPEC from env +_tspec := ${TARGET_SPEC:S/,/ /g} +.for i in ${TARGET_SPEC_VARS:${M_RANGE:Urange}} +${TARGET_SPEC_VARS:[$i]} := ${_tspec:[$i]} +.endfor +# We need to stop that TARGET_SPEC affecting any submakes +TARGET_SPEC= +# so export but do not track +.export-env TARGET_SPEC +.export ${TARGET_SPEC_VARS} +.for v in ${TARGET_SPEC_VARS:O:u} +.if empty($v) +.undef $v +.endif +.endfor +.endif +.endif + +# Now make sure we know what TARGET_SPEC is +# as we may need it to find Makefile.depend* +.if ${MACHINE:Mhost*} != "" +# host is special +TARGET_SPEC = ${MACHINE} +.else +TARGET_SPEC = ${TARGET_SPEC_VARS:@v@${$v:U}@:ts,} +.endif # absolute path to what we are reading. _PARSEDIR = ${.PARSEDIR:tA} @@ -178,3 +214,5 @@ META_NOPHONY= .PHONY META_NOECHO= echo .endif .endif + +.-include