summaryrefslogtreecommitdiffstats
path: root/tools/build/options
diff options
context:
space:
mode:
authorru <ru@FreeBSD.org>2011-05-10 11:14:40 +0000
committerru <ru@FreeBSD.org>2011-05-10 11:14:40 +0000
commitcfe73ed34bc4263add9bc4cd630d611dc50a6157 (patch)
treed3a5ddbfe790e3dc1f177697c4055cf5a971ee5e /tools/build/options
parenta6d00e343c78e147802d9c689800705b54652385 (diff)
downloadFreeBSD-src-cfe73ed34bc4263add9bc4cd630d611dc50a6157.zip
FreeBSD-src-cfe73ed34bc4263add9bc4cd630d611dc50a6157.tar.gz
- There now exist options that have different defaults depending on
the architecture, reflect this in documentation. For such options, both WITH_FOO and WITHOUT_FOO description files should be provided. Prodded by: des - Setting a build option may enforce other build options, try harder to detect this case. - Setting a build option may change other option's default value, try harder to detect this case.
Diffstat (limited to 'tools/build/options')
-rw-r--r--tools/build/options/WITH_CLANG2
-rw-r--r--tools/build/options/WITH_FDT3
-rwxr-xr-xtools/build/options/makeman183
3 files changed, 139 insertions, 49 deletions
diff --git a/tools/build/options/WITH_CLANG b/tools/build/options/WITH_CLANG
new file mode 100644
index 0000000..b0e300a
--- /dev/null
+++ b/tools/build/options/WITH_CLANG
@@ -0,0 +1,2 @@
+.\" $FreeBSD$
+Set to build the Clang C/C++ compiler.
diff --git a/tools/build/options/WITH_FDT b/tools/build/options/WITH_FDT
new file mode 100644
index 0000000..b812e3b
--- /dev/null
+++ b/tools/build/options/WITH_FDT
@@ -0,0 +1,3 @@
+.\" $FreeBSD$
+Set to build Flattened Device Tree support as part of the base system.
+This includes the device tree compiler (dtc) and libfdt support library.
diff --git a/tools/build/options/makeman b/tools/build/options/makeman
index 68ed87b..99c892e 100755
--- a/tools/build/options/makeman
+++ b/tools/build/options/makeman
@@ -2,34 +2,98 @@
#
# This file is in the public domain.
+set -o errexit
+
ident='$FreeBSD$'
+t=$(mktemp -d -t makeman)
+trap 'test -d $t && rm -rf $t' exit
+
#
-# usage: show { settings | options } ...
+# usage: no_targets all_targets yes_targets
+#
+no_targets()
+{
+ for t1 in $1 ; do
+ for t2 in $2 ; do
+ if [ "${t1}" = "${t2}" ] ; then
+ continue 2
+ fi
+ done
+ echo ${t1}
+ done
+}
+
+show_options()
+{
+ ALL_TARGETS=$(echo $(make -C ../../.. targets | tail -n +2))
+ rm -f $t/settings
+ for target in ${ALL_TARGETS} ; do
+ make -C ../../.. showconfig \
+ SRCCONF=/dev/null __MAKE_CONF=/dev/null \
+ TARGET_ARCH=${target#*/} TARGET=${target%/*} |
+ while read var _ val ; do
+ opt=${var#MK_}
+ case ${val} in
+ yes)
+ echo ${opt} ${target}
+ ;;
+ no)
+ echo ${opt}
+ ;;
+ *)
+ echo 'make showconfig broken' >&2
+ exit 1
+ ;;
+ esac
+ done > $t/settings.target
+ if [ -r $t/settings ] ; then
+ join -t\ $t/settings $t/settings.target > $t/settings.new
+ mv $t/settings.new $t/settings
+ else
+ mv $t/settings.target $t/settings
+ fi
+ done
+
+ cat $t/settings | while read opt targets ; do
+ if [ "${targets}" = "${ALL_TARGETS}" ] ; then
+ echo "WITHOUT_${opt}"
+ elif [ -z "${targets}" ] ; then
+ echo "WITH_${opt}"
+ else
+ echo "WITHOUT_${opt}" $(no_targets "${ALL_TARGETS}" "${targets}")
+ echo "WITH_${opt} ${targets}"
+ fi
+ done
+}
+
+#
+# usage: show { settings | with | without } ...
#
show()
{
- mode=$1; shift
+ mode=$1 ; shift
case ${mode} in
settings)
yes_prefix=WITH
no_prefix=WITHOUT
;;
- options)
- yes_prefix=WITHOUT
+ with)
+ yes_prefix=WITH
no_prefix=WITH
;;
+ without)
+ yes_prefix=WITHOUT
+ no_prefix=WITHOUT
+ ;;
*)
- echo "internal error" >/dev/stderr
+ echo 'internal error' >&2
exit 1
;;
esac
- (
- cd ../../..
- make "$@" showconfig SRCCONF=/dev/null __MAKE_CONF=/dev/null
- ) |
- while read var _ val; do
+ make -C ../../.. "$@" showconfig __MAKE_CONF=/dev/null |
+ while read var _ val ; do
opt=${var#MK_}
case ${val} in
yes)
@@ -39,7 +103,7 @@ show()
echo ${no_prefix}_${opt}
;;
*)
- echo "make showconfig broken" >/dev/stderr
+ echo 'make showconfig broken' >&2
exit 1
;;
esac
@@ -49,7 +113,6 @@ show()
main()
{
- trap 'rm -f _defcfg _config _config2 _deps _deps2' exit
ident=${ident#$}
ident=${ident% $}
fbsdid='$'FreeBSD'$'
@@ -57,7 +120,7 @@ main()
.\" DO NOT EDIT-- this file is automatically generated.
.\" from ${ident}
.\" ${fbsdid}
-.Dd $(LC_TIME=C date +'%B %e, %Y')
+.Dd $(echo $(LC_TIME=C date +'%B %e, %Y'))
.Dt SRC.CONF 5
.Os
.Sh NAME
@@ -134,46 +197,68 @@ The following list provides a name and short description for variables
that can be used for source builds.
.Bl -tag -width indent
EOF
- show settings |sort >_defcfg
- show options |
- while read opt; do
- if [ -f ${opt} ]; then
- cat <<EOF
-.It Va ${opt}
-EOF
+ show settings SRCCONF=/dev/null | sort > $t/config_default
+ show with SRCCONF=/dev/null | sort > $t/config_WITH_ALL
+ show without SRCCONF=/dev/null | sort > $t/config_WITHOUT_ALL
+
+ show_options |
+ while read opt targets ; do
+ if [ ! -f ${opt} ] ; then
+ echo "no description found for ${opt}, skipping" >&2
+ continue
+ else
+ echo ".It Va ${opt}"
sed -e's/\$\(FreeBSD: .*\) \$/from \1/' ${opt}
+ if [ -n "${targets}" ] ; then
+ echo '.Pp'
+ echo 'It is a default setting on'
+ echo $(echo ${targets} | sed -e's/ /, /g' -e's/\(.*\), /\1 and /').
+ fi
+ fi
+
+ if [ "${opt%%_*}" = "WITHOUT" ] ; then
+ sed -n "/^WITH_${opt#WITHOUT_}$/!s/$/=/p" $t/config_WITH_ALL > $t/src.conf
+ show settings SRCCONF=$t/src.conf -D${opt} | sort > $t/config_WITH_ALL_${opt}
+ comm -13 $t/config_WITH_ALL $t/config_WITH_ALL_${opt} | sed -n "/^${opt}$/!p" > $t/deps
+ elif [ "${opt%%_*}" = "WITH" ] ; then
+ sed -n "/^WITHOUT${opt#WITH}$/!s/$/=/p" $t/config_WITHOUT_ALL > $t/src.conf
+ show settings SRCCONF=$t/src.conf -D${opt} | sort > $t/config_WITHOUT_ALL_${opt}
+ comm -13 $t/config_WITHOUT_ALL $t/config_WITHOUT_ALL_${opt} | sed -n "/^${opt}$/!p" > $t/deps
else
- echo "no description found for ${opt}, skipping" >/dev/stderr
- continue
+ echo 'internal error' >&2
+ exit 1
fi
- show settings -D${opt} |sort >_config
- comm -13 _defcfg _config |grep -v "^${opt}$" >_deps
- if [ -s _deps ]; then
- cat <<EOF
-When set, it also enforces the following options:
-.Pp
-.Bl -item -compact
-EOF
- cat _deps |while read opt2; do
- cat <<EOF
-.It
-.Va ${opt2}
-EOF
- show settings -D${opt} $(
- echo ${opt2} |
- sed -e's/^WITHOUT_/-DWITH_/' -e's/^WITH_/-DWITHOUT_/'
- ) |sort >_config2
- comm -13 _config _config2 >_deps2
- if [ -s _deps2 ]; then
- cat <<EOF
-(can be overridden with
-.Va $(cat _deps2) )
-EOF
- fi
+
+ if [ -s $t/deps ] ; then
+ echo 'When set, it also enforces the following options:'
+ echo '.Pp'
+ echo '.Bl -item -compact'
+ cat $t/deps | while read opt2 ; do
+ echo '.It'
+ echo ".Va ${opt2}"
done
- cat <<EOF
-.El
-EOF
+ echo '.El'
+ fi
+
+ show settings SRCCONF=/dev/null -D${opt} | sort > $t/config_${opt}
+ comm -13 $t/config_default $t/config_${opt} | sed -n "/^${opt}$/!p" |
+ comm -13 $t/deps - > $t/deps2
+
+ if [ -s $t/deps2 ] ; then
+ if [ -s $t/deps ] ; then
+ echo '.Pp'
+ fi
+ echo 'When set, the following options are also in effect:'
+ echo '.Pp'
+ echo '.Bl -inset -compact'
+ cat $t/deps2 | while read opt2 ; do
+ echo ".It Va ${opt2}"
+ noopt=$(echo ${opt2} | sed -e's/WITH_/WITHOUT_/;t' -e's/WITHOUT_/WITH_/')
+ echo '(unless'
+ echo ".Va ${noopt}"
+ echo 'is set explicitly)'
+ done
+ echo '.El'
fi
done
cat <<EOF
OpenPOWER on IntegriCloud