]> CyberLeo.Net >> Repos - FreeBSD/releng/8.1.git/blob - tools/build/options/makeman
Copy stable/8 to releng/8.1 in preparation for 8.1-RC1.
[FreeBSD/releng/8.1.git] / tools / build / options / makeman
1 #!/bin/sh
2 #
3 # This file is in the public domain.
4
5 ident='$FreeBSD$'
6
7 #
8 # usage: show { settings | options } ...
9 #
10 show()
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
49 main()
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
67 The
68 .Nm
69 file contains settings that will apply to every build involving the
70 .Fx
71 source tree; see
72 .Xr build 7 .
73 .Pp
74 The
75 .Nm
76 file uses the standard makefile syntax.
77 However,
78 .Nm
79 should not specify any dependencies to
80 .Xr make 1 .
81 Instead,
82 .Nm
83 is to set
84 .Xr make 1
85 variables that control the aspects of how the system builds.
86 .Pp
87 The default location of
88 .Nm
89 is
90 .Pa /etc/src.conf ,
91 though an alternative location can be specified in the
92 .Xr make 1
93 variable
94 .Va SRCCONF .
95 Overriding the location of
96 .Nm
97 may be necessary if the system-wide settings are not suitable
98 for a particular build.
99 For instance, setting
100 .Va SRCCONF
101 to
102 .Pa /dev/null
103 effectively resets all build controls to their defaults.
104 .Pp
105 The only purpose of
106 .Nm
107 is to control the compilation of the
108 .Fx
109 source code, which is usually located in
110 .Pa /usr/src .
111 As a rule, the system administrator creates
112 .Nm
113 when the values of certain control variables need to be changed
114 from their defaults.
115 .Pp
116 In addition, control variables can be specified
117 for a particular build via the
118 .Fl D
119 option of
120 .Xr make 1
121 or in its environment; see
122 .Xr environ 7 .
123 .Pp
124 The values of variables are ignored regardless of their setting;
125 even if they would be set to
126 .Dq Li FALSE
127 or
128 .Dq Li NO .
129 Just the existence of an option will cause
130 it to be honoured by
131 .Xr make 1 .
132 .Pp
133 The following list provides a name and short description for variables
134 that can be used for source builds.
135 .Bl -tag -width indent
136 EOF
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}
143 EOF
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
153 When set, it also enforces the following options:
154 .Pp
155 .Bl -item -compact
156 EOF
157                         cat _deps |while read opt2; do
158                                 cat <<EOF
159 .It
160 .Va ${opt2}
161 EOF
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) )
171 EOF
172                                 fi
173                         done
174                                 cat <<EOF
175 .El
176 EOF
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
192 The
193 .Nm
194 file appeared in
195 .Fx 7.0 .
196 .Sh AUTHORS
197 This manual page was autogenerated.
198 EOF
199 }
200
201 main