xref: /freebsd/tools/build/options/makeman (revision ea906c4152774dff300bb26fbfc1e4188351c89a)
1#!/bin/sh
2#
3# This file is in the public domain.
4
5ident='$FreeBSD$'
6
7#
8# usage: show { settings | options } ...
9#
10show()
11{
12
13	mode=$1; shift
14	case ${mode} in
15	settings)
16		yes_prefix=WITH
17		no_prefix=WITHOUT
18		;;
19	options)
20		yes_prefix=WITHOUT
21		no_prefix=WITH
22		;;
23	*)
24		echo "internal error" >/dev/stderr
25		exit 1
26		;;
27	esac
28	(
29		cd ../../..
30		make "$@" showconfig SRCCONF=/dev/null __MAKE_CONF=/dev/null
31	) |
32	while read var _ val; do
33		opt=${var#MK_}
34		case ${val} in
35		yes)
36			echo ${yes_prefix}_${opt}
37			;;
38		no)
39			echo ${no_prefix}_${opt}
40			;;
41		*)
42			echo "make showconfig broken" >/dev/stderr
43			exit 1
44			;;
45		esac
46	done
47}
48
49main()
50{
51
52	trap 'rm -f _defcfg _config _config2 _deps _deps2' exit
53	ident=${ident#$}
54	ident=${ident% $}
55	fbsdid='$'FreeBSD'$'
56	cat <<EOF
57.\" DO NOT EDIT-- this file is automatically generated.
58.\" from ${ident}
59.\" ${fbsdid}
60.Dd $(LC_TIME=C date +'%B %e, %Y')
61.Dt SRC.CONF 5
62.Os
63.Sh NAME
64.Nm src.conf
65.Nd "source build options"
66.Sh DESCRIPTION
67The
68.Nm
69file contains settings that will apply to every build involving the
70.Fx
71source tree; see
72.Xr build 7 .
73.Pp
74The
75.Nm
76file uses the standard makefile syntax.
77However,
78.Nm
79should not specify any dependencies to
80.Xr make 1 .
81Instead,
82.Nm
83is to set
84.Xr make 1
85variables that control the aspects of how the system builds.
86.Pp
87The default location of
88.Nm
89is
90.Pa /etc/src.conf ,
91though an alternative location can be specified in the
92.Xr make 1
93variable
94.Va SRCCONF .
95Overriding the location of
96.Nm
97may be necessary if the system-wide settings are not suitable
98for a particular build.
99For instance, setting
100.Va SRCCONF
101to
102.Pa /dev/null
103effectively resets all build controls to their defaults.
104.Pp
105The only purpose of
106.Nm
107is to control the compilation of the
108.Fx
109source code, which is usually located in
110.Pa /usr/src .
111As a rule, the system administrator creates
112.Nm
113when the values of certain control variables need to be changed
114from their defaults.
115.Pp
116In addition, control variables can be specified
117for a particular build via the
118.Fl D
119option of
120.Xr make 1
121or in environment; see
122.Xr environ 7 .
123.Pp
124The values of variables are ignored regardless of their setting;
125even if they would be set to
126.Dq Li FALSE
127or
128.Dq Li NO .
129Just the existence of an option will cause
130it to be honoured by
131.Xr make 1 .
132.Pp
133The following list provides a name and short description for variables
134that can be used for source builds.
135.Bl -tag -width indent
136EOF
137	show settings |sort >_defcfg
138	show options |
139	while read opt; do
140		if [ -f ${opt} ]; then
141			cat <<EOF
142.It Va ${opt}
143EOF
144			sed -e's/\$\(FreeBSD: .*\) \$/from \1/' ${opt}
145		else
146			echo "no description found for ${opt}, skipping" >/dev/stderr
147			continue
148		fi
149		show settings -D${opt} |sort >_config
150		comm -13 _defcfg _config |grep -v "^${opt}$" >_deps
151		if [ -s _deps ]; then
152			cat <<EOF
153When set, it also enforces the following options:
154.Pp
155.Bl -item -compact
156EOF
157			cat _deps |while read opt2; do
158				cat <<EOF
159.It
160.Va ${opt2}
161EOF
162				show settings -D${opt} $(
163				    echo ${opt2} |
164				    sed -e's/^WITHOUT_/-DWITH_/' -e's/^WITH_/-DWITHOUT_/'
165				) |sort >_config2
166				comm -13 _config _config2 >_deps2
167				if [ -s _deps2 ]; then
168					cat <<EOF
169(can be overridden with
170.Va $(cat _deps2) )
171EOF
172				fi
173			done
174				cat <<EOF
175.El
176EOF
177		fi
178	done
179	cat <<EOF
180.El
181.Sh FILES
182.Bl -tag -compact
183.It Pa /etc/src.conf
184.It Pa /usr/share/mk/bsd.own.mk
185.El
186.Sh SEE ALSO
187.Xr make 1 ,
188.Xr make.conf 5 ,
189.Xr build 7 ,
190.Xr ports 7
191.Sh HISTORY
192The
193.Nm
194file appeared in
195.Fx 7.0 .
196.Sh AUTHORS
197This manual page was autogenerated.
198EOF
199}
200
201main
202