Skip site navigation (1)Skip section navigation (2)
Date:      Tue, 10 May 2011 11:14:40 +0000 (UTC)
From:      Ruslan Ermilov <ru@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org
Subject:   svn commit: r221730 - head/tools/build/options
Message-ID:  <201105101114.p4ABEeqM041830@svn.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: ru
Date: Tue May 10 11:14:40 2011
New Revision: 221730
URL: http://svn.freebsd.org/changeset/base/221730

Log:
  - 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.

Added:
  head/tools/build/options/WITH_CLANG
     - copied, changed from r221204, head/tools/build/options/WITHOUT_CLANG
  head/tools/build/options/WITH_FDT
     - copied, changed from r221539, head/tools/build/options/WITHOUT_FDT
Modified:
  head/tools/build/options/makeman

Copied and modified: head/tools/build/options/WITH_CLANG (from r221204, head/tools/build/options/WITHOUT_CLANG)
==============================================================================
--- head/tools/build/options/WITHOUT_CLANG	Fri Apr 29 10:33:54 2011	(r221204, copy source)
+++ head/tools/build/options/WITH_CLANG	Tue May 10 11:14:40 2011	(r221730)
@@ -1,2 +1,2 @@
 .\" $FreeBSD$
-Set to not build the Clang C/C++ compiler.
+Set to build the Clang C/C++ compiler.

Copied and modified: head/tools/build/options/WITH_FDT (from r221539, head/tools/build/options/WITHOUT_FDT)
==============================================================================
--- head/tools/build/options/WITHOUT_FDT	Fri May  6 19:10:27 2011	(r221539, copy source)
+++ head/tools/build/options/WITH_FDT	Tue May 10 11:14:40 2011	(r221730)
@@ -1,3 +1,3 @@
 .\" $FreeBSD$
-Set to not build Flattened Device Tree support as part of the base system.
+Set to build Flattened Device Tree support as part of the base system.
 This includes the device tree compiler (dtc) and libfdt support library.

Modified: head/tools/build/options/makeman
==============================================================================
--- head/tools/build/options/makeman	Tue May 10 11:06:14 2011	(r221729)
+++ head/tools/build/options/makeman	Tue May 10 11:14:40 2011	(r221730)
@@ -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 s
 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



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201105101114.p4ABEeqM041830>