1# $Id: dirdeps-options.mk,v 1.9 2018/09/20 00:07:19 sjg Exp $ 2# 3# @(#) Copyright (c) 2018, Simon J. Gerraty 4# 5# This file is provided in the hope that it will 6# be of use. There is absolutely NO WARRANTY. 7# Permission to copy, redistribute or otherwise 8# use this file is hereby granted provided that 9# the above copyright notice and this notice are 10# left intact. 11# 12# Please send copies of changes and bug-fixes to: 13# sjg@crufty.net 14# 15 16## 17# 18# This makefile is used to deal with optional DIRDEPS. 19# 20# It is to be included by Makefile.depend.options in a 21# directory which has DIRDEPS affected by optional features. 22# Makefile.depend.options should set DIRDEPS_OPTIONS and 23# may also set specific DIRDEPS.* for those options. 24# 25# If a Makefile.depend.options file exists, it will be included by 26# dirdeps.mk and meta.autodep.mk 27# 28# We include local.dirdeps-options.mk which may also define DIRDEPS.* 29# for options. 30# 31# Thus a directory, that is affected by an option FOO would have 32# a Makefile.depend.options that sets 33# DIRDEPS_OPTIONS= FOO 34# It can also set either/both of 35# DIRDEPS.FOO.yes 36# DIRDEPS.FOO.no 37# to whatever applies for that dir, or it can rely on globals 38# set in local.dirdeps-options.mk 39# Either way, we will .undef DIRDEPS.* when done. 40 41# This should have been set by Makefile.depend.options 42# before including us 43DIRDEPS_OPTIONS ?= 44 45# pickup any DIRDEPS.* we need 46.-include <local.dirdeps-options.mk> 47 48.if ${.MAKE.LEVEL} == 0 49# :U below avoids potential errors when we := 50.for o in ${DIRDEPS_OPTIONS:tu} 51DIRDEPS += ${DIRDEPS.$o.${MK_$o:U}:U} 52.endfor 53DIRDEPS := ${DIRDEPS:O:u} 54# avoid cross contamination 55.for o in ${DIRDEPS_OPTIONS:tu} 56.undef DIRDEPS.$o.yes 57.undef DIRDEPS.$o.no 58.endfor 59.else 60# whether options are enabled or not, 61# we want to filter out the relevant DIRDEPS.* 62# we should only be included by meta.autodep.mk 63# if dependencies are to be updated 64.for o in ${DIRDEPS_OPTIONS:tu} 65.for d in ${DIRDEPS.$o.yes} ${DIRDEPS.$o.no} 66.if exists(${SRCTOP}/$d) 67GENDIRDEPS_FILTER += N$d* 68.elif exists(${SRCTOP}/${d:R}) 69GENDIRDEPS_FILTER += N${d:R}* 70.endif 71.endfor 72.endfor 73.endif 74