From 6f3e2a2709b35068932c98852d98b7ec539b98b1 Mon Sep 17 00:00:00 2001 From: mat Date: Fri, 28 Aug 2015 12:28:13 +0000 Subject: Add generic opt_VARS/opt_VARS_OFF. OPT1_VARS= foo=bar baz+=bam will set FOO to bar and append bam to BAZ if OPT1 is enabled. _VARS_OFF works the same way, if the option is disabled. Reviewed by: bapt Sponsored by: Absolight Differential Revision: https://reviews.freebsd.org/D3410 --- Mk/bsd.options.mk | 29 +++++++++++++++++++++++++++++ 1 file changed, 29 insertions(+) (limited to 'Mk') diff --git a/Mk/bsd.options.mk b/Mk/bsd.options.mk index 22ec6a6562a1..bfdf348c1cda 100644 --- a/Mk/bsd.options.mk +++ b/Mk/bsd.options.mk @@ -110,6 +110,15 @@ # ${opt}_USE_OFF= FOO=bar When option is disabled, it will enable # USE_FOO+= bar # +# ${opt}_VARS= FOO=bar When option is enabled, it will run +# FOO= bar +# ${opt}_VARS= FOO+=bar When option is enabled, it will run +# FOO+= bar +# ${opt}_VARS_OFF= FOO=bar When option is disabled, it will run +# FOO= bar +# ${opt}_VARS_OFF= FOO+=bar When option is disabled, it will run +# FOO+= bar +# # For each of: # ALL_TARGET BROKEN CATEGORIES CFLAGS CONFIGURE_ENV CONFLICTS CONFLICTS_BUILD # CONFLICTS_INSTALL CPPFLAGS CXXFLAGS DISTFILES EXTRA_PATCHES EXTRACT_ONLY @@ -463,6 +472,16 @@ _u= ${option:C/=.*//g} USE_${_u:tu}+= ${option:C/.*=//g:C/,/ /g} . endfor . endif +. if defined(${opt}_VARS) +. for var in ${${opt}_VARS} +_u= ${var:C/=.*//} +. if ${_u:M*+} +${_u:C/.$//:tu}+= ${var:C/[^+]*\+=//:C/^"(.*)"$$/\1/} +. else +${_u:tu}= ${var:C/[^=]*=//:C/^"(.*)"$$/\1/} +. endif +. endfor +. endif . if defined(${opt}_CONFIGURE_ENABLE) . for iopt in ${${opt}_CONFIGURE_ENABLE} CONFIGURE_ARGS+= --enable-${iopt} @@ -501,6 +520,16 @@ _u= ${option:C/=.*//g} USE_${_u:tu}+= ${option:C/.*=//g:C/,/ /g} . endfor . endif +. if defined(${opt}_VARS_OFF) +. for var in ${${opt}_VARS_OFF} +_u= ${var:C/=.*//} +. if ${_u:M*+} +${_u:C/.$//:tu}+= ${var:C/[^+]*\+=//:C/^"(.*)"$$/\1/} +. else +${_u:tu}= ${var:C/[^=]*=//:C/^"(.*)"$$/\1/} +. endif +. endfor +. endif . if defined(${opt}_CONFIGURE_ENABLE) . for iopt in ${${opt}_CONFIGURE_ENABLE} CONFIGURE_ARGS+= --disable-${iopt:C/=.*//} -- cgit