3 # This file is in the public domain.
10 t=$(mktemp -d -t makeman)
11 trap 'test -d $t && rm -rf $t' exit
13 srcdir=$(realpath ../../..)
14 make="make -C $srcdir -m $srcdir/share/mk"
17 # usage: no_targets all_targets yes_targets
23 if [ "${t1}" = "${t2}" ] ; then
33 ALL_TARGETS=$(echo $(${make} targets | tail -n +2))
35 for target in ${ALL_TARGETS} ; do
36 env -i ${make} showconfig \
37 SRC_ENV_CONF=/dev/null SRCCONF=/dev/null \
38 __MAKE_CONF=/dev/null \
39 TARGET_ARCH=${target#*/} TARGET=${target%/*} |
40 while read var _ val ; do
50 echo "make showconfig broken: ${var} ${_} ${val} (not yes or no)" >&2
54 done > $t/settings.target
55 if [ -r $t/settings ] ; then
56 join -t\ $t/settings $t/settings.target > $t/settings.new
57 mv $t/settings.new $t/settings
59 mv $t/settings.target $t/settings
63 while read opt targets ; do
64 if [ "${targets}" = "${ALL_TARGETS}" ] ; then
66 elif [ -z "${targets}" ] ; then
69 echo "WITHOUT_${opt}" $(no_targets "${ALL_TARGETS}" "${targets}")
70 echo "WITH_${opt} ${targets}"
76 # usage: show { settings | with | without } ...
96 echo 'internal error' >&2
100 env -i ${make} .MAKE.MODE=normal "$@" showconfig __MAKE_CONF=/dev/null \
102 while read var _ val ; do
106 echo ${yes_prefix}_${opt}
109 echo ${no_prefix}_${opt}
112 echo "make showconfig broken: ${var} ${_} ${val} (not yes or no)" >&2
126 .\" DO NOT EDIT-- this file is automatically generated.
129 .Dd $(echo $(LC_TIME=C date +'%B %e, %Y'))
134 .Nd "source build options"
138 file contains settings that will apply to every build involving the
145 file uses the standard makefile syntax.
148 should not specify any dependencies to
154 variables that control the aspects of how the system builds.
156 The default location of
160 though an alternative location can be specified in the
164 Overriding the location of
166 may be necessary if the system-wide settings are not suitable
167 for a particular build.
168 For instance, setting
172 effectively resets all build controls to their defaults.
176 is to control the compilation of the
178 source code, which is usually located in
180 As a rule, the system administrator creates
182 when the values of certain control variables need to be changed
185 In addition, control variables can be specified
186 for a particular build via the
190 or in its environment; see
195 for the build can be controlled via the
197 variable, which defaults to
198 .Pa /etc/src-env.conf .
199 Some examples that may only be set in this file are
200 .Va MAKEOBJDIRPREFIX ,
203 as they are environment-only variables.
205 The values of variables are ignored regardless of their setting;
206 even if they would be set to
210 Just the existence of an option will cause
214 The following list provides a name and short description for variables
215 that can be used for source builds.
216 .Bl -tag -width indent
218 show settings SRC_ENV_CONF=/dev/null | sort > $t/config_default
219 # Work around WITH_LDNS_UTILS forcing BIND_UTILS off by parsing the
220 # actual config that results from enabling every WITH_ option. This
221 # can be reverted if/when we no longer have options that disable
223 show with SRC_ENV_CONF=/dev/null | sort | sed 's/$/=/' > $t/src.conf
224 show settings SRC_ENV_CONF=$t/src.conf | sort > $t/config_WITH_ALL
225 show without SRC_ENV_CONF=/dev/null | sort > $t/config_WITHOUT_ALL
226 env_only_options="$(${make} -V __ENV_ONLY_OPTIONS)"
229 while read opt targets ; do
230 if [ ! -f ${opt} ] ; then
231 echo "no description found for ${opt}, skipping" >&2
236 sed -e's/\$\(FreeBSD: .*\) \$/from \1/' ${opt}
237 if [ -n "${targets}" ] ; then
239 echo 'It is a default setting on'
240 echo $(echo ${targets} | sed -e's/ /, /g' -e's/\(.*\), /\1 and /').
243 if [ "${opt%%_*}" = 'WITHOUT' ] ; then
244 sed -n "/^WITH_${opt#WITHOUT_}$/!s/$/=/p" $t/config_WITH_ALL > $t/src.conf
245 show settings SRC_ENV_CONF=$t/src.conf -D${opt} | sort > $t/config_WITH_ALL_${opt}
246 comm -13 $t/config_WITH_ALL $t/config_WITH_ALL_${opt} | sed -n "/^${opt}$/!p" > $t/deps
247 elif [ "${opt%%_*}" = 'WITH' ] ; then
248 sed -n "/^WITHOUT${opt#WITH}$/!s/$/=/p" $t/config_WITHOUT_ALL > $t/src.conf
249 show settings SRC_ENV_CONF=$t/src.conf -D${opt} | sort > $t/config_WITHOUT_ALL_${opt}
250 comm -13 $t/config_WITHOUT_ALL $t/config_WITHOUT_ALL_${opt} | sed -n "/^${opt}$/!p" > $t/deps
252 echo 'internal error' >&2
256 show settings SRC_ENV_CONF=/dev/null -D${opt} | sort > $t/config_${opt}
257 comm -13 $t/config_default $t/config_${opt} | sed -n "/^${opt}$/!p" |
258 comm -13 $t/deps - > $t/deps2
260 # Work around BIND_UTILS=no being the default when every WITH_
262 if [ "$(cat $t/deps2)" = WITHOUT_BIND_UTILS ]; then
263 sort $t/deps $t/deps2 > $t/_deps
269 if [ -s $t/deps ] ; then
271 echo 'When set, it also enforces the following options:'
273 echo '.Bl -item -compact'
281 if [ -s $t/deps2 ] ; then
282 if [ ${havedeps} -eq 1 ] ; then
285 echo 'When set, the following options are also in effect:'
287 echo '.Bl -inset -compact'
289 echo ".It Va ${opt2}"
290 noopt=$(echo ${opt2} | sed -e's/WITH_/WITHOUT_/;t' -e's/WITHOUT_/WITH_/')
293 echo 'is set explicitly)'
298 case " ${env_only_options} " in
301 echo "This must be set in the environment, make command line, or"
302 echo ".Pa /etc/src-env.conf ,"
304 echo ".Pa /etc/src.conf ."
313 .Bl -tag -compact -width Pa
315 .It Pa /etc/src-env.conf
316 .It Pa /usr/share/mk/bsd.own.mk
329 This manual page was autogenerated.
336 local c0='|' c1='/' c2='-' c3='\'
338 eval printf '%c\\b' '$c'${twiddle_pos}
339 twiddle_pos=$(((twiddle_pos+1)%4))