Changeset View
Changeset View
Standalone View
Standalone View
head/share/mk/dirdeps-options.mk
# $FreeBSD$ | # $FreeBSD$ | ||||
# $Id: dirdeps-options.mk,v 1.9 2018/09/20 00:07:19 sjg Exp $ | # $Id: dirdeps-options.mk,v 1.17 2020/08/07 01:57:38 sjg Exp $ | ||||
# | # | ||||
# @(#) Copyright (c) 2018, Simon J. Gerraty | # @(#) Copyright (c) 2018-2020, 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. | ||||
# Permission to copy, redistribute or otherwise | # Permission to copy, redistribute or otherwise | ||||
# use this file is hereby granted provided that | # use this file is hereby granted provided that | ||||
# the above copyright notice and this notice are | # the above copyright notice and this notice are | ||||
# left intact. | # left intact. | ||||
# | # | ||||
Show All 20 Lines | |||||
# a Makefile.depend.options that sets | # a Makefile.depend.options that sets | ||||
# DIRDEPS_OPTIONS= FOO | # DIRDEPS_OPTIONS= FOO | ||||
# It can also set either/both of | # It can also set either/both of | ||||
# DIRDEPS.FOO.yes | # DIRDEPS.FOO.yes | ||||
# DIRDEPS.FOO.no | # DIRDEPS.FOO.no | ||||
# to whatever applies for that dir, or it can rely on globals | # to whatever applies for that dir, or it can rely on globals | ||||
# set in local.dirdeps-options.mk | # set in local.dirdeps-options.mk | ||||
# Either way, we will .undef DIRDEPS.* when done. | # Either way, we will .undef DIRDEPS.* when done. | ||||
# | |||||
# In some cases the value of MK_FOO might depend on TARGET_SPEC | |||||
# so we qualify MK_FOO with .${TARGET_SPEC} and each component | |||||
# TARGET_SPEC_VAR (in reverse order) before using MK_FOO. | |||||
# | |||||
# This should have been set by Makefile.depend.options | # This should have been set by Makefile.depend.options | ||||
# before including us | # before including us | ||||
DIRDEPS_OPTIONS ?= | DIRDEPS_OPTIONS ?= | ||||
# pickup any DIRDEPS.* we need | # pickup any DIRDEPS.* we need | ||||
.-include <local.dirdeps-options.mk> | .-include <local.dirdeps-options.mk> | ||||
.if ${.MAKE.LEVEL} == 0 | .if ${.MAKE.LEVEL} == 0 | ||||
# :U below avoids potential errors when we := | # :U below avoids potential errors when we := | ||||
.for o in ${DIRDEPS_OPTIONS:tu} | # some options can depend on TARGET_SPEC! | ||||
DIRDEPS += ${DIRDEPS.$o.${MK_$o:U}:U} | DIRDEPS_OPTIONS_QUALIFIER_LIST ?= \ | ||||
${DEP_TARGET_SPEC:U${TARGET_SPEC}} \ | |||||
${TARGET_SPEC_VARSr:U${TARGET_SPEC_VARS}:@v@${DEP_$v:U${$v}}@} | |||||
# note that we need to include $o in the variable _o$o | |||||
# to ensure correct evaluation. | |||||
.for o in ${DIRDEPS_OPTIONS} | |||||
.undef _o$o _v$o | |||||
.for x in ${DIRDEPS_OPTIONS_QUALIFIER_LIST} | |||||
.if defined(MK_$o.$x) | |||||
_o$o ?= MK_$o.$x | |||||
_v$o ?= ${MK_$o.$x} | |||||
.endif | |||||
.endfor | .endfor | ||||
_v$o ?= ${MK_$o} | |||||
.if ${_debug_reldir:U0} | |||||
.info ${DEP_RELDIR:U${RELDIR}}.${DEP_TARGET_SPEC:U${TARGET_SPEC}}: o=$o ${_o$o:UMK_$o}=${_v$o:U} DIRDEPS += ${DIRDEPS.$o.${_v$o:U}:U} | |||||
.endif | |||||
DIRDEPS += ${DIRDEPS.$o.${_v$o:U}:U} | |||||
.endfor | |||||
DIRDEPS := ${DIRDEPS:O:u} | DIRDEPS := ${DIRDEPS:O:u} | ||||
.if ${_debug_reldir:U0} | |||||
.info ${DEP_RELDIR:U${RELDIR}}: DIRDEPS=${DIRDEPS} | |||||
.endif | |||||
# avoid cross contamination | # avoid cross contamination | ||||
.for o in ${DIRDEPS_OPTIONS:tu} | .for o in ${DIRDEPS_OPTIONS} | ||||
.undef DIRDEPS.$o.yes | .undef DIRDEPS.$o.yes | ||||
.undef DIRDEPS.$o.no | .undef DIRDEPS.$o.no | ||||
.undef _o$o | |||||
.undef _v$o | |||||
.endfor | .endfor | ||||
.else | .else | ||||
# whether options are enabled or not, | # whether options are enabled or not, | ||||
# we want to filter out the relevant DIRDEPS.* | # we want to filter out the relevant DIRDEPS.* | ||||
# we should only be included by meta.autodep.mk | # we should only be included by meta.autodep.mk | ||||
# if dependencies are to be updated | # if dependencies are to be updated | ||||
.for o in ${DIRDEPS_OPTIONS:tu} | .for o in ${DIRDEPS_OPTIONS} | ||||
.for d in ${DIRDEPS.$o.yes} ${DIRDEPS.$o.no} | .for d in ${DIRDEPS.$o.yes} ${DIRDEPS.$o.no} | ||||
.if exists(${SRCTOP}/$d) | .if exists(${SRCTOP}/$d) | ||||
GENDIRDEPS_FILTER += N$d* | GENDIRDEPS_FILTER += N$d* | ||||
.elif exists(${SRCTOP}/${d:R}) | .elif exists(${SRCTOP}/${d:R}) | ||||
GENDIRDEPS_FILTER += N${d:R}* | GENDIRDEPS_FILTER += N${d:R}* | ||||
.endif | .endif | ||||
.endfor | .endfor | ||||
.endfor | .endfor | ||||
.endif | .endif |