xref: /freebsd/tools/build/options/makeman (revision 3d11b6c8f01e1fca5936a11d6996448467851a94)
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
107sources, which are usually found 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; the variable being
123set at all (even to
124.Dq Li FALSE
125or
126.Dq Li NO )
127causes it to be treated as if it was set with no value.
128.Pp
129The following list provides a name and short description for variables
130that can be used for source builds.
131.Bl -tag -width indent
132EOF
133	show settings |sort >_config
134	show options |
135	while read opt; do
136		if [ -f ${opt} ]; then
137			cat <<EOF
138.It Va ${opt}
139EOF
140			sed -e's/\$\(FreeBSD: .*\) \$/from \1/' ${opt}
141		else
142			echo "no description found for ${opt}, skipping" >/dev/stderr
143		fi
144		show settings -D${opt} |sort >_config2
145		comm -13 _config _config2 |grep -v "^${opt}$" >_deps
146		if [ -s _deps ]; then
147			cat <<EOF
148When set, it also enforces the following options:
149.Pp
150.Bl -item -compact
151EOF
152			cat _deps |while read opt2; do
153				cat <<EOF
154.It
155.Va ${opt2}
156EOF
157			done
158				cat <<EOF
159.El
160EOF
161		fi
162	done
163	cat <<EOF
164.El
165.Sh FILES
166.Bl -tag -compact
167.It Pa /etc/src.conf
168.It Pa /usr/share/mk/bsd.own.mk
169.El
170.Sh SEE ALSO
171.Xr make 1 ,
172.Xr make.conf 5 ,
173.Xr build 7 ,
174.Xr ports 7
175.Sh HISTORY
176The
177.Nm
178file appeared in
179.Fx 7.0 .
180.Sh AUTHORS
181This manual page was autogenerated.
182EOF
183}
184
185main
186