xref: /freebsd/tools/build/options/makeman (revision adfa0adec0b5d7c19c220a85ef6ca729235ed172)
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			continue
146		fi
147		show settings -D${opt} |sort >_config2
148		comm -13 _config _config2 |grep -v "^${opt}$" >_deps
149		if [ -s _deps ]; then
150			cat <<EOF
151When set, it also enforces the following options:
152.Pp
153.Bl -item -compact
154EOF
155			cat _deps |while read opt2; do
156				cat <<EOF
157.It
158.Va ${opt2}
159EOF
160			done
161				cat <<EOF
162.El
163EOF
164		fi
165	done
166	cat <<EOF
167.El
168.Sh FILES
169.Bl -tag -compact
170.It Pa /etc/src.conf
171.It Pa /usr/share/mk/bsd.own.mk
172.El
173.Sh SEE ALSO
174.Xr make 1 ,
175.Xr make.conf 5 ,
176.Xr build 7 ,
177.Xr ports 7
178.Sh HISTORY
179The
180.Nm
181file appeared in
182.Fx 7.0 .
183.Sh AUTHORS
184This manual page was autogenerated.
185EOF
186}
187
188main
189