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