Skip to content

Commit 23078c8

Browse files
committed
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.
1 parent 6e70a39 commit 23078c8

1 file changed

Lines changed: 20 additions & 4 deletions

File tree

Makefile

Lines changed: 20 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,10 @@
6363
#
6464
# Options can be forced by specifying "USE_xxx=1" or can be disabled by using
6565
# "USE_xxx=" (empty string). The list of enabled and disabled options for a
66-
# given TARGET is enumerated at the end of "make help".
66+
# given TARGET is enumerated at the end of "make help". Most of these options
67+
# support specific xxx_CFLAGS and/or xxx_LDFLAGS that can be individually
68+
# forced. The currently active ones for a given set of options are listed in
69+
# "make opts USE_xxx=1 ...".
6770
#
6871
# Variables useful for packagers :
6972
# CC is set to "cc" by default and is used for compilation only.
@@ -875,7 +878,8 @@ all:
875878
@echo " USE_LUA=1 - Support for dynamic processing using Lua"
876879
@echo
877880
@echo "Use 'make help' to print a full explanation of supported targets"
878-
@echo "and features."
881+
@echo "and features, and 'make ... opts' to show the variables in use"
882+
@echo "for a given set of build options, in a reusable form."
879883
@echo
880884
@exit 1
881885
else
@@ -1110,7 +1114,9 @@ update-version:
11101114
echo "$(SUBVERS)" > SUBVERS
11111115
echo "$(VERDATE)" > VERDATE
11121116
1113-
# just display the build options
1117+
# just display the build options. The "USE_*" options and their respective
1118+
# settings are also listed if they're explicitly set on the command line, or if
1119+
# they are not empty. Implicit "USE_*" are not listed.
11141120
opts:
11151121
@echo -n 'Using: '
11161122
@echo -n 'TARGET="$(strip $(TARGET))" '
@@ -1120,7 +1126,17 @@ opts:
11201126
@echo -n 'ARCH_FLAGS="$(strip $(ARCH_FLAGS))" '
11211127
@echo -n 'CPU_CFLAGS="$(strip $(CPU_CFLAGS))" '
11221128
@echo -n 'DEBUG_CFLAGS="$(strip $(DEBUG_CFLAGS))" '
1123-
@echo "$(strip $(BUILD_OPTIONS))"
1129+
@#echo "$(strip $(BUILD_OPTIONS))"
1130+
@$(foreach opt,$(enabled_opts),\
1131+
$(if $(subst command line,,$(origin USE_$(opt))),,\
1132+
echo -n 'USE_$(opt)=$(USE_$(opt)) ';) \
1133+
$(if $(subst command line,,$(origin $(opt)_CFLAGS)),\
1134+
$(if $($(opt)_CFLAGS),echo -n '$(opt)_CFLAGS="$($(opt)_CFLAGS)" ';),\
1135+
echo -n '$(opt)_CFLAGS="$($(opt)_CFLAGS)" ';) \
1136+
$(if $(subst command line,,$(origin $(opt)_LDFLAGS)),\
1137+
$(if $($(opt)_LDFLAGS),echo -n '$(opt)_LDFLAGS="$($(opt)_LDFLAGS)" ';),\
1138+
echo -n '$(opt)_LDFLAGS="$($(opt)_LDFLAGS)" ';))
1139+
@echo
11241140
@echo 'COPTS="$(strip $(COPTS))"'
11251141
@echo 'LDFLAGS="$(strip $(LDFLAGS))"'
11261142
@echo 'LDOPTS="$(strip $(LDOPTS))"'

0 commit comments

Comments
 (0)