BUILD: makefile: also list per-option settings in 'make opts'

Thanks to the generic naming of the build options, it's now relatively
easy to enumerate all _CFLAGS and _LDFLAGS for defined USE_* options.
That was added to the first line of 'make opts', but is only listed for
enabled options, non-empty variables or cmd-line defined variables.
diff --git a/Makefile b/Makefile
index b2ff189..933a54d 100644
--- a/Makefile
+++ b/Makefile
@@ -63,7 +63,10 @@
 #
 # Options can be forced by specifying "USE_xxx=1" or can be disabled by using
 # "USE_xxx=" (empty string). The list of enabled and disabled options for a
-# given TARGET is enumerated at the end of "make help".
+# given TARGET is enumerated at the end of "make help". Most of these options
+# support specific xxx_CFLAGS and/or xxx_LDFLAGS that can be individually
+# forced. The currently active ones for a given set of options are listed in
+# "make opts USE_xxx=1 ...".
 #
 # Variables useful for packagers :
 #   CC is set to "cc" by default and is used for compilation only.
@@ -875,7 +878,8 @@
 	@echo "    USE_LUA=1     - Support for dynamic processing using Lua"
 	@echo
 	@echo "Use 'make help' to print a full explanation of supported targets"
-	@echo "and features."
+	@echo "and features, and 'make ... opts' to show the variables in use"
+	@echo "for a given set of build options, in a reusable form."
 	@echo
 	@exit 1
 else
@@ -1110,7 +1114,9 @@
 	echo "$(SUBVERS)" > SUBVERS
 	echo "$(VERDATE)" > VERDATE
 
-# just display the build options
+# just display the build options. The "USE_*" options and their respective
+# settings are also listed if they're explicitly set on the command line, or if
+# they are not empty. Implicit "USE_*" are not listed.
 opts:
 	@echo -n 'Using: '
 	@echo -n 'TARGET="$(strip $(TARGET))" '
@@ -1120,7 +1126,17 @@
 	@echo -n 'ARCH_FLAGS="$(strip $(ARCH_FLAGS))" '
 	@echo -n 'CPU_CFLAGS="$(strip $(CPU_CFLAGS))" '
 	@echo -n 'DEBUG_CFLAGS="$(strip $(DEBUG_CFLAGS))" '
-	@echo "$(strip $(BUILD_OPTIONS))"
+	@#echo "$(strip $(BUILD_OPTIONS))"
+	@$(foreach opt,$(enabled_opts),\
+		$(if $(subst command line,,$(origin USE_$(opt))),,\
+			echo -n 'USE_$(opt)=$(USE_$(opt)) ';) \
+		$(if $(subst command line,,$(origin $(opt)_CFLAGS)),\
+			$(if $($(opt)_CFLAGS),echo -n '$(opt)_CFLAGS="$($(opt)_CFLAGS)" ';),\
+			echo -n '$(opt)_CFLAGS="$($(opt)_CFLAGS)" ';) \
+		$(if $(subst command line,,$(origin $(opt)_LDFLAGS)),\
+			$(if $($(opt)_LDFLAGS),echo -n '$(opt)_LDFLAGS="$($(opt)_LDFLAGS)" ';),\
+			echo -n '$(opt)_LDFLAGS="$($(opt)_LDFLAGS)" ';))
+	@echo
 	@echo 'COPTS="$(strip $(COPTS))"'
 	@echo 'LDFLAGS="$(strip $(LDFLAGS))"'
 	@echo 'LDOPTS="$(strip $(LDOPTS))"'