mirror of
https://github.com/freebsd/freebsd-src
synced 2024-10-07 00:50:50 +00:00
makeman: add minimal support for group options
Ignore OPT_* values in showconfig out in exising code paths and add a new path to include descriptions for each. For now, hardcode the description contents rather than attempting to generate it. This runs the risk of docs getting out of date, limits the amount of new shell code added today while a lua rewrite is nearly ready to land. This change requires a followup commit to enable OPT_* values in "make showconfig" in order to actually find group options. Reviewed by: emaste Differential Revision: https://reviews.freebsd.org/D41681
This commit is contained in:
parent
ce5fa47cf0
commit
897ae85f7d
|
@ -52,21 +52,32 @@ show_options()
|
|||
__MAKE_CONF=/dev/null \
|
||||
TARGET_ARCH=${target#*/} TARGET=${target%/*} |
|
||||
while read var _ val ; do
|
||||
opt=${var#MK_}
|
||||
if [ $opt = "$prev_opt" ]; then
|
||||
echo "$target: ignoring duplicate option $opt" >&2
|
||||
continue
|
||||
fi
|
||||
prev_opt=$opt
|
||||
case ${val} in
|
||||
yes)
|
||||
echo ${opt} ${target}
|
||||
case $var in
|
||||
MK_*)
|
||||
opt=${var#MK_}
|
||||
if [ $opt = "$prev_opt" ]; then
|
||||
echo "$target: ignoring duplicate option $opt" >&2
|
||||
continue
|
||||
fi
|
||||
prev_opt=$opt
|
||||
case ${val} in
|
||||
yes)
|
||||
echo ${opt} ${target}
|
||||
;;
|
||||
no)
|
||||
echo ${opt}
|
||||
;;
|
||||
*)
|
||||
echo "make showconfig broken: ${var} ${_} ${val} (not yes or no)" >&2
|
||||
exit 1
|
||||
;;
|
||||
esac
|
||||
;;
|
||||
no)
|
||||
echo ${opt}
|
||||
OPT_*)
|
||||
# ignore
|
||||
;;
|
||||
*)
|
||||
echo "make showconfig broken: ${var} ${_} ${val} (not yes or no)" >&2
|
||||
echo "make showconfig broken: ${var} ${_} ${val} not MK_ or OPT_" >&2
|
||||
exit 1
|
||||
;;
|
||||
esac
|
||||
|
@ -121,21 +132,53 @@ show()
|
|||
env -i ${make} .MAKE.MODE=normal "$@" showconfig __MAKE_CONF=/dev/null \
|
||||
SRCCONF=/dev/null |
|
||||
while read var _ val ; do
|
||||
opt=${var#MK_}
|
||||
case ,${requireds}, in
|
||||
*,${opt},*)
|
||||
continue
|
||||
case ${var} in
|
||||
MK_*)
|
||||
opt=${var#MK_}
|
||||
case ,${requireds}, in
|
||||
*,${opt},*)
|
||||
continue
|
||||
;;
|
||||
esac
|
||||
case ${val} in
|
||||
yes)
|
||||
echo ${yes_prefix}_${opt}
|
||||
;;
|
||||
no)
|
||||
echo ${no_prefix}_${opt}
|
||||
;;
|
||||
*)
|
||||
echo "make showconfig broken: ${var} ${_} ${val} (not yes or no)" >&2
|
||||
exit 1
|
||||
;;
|
||||
esac
|
||||
;;
|
||||
esac
|
||||
case ${val} in
|
||||
yes)
|
||||
echo ${yes_prefix}_${opt}
|
||||
;;
|
||||
no)
|
||||
echo ${no_prefix}_${opt}
|
||||
OPT_*)
|
||||
# ignore
|
||||
;;
|
||||
*)
|
||||
echo "make showconfig broken: ${var} ${_} ${val} (not yes or no)" >&2
|
||||
echo "make showconfig broken: ${var} ${_} ${val} not MK_ or OPT_" >&2
|
||||
exit 1
|
||||
;;
|
||||
esac
|
||||
done
|
||||
}
|
||||
|
||||
show_group_options()
|
||||
{
|
||||
env -i ${make} .MAKE.MODE=normal "$@" showconfig __MAKE_CONF=/dev/null \
|
||||
SRCCONF=/dev/null |
|
||||
while read var _ val ; do
|
||||
case ${var} in
|
||||
MK_*)
|
||||
# ignore
|
||||
;;
|
||||
OPT_*)
|
||||
opt=${var#OPT_}
|
||||
echo ${opt}
|
||||
;;
|
||||
*)
|
||||
echo "make showconfig broken: ${var} ${_} ${val} not MK_ or OPT_" >&2
|
||||
exit 1
|
||||
;;
|
||||
esac
|
||||
|
@ -332,6 +375,22 @@ EOF
|
|||
printf "\n" >&2
|
||||
cat <<EOF
|
||||
.El
|
||||
.Pp
|
||||
The following options accept a single value from a list of valid values.
|
||||
.Bl -tag -width indent
|
||||
EOF
|
||||
show_group_options |
|
||||
while read opt ; do
|
||||
if [ ! -f ${opt} ] ; then
|
||||
echo "no description found for ${opt}, skipping" >&2
|
||||
continue
|
||||
fi
|
||||
|
||||
echo ".It Va ${opt}"
|
||||
cat ${opt}
|
||||
done
|
||||
cat <<EOF
|
||||
.El
|
||||
.Sh FILES
|
||||
.Bl -tag -compact -width Pa
|
||||
.It Pa /etc/src.conf
|
||||
|
|
Loading…
Reference in a new issue