makeman: avoid bogus output with duplicated options

On some targets 'make showconfig' currently reports both 'no' and 'yes'
for some options. For example:

% make TARGET=mips showconfig | grep SSP
MK_SSP           = no
MK_SSP           = yes

Emit a warning on encountering a duplicated variable, and skip the
second entry.

Sponsored by:	The FreeBSD Foundation
This commit is contained in:
Ed Maste 2016-10-05 20:12:00 +00:00
parent e441cce6b5
commit b7f38e69a9

View File

@ -33,12 +33,18 @@ show_options()
ALL_TARGETS=$(echo $(${make} targets | tail -n +2)) ALL_TARGETS=$(echo $(${make} targets | tail -n +2))
rm -f $t/settings rm -f $t/settings
for target in ${ALL_TARGETS} ; do for target in ${ALL_TARGETS} ; do
prev_opt=
env -i ${make} showconfig \ env -i ${make} showconfig \
SRC_ENV_CONF=/dev/null SRCCONF=/dev/null \ SRC_ENV_CONF=/dev/null SRCCONF=/dev/null \
__MAKE_CONF=/dev/null \ __MAKE_CONF=/dev/null \
TARGET_ARCH=${target#*/} TARGET=${target%/*} | TARGET_ARCH=${target#*/} TARGET=${target%/*} |
while read var _ val ; do while read var _ val ; do
opt=${var#MK_} opt=${var#MK_}
if [ $opt = "$prev_opt" ]; then
echo "$target: ignoring duplicate option $opt" >&2
continue
fi
prev_opt=$opt
case ${val} in case ${val} in
yes) yes)
echo ${opt} ${target} echo ${opt} ${target}