3 # This file is in the public domain.
6 # This script creates the src.conf.5 man page using template text contained
7 # herein and the contents of the WITH_* and WITHOUT_* files in the same
8 # directory. Each WITH_* and WITHOUT_* file documents the effect of the
9 # /etc/src.conf knob with the same name.
11 # For each supported architecture, "make showconfig" is invoked to determine
12 # the default setting of every option: always WITH_, always WITHOUT_, or
13 # architecture-dependent WITH_/WITHOUT_. It also determines and describes
14 # dependencies between options.
18 # cd tools/build/options
19 # sh makeman > ../../../share/man/man5/src.conf.5
24 t=$(mktemp -d -t makeman)
25 # trap 'test -d $t && rm -rf $t' exit
27 srcdir=$(realpath ../../..)
28 make="make -C $srcdir -m $srcdir/share/mk"
31 # usage: no_targets all_targets yes_targets
37 if [ "${t1}" = "${t2}" ] ; then
47 ALL_TARGETS=$(echo $(${make} targets | tail -n +2))
49 for target in ${ALL_TARGETS} ; do
50 env -i ${make} showconfig \
51 SRC_ENV_CONF=/dev/null SRCCONF=/dev/null \
52 __MAKE_CONF=/dev/null \
53 TARGET_ARCH=${target#*/} TARGET=${target%/*} |
54 while read var _ val ; do
64 echo "make showconfig broken: ${var} ${_} ${val} (not yes or no)" >&2
68 done > $t/settings.target
69 if [ -r $t/settings ] ; then
70 join -t\ $t/settings $t/settings.target > $t/settings.new
71 mv $t/settings.new $t/settings
73 mv $t/settings.target $t/settings
77 while read opt targets ; do
78 if [ "${targets}" = "${ALL_TARGETS}" ] ; then
80 elif [ -z "${targets}" ] ; then
83 echo "WITHOUT_${opt}" $(no_targets "${ALL_TARGETS}" "${targets}")
84 echo "WITH_${opt} ${targets}"
90 # usage: show { settings | with | without } ...
110 echo 'internal error' >&2
114 env -i ${make} .MAKE.MODE=normal "$@" showconfig __MAKE_CONF=/dev/null \
116 while read var _ val ; do
120 echo ${yes_prefix}_${opt}
123 echo ${no_prefix}_${opt}
126 echo "make showconfig broken: ${var} ${_} ${val} (not yes or no)" >&2
135 echo "building src.conf.5 man page from files in ${PWD}" >&2
139 .\" DO NOT EDIT-- this file is generated by tools/build/options/makeman.
141 .Dd $(echo $(LC_TIME=C date +'%B %e, %Y'))
146 .Nd "source build options"
150 file contains settings that will apply to every build involving the
157 file uses the standard makefile syntax.
160 should not specify any dependencies to
166 variables that control the aspects of how the system builds.
168 The default location of
172 though an alternative location can be specified in the
176 Overriding the location of
178 may be necessary if the system-wide settings are not suitable
179 for a particular build.
180 For instance, setting
184 effectively resets all build controls to their defaults.
188 is to control the compilation of the
190 source code, which is usually located in
192 As a rule, the system administrator creates
194 when the values of certain control variables need to be changed
197 In addition, control variables can be specified
198 for a particular build via the
202 or in its environment; see
207 for the build can be controlled via the
209 variable, which defaults to
210 .Pa /etc/src-env.conf .
211 Some examples that may only be set in this file are
212 .Va WITH_DIRDEPS_BUILD ,
215 as they are environment-only variables.
218 may be set here only when using
219 .Va WITH_DIRDEPS_BUILD .
221 The values of variables are ignored regardless of their setting;
222 even if they would be set to
226 The presence of an option causes
230 This list provides a name and short description for variables
231 that can be used for source builds.
232 .Bl -tag -width indent
234 show settings SRC_ENV_CONF=/dev/null | sort > $t/config_default
235 # Work around WITH_LDNS_UTILS forcing BIND_UTILS off by parsing the
236 # actual config that results from enabling every WITH_ option. This
237 # can be reverted if/when we no longer have options that disable
239 show with SRC_ENV_CONF=/dev/null | sort | sed 's/$/=/' > $t/src.conf
240 show settings SRC_ENV_CONF=$t/src.conf | sort > $t/config_WITH_ALL
241 show without SRC_ENV_CONF=/dev/null | sort > $t/config_WITHOUT_ALL
242 env_only_options="$(${make} -V __ENV_ONLY_OPTIONS)"
245 while read opt targets ; do
246 if [ ! -f ${opt} ] ; then
247 echo "no description found for ${opt}, skipping" >&2
252 sed -e'/\$FreeBSD.*\$/d' ${opt}
253 if [ -n "${targets}" ] ; then
255 echo 'This is a default setting on'
256 echo $(echo ${targets} | sed -e's/ /, /g' -e's/\(.*\), /\1 and /').
259 if [ "${opt%%_*}" = 'WITHOUT' ] ; then
260 sed -n "/^WITH_${opt#WITHOUT_}$/!s/$/=/p" $t/config_WITH_ALL > $t/src.conf
261 show settings SRC_ENV_CONF=$t/src.conf -D${opt} | sort > $t/config_WITH_ALL_${opt}
262 comm -13 $t/config_WITH_ALL $t/config_WITH_ALL_${opt} | sed -n "/^${opt}$/!p" > $t/deps
263 elif [ "${opt%%_*}" = 'WITH' ] ; then
264 sed -n "/^WITHOUT${opt#WITH}$/!s/$/=/p" $t/config_WITHOUT_ALL > $t/src.conf
265 show settings SRC_ENV_CONF=$t/src.conf -D${opt} | sort > $t/config_WITHOUT_ALL_${opt}
266 comm -13 $t/config_WITHOUT_ALL $t/config_WITHOUT_ALL_${opt} | sed -n "/^${opt}$/!p" > $t/deps
268 echo 'internal error' >&2
272 show settings SRC_ENV_CONF=/dev/null -D${opt} | sort > $t/config_${opt}
273 comm -13 $t/config_default $t/config_${opt} | sed -n "/^${opt}$/!p" |
274 comm -13 $t/deps - > $t/deps2
276 # Work around BIND_UTILS=no being the default when every WITH_
278 if [ "$(cat $t/deps2)" = WITHOUT_BIND_UTILS ]; then
279 sort $t/deps $t/deps2 > $t/_deps
285 if [ -s $t/deps ] ; then
287 echo 'When set, it enforces these options:'
289 echo '.Bl -item -compact'
297 if [ -s $t/deps2 ] ; then
298 if [ ${havedeps} -eq 1 ] ; then
301 echo 'When set, these options are also in effect:'
303 echo '.Bl -inset -compact'
305 echo ".It Va ${opt2}"
306 noopt=$(echo ${opt2} | sed -e's/WITH_/WITHOUT_/;t' -e's/WITHOUT_/WITH_/')
309 echo 'is set explicitly)'
314 case " ${env_only_options} " in
317 echo "This must be set in the environment, make command line, or"
318 echo ".Pa /etc/src-env.conf ,"
320 echo ".Pa /etc/src.conf ."
329 .Bl -tag -compact -width Pa
331 .It Pa /etc/src-env.conf
332 .It Pa /usr/share/mk/bsd.own.mk
345 This manual page was autogenerated by
346 .An tools/build/options/makeman .
353 local c0='|' c1='/' c2='-' c3='\'
355 eval printf '%c\\b' '$c'${twiddle_pos}
356 twiddle_pos=$(((twiddle_pos+1)%4))