Page Menu
Home
FreeBSD
Search
Configure Global Search
Log In
Files
F158885631
D41659.id126696.diff
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Flag For Later
Award Token
Size
1 KB
Referenced Files
None
Subscribers
None
D41659.id126696.diff
View Options
diff --git a/share/mk/bsd.mkopt.mk b/share/mk/bsd.mkopt.mk
--- a/share/mk/bsd.mkopt.mk
+++ b/share/mk/bsd.mkopt.mk
@@ -1,7 +1,7 @@
#
#
# Generic mechanism to deal with WITH and WITHOUT options and turn
-# them into MK_ options.
+# them into MK_ options. Also turn group options into OPT_ options.
#
# For each option FOO in __DEFAULT_YES_OPTIONS, MK_FOO is set to
# "yes", unless WITHOUT_FOO is defined, in which case it is set to
@@ -31,6 +31,11 @@
# system should use MK_FOO={yes,no} when it needs to override the
# user's desires or default behavior.
#
+# For each option in __SINGLE_OPTIONS, OPT_FOO is set to FOO if
+# defined and __FOO_DEFAULT if not. Valid option for FOO are specifed
+# by __FOO_OPTIONS and if no __FOO_DEFAULT is set explicitly, it is
+# defined to be the first __FOO_OPTIONS value.
+#
#
# MK_* options which default to "yes".
@@ -93,6 +98,26 @@
MK_${var}:= no
.endfor
+#
+# Group options set an OPT_FOO variable for each option.
+#
+.for opt in ${__SINGLE_OPTIONS}
+.if !defined(__${opt}_OPTIONS) || empty(__${opt}_OPTIONS)
+.error __${opt}_OPTIONS not defined or empty
+.endif
+.if !defined(__${opt}_DEFAULT)
+__${opt}_DEFAULT:= ${__${opt}_OPTIONS:[1]}
+.endif
+.if defined(${opt})
+OPT_${opt}:= ${${opt}}
+.else
+OPT_${opt}:= ${__${opt}_DEFAULT}
+.endif
+.if empty(OPT_${opt}) || ${__${opt}_OPTIONS:M${OPT_${opt}}} != ${OPT_${opt}}
+.error Invalid option OPT_${opt} (${OPT_${opt}}), must be one of: ${__${opt}_OPTIONS}
+.endif
+.endfor
+
.for vv in ${__DEFAULT_DEPENDENT_OPTIONS}
.if defined(WITH_${vv:H}) && defined(WITHOUT_${vv:H})
MK_${vv:H}?= no
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Mon, Jun 8, 7:50 AM (11 h, 46 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
33808196
Default Alt Text
D41659.id126696.diff (1 KB)
Attached To
Mode
D41659: share/mk: basic support for group options
Attached
Detach File
Event Timeline
Log In to Comment