Page Menu
Home
FreeBSD
Search
Configure Global Search
Log In
Files
F109425258
D39737.diff
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Flag For Later
Award Token
Size
7 KB
Referenced Files
None
Subscribers
None
D39737.diff
View Options
diff --git a/share/mk/gendirdeps.mk b/share/mk/gendirdeps.mk
--- 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
--- a/share/mk/local.dirdeps.mk
+++ b/share/mk/local.dirdeps.mk
@@ -207,12 +207,13 @@
.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
--- a/share/mk/local.gendirdeps.mk
+++ b/share/mk/local.gendirdeps.mk
@@ -53,20 +53,8 @@
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
--- 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 @@
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 @@
.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 @@
.endif
.if ${MACHINE} == "host"
OBJTOP := ${HOST_OBJTOP}
+MACHINE_ARCH= ${MACHINE_ARCH.${MACHINE}}
.endif
.if ${.MAKE.LEVEL} == 0 || empty(PYTHON)
@@ -267,3 +236,30 @@
.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
--- a/share/mk/local.sys.env.mk
+++ b/share/mk/local.sys.env.mk
@@ -50,3 +50,8 @@
.include "src.sys.env.mk"
.-include <site.sys.env.mk>
+
+# 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
--- 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 <local.meta.sys.mk>
+.-include <local.meta.sys.env.mk>
+
+# 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_NOECHO= echo
.endif
.endif
+
+.-include <local.meta.sys.mk>
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Wed, Feb 5, 9:50 PM (20 h, 40 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
16481431
Default Alt Text
D39737.diff (7 KB)
Attached To
Mode
D39737: Update meta.sys.mk and related local*mk
Attached
Detach File
Event Timeline
Log In to Comment