xref: /freebsd/tools/build/options/makeman (revision 3d919b75217236f2d55d0e821f4d164916310581)
1c5922fbfSRuslan Ermilov#!/bin/sh
2c5922fbfSRuslan Ermilov#
3c5922fbfSRuslan Ermilov# This file is in the public domain.
4c5922fbfSRuslan Ermilov
5c5922fbfSRuslan Ermilovident='$FreeBSD$'
6c5922fbfSRuslan Ermilov
7c5922fbfSRuslan Ermilov#
8c1e29f71SRuslan Ermilov# usage: show { settings | options } ...
9c5922fbfSRuslan Ermilov#
10c5922fbfSRuslan Ermilovshow()
11c5922fbfSRuslan Ermilov{
12c5922fbfSRuslan Ermilov
13c5922fbfSRuslan Ermilov	mode=$1; shift
14c5922fbfSRuslan Ermilov	case ${mode} in
15c5922fbfSRuslan Ermilov	settings)
16c5922fbfSRuslan Ermilov		yes_prefix=WITH
17c5922fbfSRuslan Ermilov		no_prefix=WITHOUT
18c5922fbfSRuslan Ermilov		;;
19c5922fbfSRuslan Ermilov	options)
20c5922fbfSRuslan Ermilov		yes_prefix=WITHOUT
21c5922fbfSRuslan Ermilov		no_prefix=WITH
22c5922fbfSRuslan Ermilov		;;
23c5922fbfSRuslan Ermilov	*)
24c5922fbfSRuslan Ermilov		echo "internal error" >/dev/stderr
25c5922fbfSRuslan Ermilov		exit 1
26c5922fbfSRuslan Ermilov		;;
27c5922fbfSRuslan Ermilov	esac
28c1e29f71SRuslan Ermilov	(
29c1e29f71SRuslan Ermilov		cd ../../..
30c1e29f71SRuslan Ermilov		make "$@" showconfig SRCCONF=/dev/null __MAKE_CONF=/dev/null
31c1e29f71SRuslan Ermilov	) |
32c5922fbfSRuslan Ermilov	while read var _ val; do
33c5922fbfSRuslan Ermilov		opt=${var#MK_}
34c5922fbfSRuslan Ermilov		case ${val} in
35c5922fbfSRuslan Ermilov		yes)
36c5922fbfSRuslan Ermilov			echo ${yes_prefix}_${opt}
37c5922fbfSRuslan Ermilov			;;
38c5922fbfSRuslan Ermilov		no)
39c5922fbfSRuslan Ermilov			echo ${no_prefix}_${opt}
40c5922fbfSRuslan Ermilov			;;
41c5922fbfSRuslan Ermilov		*)
42c5922fbfSRuslan Ermilov			echo "make showconfig broken" >/dev/stderr
43c5922fbfSRuslan Ermilov			exit 1
44c5922fbfSRuslan Ermilov			;;
45c5922fbfSRuslan Ermilov		esac
46c5922fbfSRuslan Ermilov	done
47c5922fbfSRuslan Ermilov}
48c5922fbfSRuslan Ermilov
49c5922fbfSRuslan Ermilovmain()
50c5922fbfSRuslan Ermilov{
51c5922fbfSRuslan Ermilov
526dc51ecaSRuslan Ermilov	trap 'rm -f _defcfg _config _config2 _deps _deps2' exit
53c5922fbfSRuslan Ermilov	ident=${ident#$}
54c5922fbfSRuslan Ermilov	ident=${ident% $}
5541c8ddc3SRuslan Ermilov	fbsdid='$'FreeBSD'$'
56c5922fbfSRuslan Ermilov	cat <<EOF
57c5922fbfSRuslan Ermilov.\" DO NOT EDIT-- this file is automatically generated.
58c5922fbfSRuslan Ermilov.\" from ${ident}
59c5922fbfSRuslan Ermilov.\" ${fbsdid}
60c5922fbfSRuslan Ermilov.Dd $(LC_TIME=C date +'%B %e, %Y')
61c5922fbfSRuslan Ermilov.Dt SRC.CONF 5
62c5922fbfSRuslan Ermilov.Os
63c5922fbfSRuslan Ermilov.Sh NAME
64c5922fbfSRuslan Ermilov.Nm src.conf
6557caf3d6STom Rhodes.Nd "source build options"
66c5922fbfSRuslan Ermilov.Sh DESCRIPTION
67c5922fbfSRuslan ErmilovThe
68c5922fbfSRuslan Ermilov.Nm
69c5922fbfSRuslan Ermilovfile contains settings that will apply to every build involving the
70c5922fbfSRuslan Ermilov.Fx
71c5922fbfSRuslan Ermilovsource tree; see
72c5922fbfSRuslan Ermilov.Xr build 7 .
73c5922fbfSRuslan Ermilov.Pp
74c5922fbfSRuslan ErmilovThe
75c5922fbfSRuslan Ermilov.Nm
76c5922fbfSRuslan Ermilovfile uses the standard makefile syntax.
77c5922fbfSRuslan ErmilovHowever,
78c5922fbfSRuslan Ermilov.Nm
79c5922fbfSRuslan Ermilovshould not specify any dependencies to
80c5922fbfSRuslan Ermilov.Xr make 1 .
81c5922fbfSRuslan ErmilovInstead,
82c5922fbfSRuslan Ermilov.Nm
83c5922fbfSRuslan Ermilovis to set
84c5922fbfSRuslan Ermilov.Xr make 1
85c5922fbfSRuslan Ermilovvariables that control the aspects of how the system builds.
86c5922fbfSRuslan Ermilov.Pp
87c5922fbfSRuslan ErmilovThe default location of
88c5922fbfSRuslan Ermilov.Nm
89c5922fbfSRuslan Ermilovis
90c5922fbfSRuslan Ermilov.Pa /etc/src.conf ,
91c5922fbfSRuslan Ermilovthough an alternative location can be specified in the
92c5922fbfSRuslan Ermilov.Xr make 1
93c5922fbfSRuslan Ermilovvariable
94c5922fbfSRuslan Ermilov.Va SRCCONF .
95c5922fbfSRuslan ErmilovOverriding the location of
96c5922fbfSRuslan Ermilov.Nm
97c5922fbfSRuslan Ermilovmay be necessary if the system-wide settings are not suitable
98c5922fbfSRuslan Ermilovfor a particular build.
99c5922fbfSRuslan ErmilovFor instance, setting
100c5922fbfSRuslan Ermilov.Va SRCCONF
101c5922fbfSRuslan Ermilovto
102c5922fbfSRuslan Ermilov.Pa /dev/null
103c5922fbfSRuslan Ermiloveffectively resets all build controls to their defaults.
104c5922fbfSRuslan Ermilov.Pp
105c5922fbfSRuslan ErmilovThe only purpose of
106c5922fbfSRuslan Ermilov.Nm
107c5922fbfSRuslan Ermilovis to control the compilation of the
108c5922fbfSRuslan Ermilov.Fx
10957caf3d6STom Rhodessource code, which is usually located in
110c5922fbfSRuslan Ermilov.Pa /usr/src .
111c5922fbfSRuslan ErmilovAs a rule, the system administrator creates
112c5922fbfSRuslan Ermilov.Nm
113c5922fbfSRuslan Ermilovwhen the values of certain control variables need to be changed
114c5922fbfSRuslan Ermilovfrom their defaults.
115c5922fbfSRuslan Ermilov.Pp
116c5922fbfSRuslan ErmilovIn addition, control variables can be specified
117c5922fbfSRuslan Ermilovfor a particular build via the
118c5922fbfSRuslan Ermilov.Fl D
119c5922fbfSRuslan Ermilovoption of
120c5922fbfSRuslan Ermilov.Xr make 1
1213d919b75SMike Makonnenor in its environment; see
122c5922fbfSRuslan Ermilov.Xr environ 7 .
123c5922fbfSRuslan Ermilov.Pp
12407b7d7fbSTom RhodesThe values of variables are ignored regardless of their setting;
12557caf3d6STom Rhodeseven if they would be set to
126c5922fbfSRuslan Ermilov.Dq Li FALSE
127c5922fbfSRuslan Ermilovor
12857caf3d6STom Rhodes.Dq Li NO .
12957caf3d6STom RhodesJust the existence of an option will cause
13057caf3d6STom Rhodesit to be honoured by
13157caf3d6STom Rhodes.Xr make 1 .
132c5922fbfSRuslan Ermilov.Pp
133c5922fbfSRuslan ErmilovThe following list provides a name and short description for variables
134c5922fbfSRuslan Ermilovthat can be used for source builds.
135c5922fbfSRuslan Ermilov.Bl -tag -width indent
136c5922fbfSRuslan ErmilovEOF
1376dc51ecaSRuslan Ermilov	show settings |sort >_defcfg
138c5922fbfSRuslan Ermilov	show options |
139c5922fbfSRuslan Ermilov	while read opt; do
140c5922fbfSRuslan Ermilov		if [ -f ${opt} ]; then
141c5922fbfSRuslan Ermilov			cat <<EOF
142c5922fbfSRuslan Ermilov.It Va ${opt}
143c5922fbfSRuslan ErmilovEOF
144c5922fbfSRuslan Ermilov			sed -e's/\$\(FreeBSD: .*\) \$/from \1/' ${opt}
145c5922fbfSRuslan Ermilov		else
146c5922fbfSRuslan Ermilov			echo "no description found for ${opt}, skipping" >/dev/stderr
147c3b08cc6SYaroslav Tykhiy			continue
148c5922fbfSRuslan Ermilov		fi
1496dc51ecaSRuslan Ermilov		show settings -D${opt} |sort >_config
1506dc51ecaSRuslan Ermilov		comm -13 _defcfg _config |grep -v "^${opt}$" >_deps
151c5922fbfSRuslan Ermilov		if [ -s _deps ]; then
152c5922fbfSRuslan Ermilov			cat <<EOF
153c5922fbfSRuslan ErmilovWhen set, it also enforces the following options:
154c5922fbfSRuslan Ermilov.Pp
155c5922fbfSRuslan Ermilov.Bl -item -compact
156c5922fbfSRuslan ErmilovEOF
157c5922fbfSRuslan Ermilov			cat _deps |while read opt2; do
158c5922fbfSRuslan Ermilov				cat <<EOF
159c5922fbfSRuslan Ermilov.It
160c5922fbfSRuslan Ermilov.Va ${opt2}
161c5922fbfSRuslan ErmilovEOF
1626dc51ecaSRuslan Ermilov				show settings -D${opt} $(
1636dc51ecaSRuslan Ermilov				    echo ${opt2} |
1646dc51ecaSRuslan Ermilov				    sed -e's/^WITHOUT_/-DWITH_/' -e's/^WITH_/-DWITHOUT_/'
1656dc51ecaSRuslan Ermilov				) |sort >_config2
1666dc51ecaSRuslan Ermilov				comm -13 _config _config2 >_deps2
1676dc51ecaSRuslan Ermilov				if [ -s _deps2 ]; then
1686dc51ecaSRuslan Ermilov					cat <<EOF
1696dc51ecaSRuslan Ermilov(can be overridden with
1706dc51ecaSRuslan Ermilov.Va $(cat _deps2) )
1716dc51ecaSRuslan ErmilovEOF
1726dc51ecaSRuslan Ermilov				fi
173c5922fbfSRuslan Ermilov			done
174c5922fbfSRuslan Ermilov				cat <<EOF
175c5922fbfSRuslan Ermilov.El
176c5922fbfSRuslan ErmilovEOF
177c5922fbfSRuslan Ermilov		fi
178c5922fbfSRuslan Ermilov	done
179c5922fbfSRuslan Ermilov	cat <<EOF
180c5922fbfSRuslan Ermilov.El
181c5922fbfSRuslan Ermilov.Sh FILES
182c5922fbfSRuslan Ermilov.Bl -tag -compact
183c5922fbfSRuslan Ermilov.It Pa /etc/src.conf
184c5922fbfSRuslan Ermilov.It Pa /usr/share/mk/bsd.own.mk
185c5922fbfSRuslan Ermilov.El
186c5922fbfSRuslan Ermilov.Sh SEE ALSO
187c5922fbfSRuslan Ermilov.Xr make 1 ,
188c5922fbfSRuslan Ermilov.Xr make.conf 5 ,
189c5922fbfSRuslan Ermilov.Xr build 7 ,
190c5922fbfSRuslan Ermilov.Xr ports 7
191c5922fbfSRuslan Ermilov.Sh HISTORY
192c5922fbfSRuslan ErmilovThe
193c5922fbfSRuslan Ermilov.Nm
194c5922fbfSRuslan Ermilovfile appeared in
195c5922fbfSRuslan Ermilov.Fx 7.0 .
196c5922fbfSRuslan Ermilov.Sh AUTHORS
197c5922fbfSRuslan ErmilovThis manual page was autogenerated.
198c5922fbfSRuslan ErmilovEOF
199c5922fbfSRuslan Ermilov}
200c5922fbfSRuslan Ermilov
201c5922fbfSRuslan Ermilovmain
202