1# 2# $FreeBSD$ 3# 4# Generic mechanism to deal with WITH and WITHOUT options and turn 5# them into MK_ options. 6# 7# For each option FOO in __DEFAULT_YES_OPTIONS, MK_FOO is set to 8# "yes", unless WITHOUT_FOO is defined, in which case it is set to 9# "no". 10# 11# For each option FOO in __DEFAULT_NO_OPTIONS, MK_FOO is set to "no", 12# unless WITH_FOO is defined, in which case it is set to "yes". 13# 14# If both WITH_FOO and WITHOUT_FOO are defined, WITHOUT_FOO wins and 15# MK_FOO is set to "no" regardless of which list it was in. 16# 17# Both __DEFAULT_YES_OPTIONS and __DEFAULT_NO_OPTIONS are undef'd 18# after all this processing, allowing this file to be included 19# multiple times with different lists. 20# 21# Users should generally define WITH_FOO or WITHOUT_FOO, but the build 22# system should use MK_FOO={yes,no} when it needs to override the 23# user's desires or default behavior. 24# 25 26# 27# MK_* options which default to "yes". 28# 29.for var in ${__DEFAULT_YES_OPTIONS} 30.if !defined(MK_${var}) 31.if defined(WITHOUT_${var}) # WITHOUT always wins 32MK_${var}:= no 33.else 34MK_${var}:= yes 35.endif 36.else 37.if ${MK_${var}} != "yes" && ${MK_${var}} != "no" 38.error "Illegal value for MK_${var}: ${MK_${var}}" 39.endif 40.endif # !defined(MK_${var}) 41.endfor 42.undef __DEFAULT_YES_OPTIONS 43 44# 45# MK_* options which default to "no". 46# 47.for var in ${__DEFAULT_NO_OPTIONS} 48.if !defined(MK_${var}) 49.if defined(WITH_${var}) && !defined(WITHOUT_${var}) # WITHOUT always wins 50MK_${var}:= yes 51.else 52MK_${var}:= no 53.endif 54.else 55.if ${MK_${var}} != "yes" && ${MK_${var}} != "no" 56.error "Illegal value for MK_${var}: ${MK_${var}}" 57.endif 58.endif # !defined(MK_${var}) 59.endfor 60.undef __DEFAULT_NO_OPTIONS 61