# preset all variables for all supported build options among use_opts
$(reset_opts_vars)
+# Check that any USE_* variable that was forced actually exist.
+$(warn_unknown_options)
+
#### Target system options
# poll() is always supported, unless explicitly disabled by passing USE_POLL=""
# collect all enabled USE_foo's foo_{C,LD}FLAGS into OPTIONS_{C,LD}FLAGS
collect_opts_flags = $(foreach opt,$(enabled_opts),$(eval $(call collect_opt_flags,$(opt))))
+
+# Check that any USE_* variable that was forced actually exist. For this we'll
+# build a list of the MAKEOVERRIDES variables that start with USE_*, and keep
+# the ones that do not match any of the patterns built by appending '=%' to all
+# use_opts. The outstanding ones are thus unknown and each of them produces a
+# warning.
+warn_unknown_options = \
+ $(foreach unknown, \
+ $(filter-out $(foreach opt,$(use_opts),$(opt:==%)), \
+ $(foreach opt,$(MAKEOVERRIDES), \
+ $(strip $(filter USE_%,$(opt))))), \
+ $(warning Warning: ignoring unknown build option: $(unknown)))