Move DIRDEPS_BUILD settings to sys.dirdeps.mk
When originally implemented, there was no distinction between DIRDEPS_BUILD and META_MODE, they were one and the same. META_MODE however is useful by itself, but since meta.sys.mk had lots of settings related to DIRDEPS_BUILD its use was limited to DIRDEPS_BUILD. Move (most) DIRDEPS_BUILD related items to sys.dirdeps.mk so that meta.sys.mk can be used for just META_MODE. There is of course some bluring of the lines, so settings remain in meta.sys.mk Add MK_META_ERROR_TARGET to enable the META_MODE .ERROR target independent of DIRDEPS_BUILD, it copies failed .meta files to ${SB}/error to make it easier to identify the cause of build failures. Since sys.dirdeps.mk should be included first, most of local.meta.sys.mk becomes local.sys.dirdeps.mk and some other bits need to move to local.sys.dirdeps.env.mk Also fix dirdeps.mk to not add CURDIR to DIRDEPS when it is SRCTOP. Reviewed by: bdrewery Differential Revision: https://reviews.freebsd.org/D40053
This commit is contained in:
parent
bdf6dee2a9
commit
bee3d4bf8e
@ -1,4 +1,4 @@
|
|||||||
# $Id: dirdeps.mk,v 1.158 2023/05/04 18:26:17 sjg Exp $
|
# $Id: dirdeps.mk,v 1.160 2023/05/10 20:44:58 sjg Exp $
|
||||||
|
|
||||||
# SPDX-License-Identifier: BSD-2-Clause
|
# SPDX-License-Identifier: BSD-2-Clause
|
||||||
#
|
#
|
||||||
@ -273,6 +273,10 @@ _machine_dependfiles := ${.MAKE.DEPENDFILE_PREFERENCE:T:M*${MACHINE}*}
|
|||||||
.endif
|
.endif
|
||||||
.endif
|
.endif
|
||||||
|
|
||||||
|
# turn a list into a set of :N modifiers
|
||||||
|
# NskipFoo = ${Foo:${M_ListToSkip}}
|
||||||
|
M_ListToSkip ?= O:u:S,^,N,:ts:
|
||||||
|
|
||||||
# this is how we identify non-machine specific dependfiles
|
# this is how we identify non-machine specific dependfiles
|
||||||
N_notmachine := ${.MAKE.DEPENDFILE_PREFERENCE:E:N*${MACHINE}*:${M_ListToSkip}}
|
N_notmachine := ${.MAKE.DEPENDFILE_PREFERENCE:E:N*${MACHINE}*:${M_ListToSkip}}
|
||||||
|
|
||||||
@ -661,7 +665,7 @@ _machines := ${_machines:${M_dep_qual_fixes:ts:}:O:u}
|
|||||||
# reset each time through
|
# reset each time through
|
||||||
_build_dirs =
|
_build_dirs =
|
||||||
|
|
||||||
.if ${DEP_RELDIR} == ${_DEP_RELDIR}
|
.if ${DEP_RELDIR} == ${_DEP_RELDIR} && ${_CURDIR} != ${SRCTOP}
|
||||||
# pickup other machines for this dir if necessary
|
# pickup other machines for this dir if necessary
|
||||||
_build_dirs += ${_machines:@m@${_CURDIR}.$m@}
|
_build_dirs += ${_machines:@m@${_CURDIR}.$m@}
|
||||||
.endif
|
.endif
|
||||||
|
@ -4,12 +4,6 @@
|
|||||||
# before we process TARGET_SPEC
|
# before we process TARGET_SPEC
|
||||||
# we assume that MK_DIRDEPS_BUILD=yes
|
# we assume that MK_DIRDEPS_BUILD=yes
|
||||||
|
|
||||||
.if !defined(HOST_TARGET) || !defined(HOST_MACHINE)
|
|
||||||
# we need HOST_TARGET etc below.
|
|
||||||
.include <host-target.mk>
|
|
||||||
.export HOST_TARGET
|
|
||||||
.endif
|
|
||||||
|
|
||||||
# from src/Makefile (for universe)
|
# from src/Makefile (for universe)
|
||||||
TARGET_ARCHES_arm?= arm armv6 armv7
|
TARGET_ARCHES_arm?= arm armv6 armv7
|
||||||
TARGET_ARCHES_arm64?= aarch64
|
TARGET_ARCHES_arm64?= aarch64
|
||||||
@ -41,11 +35,6 @@ MACHINE_ARCH= ${MACHINE_ARCH.${MACHINE}}
|
|||||||
MACHINE_ARCH?= ${MACHINE_ARCH.${MACHINE}}
|
MACHINE_ARCH?= ${MACHINE_ARCH.${MACHINE}}
|
||||||
MACHINE_ARCH:= ${MACHINE_ARCH}
|
MACHINE_ARCH:= ${MACHINE_ARCH}
|
||||||
|
|
||||||
# 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
|
|
||||||
|
|
||||||
HOST_OBJTOP ?= ${OBJROOT}${HOST_TARGET}
|
HOST_OBJTOP ?= ${OBJROOT}${HOST_TARGET}
|
||||||
|
|
||||||
.if ${REQUESTED_MACHINE:U${MACHINE}} == "host"
|
.if ${REQUESTED_MACHINE:U${MACHINE}} == "host"
|
||||||
@ -74,17 +63,13 @@ PYTHON ?= /usr/local/bin/python
|
|||||||
.endif
|
.endif
|
||||||
.endif
|
.endif
|
||||||
|
|
||||||
# this is sufficient for most of the tree.
|
.if !defined(NO_META_MISSING)
|
||||||
.MAKE.DEPENDFILE_DEFAULT = ${.MAKE.DEPENDFILE_PREFIX}
|
|
||||||
|
|
||||||
# but if we have a machine qualified file it should be used in preference
|
|
||||||
.MAKE.DEPENDFILE_PREFERENCE = \
|
|
||||||
${.MAKE.DEPENDFILE_PREFIX}.${MACHINE} \
|
|
||||||
${.MAKE.DEPENDFILE_PREFIX}
|
|
||||||
|
|
||||||
.undef .MAKE.DEPENDFILE
|
|
||||||
|
|
||||||
META_MODE+= missing-meta=yes
|
META_MODE+= missing-meta=yes
|
||||||
|
.endif
|
||||||
|
# silent will hide command output if a .meta file is created.
|
||||||
|
.if !defined(NO_SILENT)
|
||||||
|
META_MODE+= silent=yes
|
||||||
|
.endif
|
||||||
.if empty(META_MODE:Mnofilemon)
|
.if empty(META_MODE:Mnofilemon)
|
||||||
META_MODE+= missing-filemon=yes
|
META_MODE+= missing-filemon=yes
|
||||||
.endif
|
.endif
|
||||||
|
14
share/mk/local.sys.dirdeps.env.mk
Normal file
14
share/mk/local.sys.dirdeps.env.mk
Normal file
@ -0,0 +1,14 @@
|
|||||||
|
|
||||||
|
# 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
|
||||||
|
|
||||||
|
# this is sufficient for most of the tree.
|
||||||
|
.MAKE.DEPENDFILE_DEFAULT = ${.MAKE.DEPENDFILE_PREFIX}
|
||||||
|
|
||||||
|
# but if we have a machine qualified file it should be used in preference
|
||||||
|
.MAKE.DEPENDFILE_PREFERENCE = \
|
||||||
|
${.MAKE.DEPENDFILE_PREFIX}.${MACHINE} \
|
||||||
|
${.MAKE.DEPENDFILE_PREFIX}
|
||||||
|
|
@ -6,39 +6,13 @@
|
|||||||
# we need this until there is an alternative
|
# we need this until there is an alternative
|
||||||
MK_INSTALL_AS_USER= yes
|
MK_INSTALL_AS_USER= yes
|
||||||
|
|
||||||
|
.-include <site.sys.dirdeps.mk>
|
||||||
|
# previously only included for DIRDEPS_BUILD anyway
|
||||||
.-include <site.meta.sys.mk>
|
.-include <site.meta.sys.mk>
|
||||||
|
|
||||||
# to be consistent with src/Makefile just concatenate with '.'s
|
|
||||||
TARGET_OBJ_SPEC:= ${TARGET_SPEC:S;,;.;g}
|
|
||||||
.if ${MACHINE} != "host"
|
|
||||||
OBJTOP:= ${OBJROOT}${TARGET_OBJ_SPEC}
|
|
||||||
.endif
|
|
||||||
|
|
||||||
.if defined(MAKEOBJDIR)
|
|
||||||
.if ${MAKEOBJDIR:M/*} == ""
|
|
||||||
.error Cannot use MAKEOBJDIR=${MAKEOBJDIR}${.newline}Unset MAKEOBJDIR to get default: MAKEOBJDIR='${_default_makeobjdir}'
|
|
||||||
.endif
|
|
||||||
.endif
|
|
||||||
|
|
||||||
|
|
||||||
# we want to end up with a singe stage tree for all machines
|
|
||||||
.if ${MK_STAGING} == "yes"
|
.if ${MK_STAGING} == "yes"
|
||||||
.if empty(STAGE_ROOT)
|
|
||||||
STAGE_ROOT?= ${OBJROOT}stage
|
|
||||||
.export STAGE_ROOT
|
|
||||||
.endif
|
|
||||||
.endif
|
|
||||||
|
|
||||||
.if ${MK_STAGING} == "yes"
|
|
||||||
.if ${MACHINE} == "host"
|
|
||||||
STAGE_MACHINE= ${HOST_TARGET}
|
|
||||||
.else
|
|
||||||
STAGE_MACHINE:= ${TARGET_OBJ_SPEC}
|
|
||||||
.endif
|
|
||||||
STAGE_OBJTOP:= ${STAGE_ROOT}/${STAGE_MACHINE}
|
|
||||||
STAGE_COMMON_OBJTOP:= ${STAGE_ROOT}/common
|
|
||||||
STAGE_TARGET_OBJTOP:= ${STAGE_ROOT}/${TARGET_OBJ_SPEC}
|
STAGE_TARGET_OBJTOP:= ${STAGE_ROOT}/${TARGET_OBJ_SPEC}
|
||||||
STAGE_HOST_OBJTOP:= ${STAGE_ROOT}/${HOST_TARGET}
|
|
||||||
# These are exported for hooking in out-of-tree builds. They will always
|
# These are exported for hooking in out-of-tree builds. They will always
|
||||||
# be overridden in sub-makes above when building in-tree.
|
# be overridden in sub-makes above when building in-tree.
|
||||||
.if ${.MAKE.LEVEL} > 0
|
.if ${.MAKE.LEVEL} > 0
|
||||||
@ -156,7 +130,6 @@ CFLAGS+= ${CROSS_TARGET_FLAGS}
|
|||||||
ACFLAGS+= ${CROSS_TARGET_FLAGS}
|
ACFLAGS+= ${CROSS_TARGET_FLAGS}
|
||||||
.endif
|
.endif
|
||||||
|
|
||||||
.if ${MK_DIRDEPS_BUILD} == "yes"
|
|
||||||
# we set these here, rather than local.gendirdeps.mk
|
# we set these here, rather than local.gendirdeps.mk
|
||||||
# so we can ensure any DEP_* values that might be used in
|
# so we can ensure any DEP_* values that might be used in
|
||||||
# conditionals do not cause syntax errors when Makefile.depend
|
# conditionals do not cause syntax errors when Makefile.depend
|
||||||
@ -185,5 +158,3 @@ $V?= ${${V:S,DEP_,,}}
|
|||||||
# some makefiles expect this
|
# some makefiles expect this
|
||||||
BOOTSTRAPPING= 0
|
BOOTSTRAPPING= 0
|
||||||
.endif
|
.endif
|
||||||
|
|
||||||
.endif
|
|
@ -50,3 +50,9 @@ ECHO_TRACE?= true
|
|||||||
|
|
||||||
.include "src.sys.env.mk"
|
.include "src.sys.env.mk"
|
||||||
.-include <site.sys.env.mk>
|
.-include <site.sys.env.mk>
|
||||||
|
|
||||||
|
.if !defined(HOST_TARGET) || !defined(HOST_MACHINE)
|
||||||
|
# we need HOST_TARGET etc below.
|
||||||
|
.include <host-target.mk>
|
||||||
|
.export HOST_TARGET
|
||||||
|
.endif
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
# $Id: meta.sys.mk,v 1.48 2023/05/04 16:41:10 sjg Exp $
|
# $Id: meta.sys.mk,v 1.51 2023/05/11 20:05:32 sjg Exp $
|
||||||
|
|
||||||
#
|
#
|
||||||
# @(#) Copyright (c) 2010-2021, Simon J. Gerraty
|
# @(#) Copyright (c) 2010-2023, Simon J. Gerraty
|
||||||
#
|
#
|
||||||
# This file is provided in the hope that it will
|
# This file is provided in the hope that it will
|
||||||
# be of use. There is absolutely NO WARRANTY.
|
# be of use. There is absolutely NO WARRANTY.
|
||||||
@ -17,56 +17,21 @@
|
|||||||
# include this if you want to enable meta mode
|
# include this if you want to enable meta mode
|
||||||
# for maximum benefit, requires filemon(4) driver.
|
# for maximum benefit, requires filemon(4) driver.
|
||||||
|
|
||||||
.if ${MAKE_VERSION:U0} > 20100901
|
# absolute path to what we are reading.
|
||||||
.if !target(.ERROR)
|
_PARSEDIR ?= ${.PARSEDIR:tA}
|
||||||
|
|
||||||
.-include <local.meta.sys.env.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}
|
|
||||||
|
|
||||||
.if !defined(SYS_MK_DIR)
|
.if !defined(SYS_MK_DIR)
|
||||||
SYS_MK_DIR := ${_PARSEDIR}
|
SYS_MK_DIR := ${_PARSEDIR}
|
||||||
.endif
|
.endif
|
||||||
|
|
||||||
META_MODE += meta verbose
|
.if !target(.ERROR)
|
||||||
|
|
||||||
|
META_MODE += meta
|
||||||
|
.if empty(.MAKEFLAGS:M-s)
|
||||||
|
META_MODE += verbose
|
||||||
|
.endif
|
||||||
.if ${MAKE_VERSION:U0} > 20130323 && empty(.MAKE.PATH_FILEMON)
|
.if ${MAKE_VERSION:U0} > 20130323 && empty(.MAKE.PATH_FILEMON)
|
||||||
# we do not support filemon
|
# we do not support filemon
|
||||||
META_MODE += nofilemon
|
META_MODE += nofilemon
|
||||||
@ -102,19 +67,7 @@ META_MODE += silent=yes
|
|||||||
.endif
|
.endif
|
||||||
.endif
|
.endif
|
||||||
|
|
||||||
# we use the pseudo machine "host" for the build host.
|
.if ${MK_DIRDEPS_BUILD:Uno} == "yes"
|
||||||
# this should be taken care of before we get here
|
|
||||||
.if ${OBJTOP:Ua} == ${HOST_OBJTOP:Ub}
|
|
||||||
MACHINE = host
|
|
||||||
.endif
|
|
||||||
|
|
||||||
.if !defined(MACHINE0)
|
|
||||||
# it can be handy to know which MACHINE kicked off the build
|
|
||||||
# for example, if using Makefild.depend for multiple machines,
|
|
||||||
# allowing only MACHINE0 to update can keep things simple.
|
|
||||||
MACHINE0 := ${MACHINE}
|
|
||||||
.export MACHINE0
|
|
||||||
.endif
|
|
||||||
|
|
||||||
.if !defined(META2DEPS)
|
.if !defined(META2DEPS)
|
||||||
.if defined(PYTHON) && exists(${PYTHON})
|
.if defined(PYTHON) && exists(${PYTHON})
|
||||||
@ -134,6 +87,11 @@ MAKE_PRINT_VAR_ON_ERROR += \
|
|||||||
MAKEFILE \
|
MAKEFILE \
|
||||||
.MAKE.MODE
|
.MAKE.MODE
|
||||||
|
|
||||||
|
MK_META_ERROR_TARGET = yes
|
||||||
|
.endif
|
||||||
|
|
||||||
|
.if ${MK_META_ERROR_TARGET:Uno} == "yes"
|
||||||
|
|
||||||
.if !defined(SB) && defined(SRCTOP)
|
.if !defined(SB) && defined(SRCTOP)
|
||||||
SB = ${SRCTOP:H}
|
SB = ${SRCTOP:H}
|
||||||
.endif
|
.endif
|
||||||
@ -150,21 +108,12 @@ _metaError: .NOMETA .NOTMAIN
|
|||||||
echo "ERROR: log ${meta_error_log}" >&2; }; :
|
echo "ERROR: log ${meta_error_log}" >&2; }; :
|
||||||
|
|
||||||
.endif
|
.endif
|
||||||
|
.endif
|
||||||
|
|
||||||
# Are we, after all, in meta mode?
|
# Are we, after all, in meta mode?
|
||||||
.if ${.MAKE.MODE:Uno:Mmeta*} != ""
|
.if ${.MAKE.MODE:Uno:Mmeta*} != ""
|
||||||
MKDEP_MK ?= meta.autodep.mk
|
MKDEP_MK ?= meta.autodep.mk
|
||||||
|
|
||||||
.if ${.MAKE.MAKEFILES:M*sys.dependfile.mk} == ""
|
|
||||||
# this does all the smarts of setting .MAKE.DEPENDFILE
|
|
||||||
.-include <sys.dependfile.mk>
|
|
||||||
# check if we got anything sane
|
|
||||||
.if ${.MAKE.DEPENDFILE} == ".depend"
|
|
||||||
.undef .MAKE.DEPENDFILE
|
|
||||||
.endif
|
|
||||||
.MAKE.DEPENDFILE ?= Makefile.depend
|
|
||||||
.endif
|
|
||||||
|
|
||||||
# we can afford to use cookies to prevent some targets
|
# we can afford to use cookies to prevent some targets
|
||||||
# re-running needlessly
|
# re-running needlessly
|
||||||
META_COOKIE_TOUCH?= touch ${COOKIE.${.TARGET}:U${.OBJDIR}/${.TARGET:T}}
|
META_COOKIE_TOUCH?= touch ${COOKIE.${.TARGET}:U${.OBJDIR}/${.TARGET:T}}
|
||||||
@ -192,36 +141,13 @@ UPDATE_DEPENDFILE= NO
|
|||||||
.endif
|
.endif
|
||||||
.endif
|
.endif
|
||||||
|
|
||||||
.if ${.MAKE.LEVEL} == 0
|
.else # in meta mode?
|
||||||
.if ${MK_DIRDEPS_BUILD:Uyes} == "yes"
|
|
||||||
# make sure dirdeps target exists and do it first
|
|
||||||
all: dirdeps .WAIT
|
|
||||||
dirdeps:
|
|
||||||
.NOPATH: dirdeps
|
|
||||||
|
|
||||||
.if defined(ALL_MACHINES)
|
|
||||||
# the first .MAIN: is what counts
|
|
||||||
# by default dirdeps is all we want at level0
|
|
||||||
.MAIN: dirdeps
|
|
||||||
.endif
|
|
||||||
.endif
|
|
||||||
|
|
||||||
.else # level > 0
|
|
||||||
|
|
||||||
# Makefile.depend* get read at level 1+
|
|
||||||
# and often refer to DEP_MACHINE etc,
|
|
||||||
# so ensure DEP_* (for TARGET_SPEC_VARS anyway) are set
|
|
||||||
.for V in ${TARGET_SPEC_VARS}
|
|
||||||
DEP_$V = ${$V}
|
|
||||||
.endfor
|
|
||||||
|
|
||||||
.endif
|
|
||||||
.else
|
|
||||||
META_COOKIE_TOUCH=
|
META_COOKIE_TOUCH=
|
||||||
# some targets need to be .PHONY in non-meta mode
|
# some targets need to be .PHONY in non-meta mode
|
||||||
META_NOPHONY= .PHONY
|
META_NOPHONY= .PHONY
|
||||||
META_NOECHO= echo
|
META_NOECHO= echo
|
||||||
.endif
|
|
||||||
.endif
|
.endif # in meta mode?
|
||||||
|
|
||||||
.-include <local.meta.sys.mk>
|
.-include <local.meta.sys.mk>
|
||||||
|
@ -220,11 +220,6 @@ OBJROOT= ${SRCTOP}/
|
|||||||
.endif
|
.endif
|
||||||
.endif # defined(NO_OBJ)
|
.endif # defined(NO_OBJ)
|
||||||
|
|
||||||
.if !defined(HOST_TARGET)
|
|
||||||
# we need HOST_TARGET etc below.
|
|
||||||
.include <host-target.mk>
|
|
||||||
.export HOST_TARGET
|
|
||||||
.endif
|
|
||||||
HOST_OBJTOP?= ${OBJROOT}${HOST_TARGET}
|
HOST_OBJTOP?= ${OBJROOT}${HOST_TARGET}
|
||||||
|
|
||||||
.endif # ${MK_DIRDEPS_BUILD} == "no"
|
.endif # ${MK_DIRDEPS_BUILD} == "no"
|
||||||
|
@ -1,7 +1,6 @@
|
|||||||
# $FreeBSD$
|
# $Id: sys.dependfile.mk,v 1.10 2023/05/10 19:23:26 sjg Exp $
|
||||||
# $Id: sys.dependfile.mk,v 1.7 2016/02/20 01:57:39 sjg Exp $
|
|
||||||
#
|
#
|
||||||
# @(#) Copyright (c) 2012, Simon J. Gerraty
|
# @(#) Copyright (c) 2012-2023, Simon J. Gerraty
|
||||||
#
|
#
|
||||||
# This file is provided in the hope that it will
|
# This file is provided in the hope that it will
|
||||||
# be of use. There is absolutely NO WARRANTY.
|
# be of use. There is absolutely NO WARRANTY.
|
||||||
@ -14,7 +13,10 @@
|
|||||||
# sjg@crufty.net
|
# sjg@crufty.net
|
||||||
#
|
#
|
||||||
|
|
||||||
# This only makes sense in meta mode.
|
.if !target(__${.PARSEFILE}__)
|
||||||
|
__${.PARSEFILE}__: .NOTMAIN
|
||||||
|
|
||||||
|
# This only makes sense for DIRDEPS_BUILD.
|
||||||
# This allows a mixture of auto generated as well as manually edited
|
# This allows a mixture of auto generated as well as manually edited
|
||||||
# dependency files, which can be differentiated by their names.
|
# dependency files, which can be differentiated by their names.
|
||||||
# As per dirdeps.mk we only require:
|
# As per dirdeps.mk we only require:
|
||||||
@ -58,3 +60,5 @@ MACHINE := ${_m}
|
|||||||
.endif
|
.endif
|
||||||
.endif
|
.endif
|
||||||
.MAKE.DEPENDFILE ?= ${.MAKE.DEPENDFILE_DEFAULT}
|
.MAKE.DEPENDFILE ?= ${.MAKE.DEPENDFILE_DEFAULT}
|
||||||
|
|
||||||
|
.endif
|
||||||
|
183
share/mk/sys.dirdeps.mk
Normal file
183
share/mk/sys.dirdeps.mk
Normal file
@ -0,0 +1,183 @@
|
|||||||
|
# $Id: sys.dirdeps.mk,v 1.9 2023/05/11 20:05:42 sjg Exp $
|
||||||
|
#
|
||||||
|
# @(#) Copyright (c) 2012-2023, Simon J. Gerraty
|
||||||
|
#
|
||||||
|
# This file is provided in the hope that it will
|
||||||
|
# be of use. There is absolutely NO WARRANTY.
|
||||||
|
# Permission to copy, redistribute or otherwise
|
||||||
|
# use this file is hereby granted provided that
|
||||||
|
# the above copyright notice and this notice are
|
||||||
|
# left intact.
|
||||||
|
#
|
||||||
|
# Please send copies of changes and bug-fixes to:
|
||||||
|
# sjg@crufty.net
|
||||||
|
#
|
||||||
|
|
||||||
|
# Originally DIRDEPS_BUILD and META_MODE were the same thing.
|
||||||
|
# So, much of this was done in *meta.sys.mk and local*mk
|
||||||
|
# but properly belongs here.
|
||||||
|
|
||||||
|
# Include from [local.]sys.mk - if doing DIRDEPS_BUILD
|
||||||
|
# we should not be here otherwise
|
||||||
|
MK_DIRDEPS_BUILD ?= yes
|
||||||
|
# these are all implied
|
||||||
|
MK_AUTO_OBJ ?= yes
|
||||||
|
MK_META_MODE ?= yes
|
||||||
|
MK_STAGING ?= yes
|
||||||
|
|
||||||
|
_PARSEDIR ?= ${.PARSEDIR:tA}
|
||||||
|
|
||||||
|
.-include <local.sys.dirdeps.env.mk>
|
||||||
|
|
||||||
|
.if ${.MAKE.LEVEL} == 0
|
||||||
|
# make sure dirdeps target exists and do it first
|
||||||
|
dirdeps:
|
||||||
|
# first .MAIN is what counts
|
||||||
|
.MAIN: dirdeps
|
||||||
|
.NOPATH: dirdeps
|
||||||
|
all: dirdeps .WAIT
|
||||||
|
.endif
|
||||||
|
|
||||||
|
.if empty(SRCTOP)
|
||||||
|
# fallback assumes share/mk!
|
||||||
|
SRCTOP := ${SB_SRC:U${.PARSEDIR:tA:H:H}}
|
||||||
|
.export SRCTOP
|
||||||
|
.endif
|
||||||
|
|
||||||
|
# fake SB if not using mk wrapper
|
||||||
|
.if !defined(SB)
|
||||||
|
SB := ${SRCTOP:H}
|
||||||
|
.export SB
|
||||||
|
.endif
|
||||||
|
|
||||||
|
.if empty(OBJROOT)
|
||||||
|
OBJROOT := ${SB_OBJROOT:U${MAKEOBJDIRPREFIX:U${SB}/obj}/}
|
||||||
|
.export OBJROOT
|
||||||
|
.endif
|
||||||
|
|
||||||
|
.if empty(STAGE_ROOT)
|
||||||
|
STAGE_ROOT ?= ${OBJROOT}stage
|
||||||
|
.export STAGE_ROOT
|
||||||
|
.endif
|
||||||
|
|
||||||
|
# We should be included before meta.sys.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(_tspec_env_done_)
|
||||||
|
_tspec_env_done_: .NOTMAIN
|
||||||
|
|
||||||
|
.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
|
||||||
|
|
||||||
|
.if ${TARGET_SPEC_VARS:[#]} > 1
|
||||||
|
TARGET_OBJ_SPEC ?= ${TARGET_SPEC_VARS:@v@${$v:U}@:ts.}
|
||||||
|
.else
|
||||||
|
TARGET_OBJ_SPEC ?= ${MACHINE}
|
||||||
|
.endif
|
||||||
|
|
||||||
|
MAKE_PRINT_VAR_ON_ERROR += ${TARGET_SPEC_VARS}
|
||||||
|
|
||||||
|
.if !defined(MACHINE0)
|
||||||
|
# it can be handy to know which MACHINE kicked off the build
|
||||||
|
# for example, if using Makefild.depend for multiple machines,
|
||||||
|
# allowing only MACHINE0 to update can keep things simple.
|
||||||
|
MACHINE0 := ${MACHINE}
|
||||||
|
.export MACHINE0
|
||||||
|
.endif
|
||||||
|
|
||||||
|
.if ${MACHINE} == "host"
|
||||||
|
OBJTOP = ${HOST_OBJTOP}
|
||||||
|
.elif ${MACHINE} == "host32"
|
||||||
|
OBJTOP = ${HOST_OBJTOP32}
|
||||||
|
.endif
|
||||||
|
|
||||||
|
MACHINE_OBJ.host = ${HOST_TARGET}
|
||||||
|
MACHINE_OBJ.host32 = ${HOST_TARGET32}
|
||||||
|
MACHINE_OBJ.${MACHINE} ?= ${TARGET_OBJ_SPEC}
|
||||||
|
MACHINE_OBJDIR = ${MACHINE_OBJ.${MACHINE}}
|
||||||
|
OBJTOP = ${OBJROOT}/${MACHINE_OBJDIR}
|
||||||
|
|
||||||
|
# we do not use MAKEOBJDIRPREFIX
|
||||||
|
.undef MAKEOBJDIRPREFIX
|
||||||
|
# we use this
|
||||||
|
MAKEOBJDIR ?= ${.CURDIR:S,${SRCTOP},${OBJTOP},}
|
||||||
|
|
||||||
|
STAGE_MACHINE ?= ${MACHINE_OBJDIR}
|
||||||
|
STAGE_OBJTOP ?= ${STAGE_ROOT}/${STAGE_MACHINE}
|
||||||
|
STAGE_COMMON_OBJTOP ?= ${STAGE_ROOT}/common
|
||||||
|
STAGE_HOST_OBJTOP ?= ${STAGE_ROOT}/${HOST_TARGET}
|
||||||
|
STAGE_HOST_OBJTOP32 ?= ${STAGE_ROOT}/${HOST_TARGET32}
|
||||||
|
|
||||||
|
STAGE_INCLUDEDIR ?= ${STAGE_OBJTOP}${INCLUDEDIR:U/usr/include}
|
||||||
|
STAGE_LIBDIR ?= ${STAGE_OBJTOP}${LIBDIR:U/lib}
|
||||||
|
|
||||||
|
TIME_STAMP_FMT ?= @ %s [%Y-%m-%d %T] ${:U}
|
||||||
|
DATE_TIME_STAMP ?= `date '+${TIME_STAMP_FMT}'`
|
||||||
|
TIME_STAMP ?= ${TIME_STAMP_FMT:localtime}
|
||||||
|
|
||||||
|
.if ${MK_TIME_STAMPS:Uyes} == "yes"
|
||||||
|
TRACER = ${TIME_STAMP}
|
||||||
|
ECHO_DIR = echo ${TIME_STAMP}
|
||||||
|
ECHO_TRACE = echo ${TIME_STAMP}
|
||||||
|
.endif
|
||||||
|
|
||||||
|
.if ${.CURDIR} == ${SRCTOP}
|
||||||
|
RELDIR= .
|
||||||
|
RELTOP= .
|
||||||
|
.elif ${.CURDIR:M${SRCTOP}/*}
|
||||||
|
RELDIR:= ${.CURDIR:S,${SRCTOP}/,,}
|
||||||
|
.else
|
||||||
|
RELDIR:= ${.OBJDIR:S,${OBJTOP}/,,}
|
||||||
|
.endif
|
||||||
|
RELTOP?= ${RELDIR:C,[^/]+,..,g}
|
||||||
|
RELOBJTOP?= ${RELTOP}
|
||||||
|
RELSRCTOP?= ${RELTOP}
|
||||||
|
|
||||||
|
# this does all the smarts of setting .MAKE.DEPENDFILE
|
||||||
|
.-include <sys.dependfile.mk>
|
||||||
|
|
||||||
|
.-include <local.sys.dirdeps.mk>
|
||||||
|
|
||||||
|
# check if we got anything sane
|
||||||
|
.if ${.MAKE.DEPENDFILE} == ".depend"
|
||||||
|
.undef .MAKE.DEPENDFILE
|
||||||
|
.endif
|
||||||
|
# just in case
|
||||||
|
.MAKE.DEPENDFILE ?= Makefile.depend
|
||||||
|
|
||||||
|
.if ${.MAKE.LEVEL} > 0
|
||||||
|
# Makefile.depend* also get read at level 1+
|
||||||
|
# and often refer to DEP_MACHINE etc,
|
||||||
|
# so ensure DEP_* (for TARGET_SPEC_VARS anyway) are set
|
||||||
|
.for V in ${TARGET_SPEC_VARS}
|
||||||
|
DEP_$V = ${$V}
|
||||||
|
.endfor
|
||||||
|
.endif
|
@ -33,6 +33,7 @@ __DEFAULT_NO_OPTIONS= \
|
|||||||
|
|
||||||
__DEFAULT_DEPENDENT_OPTIONS= \
|
__DEFAULT_DEPENDENT_OPTIONS= \
|
||||||
AUTO_OBJ/DIRDEPS_BUILD \
|
AUTO_OBJ/DIRDEPS_BUILD \
|
||||||
|
META_ERROR_TARGET/DIRDEPS_BUILD \
|
||||||
META_MODE/DIRDEPS_BUILD \
|
META_MODE/DIRDEPS_BUILD \
|
||||||
STAGING/DIRDEPS_BUILD \
|
STAGING/DIRDEPS_BUILD \
|
||||||
SYSROOT/DIRDEPS_BUILD
|
SYSROOT/DIRDEPS_BUILD
|
||||||
@ -57,27 +58,13 @@ MK_META_MODE= no
|
|||||||
.endif
|
.endif
|
||||||
|
|
||||||
.if ${MK_DIRDEPS_BUILD} == "yes"
|
.if ${MK_DIRDEPS_BUILD} == "yes"
|
||||||
.sinclude <meta.sys.mk>
|
.-include <sys.dirdeps.mk>
|
||||||
.elif ${MK_META_MODE} == "yes"
|
|
||||||
META_MODE+= meta
|
|
||||||
.if empty(.MAKEFLAGS:M-s)
|
|
||||||
# verbose will show .MAKE.META.PREFIX for each target.
|
|
||||||
META_MODE+= verbose
|
|
||||||
.endif
|
|
||||||
.if !defined(NO_META_MISSING)
|
|
||||||
META_MODE+= missing-meta=yes
|
|
||||||
.endif
|
|
||||||
# silent will hide command output if a .meta file is created.
|
|
||||||
.if !defined(NO_SILENT)
|
|
||||||
META_MODE+= silent=yes
|
|
||||||
.endif
|
.endif
|
||||||
|
.if ${MK_META_MODE} == "yes"
|
||||||
.if !exists(/dev/filemon) || defined(NO_FILEMON)
|
.if !exists(/dev/filemon) || defined(NO_FILEMON)
|
||||||
META_MODE+= nofilemon
|
META_MODE+= nofilemon
|
||||||
.endif
|
.endif
|
||||||
# Require filemon data with bmake
|
.-include <meta.sys.mk>
|
||||||
.if empty(META_MODE:Mnofilemon)
|
|
||||||
META_MODE+= missing-filemon=yes
|
|
||||||
.endif
|
|
||||||
.endif
|
.endif
|
||||||
META_MODE?= normal
|
META_MODE?= normal
|
||||||
.export META_MODE
|
.export META_MODE
|
||||||
|
Loading…
Reference in New Issue
Block a user