Sun Jun 11 10:43:51 2023 UTC ()
more NBUILDJOBS deprecation

The NBUILDJOBS option was deprecated in 2002;
there's no need to keep warning about it,
remove from params / show-params,
and only document as obsolete.


(lukem)
diff -r1.152 -r1.153 src/BUILDING
diff -r1.336 -r1.337 src/Makefile
diff -r1.141 -r1.142 src/doc/BUILDING.mdoc
diff -r1.22 -r1.23 src/etc/Makefile.params

cvs diff -r1.152 -r1.153 src/BUILDING (switch to unified diff)

--- src/BUILDING 2023/06/05 22:36:17 1.152
+++ src/BUILDING 2023/06/11 10:43:51 1.153
@@ -1,1319 +1,1314 @@ @@ -1,1319 +1,1314 @@
1BUILDING(8) System Manager's Manual BUILDING(8) 1BUILDING(8) System Manager's Manual BUILDING(8)
2 2
3NAME 3NAME
4 BUILDING - Procedure for building NetBSD from source code 4 BUILDING - Procedure for building NetBSD from source code
5 5
6REQUIREMENTS 6REQUIREMENTS
7 NetBSD is designed to be buildable on most POSIX-compliant host systems. 7 NetBSD is designed to be buildable on most POSIX-compliant host systems.
8 The basic build procedure is the same whether compiling natively (on the 8 The basic build procedure is the same whether compiling natively (on the
9 same NetBSD architecture) or cross compiling (on another architecture or 9 same NetBSD architecture) or cross compiling (on another architecture or
10 OS). 10 OS).
11 11
12 This source tree contains a special subtree, "tools", which uses the host 12 This source tree contains a special subtree, "tools", which uses the host
13 system to create a build toolchain for the target architecture. The host 13 system to create a build toolchain for the target architecture. The host
14 system must have at least C and C++ compilers in order to create the 14 system must have at least C and C++ compilers in order to create the
15 toolchain (make is not required); all other tools are created as part of 15 toolchain (make is not required); all other tools are created as part of
16 the NetBSD build process. (See the Environment variables section below 16 the NetBSD build process. (See the Environment variables section below
17 if you need to override or manually select your compilers.) 17 if you need to override or manually select your compilers.)
18 18
19FILES 19FILES
20 Source tree layout 20 Source tree layout
21 BUILDING This document (in plaintext). Generated from 21 BUILDING This document (in plaintext). Generated from
22 doc/BUILDING.mdoc. 22 doc/BUILDING.mdoc.
23 23
24 Makefile The main Makefile for NetBSD; should only be run for 24 Makefile The main Makefile for NetBSD; should only be run for
25 native builds with an appropriately up-to-date version of 25 native builds with an appropriately up-to-date version of
26 NetBSD make(1). Intended for expert use with knowledge of 26 NetBSD make(1). Intended for expert use with knowledge of
27 its shortcomings, it has been superseded by the build.sh 27 its shortcomings, it has been superseded by the build.sh
28 shell script as the recommended means for building NetBSD. 28 shell script as the recommended means for building NetBSD.
29 29
30 UPDATING Special notes for updating from an earlier revision of 30 UPDATING Special notes for updating from an earlier revision of
31 NetBSD. It is important to read this file before every 31 NetBSD. It is important to read this file before every
32 build of an updated source tree. 32 build of an updated source tree.
33 33
34 build.sh Bourne-compatible shell script used for building the host 34 build.sh Bourne-compatible shell script used for building the host
35 build tools and the NetBSD system from scratch. Can be 35 build tools and the NetBSD system from scratch. Can be
36 used for both native and cross builds, and should be used 36 used for both native and cross builds, and should be used
37 instead of make(1) as it performs additional checks to 37 instead of make(1) as it performs additional checks to
38 prevent common issues going undetected, such as building 38 prevent common issues going undetected, such as building
39 with an outdated version of make(1). 39 with an outdated version of make(1).
40 40
41 crypto/dist/, dist/, gnu/dist/ 41 crypto/dist/, dist/, gnu/dist/
42 Sources imported verbatim from third parties, without 42 Sources imported verbatim from third parties, without
43 mangling the existing build structure. Other source trees 43 mangling the existing build structure. Other source trees
44 in bin through usr.sbin use the NetBSD make(1) "reachover" 44 in bin through usr.sbin use the NetBSD make(1) "reachover"
45 Makefile semantics when building these programs for a 45 Makefile semantics when building these programs for a
46 native host. 46 native host.
47 47
48 distrib/, etc/ 48 distrib/, etc/
49 Sources for items used when making a full release 49 Sources for items used when making a full release
50 snapshot, such as files installed in DESTDIR/etc on the 50 snapshot, such as files installed in DESTDIR/etc on the
51 destination system, boot media, and release notes. 51 destination system, boot media, and release notes.
52 52
53 doc/BUILDING.mdoc 53 doc/BUILDING.mdoc
54 This document, in -mdoc troff format; the original copy. 54 This document, in -mdoc troff format; the original copy.
55 Used to generate BUILDING. 55 Used to generate BUILDING.
56 56
57 external, sys/external 57 external, sys/external
58 Sources and build infrastructure for components imported 58 Sources and build infrastructure for components imported
59 (mostly) unchanged from upstream maintainers, sorted by 59 (mostly) unchanged from upstream maintainers, sorted by
60 applicable license. This is (slowly) replacing the 60 applicable license. This is (slowly) replacing the
61 crypto/dist, dist, and gnu/dist directories. 61 crypto/dist, dist, and gnu/dist directories.
62 62
63 external/mit/xorg/ 63 external/mit/xorg/
64 "Reachover" build structure for modular Xorg; the source 64 "Reachover" build structure for modular Xorg; the source
65 is in X11SRCDIR. 65 is in X11SRCDIR.
66 66
67 regress/, tests/ 67 regress/, tests/
68 Regression test harness. Can be cross-compiled, but only 68 Regression test harness. Can be cross-compiled, but only
69 run natively. tests/ uses the atf(7) test framework; 69 run natively. tests/ uses the atf(7) test framework;
70 regress/ contains older tests that have not yet been 70 regress/ contains older tests that have not yet been
71 migrated to atf(7). 71 migrated to atf(7).
72 72
73 sys/ NetBSD kernel sources. 73 sys/ NetBSD kernel sources.
74 74
75 tools/ "Reachover" build structure for the host build tools. 75 tools/ "Reachover" build structure for the host build tools.
76 This has a special method of determining out-of-date 76 This has a special method of determining out-of-date
77 status. 77 status.
78 78
79 tools/compat/README 79 tools/compat/README
80 Special notes for cross-hosting a NetBSD build on non- 80 Special notes for cross-hosting a NetBSD build on non-
81 NetBSD platforms. 81 NetBSD platforms.
82 82
83 Other directories including bin/ ... usr.sbin/ 83 Other directories including bin/ ... usr.sbin/
84 Sources to the NetBSD userland (non-kernel) programs. If 84 Sources to the NetBSD userland (non-kernel) programs. If
85 any of these directories are missing, they will be skipped 85 any of these directories are missing, they will be skipped
86 during the build. 86 during the build.
87 87
88 Build tree layout 88 Build tree layout
89 The NetBSD build tree is described in hier(7), and the release layout is 89 The NetBSD build tree is described in hier(7), and the release layout is
90 described in release(7). 90 described in release(7).
91 91
92CONFIGURATION 92CONFIGURATION
93 Environment variables 93 Environment variables
94 Several environment variables control the behaviour of NetBSD builds. 94 Several environment variables control the behaviour of NetBSD builds.
95 95
96 HOST_CC Path name to C compiler used to create the toolchain. 96 HOST_CC Path name to C compiler used to create the toolchain.
97 97
98 HOST_CFLAGS Flags passed to the host C compiler. 98 HOST_CFLAGS Flags passed to the host C compiler.
99 99
100 HOST_CXX Path name to C++ compiler used to create the toolchain. 100 HOST_CXX Path name to C++ compiler used to create the toolchain.
101 101
102 HOST_CXXFLAGS Flags passed to the host C++ compiler. 102 HOST_CXXFLAGS Flags passed to the host C++ compiler.
103 103
104 HOST_SH Path name to a shell available on the host system and 104 HOST_SH Path name to a shell available on the host system and
105 suitable for use during the build. The NetBSD build 105 suitable for use during the build. The NetBSD build
106 system requires a modern Bourne-like shell with POSIX- 106 system requires a modern Bourne-like shell with POSIX-
107 compliant features, and also requires support for the 107 compliant features, and also requires support for the
108 "local" keyword to declare local variables in shell 108 "local" keyword to declare local variables in shell
109 functions (which is a widely-implemented but non- 109 functions (which is a widely-implemented but non-
110 standardised feature). 110 standardised feature).
111 111
112 Depending on the host system, a suitable shell may be 112 Depending on the host system, a suitable shell may be
113 /bin/sh, /usr/xpg4/bin/sh, /bin/ksh (provided it is a 113 /bin/sh, /usr/xpg4/bin/sh, /bin/ksh (provided it is a
114 variant of ksh that supports the "local" keyword, such as 114 variant of ksh that supports the "local" keyword, such as
115 ksh88, but not ksh93), or /usr/local/bin/bash. 115 ksh88, but not ksh93), or /usr/local/bin/bash.
116 116
117 Most parts of the build require HOST_SH to be an absolute 117 Most parts of the build require HOST_SH to be an absolute
118 path; however, build.sh allows it to be a simple command 118 path; however, build.sh allows it to be a simple command
119 name, which will be converted to an absolute path by 119 name, which will be converted to an absolute path by
120 searching the PATH. 120 searching the PATH.
121 121
122 INSTALLBOOT_UBOOT_PATHS 122 INSTALLBOOT_UBOOT_PATHS
123 A colon-separated list of search paths used by 123 A colon-separated list of search paths used by
124 installboot(8) to find U-Boot packages. 124 installboot(8) to find U-Boot packages.
125 125
126 MACHINE Machine type, e.g., "macppc". 126 MACHINE Machine type, e.g., "macppc".
127 127
128 MACHINE_ARCH Machine architecture, e.g., "powerpc". 128 MACHINE_ARCH Machine architecture, e.g., "powerpc".
129 129
130 MAKE Path name to invoke make(1) as. 130 MAKE Path name to invoke make(1) as.
131 131
132 MAKECONF The name of the make(1) configuration file. See "make" 132 MAKECONF The name of the make(1) configuration file. See "make"
133 variables and mk.conf(5). 133 variables and mk.conf(5).
134 134
135 Note: Only settable in the process environment. 135 Note: Only settable in the process environment.
136 136
137 Default: "/etc/mk.conf" 137 Default: "/etc/mk.conf"
138 138
139 MAKEFLAGS Flags to invoke make(1) with. 139 MAKEFLAGS Flags to invoke make(1) with.
140 140
141 Note: build.sh ignores the value of MAKEFLAGS passed in 141 Note: build.sh ignores the value of MAKEFLAGS passed in
142 the environment, but allows MAKEFLAGS to be set via the 142 the environment, but allows MAKEFLAGS to be set via the
143 -V option. 143 -V option.
144 144
145 MAKEOBJDIR Directory to use as the .OBJDIR for the current 145 MAKEOBJDIR Directory to use as the .OBJDIR for the current
146 directory. The value is subjected to variable expansion 146 directory. The value is subjected to variable expansion
147 by make(1). Typical usage is to set this variable to a 147 by make(1). Typical usage is to set this variable to a
148 value involving the use of `${.CURDIR:S...}' or 148 value involving the use of `${.CURDIR:S...}' or
149 `${.CURDIR:C...}', to derive the value of .OBJDIR from 149 `${.CURDIR:C...}', to derive the value of .OBJDIR from
150 the value of .CURDIR. Used only if MAKEOBJDIRPREFIX is 150 the value of .CURDIR. Used only if MAKEOBJDIRPREFIX is
151 not defined. 151 not defined.
152 152
153 Note: MAKEOBJDIR can be provided only in the environment 153 Note: MAKEOBJDIR can be provided only in the environment
154 or via the -O flag of build.sh; it cannot usefully be set 154 or via the -O flag of build.sh; it cannot usefully be set
155 inside a Makefile, including in mk.conf(5) or MAKECONF. 155 inside a Makefile, including in mk.conf(5) or MAKECONF.
156 156
157 MAKEOBJDIRPREFIX 157 MAKEOBJDIRPREFIX
158 Top level directory of the object directory tree. The 158 Top level directory of the object directory tree. The
159 value is subjected to variable expansion by make(1). 159 value is subjected to variable expansion by make(1).
160 build.sh will create the ${MAKEOBJDIRPREFIX} directory if 160 build.sh will create the ${MAKEOBJDIRPREFIX} directory if
161 necessary, but if make(1) is used without build.sh, then 161 necessary, but if make(1) is used without build.sh, then
162 rules in <bsd.obj.mk> will abort the build if the 162 rules in <bsd.obj.mk> will abort the build if the
163 ${MAKEOBJDIRPREFIX} directory does not exist. If the 163 ${MAKEOBJDIRPREFIX} directory does not exist. If the
164 value is defined and valid, then 164 value is defined and valid, then
165 ${MAKEOBJDIRPREFIX}/${.CURDIR} is used as the .OBJDIR for 165 ${MAKEOBJDIRPREFIX}/${.CURDIR} is used as the .OBJDIR for
166 the current directory. The current directory may be read 166 the current directory. The current directory may be read
167 only. 167 only.
168 168
169 Note: MAKEOBJDIRPREFIX can be provided only in the 169 Note: MAKEOBJDIRPREFIX can be provided only in the
170 environment or via the -M flag of build.sh; it cannot 170 environment or via the -M flag of build.sh; it cannot
171 usefully be set inside a Makefile, including in 171 usefully be set inside a Makefile, including in
172 mk.conf(5) or MAKECONF. 172 mk.conf(5) or MAKECONF.
173 173
174 TMPDIR Top-level directory to store temporary directories used 174 TMPDIR Top-level directory to store temporary directories used
175 by build.sh before paths to other directories such as 175 by build.sh before paths to other directories such as
176 .OBJDIR can be determined. 176 .OBJDIR can be determined.
177 177
178 Note: Must support execution of binaries. I.e., without 178 Note: Must support execution of binaries. I.e., without
179 mount(8)'s -o noexec option. 179 mount(8)'s -o noexec option.
180 180
181 Default: "/tmp". 181 Default: "/tmp".
182 182
183 "make" variables 183 "make" variables
184 Several variables control the behavior of NetBSD builds. Unless 184 Several variables control the behavior of NetBSD builds. Unless
185 otherwise specified, these variables may be set in either the process 185 otherwise specified, these variables may be set in either the process
186 environment or the make(1) configuration file mk.conf(5) specified by 186 environment or the make(1) configuration file mk.conf(5) specified by
187 MAKECONF. 187 MAKECONF.
188 188
189 This list is not comprehensive; all supported variables and their 189 This list is not comprehensive; all supported variables and their
190 defaults are documented in mk.conf(5). 190 defaults are documented in mk.conf(5).
191 191
192 BSDOBJDIR The real path to the object directory tree for the NetBSD 192 BSDOBJDIR The real path to the object directory tree for the NetBSD
193 source tree. 193 source tree.
194 194
195 Default: "/usr/obj" 195 Default: "/usr/obj"
196 196
197 BSDSRCDIR The real path to the NetBSD source tree, if NETBSDSRCDIR 197 BSDSRCDIR The real path to the NetBSD source tree, if NETBSDSRCDIR
198 isn't defined. 198 isn't defined.
199 199
200 Default: "/usr/src" 200 Default: "/usr/src"
201 201
202 BUILDID Identifier for the build. If set, this should be a short 202 BUILDID Identifier for the build. If set, this should be a short
203 string that is suitable for use as part of a file or 203 string that is suitable for use as part of a file or
204 directory name. The identifier will be appended to 204 directory name. The identifier will be appended to
205 object directory names, and can be consulted in the 205 object directory names, and can be consulted in the
206 make(1) configuration file in order to set additional 206 make(1) configuration file in order to set additional
207 build parameters, such as compiler flags. It will also 207 build parameters, such as compiler flags. It will also
208 be used as part of the kernel version string, which can 208 be used as part of the kernel version string, which can
209 be shown by "uname -v". 209 be shown by "uname -v".
210 210
211 Default: Unset. 211 Default: Unset.
212 212
213 BUILDINFO Optional multi-line string containing information about 213 BUILDINFO Optional multi-line string containing information about
214 the build. This will appear in DESTDIR/etc/release, and 214 the build. This will appear in DESTDIR/etc/release, and
215 it will be stored in the buildinfo variable in any 215 it will be stored in the buildinfo variable in any
216 kernels that are built. When such kernels are booted, 216 kernels that are built. When such kernels are booted,
217 the sysctl(7) kern.buildinfo variable will report this 217 the sysctl(7) kern.buildinfo variable will report this
218 value. The string may contain backslash escape 218 value. The string may contain backslash escape
219 sequences, such as "\\" (representing a backslash 219 sequences, such as "\\" (representing a backslash
220 character) and "\n" (representing a newline). 220 character) and "\n" (representing a newline).
221 221
222 Default: Unset. 222 Default: Unset.
223 223
224 BUILDSEED g++(1) uses random numbers when compiling C++ code. This 224 BUILDSEED g++(1) uses random numbers when compiling C++ code. This
225 variable seeds the g++(1) random number generator using 225 variable seeds the g++(1) random number generator using
226 -frandom-seed with this value. By default, it is set to 226 -frandom-seed with this value. By default, it is set to
227 "NetBSD-(majorversion)". Using a fixed value causes C++ 227 "NetBSD-(majorversion)". Using a fixed value causes C++
228 binaries to be the same when built from the same sources, 228 binaries to be the same when built from the same sources,
229 resulting in identical (reproducible) builds. Additional 229 resulting in identical (reproducible) builds. Additional
230 information is available in the g++(1) documentation of 230 information is available in the g++(1) documentation of
231 -frandom-seed. 231 -frandom-seed.
232 232
233 Default: Unset. 233 Default: Unset.
234 234
235 CPUFLAGS Additional flags to the compiler/assembler to select CPU 235 CPUFLAGS Additional flags to the compiler/assembler to select CPU
236 instruction set options, CPU tuning options, etc. 236 instruction set options, CPU tuning options, etc.
237 237
238 Default: Unset. 238 Default: Unset.
239 239
240 DESTDIR Directory to contain the built NetBSD system. If set, 240 DESTDIR Directory to contain the built NetBSD system. If set,
241 special options are passed to the compilation tools to 241 special options are passed to the compilation tools to
242 prevent their default use of the host system's 242 prevent their default use of the host system's
243 /usr/include, /usr/lib, and so forth. This pathname must 243 /usr/include, /usr/lib, and so forth. This pathname must
244 be an absolute path, and should not end with a slash (/) 244 be an absolute path, and should not end with a slash (/)
245 character. (For installation into the system's root 245 character. (For installation into the system's root
246 directory, set DESTDIR to an empty string, not to "/"). 246 directory, set DESTDIR to an empty string, not to "/").
247 The directory must reside on a file system which supports 247 The directory must reside on a file system which supports
248 long file names and hard links. 248 long file names and hard links.
249 249
250 Note: build.sh will provide a default of destdir.MACHINE 250 Note: build.sh will provide a default of destdir.MACHINE
251 (in the top-level .OBJDIR) unless run in `expert' mode. 251 (in the top-level .OBJDIR) unless run in `expert' mode.
252 252
253 Default: Empty string if USETOOLS is "yes"; unset 253 Default: Empty string if USETOOLS is "yes"; unset
254 otherwise. 254 otherwise.
255 255
256 EXTERNAL_TOOLCHAIN 256 EXTERNAL_TOOLCHAIN
257 If defined, this variable indicates the root directory of 257 If defined, this variable indicates the root directory of
258 an external toolchain which will be used to build the 258 an external toolchain which will be used to build the
259 tree. For example, if a platform is a TOOLCHAIN_MISSING 259 tree. For example, if a platform is a TOOLCHAIN_MISSING
260 platform, EXTERNAL_TOOLCHAIN can be used to re-enable the 260 platform, EXTERNAL_TOOLCHAIN can be used to re-enable the
261 cross-compile framework. 261 cross-compile framework.
262 262
263 If EXTERNAL_TOOLCHAIN is defined, act as MKGCC=no, since 263 If EXTERNAL_TOOLCHAIN is defined, act as MKGCC=no, since
264 the external version of the compiler may not be able to 264 the external version of the compiler may not be able to
265 build the library components of the in-tree compiler. 265 build the library components of the in-tree compiler.
266 266
267 This variable should be used in conjunction with an 267 This variable should be used in conjunction with an
268 appropriate HAVE_GCC or HAVE_LLVM setting to control the 268 appropriate HAVE_GCC or HAVE_LLVM setting to control the
269 compiler flags. 269 compiler flags.
270 270
271 Note: This variable is not yet used in as many places as 271 Note: This variable is not yet used in as many places as
272 it should be. Expect the exact semantics of this 272 it should be. Expect the exact semantics of this
273 variable to change in the short term as parts of the 273 variable to change in the short term as parts of the
274 cross-compile framework continue to be cleaned up. 274 cross-compile framework continue to be cleaned up.
275 275
276 Default: Unset. 276 Default: Unset.
277 277
278 MAKEVERBOSE Level of verbosity of status messages. Supported values: 278 MAKEVERBOSE Level of verbosity of status messages. Supported values:
279 279
280 0 No descriptive messages or commands executed by 280 0 No descriptive messages or commands executed by
281 make(1) are shown. 281 make(1) are shown.
282 282
283 1 Brief messages are shown describing what is being 283 1 Brief messages are shown describing what is being
284 done, but the actual commands executed by make(1) are 284 done, but the actual commands executed by make(1) are
285 not shown. 285 not shown.
286 286
287 2 Descriptive messages are shown as above (prefixed 287 2 Descriptive messages are shown as above (prefixed
288 with a `#'), and ordinary commands performed by 288 with a `#'), and ordinary commands performed by
289 make(1) are shown. 289 make(1) are shown.
290 290
291 3 In addition to the above, all commands performed by 291 3 In addition to the above, all commands performed by
292 make(1) are shown, even if they would ordinarily have 292 make(1) are shown, even if they would ordinarily have
293 been hidden through use of the "@" prefix in the 293 been hidden through use of the "@" prefix in the
294 relevant makefile. 294 relevant makefile.
295 295
296 4 In addition to the above, commands executed by 296 4 In addition to the above, commands executed by
297 make(1) are traced through use of the sh(1) "-x" 297 make(1) are traced through use of the sh(1) "-x"
298 flag. 298 flag.
299 299
300 Default: 2 300 Default: 2
301 301
302 MKCATPAGES Can be set to "yes" or "no". Indicates whether 302 MKCATPAGES Can be set to "yes" or "no". Indicates whether
303 preformatted plaintext manual pages will be created and 303 preformatted plaintext manual pages will be created and
304 installed. 304 installed.
305 305
306 Forced to "no" if MKMAN=no or MKSHARE=no. 306 Forced to "no" if MKMAN=no or MKSHARE=no.
307 307
308 Default: "no" 308 Default: "no"
309 309
310 MKCROSSGDB Can be set to "yes" or "no". Create a cross-gdb as a 310 MKCROSSGDB Can be set to "yes" or "no". Create a cross-gdb as a
311 host tool. 311 host tool.
312 312
313 Default: "no" 313 Default: "no"
314 314
315 MKDEBUG Can be set to "yes" or "no". Indicates whether debug 315 MKDEBUG Can be set to "yes" or "no". Indicates whether debug
316 information should be generated for all userland 316 information should be generated for all userland
317 binaries. The result is collected as an additional 317 binaries. The result is collected as an additional
318 debug.tgz and xdebug.tgz set and installed in 318 debug.tgz and xdebug.tgz set and installed in
319 DESTDIR/usr/libdata/debug. 319 DESTDIR/usr/libdata/debug.
320 320
321 Forced to "no" if NODEBUG is defined, usually in the 321 Forced to "no" if NODEBUG is defined, usually in the
322 Makefile before any make(1) .include directives. 322 Makefile before any make(1) .include directives.
323 323
324 Default: "no" 324 Default: "no"
325 325
326 MKDEBUGKERNEL Can be set to "yes" or "no". Indicates whether debugging 326 MKDEBUGKERNEL Can be set to "yes" or "no". Indicates whether debugging
327 symbols will be built for kernels by default; pretend as 327 symbols will be built for kernels by default; pretend as
328 if makeoptions DEBUG="-g" is specified in kernel 328 if makeoptions DEBUG="-g" is specified in kernel
329 configuration files. This will also put the debug kernel 329 configuration files. This will also put the debug kernel
330 netbsd.gdb in the kernel sets. See options(4) for 330 netbsd.gdb in the kernel sets. See options(4) for
331 details. This is useful if a cross-gdb is built as well 331 details. This is useful if a cross-gdb is built as well
332 (see MKCROSSGDB). 332 (see MKCROSSGDB).
333 333
334 Default: "no" 334 Default: "no"
335 335
336 MKDEBUGLIB Can be set to "yes" or "no". Indicates whether debug 336 MKDEBUGLIB Can be set to "yes" or "no". Indicates whether debug
337 libraries (lib*_g.a) will be built and installed. Debug 337 libraries (lib*_g.a) will be built and installed. Debug
338 libraries are compiled with "-g -DDEBUG". 338 libraries are compiled with "-g -DDEBUG".
339 339
340 Forced to "no" if NODEBUGLIB is defined, usually in the 340 Forced to "no" if NODEBUGLIB is defined, usually in the
341 Makefile before any make(1) .include directives. 341 Makefile before any make(1) .include directives.
342 342
343 Default: "no" 343 Default: "no"
344 344
345 MKDEBUGTOOLS Can be set to "yes" or "no". Indicates whether debug 345 MKDEBUGTOOLS Can be set to "yes" or "no". Indicates whether debug
346 information (lib*_g.a) will be included in the build 346 information (lib*_g.a) will be included in the build
347 toolchain. 347 toolchain.
348 348
349 Default: "no" 349 Default: "no"
350 350
351 MKDOC Can be set to "yes" or "no". Indicates whether system 351 MKDOC Can be set to "yes" or "no". Indicates whether system
352 documentation destined for DESTDIR/usr/share/doc will be 352 documentation destined for DESTDIR/usr/share/doc will be
353 installed. 353 installed.
354 354
355 Forced to "no" if NODOC is defined, usually in the 355 Forced to "no" if NODOC is defined, usually in the
356 Makefile before any make(1) .include directives. 356 Makefile before any make(1) .include directives.
357 357
358 Forced to "no" if MKSHARE=no. 358 Forced to "no" if MKSHARE=no.
359 359
360 Default: "yes" 360 Default: "yes"
361 361
362 MKHOSTOBJ Can be set to "yes" or "no". If set to "yes", then for 362 MKHOSTOBJ Can be set to "yes" or "no". If set to "yes", then for
363 programs intended to be run on the compile host, the 363 programs intended to be run on the compile host, the
364 name, release, and architecture of the host operating 364 name, release, and architecture of the host operating
365 system will be suffixed to the name of the object 365 system will be suffixed to the name of the object
366 directory created by "make obj". (This allows multiple 366 directory created by "make obj". (This allows multiple
367 host systems to compile NetBSD for a single target.) If 367 host systems to compile NetBSD for a single target.) If
368 set to "no", then programs built to be run on the compile 368 set to "no", then programs built to be run on the compile
369 host will use the same object directory names as programs 369 host will use the same object directory names as programs
370 built to be run on the target. 370 built to be run on the target.
371 371
372 Default: "no" 372 Default: "no"
373 373
374 MKHTML Can be set to "yes" or "no". Indicates whether the HTML 374 MKHTML Can be set to "yes" or "no". Indicates whether the HTML
375 manual pages are created and installed. and installed 375 manual pages are created and installed. and installed
376 376
377 Forced to "no" if NOHTML is defined, usually in the 377 Forced to "no" if NOHTML is defined, usually in the
378 Makefile before any make(1) .include directives. 378 Makefile before any make(1) .include directives.
379 379
380 Forced to "no" if MKMAN=no or MKSHARE=no. 380 Forced to "no" if MKMAN=no or MKSHARE=no.
381 381
382 Default: "yes" 382 Default: "yes"
383 383
384 MKINFO Can be set to "yes" or "no". Indicates whether GNU Info 384 MKINFO Can be set to "yes" or "no". Indicates whether GNU Info
385 files, used for the documentation for most of the 385 files, used for the documentation for most of the
386 compilation tools, will be built and installed. 386 compilation tools, will be built and installed.
387 387
388 Forced to "no" if NOINFO is defined, usually in the 388 Forced to "no" if NOINFO is defined, usually in the
389 Makefile before any make(1) .include directives. 389 Makefile before any make(1) .include directives.
390 390
391 Forced to "no" if MKSHARE=no. 391 Forced to "no" if MKSHARE=no.
392 392
393 Default: "yes" 393 Default: "yes"
394 394
395 MKKDEBUG Deprecated, use MKDEBUGKERNEL. 395 MKKDEBUG Deprecated, use MKDEBUGKERNEL.
396 396
397 MKKMOD Can be set to "yes" or "no". Indicates whether kernel 397 MKKMOD Can be set to "yes" or "no". Indicates whether kernel
398 modules are built and installed. 398 modules are built and installed.
399 399
400 Default: "no" on or1k; "yes" on other platforms. 400 Default: "no" on or1k; "yes" on other platforms.
401 401
402 MKLINKLIB Can be set to "yes" or "no". Indicates whether all of 402 MKLINKLIB Can be set to "yes" or "no". Indicates whether all of
403 the shared library infrastructure will be built and 403 the shared library infrastructure will be built and
404 installed. If "no", prevents: installation of the *.a 404 installed. If "no", prevents: installation of the *.a
405 libraries, installation of the *_pic.a libraries on PIC 405 libraries, installation of the *_pic.a libraries on PIC
406 systems, building of *.a libraries on PIC systems, or 406 systems, building of *.a libraries on PIC systems, or
407 installation of .so symlinks on ELF systems. 407 installation of .so symlinks on ELF systems.
408 408
409 Forced to "no" if NOLINKLIB is defined, usually in the 409 Forced to "no" if NOLINKLIB is defined, usually in the
410 Makefile before any make(1) .include directives. 410 Makefile before any make(1) .include directives.
411 411
412 If "no", acts as MKLINT=no MKPICINSTALL=no MKPROFILE=no. 412 If "no", acts as MKLINT=no MKPICINSTALL=no MKPROFILE=no.
413 413
414 Default: "yes" 414 Default: "yes"
415 415
416 MKLINT Can be set to "yes" or "no". Indicates whether lint(1) 416 MKLINT Can be set to "yes" or "no". Indicates whether lint(1)
417 will be run against portions of the NetBSD source code 417 will be run against portions of the NetBSD source code
418 during the build, and whether lint libraries will be 418 during the build, and whether lint libraries will be
419 installed into DESTDIR/usr/libdata/lint. 419 installed into DESTDIR/usr/libdata/lint.
420 420
421 Forced to "no" if NOLINT is defined, usually in the 421 Forced to "no" if NOLINT is defined, usually in the
422 Makefile before any make(1) .include directives. 422 Makefile before any make(1) .include directives.
423 423
424 Forced to "no" if MKLINKLIB=no. 424 Forced to "no" if MKLINKLIB=no.
425 425
426 Default: "no" 426 Default: "no"
427 427
428 MKMAN Can be set to "yes" or "no". Indicates whether manual 428 MKMAN Can be set to "yes" or "no". Indicates whether manual
429 pages will be installed. 429 pages will be installed.
430 430
431 Forced to "no" if NOMAN is defined, usually in the 431 Forced to "no" if NOMAN is defined, usually in the
432 Makefile before any make(1) .include directives. 432 Makefile before any make(1) .include directives.
433 433
434 Forced to "no" if MKSHARE=no. 434 Forced to "no" if MKSHARE=no.
435 435
436 If "no", acts as MKCATPAGES=no MKHTML=no. 436 If "no", acts as MKCATPAGES=no MKHTML=no.
437 437
438 Default: "yes" 438 Default: "yes"
439 439
440 MKNLS Can be set to "yes" or "no". Indicates whether Native 440 MKNLS Can be set to "yes" or "no". Indicates whether Native
441 Language System (NLS) locale zone files will be built and 441 Language System (NLS) locale zone files will be built and
442 installed. 442 installed.
443 443
444 Forced to "no" if NONLS is defined, usually in the 444 Forced to "no" if NONLS is defined, usually in the
445 Makefile before any make(1) .include directives. 445 Makefile before any make(1) .include directives.
446 446
447 Forced to "no" if MKSHARE=no. 447 Forced to "no" if MKSHARE=no.
448 448
449 Default: "yes" 449 Default: "yes"
450 450
451 MKOBJ Can be set to "yes" or "no". Indicates whether object 451 MKOBJ Can be set to "yes" or "no". Indicates whether object
452 directories will be created when running "make obj". If 452 directories will be created when running "make obj". If
453 set to "no", then all built files will be located inside 453 set to "no", then all built files will be located inside
454 the regular source tree. 454 the regular source tree.
455 455
456 Forced to "no" if NOOBJ is defined, usually in the 456 Forced to "no" if NOOBJ is defined, usually in the
457 Makefile before any make(1) .include directives. 457 Makefile before any make(1) .include directives.
458 458
459 If "no", acts as MKOBJDIRS=no. 459 If "no", acts as MKOBJDIRS=no.
460 460
461 Note: Setting MKOBJ to "no" is not recommended and may 461 Note: Setting MKOBJ to "no" is not recommended and may
462 cause problems when updating the tree with cvs(1). 462 cause problems when updating the tree with cvs(1).
463 463
464 Default: "yes" 464 Default: "yes"
465 465
466 MKOBJDIRS Can be set to "yes" or "no". Indicates whether object 466 MKOBJDIRS Can be set to "yes" or "no". Indicates whether object
467 directories will be created automatically (via a "make 467 directories will be created automatically (via a "make
468 obj" pass) at the start of a build. 468 obj" pass) at the start of a build.
469 469
470 Forced to "no" if MKOBJ=no. 470 Forced to "no" if MKOBJ=no.
471 471
472 Default: "no" 472 Default: "no"
473 473
474 MKPIC Can be set to "yes" or "no". Indicates whether shared 474 MKPIC Can be set to "yes" or "no". Indicates whether shared
475 objects and libraries will be created and installed. If 475 objects and libraries will be created and installed. If
476 "no", the entire built system will be statically linked. 476 "no", the entire built system will be statically linked.
477 477
478 Forced to "no" if NOPIC is defined, usually in the 478 Forced to "no" if NOPIC is defined, usually in the
479 Makefile before any make(1) .include directives. 479 Makefile before any make(1) .include directives.
480 480
481 If "no", acts as MKPICLIB=no. 481 If "no", acts as MKPICLIB=no.
482 482
483 Default: "no" on m68000; "yes" on other platforms. 483 Default: "no" on m68000; "yes" on other platforms.
484 484
485 MKPICINSTALL Can be set to "yes" or "no". Indicates whether the ar(1) 485 MKPICINSTALL Can be set to "yes" or "no". Indicates whether the ar(1)
486 format libraries (lib*_pic.a), used to generate shared 486 format libraries (lib*_pic.a), used to generate shared
487 libraries, are installed. 487 libraries, are installed.
488 488
489 Forced to "no" if NOPICINSTALL is defined, usually in the 489 Forced to "no" if NOPICINSTALL is defined, usually in the
490 Makefile before any make(1) .include directives. 490 Makefile before any make(1) .include directives.
491 491
492 Forced to "no" if MKLINKLIB=no. 492 Forced to "no" if MKLINKLIB=no.
493 493
494 Default: "no" 494 Default: "no"
495 495
496 MKPROFILE Can be set to "yes" or "no". Indicates whether profiled 496 MKPROFILE Can be set to "yes" or "no". Indicates whether profiled
497 libraries (lib*_p.a) will be built and installed. 497 libraries (lib*_p.a) will be built and installed.
498 498
499 Forced to "no" if NOPROFILE is defined, usually in the 499 Forced to "no" if NOPROFILE is defined, usually in the
500 Makefile before any make(1) .include directives. 500 Makefile before any make(1) .include directives.
501 501
502 Forced to "no" if MKLINKLIB=no. 502 Forced to "no" if MKLINKLIB=no.
503 503
504 Default: "no" on or1k, riscv32, and riscv64 (due to 504 Default: "no" on or1k, riscv32, and riscv64 (due to
505 toolchain problems with profiled code); "yes" on other 505 toolchain problems with profiled code); "yes" on other
506 platforms. 506 platforms.
507 507
508 MKREPRO Can be set to "yes" or "no". Indicates whether builds 508 MKREPRO Can be set to "yes" or "no". Indicates whether builds
509 are to be reproducible. If "yes", two builds from the 509 are to be reproducible. If "yes", two builds from the
510 same source tree will produce the same build results. 510 same source tree will produce the same build results.
511 511
512 Used as the default for MKARZERO. 512 Used as the default for MKARZERO.
513 513
514 This may be set to "yes" by giving build.sh the -P 514 This may be set to "yes" by giving build.sh the -P
515 option. 515 option.
516 516
517 Default: "no" Can be set to "yes" or "no". 517 Default: "no" Can be set to "yes" or "no".
518 518
519 MKREPRO_TIMESTAMP 519 MKREPRO_TIMESTAMP
520 Unix timestamp. When MKREPRO is set, the timestamp of 520 Unix timestamp. When MKREPRO is set, the timestamp of
521 all files in the sets will be set to this value. 521 all files in the sets will be set to this value.
522 522
523 This may be set automatically to the latest source tree 523 This may be set automatically to the latest source tree
524 timestamp using cvslatest(1) by giving build.sh the -P 524 timestamp using cvslatest(1) by giving build.sh the -P
525 option. 525 option.
526 526
527 Default: Unset. 527 Default: Unset.
528 528
529 MKSHARE Can be set to "yes" or "no". Indicates whether files 529 MKSHARE Can be set to "yes" or "no". Indicates whether files
530 destined to reside in DESTDIR/usr/share will be built and 530 destined to reside in DESTDIR/usr/share will be built and
531 installed. 531 installed.
532 532
533 Forced to "no" if NOSHARE is defined, usually in the 533 Forced to "no" if NOSHARE is defined, usually in the
534 Makefile before any make(1) .include directives. 534 Makefile before any make(1) .include directives.
535 535
536 If "no", acts as MKCATPAGES=no MKDOC=no MKINFO=no 536 If "no", acts as MKCATPAGES=no MKDOC=no MKINFO=no
537 MKHTML=no MKMAN=no MKNLS=no. 537 MKHTML=no MKMAN=no MKNLS=no.
538 538
539 Default: "yes" 539 Default: "yes"
540 540
541 MKSTRIPIDENT Can be set to "yes" or "no". Indicates whether RCS IDs, 541 MKSTRIPIDENT Can be set to "yes" or "no". Indicates whether RCS IDs,
542 for use with ident(1), should be stripped from program 542 for use with ident(1), should be stripped from program
543 binaries and shared libraries. 543 binaries and shared libraries.
544 544
545 Default: "no" 545 Default: "no"
546 546
547 MKSTRIPSYM Can be set to "yes" or "no". Indicates whether all local 547 MKSTRIPSYM Can be set to "yes" or "no". Indicates whether all local
548 symbols should be stripped from shared libraries. If 548 symbols should be stripped from shared libraries. If
549 "yes", strip all local symbols from shared libraries; the 549 "yes", strip all local symbols from shared libraries; the
550 affect is equivalent to the -x option of ld(1). If "no", 550 affect is equivalent to the -x option of ld(1). If "no",
551 strip only temporary local symbols; the affect is 551 strip only temporary local symbols; the affect is
552 equivalent to the -X option of ld(1). Keeping non- 552 equivalent to the -X option of ld(1). Keeping non-
553 temporary local symbols such as static function names is 553 temporary local symbols such as static function names is
554 useful on using DTrace for userland libraries and getting 554 useful on using DTrace for userland libraries and getting
555 a backtrace from a rump kernel loading shared libraries. 555 a backtrace from a rump kernel loading shared libraries.
556 556
557 Default: "yes" 557 Default: "yes"
558 558
559 MKUNPRIVED Can be set to "yes" or "no". Indicates whether an 559 MKUNPRIVED Can be set to "yes" or "no". Indicates whether an
560 unprivileged install will occur. The user, group, 560 unprivileged install will occur. The user, group,
561 permissions, and file flags, will not be set on the 561 permissions, and file flags, will not be set on the
562 installed items; instead the information will be appended 562 installed items; instead the information will be appended
563 to a file called METALOG in DESTDIR. The contents of 563 to a file called METALOG in DESTDIR. The contents of
564 METALOG are used during the generation of the 564 METALOG are used during the generation of the
565 distribution tar files to ensure that the appropriate 565 distribution tar files to ensure that the appropriate
566 file ownership is stored. 566 file ownership is stored.
567 567
568 Default: "no" 568 Default: "no"
569 569
570 MKUPDATE Can be set to "yes" or "no". Indicates whether all 570 MKUPDATE Can be set to "yes" or "no". Indicates whether all
571 install operations intended to write to DESTDIR will 571 install operations intended to write to DESTDIR will
572 compare file timestamps before installing, and skip the 572 compare file timestamps before installing, and skip the
573 install phase if the destination files are up-to-date. 573 install phase if the destination files are up-to-date.
574 574
575 Note: This also has implications on full builds (see next 575 Note: This also has implications on full builds (see next
576 subsection). 576 subsection).
577 577
578 Default: "no" 578 Default: "no"
579 579
580 MKX11 Can be set to "yes" or "no". Indicates whether X11 is 580 MKX11 Can be set to "yes" or "no". Indicates whether X11 is
581 built and installed from X11SRCDIR, and whether the X 581 built and installed from X11SRCDIR, and whether the X
582 sets will be created. 582 sets will be created.
583 583
584 Note: If "yes", requires MKINET6=yes. 584 Note: If "yes", requires MKINET6=yes.
585 585
586 Default: "no" 586 Default: "no"
587 587
588 NETBSDSRCDIR The path to the top level of the NetBSD sources. 588 NETBSDSRCDIR The path to the top level of the NetBSD sources.
589 589
590 Default: Top level of the NetBSD source tree (as 590 Default: Top level of the NetBSD source tree (as
591 determined by the presence of build.sh and tools/) if 591 determined by the presence of build.sh and tools/) if
592 make(1) is run from within that tree; otherwise BSDSRCDIR 592 make(1) is run from within that tree; otherwise BSDSRCDIR
593 will be used. 593 will be used.
594 594
595 TOOLCHAIN_MISSING 595 TOOLCHAIN_MISSING
596 Can be set to "yes" or "no". If not "no", this indicates 596 Can be set to "yes" or "no". If not "no", this indicates
597 that the platform "MACHINE_ARCH" being built does not 597 that the platform "MACHINE_ARCH" being built does not
598 have a working in-tree toolchain. 598 have a working in-tree toolchain.
599 599
600 If not "no", acts as MKBINUTILS=no MKGCC=no MKGDB=no. 600 If not "no", acts as MKBINUTILS=no MKGCC=no MKGDB=no.
601 601
602 Default: "no" 602 Default: "no"
603 603
604 TOOLDIR Directory to hold the host tools, once built. If 604 TOOLDIR Directory to hold the host tools, once built. If
605 specified, must be an absolute path. This directory 605 specified, must be an absolute path. This directory
606 should be unique to a given host system and NetBSD source 606 should be unique to a given host system and NetBSD source
607 tree. (However, multiple targets may share the same 607 tree. (However, multiple targets may share the same
608 TOOLDIR; the target-dependent files have unique names.) 608 TOOLDIR; the target-dependent files have unique names.)
609 If unset, a default based on the uname(1) information of 609 If unset, a default based on the uname(1) information of
610 the host platform will be created in the .OBJDIR of src. 610 the host platform will be created in the .OBJDIR of src.
611 611
612 Default: Unset. 612 Default: Unset.
613 613
614 USETOOLS Can be set to "yes" or "no". Indicates whether the tools 614 USETOOLS Can be set to "yes" or "no". Indicates whether the tools
615 specified by TOOLDIR should be used as part of a build in 615 specified by TOOLDIR should be used as part of a build in
616 progress. Must be set to "yes" if cross-compiling. 616 progress. Must be set to "yes" if cross-compiling.
617 617
618 yes Use the tools from TOOLDIR. 618 yes Use the tools from TOOLDIR.
619 619
620 no Do not use the tools from TOOLDIR, but refuse to 620 no Do not use the tools from TOOLDIR, but refuse to
621 build native compilation tool components that are 621 build native compilation tool components that are
622 version-specific for that tool. 622 version-specific for that tool.
623 623
624 never Do not use the tools from TOOLDIR, even when 624 never Do not use the tools from TOOLDIR, even when
625 building native tool components. This is similar 625 building native tool components. This is similar
626 to the traditional NetBSD build method, but does 626 to the traditional NetBSD build method, but does
627 not verify that the compilation tools in use are 627 not verify that the compilation tools in use are
628 up-to-date enough in order to build the tree 628 up-to-date enough in order to build the tree
629 successfully. This may cause build or runtime 629 successfully. This may cause build or runtime
630 problems when building the whole NetBSD source 630 problems when building the whole NetBSD source
631 tree. 631 tree.
632 632
633 Default: "no" when using <bsd.*.mk> outside the NetBSD 633 Default: "no" when using <bsd.*.mk> outside the NetBSD
634 source tree (detected automatically) or if 634 source tree (detected automatically) or if
635 TOOLCHAIN_MISSING=yes; "yes" otherwise. 635 TOOLCHAIN_MISSING=yes; "yes" otherwise.
636 636
637 X11SRCDIR Directory containing the modular Xorg source. If 637 X11SRCDIR Directory containing the modular Xorg source. If
638 specified, must be an absolute path. The main modular 638 specified, must be an absolute path. The main modular
639 Xorg source is found in X11SRCDIR/external/mit. 639 Xorg source is found in X11SRCDIR/external/mit.
640 640
641 Default: NETBSDSRCDIR/../xsrc, if that exists; otherwise 641 Default: NETBSDSRCDIR/../xsrc, if that exists; otherwise
642 /usr/xsrc. 642 /usr/xsrc.
643 643
644 "make" variables for full builds 644 "make" variables for full builds
645 These variables only affect the top level "Makefile" and do not affect 645 These variables only affect the top level "Makefile" and do not affect
646 manually building subtrees of the NetBSD source code. 646 manually building subtrees of the NetBSD source code.
647 647
648 INSTALLBOOT_BOARDS 648 INSTALLBOOT_BOARDS
649 A list of boards to create bootable images for. If 649 A list of boards to create bootable images for. If
650 corresponding U-Boot packages are installed, bootable 650 corresponding U-Boot packages are installed, bootable
651 images are created as part of a release. See the 651 images are created as part of a release. See the
652 -o board=name option of installboot(8). 652 -o board=name option of installboot(8).
653 653
654 INSTALLWORLDDIR 654 INSTALLWORLDDIR
655 Location for the "make installworld" target to install 655 Location for the "make installworld" target to install
656 to. If specified, must be an absolute path. 656 to. If specified, must be an absolute path.
657 657
658 Default: "/" 658 Default: "/"
659 659
660 MKOBJDIRS Can be set to "yes" or "no". Indicates whether object 660 MKOBJDIRS Can be set to "yes" or "no". Indicates whether object
661 directories will be created automatically (via a "make 661 directories will be created automatically (via a "make
662 obj" pass) at the start of a build. 662 obj" pass) at the start of a build.
663 663
664 Default: "no" 664 Default: "no"
665 665
666 If using build.sh, the default is "yes". This may be set 666 If using build.sh, the default is "yes". This may be set
667 back to "no" by giving build.sh the -o option. 667 back to "no" by giving build.sh the -o option.
668 668
669 MKUPDATE Can be set to "yes" or "no". If set, then in addition to 669 MKUPDATE Can be set to "yes" or "no". If set, then in addition to
670 the effects described for MKUPDATE=yes above, this 670 the effects described for MKUPDATE=yes above, this
671 implies the effects of NOCLEANDIR (i.e., "make cleandir" 671 implies the effects of NOCLEANDIR (i.e., "make cleandir"
672 is avoided). 672 is avoided).
673 673
674 Default: "no" 674 Default: "no"
675 675
676 If using build.sh, this may be set by giving the -u 676 If using build.sh, this may be set by giving the -u
677 option. 677 option.
678 678
679 NBUILDJOBS Now obsolete. Use the make(1) option -j, instead. See 
680 below. 
681 
682 Default: Unset. 
683 
684 NOCLEANDIR If set, avoids the "make cleandir" phase of a full build. 679 NOCLEANDIR If set, avoids the "make cleandir" phase of a full build.
685 This has the effect of allowing only changed files in a 680 This has the effect of allowing only changed files in a
686 source tree to be recompiled. This can speed up builds 681 source tree to be recompiled. This can speed up builds
687 when updating only a few files in the tree. 682 when updating only a few files in the tree.
688 683
689 Default: Unset. 684 Default: Unset.
690 685
691 See also MKUPDATE. 686 See also MKUPDATE.
692 687
693 NODISTRIBDIRS If set, avoids the "make distrib-dirs" phase of a full 688 NODISTRIBDIRS If set, avoids the "make distrib-dirs" phase of a full
694 build. This skips running mtree(8) on DESTDIR, useful on 689 build. This skips running mtree(8) on DESTDIR, useful on
695 systems where building as an unprivileged user, or where 690 systems where building as an unprivileged user, or where
696 it is known that the system-wide mtree files have not 691 it is known that the system-wide mtree files have not
697 changed. 692 changed.
698 693
699 Default: Unset. 694 Default: Unset.
700 695
701 NOINCLUDES If set, avoids the "make includes" phase of a full build. 696 NOINCLUDES If set, avoids the "make includes" phase of a full build.
702 This has the effect of preventing make(1) from thinking 697 This has the effect of preventing make(1) from thinking
703 that some programs are out-of-date simply because the 698 that some programs are out-of-date simply because the
704 system include files have changed. However, this option 699 system include files have changed. However, this option
705 should not be used when updating the entire NetBSD source 700 should not be used when updating the entire NetBSD source
706 tree arbitrarily; it is suggested to use MKUPDATE=yes 701 tree arbitrarily; it is suggested to use MKUPDATE=yes
707 instead in that case. 702 instead in that case.
708 703
709 Default: Unset. 704 Default: Unset.
710 705
711 RELEASEDIR If set, specifies the directory to which a release(7) 706 RELEASEDIR If set, specifies the directory to which a release(7)
712 layout will be written at the end of a "make release". 707 layout will be written at the end of a "make release".
713 If specified, must be an absolute path. 708 If specified, must be an absolute path.
714 709
715 Note: build.sh will provide a default of releasedir (in 710 Note: build.sh will provide a default of releasedir (in
716 the top-level .OBJDIR) unless run in `expert' mode. 711 the top-level .OBJDIR) unless run in `expert' mode.
717 712
718 Default: Unset. 713 Default: Unset.
719 714
720BUILDING 715BUILDING
721 "make" command line options 716 "make" command line options
722 This is not a summary of all the options available to make(1); only the 717 This is not a summary of all the options available to make(1); only the
723 options used most frequently with NetBSD builds are listed here. 718 options used most frequently with NetBSD builds are listed here.
724 719
725 -j njob Run up to njob make(1) subjobs in parallel. Makefiles should 720 -j njob Run up to njob make(1) subjobs in parallel. Makefiles should
726 use .WAIT or have explicit dependencies as necessary to 721 use .WAIT or have explicit dependencies as necessary to
727 enforce build ordering. 722 enforce build ordering.
728 723
729 -m dir Specify the default directory for searching for system 724 -m dir Specify the default directory for searching for system
730 Makefile segments, mainly the <bsd.*.mk> files. When building 725 Makefile segments, mainly the <bsd.*.mk> files. When building
731 any full NetBSD source tree, this should be set to the 726 any full NetBSD source tree, this should be set to the
732 "share/mk" directory in the source tree. This is set 727 "share/mk" directory in the source tree. This is set
733 automatically when building from the top level, or when using 728 automatically when building from the top level, or when using
734 build.sh. 729 build.sh.
735 730
736 -n Show the commands that would have been executed, but do not 731 -n Show the commands that would have been executed, but do not
737 actually execute them. This will still cause recursion to 732 actually execute them. This will still cause recursion to
738 take place. 733 take place.
739 734
740 -V var Show make(1)'s idea of the value of var. Does not build any 735 -V var Show make(1)'s idea of the value of var. Does not build any
741 targets. 736 targets.
742 737
743 var=value Set the variable var to value, overriding any setting 738 var=value Set the variable var to value, overriding any setting
744 specified by the process environment, the MAKECONF 739 specified by the process environment, the MAKECONF
745 configuration file, or the system Makefile segments. 740 configuration file, or the system Makefile segments.
746 741
747 "make" targets 742 "make" targets
748 These default targets may be built by running make(1) in any subtree of 743 These default targets may be built by running make(1) in any subtree of
749 the NetBSD source code. It is recommended that none of these be used 744 the NetBSD source code. It is recommended that none of these be used
750 from the top level Makefile; as a specific exception, "make obj" and 745 from the top level Makefile; as a specific exception, "make obj" and
751 "make cleandir" are useful in that context. 746 "make cleandir" are useful in that context.
752 747
753 all Build programs, libraries, and preformatted documentation. 748 all Build programs, libraries, and preformatted documentation.
754 749
755 clean Remove program and library object code files. 750 clean Remove program and library object code files.
756 751
757 cleandir Same as clean, but also remove preformatted documentation, 752 cleandir Same as clean, but also remove preformatted documentation,
758 dependency files generated by "make depend", and any other 753 dependency files generated by "make depend", and any other
759 files known to be created at build time. 754 files known to be created at build time.
760 755
761 depend Create dependency files (.depend) containing more detailed 756 depend Create dependency files (.depend) containing more detailed
762 information about the dependencies of source code on header 757 information about the dependencies of source code on header
763 files. Allows programs to be recompiled automatically when a 758 files. Allows programs to be recompiled automatically when a
764 dependency changes. 759 dependency changes.
765 760
766 dependall Does a "make depend" immediately followed by a "make all". 761 dependall Does a "make depend" immediately followed by a "make all".
767 This improves cache locality of the build since both passes 762 This improves cache locality of the build since both passes
768 read the source files in their entirety. 763 read the source files in their entirety.
769 764
770 distclean Synonym for cleandir. 765 distclean Synonym for cleandir.
771 766
772 includes Build and install system header files. Typically needed 767 includes Build and install system header files. Typically needed
773 before any system libraries or programs can be built. 768 before any system libraries or programs can be built.
774 769
775 install Install programs, libraries, and documentation into DESTDIR. 770 install Install programs, libraries, and documentation into DESTDIR.
776 Few files will be installed to DESTDIR/dev, DESTDIR/etc, 771 Few files will be installed to DESTDIR/dev, DESTDIR/etc,
777 DESTDIR/root or DESTDIR/var in order to prevent user supplied 772 DESTDIR/root or DESTDIR/var in order to prevent user supplied
778 configuration data from being overwritten. 773 configuration data from being overwritten.
779 774
780 lint Run lint(1) against the C source code, where appropriate, and 775 lint Run lint(1) against the C source code, where appropriate, and
781 generate system-installed lint libraries. 776 generate system-installed lint libraries.
782 777
783 obj Create object directories to be used for built files, instead 778 obj Create object directories to be used for built files, instead
784 of building directly in the source tree. 779 of building directly in the source tree.
785 780
786 tags Create ctags(1) searchable function lists usable by the ex(1) 781 tags Create ctags(1) searchable function lists usable by the ex(1)
787 and vi(1) text editors. 782 and vi(1) text editors.
788 783
789 "make" targets for the top level 784 "make" targets for the top level
790 Additional make(1) targets are usable specifically from the top source 785 Additional make(1) targets are usable specifically from the top source
791 level to facilitate building the entire NetBSD source tree. 786 level to facilitate building the entire NetBSD source tree.
792 787
793 build Build the entire NetBSD system (except the kernel). This 788 build Build the entire NetBSD system (except the kernel). This
794 orders portions of the source tree such that prerequisites 789 orders portions of the source tree such that prerequisites
795 will be built in the proper order. 790 will be built in the proper order.
796 791
797 distribution Do a "make build", and then install a full distribution 792 distribution Do a "make build", and then install a full distribution
798 (which does not include a kernel) into DESTDIR, including 793 (which does not include a kernel) into DESTDIR, including
799 files in DESTDIR/dev, DESTDIR/etc, DESTDIR/root and 794 files in DESTDIR/dev, DESTDIR/etc, DESTDIR/root and
800 DESTDIR/var. 795 DESTDIR/var.
801 796
802 buildworld As per "make distribution", except that it ensures that 797 buildworld As per "make distribution", except that it ensures that
803 DESTDIR is not the root directory. 798 DESTDIR is not the root directory.
804 799
805 installworld Install the distribution from DESTDIR to INSTALLWORLDDIR, 800 installworld Install the distribution from DESTDIR to INSTALLWORLDDIR,
806 which defaults to the root directory. Ensures that 801 which defaults to the root directory. Ensures that
807 INSTALLWORLDDIR is not the root directory if cross 802 INSTALLWORLDDIR is not the root directory if cross
808 compiling. 803 compiling.
809 804
810 The INSTALLSETS environment variable may be set to a space- 805 The INSTALLSETS environment variable may be set to a space-
811 separated list of distribution sets to be installed. By 806 separated list of distribution sets to be installed. By
812 default, all sets except "etc" and "xetc" are installed, so 807 default, all sets except "etc" and "xetc" are installed, so
813 most files in INSTALLWORLDDIR/etc will not be installed or 808 most files in INSTALLWORLDDIR/etc will not be installed or
814 modified. 809 modified.
815 810
816 Note: Before performing this operation with 811 Note: Before performing this operation with
817 INSTALLWORLDDIR=/, it is highly recommended that you 812 INSTALLWORLDDIR=/, it is highly recommended that you
818 upgrade your kernel and reboot. After performing this 813 upgrade your kernel and reboot. After performing this
819 operation, it is recommended that you use etcupdate(8) to 814 operation, it is recommended that you use etcupdate(8) to
820 update files in INSTALLWORLDDIR/etc, and postinstall(8) to 815 update files in INSTALLWORLDDIR/etc, and postinstall(8) to
821 check for or fix inconsistencies. 816 check for or fix inconsistencies.
822 817
823 sets Create distribution sets from DESTDIR into 818 sets Create distribution sets from DESTDIR into
824 RELEASEDIR/RELEASEMACHINEDIR/binary/sets. Should be run 819 RELEASEDIR/RELEASEMACHINEDIR/binary/sets. Should be run
825 after "make distribution", as "make build" alone does not 820 after "make distribution", as "make build" alone does not
826 install all of the required files. 821 install all of the required files.
827 822
828 sourcesets Create source sets of the source tree into 823 sourcesets Create source sets of the source tree into
829 RELEASEDIR/source/sets. 824 RELEASEDIR/source/sets.
830 825
831 syspkgs Create syspkgs from DESTDIR into 826 syspkgs Create syspkgs from DESTDIR into
832 RELEASEDIR/RELEASEMACHINEDIR/binary/syspkgs. Should be run 827 RELEASEDIR/RELEASEMACHINEDIR/binary/syspkgs. Should be run
833 after "make distribution", as "make build" alone does not 828 after "make distribution", as "make build" alone does not
834 install all of the required files. 829 install all of the required files.
835 830
836 release Do a "make distribution", build kernels, distribution 831 release Do a "make distribution", build kernels, distribution
837 media, and install sets (this as per "make sets"), and then 832 media, and install sets (this as per "make sets"), and then
838 package the system into a standard release layout as 833 package the system into a standard release layout as
839 described by release(7). This requires that RELEASEDIR be 834 described by release(7). This requires that RELEASEDIR be
840 set (see above). 835 set (see above).
841 836
842 iso-image Create a NetBSD installation CD-ROM image in the 837 iso-image Create a NetBSD installation CD-ROM image in the
843 RELEASEDIR/images directory. The CD-ROM file system will 838 RELEASEDIR/images directory. The CD-ROM file system will
844 have a layout as described in release(7). 839 have a layout as described in release(7).
845 840
846 For most machine types, the CD-ROM will be bootable, and 841 For most machine types, the CD-ROM will be bootable, and
847 will automatically run the sysinst(8) menu-based 842 will automatically run the sysinst(8) menu-based
848 installation program, which can be used to install or 843 installation program, which can be used to install or
849 upgrade a NetBSD system. Bootable CD-ROMs also contain 844 upgrade a NetBSD system. Bootable CD-ROMs also contain
850 tools that may be useful in repairing a damaged NetBSD 845 tools that may be useful in repairing a damaged NetBSD
851 installation. 846 installation.
852 847
853 Before "make iso-image" is attempted, RELEASEDIR must be 848 Before "make iso-image" is attempted, RELEASEDIR must be
854 populated by "make release" or equivalent. 849 populated by "make release" or equivalent.
855 850
856 Note: Other, smaller, CD-ROM images may be created in the 851 Note: Other, smaller, CD-ROM images may be created in the
857 RELEASEDIR/RELEASEMACHINEDIR/installation/cdrom directory 852 RELEASEDIR/RELEASEMACHINEDIR/installation/cdrom directory
858 by "make release". These smaller images usually contain 853 by "make release". These smaller images usually contain
859 the same tools as the larger images in RELEASEDIR/images, 854 the same tools as the larger images in RELEASEDIR/images,
860 but do not contain additional content such as the 855 but do not contain additional content such as the
861 distribution sets. 856 distribution sets.
862 857
863 Note: The mac68k port still uses an older method of 858 Note: The mac68k port still uses an older method of
864 creating CD-ROM images. This requires the mkisofs(1) 859 creating CD-ROM images. This requires the mkisofs(1)
865 utility, which is not part of NetBSD, but which can be 860 utility, which is not part of NetBSD, but which can be
866 installed from pkgsrc/sysutils/cdrtools. 861 installed from pkgsrc/sysutils/cdrtools.
867 862
868 iso-image-source 863 iso-image-source
869 Create a NetBSD installation CD-ROM image in the 864 Create a NetBSD installation CD-ROM image in the
870 RELEASEDIR/images directory. The CD-ROM file system will 865 RELEASEDIR/images directory. The CD-ROM file system will
871 have a layout as described in release(7). It will have top 866 have a layout as described in release(7). It will have top
872 level directories for the machine type and source. 867 level directories for the machine type and source.
873 868
874 For most machine types, the CD-ROM will be bootable, and 869 For most machine types, the CD-ROM will be bootable, and
875 will automatically run the sysinst(8) menu-based 870 will automatically run the sysinst(8) menu-based
876 installation program, which can be used to install or 871 installation program, which can be used to install or
877 upgrade a NetBSD system. Bootable CD-ROMs also contain 872 upgrade a NetBSD system. Bootable CD-ROMs also contain
878 tools that may be useful in repairing a damaged NetBSD 873 tools that may be useful in repairing a damaged NetBSD
879 installation. 874 installation.
880 875
881 Before "make iso-image-source" is attempted, RELEASEDIR 876 Before "make iso-image-source" is attempted, RELEASEDIR
882 must be populated by "make sourcesets release" or 877 must be populated by "make sourcesets release" or
883 equivalent. 878 equivalent.
884 879
885 Note: Other, smaller, CD-ROM images may be created in the 880 Note: Other, smaller, CD-ROM images may be created in the
886 RELEASEDIR/RELEASEMACHINEDIR/installation/cdrom directory 881 RELEASEDIR/RELEASEMACHINEDIR/installation/cdrom directory
887 by "make release". These smaller images usually contain 882 by "make release". These smaller images usually contain
888 the same tools as the larger images in RELEASEDIR/images, 883 the same tools as the larger images in RELEASEDIR/images,
889 but do not contain additional content such as the 884 but do not contain additional content such as the
890 distribution sets. 885 distribution sets.
891 886
892 Note: The mac68k port still uses an older method of 887 Note: The mac68k port still uses an older method of
893 creating CD-ROM images. This requires the mkisofs(1) 888 creating CD-ROM images. This requires the mkisofs(1)
894 utility, which is not part of NetBSD, but which can be 889 utility, which is not part of NetBSD, but which can be
895 installed from pkgsrc/sysutils/cdrtools. 890 installed from pkgsrc/sysutils/cdrtools.
896 891
897 install-image 892 install-image
898 Create a bootable NetBSD installation disk image in the 893 Create a bootable NetBSD installation disk image in the
899 RELEASEDIR/images directory. The installation disk image 894 RELEASEDIR/images directory. The installation disk image
900 is suitable for copying to bootable USB flash memory 895 is suitable for copying to bootable USB flash memory
901 sticks, etc., for machines which are able to boot from such 896 sticks, etc., for machines which are able to boot from such
902 devices. The file system in the bootable disk image will 897 devices. The file system in the bootable disk image will
903 have a layout as described in release(7). 898 have a layout as described in release(7).
904 899
905 The installation image is bootable, and will automatically 900 The installation image is bootable, and will automatically
906 run the sysinst(8) menu-based installation program, which 901 run the sysinst(8) menu-based installation program, which
907 can be used to install or upgrade a NetBSD system. The 902 can be used to install or upgrade a NetBSD system. The
908 image also contains tools that may be useful in repairing a 903 image also contains tools that may be useful in repairing a
909 damaged NetBSD installation. 904 damaged NetBSD installation.
910 905
911 Before "make install-image" is attempted, RELEASEDIR must 906 Before "make install-image" is attempted, RELEASEDIR must
912 be populated by "make release" or equivalent. The build 907 be populated by "make release" or equivalent. The build
913 must have been performed with MKUNPRIVED=yes because "make 908 must have been performed with MKUNPRIVED=yes because "make
914 install-image" relies on information in DESTDIR/METALOG. 909 install-image" relies on information in DESTDIR/METALOG.
915 910
916 live-image Create NetBSD live images in the RELEASEDIR/images 911 live-image Create NetBSD live images in the RELEASEDIR/images
917 directory. The live image contains all necessary files to 912 directory. The live image contains all necessary files to
918 boot NetBSD up to multi-user mode, including all files 913 boot NetBSD up to multi-user mode, including all files
919 which should be extracted during installation, NetBSD 914 which should be extracted during installation, NetBSD
920 disklabel, bootloaders, etc. 915 disklabel, bootloaders, etc.
921 916
922 The live image is suitable for use as a disk image in 917 The live image is suitable for use as a disk image in
923 virtual machine environments such as QEMU, and also useful 918 virtual machine environments such as QEMU, and also useful
924 to boot NetBSD from a USB flash memory stick on a real 919 to boot NetBSD from a USB flash memory stick on a real
925 machine, without the need for installation. 920 machine, without the need for installation.
926 921
927 Before "make live-image" is attempted, RELEASEDIR must be 922 Before "make live-image" is attempted, RELEASEDIR must be
928 populated by "make release" or equivalent. The build must 923 populated by "make release" or equivalent. The build must
929 have been performed with MKUNPRIVED=yes because "make 924 have been performed with MKUNPRIVED=yes because "make
930 install-image" relies on information in DESTDIR/METALOG. 925 install-image" relies on information in DESTDIR/METALOG.
931 926
932 regression-tests 927 regression-tests
933 Can only be run after building the regression tests in the 928 Can only be run after building the regression tests in the
934 directory "regress". Runs those compiled regression tests 929 directory "regress". Runs those compiled regression tests
935 on the local host. 930 on the local host.
936 931
937 Note: Most tests are now managed instead using atf(7); this 932 Note: Most tests are now managed instead using atf(7); this
938 target should probably run those as well but currently does 933 target should probably run those as well but currently does
939 not. 934 not.
940 935
941 The "build.sh" script 936 The "build.sh" script
942 This script file is a shell script designed to build the entire NetBSD 937 This script file is a shell script designed to build the entire NetBSD
943 system on any host with a suitable modern shell and some common 938 system on any host with a suitable modern shell and some common
944 utilities. The required shell features are described under the HOST_SH 939 utilities. The required shell features are described under the HOST_SH
945 variable. 940 variable.
946 941
947 If a host system's default shell does support the required features, then 942 If a host system's default shell does support the required features, then
948 we suggest that you explicitly specify a suitable shell using a command 943 we suggest that you explicitly specify a suitable shell using a command
949 like 944 like
950 945
951 /path/to/suitable/shell build.sh [options] 946 /path/to/suitable/shell build.sh [options]
952 947
953 The above command will usually enable build.sh to automatically set 948 The above command will usually enable build.sh to automatically set
954 HOST_SH=/path/to/suitable/shell, but if that fails, then the following 949 HOST_SH=/path/to/suitable/shell, but if that fails, then the following
955 set of commands may be used instead: 950 set of commands may be used instead:
956 951
957 HOST_SH=/path/to/suitable/shell 952 HOST_SH=/path/to/suitable/shell
958 export HOST_SH 953 export HOST_SH
959 ${HOST_SH} build.sh [options] 954 ${HOST_SH} build.sh [options]
960 955
961 If build.sh detects that it is being executed under an unsuitable shell, 956 If build.sh detects that it is being executed under an unsuitable shell,
962 it attempts to exec a suitable shell instead, or shows an error message. 957 it attempts to exec a suitable shell instead, or shows an error message.
963 If HOST_SH is not set explicitly, then build.sh sets a default using 958 If HOST_SH is not set explicitly, then build.sh sets a default using
964 heuristics dependent on the host platform, or from the shell under which 959 heuristics dependent on the host platform, or from the shell under which
965 build.sh is executed (if that can be determined), or using the first copy 960 build.sh is executed (if that can be determined), or using the first copy
966 of sh found in PATH. 961 of sh found in PATH.
967 962
968 All cross-compile builds, and most native builds, of the entire system 963 All cross-compile builds, and most native builds, of the entire system
969 should make use of build.sh rather than just running "make". This way, 964 should make use of build.sh rather than just running "make". This way,
970 the make(1) program will be bootstrapped properly, in case the host 965 the make(1) program will be bootstrapped properly, in case the host
971 system has an older or incompatible "make" program. 966 system has an older or incompatible "make" program.
972 967
973 When compiling the entire system via build.sh, many make(1) variables are 968 When compiling the entire system via build.sh, many make(1) variables are
974 set for you in order to help encapsulate the build process. In the list 969 set for you in order to help encapsulate the build process. In the list
975 of options below, variables that are automatically set by build.sh are 970 of options below, variables that are automatically set by build.sh are
976 noted where applicable. 971 noted where applicable.
977 972
978 The following operations are supported by build.sh: 973 The following operations are supported by build.sh:
979 974
980 build Build the system as per "make build". Before the main part 975 build Build the system as per "make build". Before the main part
981 of the build commences, this command runs the obj operation 976 of the build commences, this command runs the obj operation
982 (unless the -o option is given), "make cleandir" (unless 977 (unless the -o option is given), "make cleandir" (unless
983 the -u option is given), and the tools operation. 978 the -u option is given), and the tools operation.
984 979
985 distribution Build a full distribution as per "make distribution". This 980 distribution Build a full distribution as per "make distribution". This
986 command first runs the build operation. 981 command first runs the build operation.
987 982
988 release Build a full release as per "make release". This command 983 release Build a full release as per "make release". This command
989 first runs the distribution operation. 984 first runs the distribution operation.
990 985
991 help Show a help message, and exit. 986 help Show a help message, and exit.
992 987
993 makewrapper Create the nbmake-MACHINE wrapper. This operation is 988 makewrapper Create the nbmake-MACHINE wrapper. This operation is
994 automatically performed for any of the other operations. 989 automatically performed for any of the other operations.
995 990
996 cleandir Perform "make cleandir". 991 cleandir Perform "make cleandir".
997 992
998 obj Perform "make obj". 993 obj Perform "make obj".
999 994
1000 tools Build and install the host tools from src/tools. This 995 tools Build and install the host tools from src/tools. This
1001 command will first run "make obj" and "make cleandir" in 996 command will first run "make obj" and "make cleandir" in
1002 the tools subdirectory unless the -o or -u options 997 the tools subdirectory unless the -o or -u options
1003 (respectively) are given. 998 (respectively) are given.
1004 999
1005 install=idir Install the contents of DESTDIR to idir, using "make 1000 install=idir Install the contents of DESTDIR to idir, using "make
1006 installworld". 1001 installworld".
1007 1002
1008 Note: Files that are part of the "etc" or "xetc" sets will 1003 Note: Files that are part of the "etc" or "xetc" sets will
1009 not be installed, unless overridden by the INSTALLSETS 1004 not be installed, unless overridden by the INSTALLSETS
1010 environment variable. 1005 environment variable.
1011 1006
1012 kernel=kconf Build a new kernel. The kconf argument is the name of a 1007 kernel=kconf Build a new kernel. The kconf argument is the name of a
1013 configuration file suitable for use by config(1). If kconf 1008 configuration file suitable for use by config(1). If kconf
1014 does not contain any `/' characters, the configuration file 1009 does not contain any `/' characters, the configuration file
1015 is expected to be found in the KERNCONFDIR directory, which 1010 is expected to be found in the KERNCONFDIR directory, which
1016 is typically sys/arch/MACHINE/conf. The new kernel will be 1011 is typically sys/arch/MACHINE/conf. The new kernel will be
1017 built in a subdirectory of KERNOBJDIR, which is typically 1012 built in a subdirectory of KERNOBJDIR, which is typically
1018 sys/arch/MACHINE/compile or an associated object directory. 1013 sys/arch/MACHINE/compile or an associated object directory.
1019 1014
1020 This command does not imply the tools command; run the 1015 This command does not imply the tools command; run the
1021 tools command first unless it is certain that the tools 1016 tools command first unless it is certain that the tools
1022 already exist and are up to date. 1017 already exist and are up to date.
1023 1018
1024 This command will run "make cleandir" on the kernel in 1019 This command will run "make cleandir" on the kernel in
1025 question first unless the -u option is given. 1020 question first unless the -u option is given.
1026 1021
1027 kernel.gdb=kconf 1022 kernel.gdb=kconf
1028 Build a new kernel with debug information. Similar to the 1023 Build a new kernel with debug information. Similar to the
1029 above kernel=kconf operation, but creates a netbsd.gdb file 1024 above kernel=kconf operation, but creates a netbsd.gdb file
1030 alongside of the kernel netbsd, which contains a full 1025 alongside of the kernel netbsd, which contains a full
1031 symbol table and can be used for debugging (for example 1026 symbol table and can be used for debugging (for example
1032 with a cross-gdb built by MKCROSSGDB). 1027 with a cross-gdb built by MKCROSSGDB).
1033 1028
1034 kernels This command will build all kernels defined in port 1029 kernels This command will build all kernels defined in port
1035 specific release build procedure. 1030 specific release build procedure.
1036 1031
1037 This command internally calls the kernel=kconf operation 1032 This command internally calls the kernel=kconf operation
1038 for each found kernel configuration file. 1033 for each found kernel configuration file.
1039 1034
1040 modules This command will build kernel modules and install them 1035 modules This command will build kernel modules and install them
1041 into DESTDIR. 1036 into DESTDIR.
1042 1037
1043 releasekernel=kconf 1038 releasekernel=kconf
1044 Install a gzip(1)ed copy of the kernel previously built by 1039 Install a gzip(1)ed copy of the kernel previously built by
1045 kernel=kconf into 1040 kernel=kconf into
1046 RELEASEDIR/RELEASEMACHINEDIR/binary/kernel, usually as 1041 RELEASEDIR/RELEASEMACHINEDIR/binary/kernel, usually as
1047 netbsd-kconf.gz, although the "netbsd" prefix is determined 1042 netbsd-kconf.gz, although the "netbsd" prefix is determined
1048 from the "config" directives in kconf. 1043 from the "config" directives in kconf.
1049 1044
1050 sets Perform "make sets". 1045 sets Perform "make sets".
1051 1046
1052 sourcesets Perform "make sourcesets". 1047 sourcesets Perform "make sourcesets".
1053 1048
1054 syspkgs Perform "make syspkgs". 1049 syspkgs Perform "make syspkgs".
1055 1050
1056 iso-image Perform "make iso-image". 1051 iso-image Perform "make iso-image".
1057 1052
1058 iso-image-source 1053 iso-image-source
1059 Perform "make iso-image-source". 1054 Perform "make iso-image-source".
1060 1055
1061 install-image 1056 install-image
1062 Perform "make install-image". 1057 Perform "make install-image".
1063 1058
1064 live-image Perform "make live-image". 1059 live-image Perform "make live-image".
1065 1060
1066 list-arch Show a list of valid MACHINE and MACHINE_ARCH settings, the 1061 list-arch Show a list of valid MACHINE and MACHINE_ARCH settings, the
1067 default MACHINE_ARCH for each MACHINE, and aliases for 1062 default MACHINE_ARCH for each MACHINE, and aliases for
1068 MACHINE/MACHINE_ARCH pairs, and then exits. The -m or -a 1063 MACHINE/MACHINE_ARCH pairs, and then exits. The -m or -a
1069 options (or both) may be used to specify glob patterns that 1064 options (or both) may be used to specify glob patterns that
1070 will be used to narrow the list of results; for example, 1065 will be used to narrow the list of results; for example,
1071 "build.sh -m 'evb*' -a '*arm*' list-arch" will list all 1066 "build.sh -m 'evb*' -a '*arm*' list-arch" will list all
1072 known MACHINE/MACHINE_ARCH values in which either MACHINE 1067 known MACHINE/MACHINE_ARCH values in which either MACHINE
1073 or ALIAS matches the pattern `evb*', and MACHINE_ARCH 1068 or ALIAS matches the pattern `evb*', and MACHINE_ARCH
1074 matches the pattern `*arm*'. 1069 matches the pattern `*arm*'.
1075 1070
1076 The following command line options alter the behaviour of the build.sh 1071 The following command line options alter the behaviour of the build.sh
1077 operations described above: 1072 operations described above:
1078 1073
1079 -a arch Set the value of MACHINE_ARCH to arch. See the -m option for 1074 -a arch Set the value of MACHINE_ARCH to arch. See the -m option for
1080 more information. 1075 more information.
1081 1076
1082 -B buildid 1077 -B buildid
1083 Set the value of BUILDID to buildid. This will also append the 1078 Set the value of BUILDID to buildid. This will also append the
1084 build identifier to the name of the "make" wrapper script so 1079 build identifier to the name of the "make" wrapper script so
1085 that the resulting name is of the form 1080 that the resulting name is of the form
1086 "nbmake-MACHINE-BUILDID". 1081 "nbmake-MACHINE-BUILDID".
1087 1082
1088 -C cdextras 1083 -C cdextras
1089 Append cdextras to the CDEXTRA variable, which is a space- 1084 Append cdextras to the CDEXTRA variable, which is a space-
1090 separated list of files or directories that will be added to 1085 separated list of files or directories that will be added to
1091 the CD-ROM image that may be create by the "iso-image" or 1086 the CD-ROM image that may be create by the "iso-image" or
1092 "iso-image-source" operations. Files will be added to the root 1087 "iso-image-source" operations. Files will be added to the root
1093 of the CD-ROM image, whereas directories will be copied 1088 of the CD-ROM image, whereas directories will be copied
1094 recursively. If relative paths are specified, they will be 1089 recursively. If relative paths are specified, they will be
1095 converted to absolute paths before being used. Multiple paths 1090 converted to absolute paths before being used. Multiple paths
1096 may be specified via multiple -C options, or via a single 1091 may be specified via multiple -C options, or via a single
1097 option whose argument contains multiple space-separated paths. 1092 option whose argument contains multiple space-separated paths.
1098 1093
1099 -c compiler 1094 -c compiler
1100 Select the compiler for the toolchain to build NetBSD and for 1095 Select the compiler for the toolchain to build NetBSD and for
1101 inclusion in the NetBSD distribution. Supported choices: 1096 inclusion in the NetBSD distribution. Supported choices:
1102 1097
1103 clang 1098 clang
1104 1099
1105 gcc [default] 1100 gcc [default]
1106 1101
1107 The compiler used to build the toolchain can be different; see 1102 The compiler used to build the toolchain can be different; see
1108 HOST_CC and HOST_CXX. 1103 HOST_CC and HOST_CXX.
1109 1104
1110 -D dest Set the value of DESTDIR to dest. If a relative path is 1105 -D dest Set the value of DESTDIR to dest. If a relative path is
1111 specified, it will be converted to an absolute path before 1106 specified, it will be converted to an absolute path before
1112 being used. 1107 being used.
1113 1108
1114 -E Set `expert' mode. This overrides various sanity checks, and 1109 -E Set `expert' mode. This overrides various sanity checks, and
1115 allows: DESTDIR does not have to be set to a non-root path for 1110 allows: DESTDIR does not have to be set to a non-root path for
1116 builds, and MKUNPRIVED=yes does not have to be set when 1111 builds, and MKUNPRIVED=yes does not have to be set when
1117 building as a non-root user. 1112 building as a non-root user.
1118 1113
1119 Note: It is highly recommended that you know what you are doing 1114 Note: It is highly recommended that you know what you are doing
1120 when you use this option. 1115 when you use this option.
1121 1116
1122 -h Show a help message, and exit. 1117 -h Show a help message, and exit.
1123 1118
1124 -j njob Run up to njob make(1) subjobs in parallel; passed through to 1119 -j njob Run up to njob make(1) subjobs in parallel; passed through to
1125 make(1). If you see failures for reasons other than running 1120 make(1). If you see failures for reasons other than running
1126 out of memory while using build.sh with -j, please save 1121 out of memory while using build.sh with -j, please save
1127 complete build logs so the failures can be analyzed. 1122 complete build logs so the failures can be analyzed.
1128 1123
1129 To achieve the fastest builds, -j values between (1 + the 1124 To achieve the fastest builds, -j values between (1 + the
1130 number of CPUs) and (2 * the number of CPUs) are recommended. 1125 number of CPUs) and (2 * the number of CPUs) are recommended.
1131 Use lower values on machines with limited memory or I/O 1126 Use lower values on machines with limited memory or I/O
1132 bandwidth. 1127 bandwidth.
1133 1128
1134 -M obj Set MAKEOBJDIRPREFIX to obj. Unsets MAKEOBJDIR. See "-O obj" 1129 -M obj Set MAKEOBJDIRPREFIX to obj. Unsets MAKEOBJDIR. See "-O obj"
1135 for more information. 1130 for more information.
1136 1131
1137 For instance, if the source directory is /usr/src, a setting of 1132 For instance, if the source directory is /usr/src, a setting of
1138 "-M /usr/obj" will place build-time files under 1133 "-M /usr/obj" will place build-time files under
1139 /usr/obj/usr/src/bin, /usr/obj/usr/src/lib, 1134 /usr/obj/usr/src/bin, /usr/obj/usr/src/lib,
1140 /usr/obj/usr/src/usr.bin, and so forth. 1135 /usr/obj/usr/src/usr.bin, and so forth.
1141 1136
1142 If a relative path is specified, it will be converted to an 1137 If a relative path is specified, it will be converted to an
1143 absolute path before being used. build.sh imposes the 1138 absolute path before being used. build.sh imposes the
1144 restriction that the argument to the -M option must not begin 1139 restriction that the argument to the -M option must not begin
1145 with a "$" (dollar sign) character; otherwise it would be too 1140 with a "$" (dollar sign) character; otherwise it would be too
1146 difficult to determine whether the value is an absolute or a 1141 difficult to determine whether the value is an absolute or a
1147 relative path. If the directory does not already exist, 1142 relative path. If the directory does not already exist,
1148 build.sh will create it. 1143 build.sh will create it.
1149 1144
1150 -m mach Set the value of MACHINE to mach, unless the mach argument is 1145 -m mach Set the value of MACHINE to mach, unless the mach argument is
1151 an alias that refers to a MACHINE/MACHINE_ARCH pair, in which 1146 an alias that refers to a MACHINE/MACHINE_ARCH pair, in which
1152 case both MACHINE and MACHINE_ARCH are set from the alias. 1147 case both MACHINE and MACHINE_ARCH are set from the alias.
1153 Such aliases are interpreted entirely by build.sh; they are not 1148 Such aliases are interpreted entirely by build.sh; they are not
1154 used by any other part of the build system. The MACHINE_ARCH 1149 used by any other part of the build system. The MACHINE_ARCH
1155 setting implied by mach will override any value of MACHINE_ARCH 1150 setting implied by mach will override any value of MACHINE_ARCH
1156 in the process environment, but will not override a value set 1151 in the process environment, but will not override a value set
1157 by the -a option. All cross builds require -m, but if unset on 1152 by the -a option. All cross builds require -m, but if unset on
1158 a NetBSD host, the host's value of MACHINE will be detected and 1153 a NetBSD host, the host's value of MACHINE will be detected and
1159 used automatically. 1154 used automatically.
1160 1155
1161 See the list-arch operation for a way to get a list of valid 1156 See the list-arch operation for a way to get a list of valid
1162 MACHINE and MACHINE_ARCH settings. 1157 MACHINE and MACHINE_ARCH settings.
1163 1158
1164 -N noiselevel 1159 -N noiselevel
1165 Set the "noisyness" level of the build, by setting MAKEVERBOSE 1160 Set the "noisyness" level of the build, by setting MAKEVERBOSE
1166 to noiselevel. 1161 to noiselevel.
1167 1162
1168 -n Show the commands that would be executed by build.sh, but do 1163 -n Show the commands that would be executed by build.sh, but do
1169 not make any changes. This is similar in concept to "make -n". 1164 not make any changes. This is similar in concept to "make -n".
1170 1165
1171 -O obj Create an appropriate transform macro for MAKEOBJDIR that will 1166 -O obj Create an appropriate transform macro for MAKEOBJDIR that will
1172 place the built object files under obj. Unsets 1167 place the built object files under obj. Unsets
1173 MAKEOBJDIRPREFIX. 1168 MAKEOBJDIRPREFIX.
1174 1169
1175 For instance, a setting of "-O /usr/obj" will place build-time 1170 For instance, a setting of "-O /usr/obj" will place build-time
1176 files under /usr/obj/bin, /usr/obj/lib, /usr/obj/usr.bin, and 1171 files under /usr/obj/bin, /usr/obj/lib, /usr/obj/usr.bin, and
1177 so forth. 1172 so forth.
1178 1173
1179 If a relative path is specified, it will be converted to an 1174 If a relative path is specified, it will be converted to an
1180 absolute path before being used. build.sh imposes the 1175 absolute path before being used. build.sh imposes the
1181 restriction that the argument to the -O option must not contain 1176 restriction that the argument to the -O option must not contain
1182 a "$" (dollar sign) character. If the directory does not 1177 a "$" (dollar sign) character. If the directory does not
1183 already exist, build.sh will create it. 1178 already exist, build.sh will create it.
1184 1179
1185 In normal use, exactly one of the -M or -O options should be 1180 In normal use, exactly one of the -M or -O options should be
1186 specified. If neither -M nor -O is specified, then a default 1181 specified. If neither -M nor -O is specified, then a default
1187 object directory will be chosen according to rules in 1182 object directory will be chosen according to rules in
1188 <bsd.obj.mk>. Relying on this default is not recommended 1183 <bsd.obj.mk>. Relying on this default is not recommended
1189 because it is determined by complex rules that are influenced 1184 because it is determined by complex rules that are influenced
1190 by the values of several variables and by the location of the 1185 by the values of several variables and by the location of the
1191 source directory. 1186 source directory.
1192 1187
1193 Note: Placing the obj directory location outside of the default 1188 Note: Placing the obj directory location outside of the default
1194 source tree hierarchy makes it easier to manually clear out old 1189 source tree hierarchy makes it easier to manually clear out old
1195 files in the event the "make cleandir" operation is unable to 1190 files in the event the "make cleandir" operation is unable to
1196 do so. (See CAVEATS below.) 1191 do so. (See CAVEATS below.)
1197 1192
1198 Note: The use of one of -M or -O is the only means of building 1193 Note: The use of one of -M or -O is the only means of building
1199 multiple machine architecture userlands from the same source 1194 multiple machine architecture userlands from the same source
1200 tree without cleaning between builds (in which case, one would 1195 tree without cleaning between builds (in which case, one would
1201 specify distinct obj locations for each). 1196 specify distinct obj locations for each).
1202 1197
1203 -o Set the value of MKOBJDIRS to "no". Otherwise, it will be 1198 -o Set the value of MKOBJDIRS to "no". Otherwise, it will be
1204 automatically set to "yes". This default is opposite to the 1199 automatically set to "yes". This default is opposite to the
1205 behaviour when not using build.sh. 1200 behaviour when not using build.sh.
1206 1201
1207 -P Set the value of MKREPRO and MKREPRO_TIMESTAMP to the latest 1202 -P Set the value of MKREPRO and MKREPRO_TIMESTAMP to the latest
1208 source CVS timestamp for reproducible builds. 1203 source CVS timestamp for reproducible builds.
1209 1204
1210 -R rel Set the value of RELEASEDIR to rel. If a relative path is 1205 -R rel Set the value of RELEASEDIR to rel. If a relative path is
1211 specified, it will be converted to an absolute path before 1206 specified, it will be converted to an absolute path before
1212 being used. 1207 being used.
1213 1208
1214 -r Remove the contents of DESTDIR and TOOLDIR before building 1209 -r Remove the contents of DESTDIR and TOOLDIR before building
1215 (provides a clean starting point). This will skip deleting 1210 (provides a clean starting point). This will skip deleting
1216 DESTDIR if building on a native system to the root directory. 1211 DESTDIR if building on a native system to the root directory.
1217 1212
1218 -S seed Change the value of BUILDSEED to seed. This should rarely be 1213 -S seed Change the value of BUILDSEED to seed. This should rarely be
1219 necessary. 1214 necessary.
1220 1215
1221 -T tools Set the value of TOOLDIR to tools. If a relative path is 1216 -T tools Set the value of TOOLDIR to tools. If a relative path is
1222 specified, it will be converted to an absolute path before 1217 specified, it will be converted to an absolute path before
1223 being used. If set, the bootstrap "make" will only be rebuilt 1218 being used. If set, the bootstrap "make" will only be rebuilt
1224 if the source files for make(1) have changed. 1219 if the source files for make(1) have changed.
1225 1220
1226 -U Set MKUNPRIVED=yes. 1221 -U Set MKUNPRIVED=yes.
1227 1222
1228 -u Set MKUPDATE=yes. 1223 -u Set MKUPDATE=yes.
1229 1224
1230 -V var=[value] 1225 -V var=[value]
1231 Set the environment variable var to an optional value. This is 1226 Set the environment variable var to an optional value. This is
1232 propagated to the nbmake wrapper. 1227 propagated to the nbmake wrapper.
1233 1228
1234 -w wrapper 1229 -w wrapper
1235 Create the nbmake wrapper script (see below) in a custom 1230 Create the nbmake wrapper script (see below) in a custom
1236 location, specified by wrapper. This allows, for instance, to 1231 location, specified by wrapper. This allows, for instance, to
1237 place the wrapper in PATH automatically. 1232 place the wrapper in PATH automatically.
1238 1233
1239 Note: wrapper is the full name of the file, not just a 1234 Note: wrapper is the full name of the file, not just a
1240 directory name. If a relative path is specified, it will be 1235 directory name. If a relative path is specified, it will be
1241 converted to an absolute path before being used. 1236 converted to an absolute path before being used.
1242 1237
1243 -X x11src 1238 -X x11src
1244 Set the value of X11SRCDIR to x11src. If a relative path is 1239 Set the value of X11SRCDIR to x11src. If a relative path is
1245 specified, it will be converted to an absolute path before 1240 specified, it will be converted to an absolute path before
1246 being used. 1241 being used.
1247 1242
1248 -x Set MKX11=yes. 1243 -x Set MKX11=yes.
1249 1244
1250 -Z var Unset ("zap") the environment variable var. This is propagated 1245 -Z var Unset ("zap") the environment variable var. This is propagated
1251 to the nbmake wrapper. 1246 to the nbmake wrapper.
1252 1247
1253 -? Show a help message, and exit. 1248 -? Show a help message, and exit.
1254 1249
1255 The "nbmake-MACHINE" wrapper script 1250 The "nbmake-MACHINE" wrapper script
1256 If using the build.sh script to build NetBSD, a nbmake-MACHINE script 1251 If using the build.sh script to build NetBSD, a nbmake-MACHINE script
1257 will be created in TOOLDIR/bin upon the first build to assist in building 1252 will be created in TOOLDIR/bin upon the first build to assist in building
1258 subtrees on a cross-compile host. 1253 subtrees on a cross-compile host.
1259 1254
1260 nbmake-MACHINE can be invoked in lieu of make(1), and will instead call 1255 nbmake-MACHINE can be invoked in lieu of make(1), and will instead call
1261 the up-to-date version of "nbmake" installed into TOOLDIR/bin with 1256 the up-to-date version of "nbmake" installed into TOOLDIR/bin with
1262 several key variables pre-set, including MACHINE, MACHINE_ARCH, and 1257 several key variables pre-set, including MACHINE, MACHINE_ARCH, and
1263 TOOLDIR. nbmake-MACHINE will also set variables specified with -V, and 1258 TOOLDIR. nbmake-MACHINE will also set variables specified with -V, and
1264 unset variables specified with -Z. 1259 unset variables specified with -Z.
1265 1260
1266 This script can be symlinked into a directory listed in PATH, or called 1261 This script can be symlinked into a directory listed in PATH, or called
1267 with an absolute path. 1262 with an absolute path.
1268 1263
1269EXAMPLES 1264EXAMPLES
1270 1. % ./build.sh [OPTIONS] tools kernel=GENERIC 1265 1. % ./build.sh [OPTIONS] tools kernel=GENERIC
1271 1266
1272 Build a new toolchain, and use the new toolchain to configure and 1267 Build a new toolchain, and use the new toolchain to configure and
1273 build a new GENERIC kernel. 1268 build a new GENERIC kernel.
1274 1269
1275 2. % ./build.sh [OPTIONS] -U distribution 1270 2. % ./build.sh [OPTIONS] -U distribution
1276 1271
1277 Using unprivileged mode, build a complete distribution to a DESTDIR 1272 Using unprivileged mode, build a complete distribution to a DESTDIR
1278 directory that build.sh selects (and will show). 1273 directory that build.sh selects (and will show).
1279 1274
1280 3. # ./build.sh [OPTIONS] -U install=/ 1275 3. # ./build.sh [OPTIONS] -U install=/
1281 1276
1282 As root, install to / the distribution that was built by example 2. 1277 As root, install to / the distribution that was built by example 2.
1283 Even though this is run as root, -U is required so that the 1278 Even though this is run as root, -U is required so that the
1284 permissions stored in DESTDIR/METALOG are correctly applied to the 1279 permissions stored in DESTDIR/METALOG are correctly applied to the
1285 files as they're copied to /. 1280 files as they're copied to /.
1286 1281
1287 4. % ./build.sh [OPTIONS] -U -u release 1282 4. % ./build.sh [OPTIONS] -U -u release
1288 1283
1289 Using unprivileged mode, build a complete release to DESTDIR and 1284 Using unprivileged mode, build a complete release to DESTDIR and
1290 RELEASEDIR directories that build.sh selects (and will show). 1285 RELEASEDIR directories that build.sh selects (and will show).
1291 MKUPDATE=yes (-u) is set to prevent the "make cleandir", so that if 1286 MKUPDATE=yes (-u) is set to prevent the "make cleandir", so that if
1292 this is run after example 2, it doesn't need to redo that portion of 1287 this is run after example 2, it doesn't need to redo that portion of
1293 the release build. 1288 the release build.
1294 1289
1295OBSOLETE VARIABLES 1290OBSOLETE VARIABLES
1296 NBUILDJOBS Use the make(1) option -j instead. 1291 NBUILDJOBS Use the build.sh and make(1) option -j instead.
1297 1292
1298 USE_NEW_TOOLCHAIN 1293 USE_NEW_TOOLCHAIN
1299 The new toolchain is now the default. To disable, use 1294 The new toolchain is now the default. To disable, use
1300 TOOLCHAIN_MISSING=yes. 1295 TOOLCHAIN_MISSING=yes.
1301 1296
1302SEE ALSO 1297SEE ALSO
1303 ar(1), config(1), ctags(1), cvs(1), cvslatest(1), ex(1), g++(1), gzip(1), 1298 ar(1), config(1), ctags(1), cvs(1), cvslatest(1), ex(1), g++(1), gzip(1),
1304 ident(1), ld(1), lint(1), make(1), mkisofs(1), sh(1), uname(1), vi(1), 1299 ident(1), ld(1), lint(1), make(1), mkisofs(1), sh(1), uname(1), vi(1),
1305 options(4), mk.conf(5), atf(7), hier(7), release(7), sysctl(7), 1300 options(4), mk.conf(5), atf(7), hier(7), release(7), sysctl(7),
1306 etcupdate(8), installboot(8), mount(8), mtree(8), postinstall(8), 1301 etcupdate(8), installboot(8), mount(8), mtree(8), postinstall(8),
1307 sysinst(8), pkgsrc/sysutils/cdrtools 1302 sysinst(8), pkgsrc/sysutils/cdrtools
1308 1303
1309HISTORY 1304HISTORY
1310 The build.sh based build scheme was introduced for NetBSD 1.6 as 1305 The build.sh based build scheme was introduced for NetBSD 1.6 as
1311 USE_NEW_TOOLCHAIN, and re-worked to TOOLCHAIN_MISSING after that. 1306 USE_NEW_TOOLCHAIN, and re-worked to TOOLCHAIN_MISSING after that.
1312 1307
1313CAVEATS 1308CAVEATS
1314 After significant updates to third-party components in the source tree, 1309 After significant updates to third-party components in the source tree,
1315 the "make cleandir" operation may be insufficient to clean out old files 1310 the "make cleandir" operation may be insufficient to clean out old files
1316 in object directories. Instead, one may have to manually remove the 1311 in object directories. Instead, one may have to manually remove the
1317 files. Consult the UPDATING file for notices concerning this. 1312 files. Consult the UPDATING file for notices concerning this.
1318 1313
1319NetBSD June 5, 2023 NetBSD 1314NetBSD June 10, 2023 NetBSD

cvs diff -r1.336 -r1.337 src/Makefile (switch to unified diff)

--- src/Makefile 2023/06/02 20:48:09 1.336
+++ src/Makefile 2023/06/11 10:43:51 1.337
@@ -1,540 +1,537 @@ @@ -1,540 +1,537 @@
1# $NetBSD: Makefile,v 1.336 2023/06/02 20:48:09 lukem Exp $ 1# $NetBSD: Makefile,v 1.337 2023/06/11 10:43:51 lukem Exp $
2 2
3# 3#
4# This is the top-level makefile for building NetBSD. For an outline of 4# This is the top-level makefile for building NetBSD. For an outline of
5# how to build a snapshot or release, as well as other release engineering 5# how to build a snapshot or release, as well as other release engineering
6# information, see http://www.NetBSD.org/developers/releng/index.html 6# information, see http://www.NetBSD.org/developers/releng/index.html
7# 7#
8# Not everything you can set or do is documented in this makefile. In 8# Not everything you can set or do is documented in this makefile. In
9# particular, you should review the files in /usr/share/mk (especially 9# particular, you should review the files in /usr/share/mk (especially
10# bsd.README) for general information on building programs and writing 10# bsd.README) for general information on building programs and writing
11# Makefiles within this structure, and see the comments in src/etc/Makefile 11# Makefiles within this structure, and see the comments in src/etc/Makefile
12# for further information on installation and release set options. 12# for further information on installation and release set options.
13# 13#
14# Variables listed below can be set on the make command line (highest 14# Variables listed below can be set on the make command line (highest
15# priority), in /etc/mk.conf (middle priority), or in the environment 15# priority), in /etc/mk.conf (middle priority), or in the environment
16# (lowest priority). 16# (lowest priority).
17# 17#
18# Variables: 18# Variables:
19# DESTDIR is the target directory for installation of the compiled 19# DESTDIR is the target directory for installation of the compiled
20# software. It defaults to /. Note that programs are built against 20# software. It defaults to /. Note that programs are built against
21# libraries installed in DESTDIR. 21# libraries installed in DESTDIR.
22# MKMAN, if `no', will prevent building of manual pages. 22# MKMAN, if `no', will prevent building of manual pages.
23# MKOBJDIRS, if not `no', will build object directories at 23# MKOBJDIRS, if not `no', will build object directories at
24# an appropriate point in a build. 24# an appropriate point in a build.
25# MKSHARE, if `no', will prevent building and installing 25# MKSHARE, if `no', will prevent building and installing
26# anything in /usr/share. 26# anything in /usr/share.
27# MKUPDATE, if not `no', will avoid a `make cleandir' at the start of 27# MKUPDATE, if not `no', will avoid a `make cleandir' at the start of
28# `make build', as well as having the effects listed in 28# `make build', as well as having the effects listed in
29# /usr/share/mk/bsd.README. 29# /usr/share/mk/bsd.README.
30# NOCLEANDIR, if defined, will avoid a `make cleandir' at the start 30# NOCLEANDIR, if defined, will avoid a `make cleandir' at the start
31# of the `make build'. 31# of the `make build'.
32# NOINCLUDES will avoid the `make includes' usually done by `make build'. 32# NOINCLUDES will avoid the `make includes' usually done by `make build'.
33# NOBINARIES will not build binaries, only includes and libraries 33# NOBINARIES will not build binaries, only includes and libraries
34# 34#
35# See mk.conf(5) for more details. 35# See mk.conf(5) for more details.
36# 36#
37# 37#
38# Targets: 38# Targets:
39# build: 39# build:
40# Builds a full release of NetBSD in DESTDIR, except for the 40# Builds a full release of NetBSD in DESTDIR, except for the
41# /etc configuration files. 41# /etc configuration files.
42# If BUILD_DONE is set, this is an empty target. 42# If BUILD_DONE is set, this is an empty target.
43# distribution: 43# distribution:
44# Builds a full release of NetBSD in DESTDIR, including the /etc 44# Builds a full release of NetBSD in DESTDIR, including the /etc
45# configuration files. 45# configuration files.
46# buildworld: 46# buildworld:
47# As per `make distribution', except that it ensures that DESTDIR 47# As per `make distribution', except that it ensures that DESTDIR
48# is not the root directory. 48# is not the root directory.
49# installworld: 49# installworld:
50# Install the distribution from DESTDIR to INSTALLWORLDDIR (which 50# Install the distribution from DESTDIR to INSTALLWORLDDIR (which
51# defaults to the root directory). Ensures that INSTALLWORLDDIR 51# defaults to the root directory). Ensures that INSTALLWORLDDIR
52# is not the root directory if cross compiling. 52# is not the root directory if cross compiling.
53# release: 53# release:
54# Does a `make distribution', and then tars up the DESTDIR files 54# Does a `make distribution', and then tars up the DESTDIR files
55# into ${RELEASEDIR}/${RELEASEMACHINEDIR}, in release(7) format. 55# into ${RELEASEDIR}/${RELEASEMACHINEDIR}, in release(7) format.
56# (See etc/Makefile for more information on this.) 56# (See etc/Makefile for more information on this.)
57# regression-tests: 57# regression-tests:
58# Runs the regression tests in "regress" on this host. 58# Runs the regression tests in "regress" on this host.
59# sets: 59# sets:
60# Populate ${RELEASEDIR}/${RELEASEMACHINEDIR}/binary/sets 60# Populate ${RELEASEDIR}/${RELEASEMACHINEDIR}/binary/sets
61# from ${DESTDIR} 61# from ${DESTDIR}
62# sourcesets: 62# sourcesets:
63# Populate ${RELEASEDIR}/source/sets from ${NETBSDSRCDIR} 63# Populate ${RELEASEDIR}/source/sets from ${NETBSDSRCDIR}
64# syspkgs: 64# syspkgs:
65# Populate ${RELEASEDIR}/${RELEASEMACHINEDIR}/binary/syspkgs 65# Populate ${RELEASEDIR}/${RELEASEMACHINEDIR}/binary/syspkgs
66# from ${DESTDIR} 66# from ${DESTDIR}
67# iso-image: 67# iso-image:
68# Create CD-ROM image in RELEASEDIR/images. 68# Create CD-ROM image in RELEASEDIR/images.
69# RELEASEDIR must already have been populated by `make release' 69# RELEASEDIR must already have been populated by `make release'
70# or equivalent. 70# or equivalent.
71# iso-image-source: 71# iso-image-source:
72# Create CD-ROM image with source in RELEASEDIR/images. 72# Create CD-ROM image with source in RELEASEDIR/images.
73# RELEASEDIR must already have been populated by 73# RELEASEDIR must already have been populated by
74# `make release sourcesets' or equivalent. 74# `make release sourcesets' or equivalent.
75# live-image: 75# live-image:
76# Create bootable live image for emulators or USB stick etc. 76# Create bootable live image for emulators or USB stick etc.
77# in RELEASEDIR/liveimage. 77# in RELEASEDIR/liveimage.
78# RELEASEDIR must already have been populated by `make release' 78# RELEASEDIR must already have been populated by `make release'
79# or equivalent. 79# or equivalent.
80# install-image: 80# install-image:
81# Create bootable installation image for USB stick etc. 81# Create bootable installation image for USB stick etc.
82# in RELEASEDIR/installimage. 82# in RELEASEDIR/installimage.
83# RELEASEDIR must already have been populated by `make release' 83# RELEASEDIR must already have been populated by `make release'
84# or equivalent. 84# or equivalent.
85# 85#
86# Targets invoked by `make build,' in order: 86# Targets invoked by `make build,' in order:
87# cleandir: cleans the tree. 87# cleandir: cleans the tree.
88# do-top-obj: creates the top level object directory. 88# do-top-obj: creates the top level object directory.
89# do-tools-obj: creates object directories for the host toolchain. 89# do-tools-obj: creates object directories for the host toolchain.
90# do-tools: builds host toolchain. 90# do-tools: builds host toolchain.
91# params: create params file with various make(1) parameters. 91# params: create params file with various make(1) parameters.
92# show-params: show various make(1) parameters. 92# show-params: show various make(1) parameters.
93# obj: creates object directories. 93# obj: creates object directories.
94# do-distrib-dirs: creates the distribution directories. 94# do-distrib-dirs: creates the distribution directories.
95# includes: installs include files. 95# includes: installs include files.
96# do-lib: builds and installs prerequisites from lib. 96# do-lib: builds and installs prerequisites from lib.
97# do-compat-lib: builds and installs prerequisites from compat/lib 97# do-compat-lib: builds and installs prerequisites from compat/lib
98# if ${MKCOMPAT} != "no". 98# if ${MKCOMPAT} != "no".
99# do-x11: builds and installs X11 tools and libraries 99# do-x11: builds and installs X11 tools and libraries
100# from src/external/mit/xorg if ${MKX11} != "no". 100# from src/external/mit/xorg if ${MKX11} != "no".
101# do-build: builds and installs the entire system. 101# do-build: builds and installs the entire system.
102# do-obsolete: installs the obsolete sets (for the postinstall-* targets). 102# do-obsolete: installs the obsolete sets (for the postinstall-* targets).
103# 103#
104 104
105.if ${.MAKEFLAGS:M${.CURDIR}/share/mk} == "" 105.if ${.MAKEFLAGS:M${.CURDIR}/share/mk} == ""
106.MAKEFLAGS: -m ${.CURDIR}/share/mk 106.MAKEFLAGS: -m ${.CURDIR}/share/mk
107.endif 107.endif
108 108
109# 109#
110# If _SRC_TOP_OBJ_ gets set here, we will end up with a directory that may 110# If _SRC_TOP_OBJ_ gets set here, we will end up with a directory that may
111# not be the top level objdir, because "make obj" can happen in the *middle* 111# not be the top level objdir, because "make obj" can happen in the *middle*
112# of "make build" (long after <bsd.own.mk> is calculated it). So, pre-set 112# of "make build" (long after <bsd.own.mk> is calculated it). So, pre-set
113# _SRC_TOP_OBJ_ here so it will not be added to ${.MAKEOVERRIDES}. 113# _SRC_TOP_OBJ_ here so it will not be added to ${.MAKEOVERRIDES}.
114# 114#
115_SRC_TOP_OBJ_= 115_SRC_TOP_OBJ_=
116 116
117.include <bsd.own.mk> 117.include <bsd.own.mk>
118 118
119# 119#
120# Sanity check: make sure that "make build" is not invoked simultaneously 120# Sanity check: make sure that "make build" is not invoked simultaneously
121# with a standard recursive target. 121# with a standard recursive target.
122# 122#
123 123
124.if make(build) || make(release) || make(snapshot) 124.if make(build) || make(release) || make(snapshot)
125.for targ in ${TARGETS:Nobj:Ncleandir} 125.for targ in ${TARGETS:Nobj:Ncleandir}
126.if make(${targ}) && !target(.BEGIN) 126.if make(${targ}) && !target(.BEGIN)
127.BEGIN: 127.BEGIN:
128 @echo 'BUILD ABORTED: "make build" and "make ${targ}" are mutually exclusive.' 128 @echo 'BUILD ABORTED: "make build" and "make ${targ}" are mutually exclusive.'
129 @false 129 @false
130.endif 130.endif
131.endfor 131.endfor
132.endif 132.endif
133 133
134# 134#
135# _SUBDIR is used to set SUBDIR, after removing directories that have 135# _SUBDIR is used to set SUBDIR, after removing directories that have
136# BUILD_${dir}=no, or that have no ${dir}/Makefile. 136# BUILD_${dir}=no, or that have no ${dir}/Makefile.
137# 137#
138_SUBDIR= tools .WAIT lib 138_SUBDIR= tools .WAIT lib
139.if ${MKLLVM} != "no" 139.if ${MKLLVM} != "no"
140_SUBDIR+= external/bsd/compiler_rt 140_SUBDIR+= external/bsd/compiler_rt
141.endif 141.endif
142_SUBDIR+= include external crypto/external bin 142_SUBDIR+= include external crypto/external bin
143_SUBDIR+= games libexec sbin usr.bin 143_SUBDIR+= games libexec sbin usr.bin
144_SUBDIR+= usr.sbin share sys etc tests compat 144_SUBDIR+= usr.sbin share sys etc tests compat
145_SUBDIR+= .WAIT rescue .WAIT distrib regress 145_SUBDIR+= .WAIT rescue .WAIT distrib regress
146 146
147.for dir in ${_SUBDIR} 147.for dir in ${_SUBDIR}
148.if "${dir}" == ".WAIT" \ 148.if "${dir}" == ".WAIT" \
149 || (${BUILD_${dir}:Uyes} != "no" && exists(${dir}/Makefile)) 149 || (${BUILD_${dir}:Uyes} != "no" && exists(${dir}/Makefile))
150SUBDIR+= ${dir} 150SUBDIR+= ${dir}
151.endif 151.endif
152.endfor 152.endfor
153 153
154.if exists(regress) 154.if exists(regress)
155regression-tests: .PHONY .MAKE 155regression-tests: .PHONY .MAKE
156 @echo Running regression tests... 156 @echo Running regression tests...
157 ${MAKEDIRTARGET} regress regress 157 ${MAKEDIRTARGET} regress regress
158.endif 158.endif
159 159
160.if ${MKUNPRIVED} != "no" 160.if ${MKUNPRIVED} != "no"
161NOPOSTINSTALL= # defined 161NOPOSTINSTALL= # defined
162.endif 162.endif
163 163
164afterinstall: .PHONY .MAKE 164afterinstall: .PHONY .MAKE
165.if ${MKMAN} != "no" 165.if ${MKMAN} != "no"
166 ${MAKEDIRTARGET} share/man makedb 166 ${MAKEDIRTARGET} share/man makedb
167.endif 167.endif
168.if (${MKUNPRIVED} != "no" && ${MKINFO} != "no") 168.if (${MKUNPRIVED} != "no" && ${MKINFO} != "no")
169 ${MAKEDIRTARGET} external/gpl2/texinfo/bin/install-info infodir-meta 169 ${MAKEDIRTARGET} external/gpl2/texinfo/bin/install-info infodir-meta
170.endif 170.endif
171.if !defined(NOPOSTINSTALL) 171.if !defined(NOPOSTINSTALL)
172 ${MAKEDIRTARGET} . postinstall-check 172 ${MAKEDIRTARGET} . postinstall-check
173.endif 173.endif
174 174
175_POSTINSTALL= ${:!cd ${.CURDIR}/usr.sbin/postinstall && \ 175_POSTINSTALL= ${:!cd ${.CURDIR}/usr.sbin/postinstall && \
176 ${MAKE} -v .OBJDIR!}/postinstall \ 176 ${MAKE} -v .OBJDIR!}/postinstall \
177 -m ${MACHINE} -a ${MACHINE_ARCH} 177 -m ${MACHINE} -a ${MACHINE_ARCH}
178_POSTINSTALL_ENV= \ 178_POSTINSTALL_ENV= \
179 AWK=${TOOL_AWK:Q} \ 179 AWK=${TOOL_AWK:Q} \
180 DB=${TOOL_DB:Q} \ 180 DB=${TOOL_DB:Q} \
181 HOST_SH=${HOST_SH:Q} \ 181 HOST_SH=${HOST_SH:Q} \
182 MAKE=${MAKE:Q} \ 182 MAKE=${MAKE:Q} \
183 PWD_MKDB=${TOOL_PWD_MKDB:Q} \ 183 PWD_MKDB=${TOOL_PWD_MKDB:Q} \
184 SED=${TOOL_SED:Q} \ 184 SED=${TOOL_SED:Q} \
185 STAT=${TOOL_STAT:Q} 185 STAT=${TOOL_STAT:Q}
186 186
187.if ${MKX11} != "no" 187.if ${MKX11} != "no"
188_POSTINSTALL_X11=-x ${X11SRCDIR:Q} 188_POSTINSTALL_X11=-x ${X11SRCDIR:Q}
189.endif 189.endif
190 190
191postinstall-check: .PHONY 191postinstall-check: .PHONY
192 @echo " === Post installation checks ===" 192 @echo " === Post installation checks ==="
193 ${_POSTINSTALL_ENV} ${HOST_SH} ${_POSTINSTALL} -s ${.CURDIR} ${_POSTINSTALL_X11} -d ${DESTDIR}/ check; if [ $$? -gt 1 ]; then exit 1; fi 193 ${_POSTINSTALL_ENV} ${HOST_SH} ${_POSTINSTALL} -s ${.CURDIR} ${_POSTINSTALL_X11} -d ${DESTDIR}/ check; if [ $$? -gt 1 ]; then exit 1; fi
194 @echo " ================================" 194 @echo " ================================"
195 195
196postinstall-fix: .NOTMAIN .PHONY 196postinstall-fix: .NOTMAIN .PHONY
197 @echo " === Post installation fixes ===" 197 @echo " === Post installation fixes ==="
198 ${_POSTINSTALL_ENV} ${HOST_SH} ${_POSTINSTALL} -s ${.CURDIR} ${_POSTINSTALL_X11} -d ${DESTDIR}/ fix 198 ${_POSTINSTALL_ENV} ${HOST_SH} ${_POSTINSTALL} -s ${.CURDIR} ${_POSTINSTALL_X11} -d ${DESTDIR}/ fix
199 @echo " ===============================" 199 @echo " ==============================="
200 200
201postinstall-fix-obsolete: .NOTMAIN .PHONY 201postinstall-fix-obsolete: .NOTMAIN .PHONY
202 @echo " === Removing obsolete files ===" 202 @echo " === Removing obsolete files ==="
203 ${_POSTINSTALL_ENV} ${HOST_SH} ${_POSTINSTALL} -s ${.CURDIR} ${_POSTINSTALL_X11} -d ${DESTDIR}/ fix obsolete 203 ${_POSTINSTALL_ENV} ${HOST_SH} ${_POSTINSTALL} -s ${.CURDIR} ${_POSTINSTALL_X11} -d ${DESTDIR}/ fix obsolete
204 @echo " ===============================" 204 @echo " ==============================="
205 205
206postinstall-fix-obsolete_stand: .NOTMAIN .PHONY 206postinstall-fix-obsolete_stand: .NOTMAIN .PHONY
207 @echo " === Removing obsolete files ===" 207 @echo " === Removing obsolete files ==="
208 ${_POSTINSTALL_ENV} ${HOST_SH} ${_POSTINSTALL} -s ${.CURDIR} ${_POSTINSTALL_X11} -d ${DESTDIR}/ fix obsolete_stand 208 ${_POSTINSTALL_ENV} ${HOST_SH} ${_POSTINSTALL} -s ${.CURDIR} ${_POSTINSTALL_X11} -d ${DESTDIR}/ fix obsolete_stand
209 ${_POSTINSTALL_ENV} ${HOST_SH} ${_POSTINSTALL} -s ${.CURDIR} ${_POSTINSTALL_X11} -d ${DESTDIR}/ fix obsolete_stand_debug 209 ${_POSTINSTALL_ENV} ${HOST_SH} ${_POSTINSTALL} -s ${.CURDIR} ${_POSTINSTALL_X11} -d ${DESTDIR}/ fix obsolete_stand_debug
210 @echo " ===============================" 210 @echo " ==============================="
211 211
212 212
213# 213#
214# Targets (in order!) called by "make build". 214# Targets (in order!) called by "make build".
215# 215#
216BUILDTARGETS+= check-tools 216BUILDTARGETS+= check-tools
217.if ${MKUPDATE} == "no" && !defined(NOCLEANDIR) 217.if ${MKUPDATE} == "no" && !defined(NOCLEANDIR)
218BUILDTARGETS+= cleandir 218BUILDTARGETS+= cleandir
219.endif 219.endif
220.if ${MKOBJDIRS} != "no" 220.if ${MKOBJDIRS} != "no"
221BUILDTARGETS+= do-top-obj 221BUILDTARGETS+= do-top-obj
222.endif 222.endif
223.if ${USETOOLS} == "yes" # { 223.if ${USETOOLS} == "yes" # {
224.if ${MKOBJDIRS} != "no" 224.if ${MKOBJDIRS} != "no"
225BUILDTARGETS+= do-tools-obj 225BUILDTARGETS+= do-tools-obj
226.endif 226.endif
227BUILDTARGETS+= do-tools 227BUILDTARGETS+= do-tools
228.endif # USETOOLS # } 228.endif # USETOOLS # }
229BUILDTARGETS+= params 229BUILDTARGETS+= params
230.if ${MKOBJDIRS} != "no" 230.if ${MKOBJDIRS} != "no"
231BUILDTARGETS+= obj 231BUILDTARGETS+= obj
232.endif 232.endif
233BUILDTARGETS+= clean_METALOG 233BUILDTARGETS+= clean_METALOG
234.if !defined(NODISTRIBDIRS) 234.if !defined(NODISTRIBDIRS)
235BUILDTARGETS+= do-distrib-dirs 235BUILDTARGETS+= do-distrib-dirs
236.endif 236.endif
237.if !defined(NOINCLUDES) 237.if !defined(NOINCLUDES)
238BUILDTARGETS+= includes 238BUILDTARGETS+= includes
239.endif 239.endif
240BUILDTARGETS+= do-lib 240BUILDTARGETS+= do-lib
241BUILDTARGETS+= do-compat-lib 241BUILDTARGETS+= do-compat-lib
242.if ${MKLLVM} != "no" 242.if ${MKLLVM} != "no"
243BUILDTARGETS+= do-sanitizer 243BUILDTARGETS+= do-sanitizer
244.if ${MKSANITIZER:Uno} == "yes" 244.if ${MKSANITIZER:Uno} == "yes"
245BUILDTARGETS+= do-sanitizer-tools 245BUILDTARGETS+= do-sanitizer-tools
246.endif 246.endif
247.endif 247.endif
248.if ${MKX11} != "no" 248.if ${MKX11} != "no"
249BUILDTARGETS+= do-x11 249BUILDTARGETS+= do-x11
250.endif 250.endif
251.if !defined(NOBINARIES) 251.if !defined(NOBINARIES)
252BUILDTARGETS+= do-build 252BUILDTARGETS+= do-build
253BUILDTARGETS+= do-obsolete 253BUILDTARGETS+= do-obsolete
254.endif 254.endif
255 255
256# 256#
257# Enforce proper ordering of some rules. 257# Enforce proper ordering of some rules.
258# 258#
259 259
260.ORDER: ${BUILDTARGETS} 260.ORDER: ${BUILDTARGETS}
261includes-lib: .PHONY includes-include includes-sys 261includes-lib: .PHONY includes-include includes-sys
262 262
263# 263#
264# Record the values of variables that might affect the build. 264# Record the values of variables that might affect the build.
265# If no values have changed, avoid updating the timestamp 265# If no values have changed, avoid updating the timestamp
266# of the params file. 266# of the params file.
267# 267#
268# This is referenced by _NETBSD_VERSION_DEPENDS in <bsd.own.mk>. 268# This is referenced by _NETBSD_VERSION_DEPENDS in <bsd.own.mk>.
269# 269#
270.include "${NETBSDSRCDIR}/etc/Makefile.params" 270.include "${NETBSDSRCDIR}/etc/Makefile.params"
271CLEANDIRFILES+= params 271CLEANDIRFILES+= params
272params: .EXEC 272params: .EXEC
273 ${_MKMSG_CREATE} params 273 ${_MKMSG_CREATE} params
274 @${PRINT_PARAMS} >${.TARGET}.new 274 @${PRINT_PARAMS} >${.TARGET}.new
275 @if cmp -s ${.TARGET}.new ${.TARGET} > /dev/null 2>&1; then \ 275 @if cmp -s ${.TARGET}.new ${.TARGET} > /dev/null 2>&1; then \
276 : "params is unchanged" ; \ 276 : "params is unchanged" ; \
277 rm ${.TARGET}.new ; \ 277 rm ${.TARGET}.new ; \
278 else \ 278 else \
279 : "params has changed or is new" ; \ 279 : "params has changed or is new" ; \
280 mv ${.TARGET}.new ${.TARGET} ; \ 280 mv ${.TARGET}.new ${.TARGET} ; \
281 fi 281 fi
282 282
283# 283#
284# Display current make(1) parameters 284# Display current make(1) parameters
285# 285#
286show-params: .PHONY .MAKE 286show-params: .PHONY .MAKE
287 @${PRINT_PARAMS} 287 @${PRINT_PARAMS}
288 288
289# 289#
290# Build the system and install into DESTDIR. 290# Build the system and install into DESTDIR.
291# 291#
292 292
293START_TIME!= date 293START_TIME!= date
294 294
295build: .PHONY .MAKE 295build: .PHONY .MAKE
296.if defined(BUILD_DONE) 296.if defined(BUILD_DONE)
297 @echo "Build already installed into ${DESTDIR}" 297 @echo "Build already installed into ${DESTDIR}"
298.else 298.else
299 @echo "Build started at: ${START_TIME}" 299 @echo "Build started at: ${START_TIME}"
300.for tgt in ${BUILDTARGETS} 300.for tgt in ${BUILDTARGETS}
301 ${MAKEDIRTARGET} . ${tgt} 301 ${MAKEDIRTARGET} . ${tgt}
302.endfor 302.endfor
303 ${MAKEDIRTARGET} etc install-etc-release 303 ${MAKEDIRTARGET} etc install-etc-release
304 @echo "Build started at: ${START_TIME}" 304 @echo "Build started at: ${START_TIME}"
305 @printf "Build finished at: " && date 305 @printf "Build finished at: " && date
306.endif 306.endif
307 307
308# 308#
309# Build a full distribution, but not a release (i.e. no sets into 309# Build a full distribution, but not a release (i.e. no sets into
310# ${RELEASEDIR}). "buildworld" enforces a build to ${DESTDIR} != / 310# ${RELEASEDIR}). "buildworld" enforces a build to ${DESTDIR} != /
311# 311#
312 312
313distribution buildworld: .PHONY .MAKE 313distribution buildworld: .PHONY .MAKE
314.if make(buildworld) && \ 314.if make(buildworld) && \
315 (!defined(DESTDIR) || ${DESTDIR} == "" || ${DESTDIR} == "/") 315 (!defined(DESTDIR) || ${DESTDIR} == "" || ${DESTDIR} == "/")
316 @echo "Won't make ${.TARGET} with DESTDIR=/" 316 @echo "Won't make ${.TARGET} with DESTDIR=/"
317 @false 317 @false
318.endif 318.endif
319 ${MAKEDIRTARGET} . build NOPOSTINSTALL=1 319 ${MAKEDIRTARGET} . build NOPOSTINSTALL=1
320 ${MAKEDIRTARGET} etc distribution INSTALL_DONE=1 320 ${MAKEDIRTARGET} etc distribution INSTALL_DONE=1
321.if defined(DESTDIR) && ${DESTDIR} != "" && ${DESTDIR} != "/" 321.if defined(DESTDIR) && ${DESTDIR} != "" && ${DESTDIR} != "/"
322 ${MAKEDIRTARGET} . postinstall-fix-obsolete 322 ${MAKEDIRTARGET} . postinstall-fix-obsolete
323 ${MAKEDIRTARGET} . postinstall-fix-obsolete_stand 323 ${MAKEDIRTARGET} . postinstall-fix-obsolete_stand
324 ${MAKEDIRTARGET} distrib/sets checkflist 324 ${MAKEDIRTARGET} distrib/sets checkflist
325.endif 325.endif
326 @echo "make ${.TARGET} started at: ${START_TIME}" 326 @echo "make ${.TARGET} started at: ${START_TIME}"
327 @printf "make ${.TARGET} finished at: " && date 327 @printf "make ${.TARGET} finished at: " && date
328 328
329# 329#
330# Install the distribution from $DESTDIR to $INSTALLWORLDDIR (defaults to `/') 330# Install the distribution from $DESTDIR to $INSTALLWORLDDIR (defaults to `/')
331# If installing to /, ensures that the host's operating system is NetBSD and 331# If installing to /, ensures that the host's operating system is NetBSD and
332# the host's `uname -m` == ${MACHINE}. 332# the host's `uname -m` == ${MACHINE}.
333# 333#
334 334
335HOST_UNAME_S!= uname -s 335HOST_UNAME_S!= uname -s
336HOST_UNAME_M!= uname -m 336HOST_UNAME_M!= uname -m
337 337
338installworld: .PHONY .MAKE 338installworld: .PHONY .MAKE
339.if (!defined(DESTDIR) || ${DESTDIR} == "" || ${DESTDIR} == "/") 339.if (!defined(DESTDIR) || ${DESTDIR} == "" || ${DESTDIR} == "/")
340 @echo "Can't make ${.TARGET} to DESTDIR=/" 340 @echo "Can't make ${.TARGET} to DESTDIR=/"
341 @false 341 @false
342.endif 342.endif
343.if !defined(INSTALLWORLDDIR) || \ 343.if !defined(INSTALLWORLDDIR) || \
344 ${INSTALLWORLDDIR} == "" || ${INSTALLWORLDDIR} == "/" 344 ${INSTALLWORLDDIR} == "" || ${INSTALLWORLDDIR} == "/"
345.if (${HOST_UNAME_S} != "NetBSD") 345.if (${HOST_UNAME_S} != "NetBSD")
346 @echo "Won't cross-make ${.TARGET} from ${HOST_UNAME_S} to NetBSD with INSTALLWORLDDIR=/" 346 @echo "Won't cross-make ${.TARGET} from ${HOST_UNAME_S} to NetBSD with INSTALLWORLDDIR=/"
347 @false 347 @false
348.endif 348.endif
349.if (${HOST_UNAME_M} != ${MACHINE}) 349.if (${HOST_UNAME_M} != ${MACHINE})
350 @echo "Won't cross-make ${.TARGET} from ${HOST_UNAME_M} to ${MACHINE} with INSTALLWORLDDIR=/" 350 @echo "Won't cross-make ${.TARGET} from ${HOST_UNAME_M} to ${MACHINE} with INSTALLWORLDDIR=/"
351 @false 351 @false
352.endif 352.endif
353.endif 353.endif
354 ${MAKEDIRTARGET} distrib/sets installsets \ 354 ${MAKEDIRTARGET} distrib/sets installsets \
355 INSTALLDIR=${INSTALLWORLDDIR:U/} INSTALLSETS=${INSTALLSETS:Q} 355 INSTALLDIR=${INSTALLWORLDDIR:U/} INSTALLSETS=${INSTALLSETS:Q}
356 ${MAKEDIRTARGET} . postinstall-check DESTDIR=${INSTALLWORLDDIR} 356 ${MAKEDIRTARGET} . postinstall-check DESTDIR=${INSTALLWORLDDIR}
357 @echo "make ${.TARGET} started at: ${START_TIME}" 357 @echo "make ${.TARGET} started at: ${START_TIME}"
358 @printf "make ${.TARGET} finished at: " && date 358 @printf "make ${.TARGET} finished at: " && date
359 359
360# 360#
361# Install modules from $DESTDIR to $INSTALLMODULESDIR 361# Install modules from $DESTDIR to $INSTALLMODULESDIR
362# 362#
363installmodules: .PHONY .MAKE 363installmodules: .PHONY .MAKE
364.if (!defined(DESTDIR) || ${DESTDIR} == "" || ${DESTDIR} == "/") 364.if (!defined(DESTDIR) || ${DESTDIR} == "" || ${DESTDIR} == "/")
365 @echo "Can't make ${.TARGET} to DESTDIR=/" 365 @echo "Can't make ${.TARGET} to DESTDIR=/"
366 @false 366 @false
367.endif 367.endif
368.if !defined(INSTALLMODULESDIR) || \ 368.if !defined(INSTALLMODULESDIR) || \
369 ${INSTALLMODULESDIR} == "" || ${INSTALLMODULESDIR} == "/" 369 ${INSTALLMODULESDIR} == "" || ${INSTALLMODULESDIR} == "/"
370.if (${HOST_UNAME_S} != "NetBSD") 370.if (${HOST_UNAME_S} != "NetBSD")
371 @echo "Won't cross-make ${.TARGET} from ${HOST_UNAME_S} to NetBSD with INSTALLMODULESDIR=/" 371 @echo "Won't cross-make ${.TARGET} from ${HOST_UNAME_S} to NetBSD with INSTALLMODULESDIR=/"
372 @false 372 @false
373.endif 373.endif
374.if (${HOST_UNAME_M} != ${MACHINE}) 374.if (${HOST_UNAME_M} != ${MACHINE})
375 @echo "Won't cross-make ${.TARGET} from ${HOST_UNAME_M} to ${MACHINE} with INSTALLMODULESDIR=/" 375 @echo "Won't cross-make ${.TARGET} from ${HOST_UNAME_M} to ${MACHINE} with INSTALLMODULESDIR=/"
376 @false 376 @false
377.endif 377.endif
378.endif 378.endif
379 ${MAKEDIRTARGET} sys/modules install DESTDIR=${INSTALLMODULESDIR:U/} 379 ${MAKEDIRTARGET} sys/modules install DESTDIR=${INSTALLMODULESDIR:U/}
380 @echo "make ${.TARGET} started at: ${START_TIME}" 380 @echo "make ${.TARGET} started at: ${START_TIME}"
381 @printf "make ${.TARGET} finished at: " && date 381 @printf "make ${.TARGET} finished at: " && date
382 382
383# 383#
384# Create sets from $DESTDIR or $NETBSDSRCDIR into $RELEASEDIR 384# Create sets from $DESTDIR or $NETBSDSRCDIR into $RELEASEDIR
385# 385#
386 386
387.for tgt in sets sourcesets syspkgs 387.for tgt in sets sourcesets syspkgs
388${tgt}: .PHONY .MAKE 388${tgt}: .PHONY .MAKE
389 ${MAKEDIRTARGET} distrib/sets ${tgt} 389 ${MAKEDIRTARGET} distrib/sets ${tgt}
390.endfor 390.endfor
391 391
392# 392#
393# Build a release or snapshot (implies "make distribution"). Note that 393# Build a release or snapshot (implies "make distribution"). Note that
394# in this case, the set lists will be checked before the tar files 394# in this case, the set lists will be checked before the tar files
395# are made. 395# are made.
396# 396#
397 397
398release snapshot: .PHONY .MAKE 398release snapshot: .PHONY .MAKE
399 ${MAKEDIRTARGET} . distribution 399 ${MAKEDIRTARGET} . distribution
400 ${MAKEDIRTARGET} etc release DISTRIBUTION_DONE=1 400 ${MAKEDIRTARGET} etc release DISTRIBUTION_DONE=1
401 @echo "make ${.TARGET} started at: ${START_TIME}" 401 @echo "make ${.TARGET} started at: ${START_TIME}"
402 @printf "make ${.TARGET} finished at: " && date 402 @printf "make ${.TARGET} finished at: " && date
403 403
404# 404#
405# Create a CD-ROM image. 405# Create a CD-ROM image.
406# 406#
407 407
408iso-image: .PHONY 408iso-image: .PHONY
409 ${MAKEDIRTARGET} distrib iso_image 409 ${MAKEDIRTARGET} distrib iso_image
410 ${MAKEDIRTARGET} etc iso-image 410 ${MAKEDIRTARGET} etc iso-image
411 @echo "make ${.TARGET} started at: ${START_TIME}" 411 @echo "make ${.TARGET} started at: ${START_TIME}"
412 @printf "make ${.TARGET} finished at: " && date 412 @printf "make ${.TARGET} finished at: " && date
413 413
414iso-image-source: .PHONY 414iso-image-source: .PHONY
415 ${MAKEDIRTARGET} distrib iso_image CDSOURCE=true 415 ${MAKEDIRTARGET} distrib iso_image CDSOURCE=true
416 ${MAKEDIRTARGET} etc iso-image 416 ${MAKEDIRTARGET} etc iso-image
417 @echo "make ${.TARGET} started at: ${START_TIME}" 417 @echo "make ${.TARGET} started at: ${START_TIME}"
418 @printf "make ${.TARGET} finished at: " && date 418 @printf "make ${.TARGET} finished at: " && date
419 419
420# 420#
421# Create bootable live images. 421# Create bootable live images.
422# 422#
423 423
424live-image: .PHONY 424live-image: .PHONY
425 ${MAKEDIRTARGET} etc live-image 425 ${MAKEDIRTARGET} etc live-image
426 @echo "make ${.TARGET} started at: ${START_TIME}" 426 @echo "make ${.TARGET} started at: ${START_TIME}"
427 @printf "make ${.TARGET} finished at: " && date 427 @printf "make ${.TARGET} finished at: " && date
428 428
429# 429#
430# Create bootable installation images. 430# Create bootable installation images.
431# 431#
432 432
433install-image: .PHONY 433install-image: .PHONY
434 ${MAKEDIRTARGET} etc install-image 434 ${MAKEDIRTARGET} etc install-image
435 @echo "make ${.TARGET} started at: ${START_TIME}" 435 @echo "make ${.TARGET} started at: ${START_TIME}"
436 @printf "make ${.TARGET} finished at: " && date 436 @printf "make ${.TARGET} finished at: " && date
437 437
438# 438#
439# Special components of the "make build" process. 439# Special components of the "make build" process.
440# 440#
441 441
442check-tools: .PHONY 442check-tools: .PHONY
443.if ${TOOLCHAIN_MISSING} != "no" && !defined(EXTERNAL_TOOLCHAIN) 443.if ${TOOLCHAIN_MISSING} != "no" && !defined(EXTERNAL_TOOLCHAIN)
444 @echo '*** WARNING: Building on MACHINE=${MACHINE} with missing toolchain.' 444 @echo '*** WARNING: Building on MACHINE=${MACHINE} with missing toolchain.'
445 @echo '*** May result in a failed build or corrupt binaries!' 445 @echo '*** May result in a failed build or corrupt binaries!'
446.elif defined(EXTERNAL_TOOLCHAIN) 446.elif defined(EXTERNAL_TOOLCHAIN)
447 @echo '*** Using external toolchain rooted at ${EXTERNAL_TOOLCHAIN}.' 447 @echo '*** Using external toolchain rooted at ${EXTERNAL_TOOLCHAIN}.'
448.endif 448.endif
449.if defined(NBUILDJOBS) 
450 @echo '*** WARNING: NBUILDJOBS is obsolete; use -j directly instead!' 
451.endif 
452 449
453# Delete or sanitise a leftover METALOG from a previous build. 450# Delete or sanitise a leftover METALOG from a previous build.
454clean_METALOG: .PHONY .MAKE 451clean_METALOG: .PHONY .MAKE
455.if ${MKUPDATE} != "no" 452.if ${MKUPDATE} != "no"
456 ${MAKEDIRTARGET} distrib/sets clean_METALOG 453 ${MAKEDIRTARGET} distrib/sets clean_METALOG
457.endif 454.endif
458 455
459do-distrib-dirs: .PHONY .MAKE 456do-distrib-dirs: .PHONY .MAKE
460.if !defined(DESTDIR) || ${DESTDIR} == "" 457.if !defined(DESTDIR) || ${DESTDIR} == ""
461 ${MAKEDIRTARGET} etc distrib-dirs DESTDIR=/ 458 ${MAKEDIRTARGET} etc distrib-dirs DESTDIR=/
462.else 459.else
463 ${MAKEDIRTARGET} etc distrib-dirs DESTDIR=${DESTDIR} 460 ${MAKEDIRTARGET} etc distrib-dirs DESTDIR=${DESTDIR}
464.endif 461.endif
465 462
466.for targ in cleandir obj includes 463.for targ in cleandir obj includes
467do-${targ}: .PHONY ${targ} 464do-${targ}: .PHONY ${targ}
468 @true 465 @true
469.endfor 466.endfor
470 467
471do-tools: .PHONY .MAKE 468do-tools: .PHONY .MAKE
472 ${MAKEDIRTARGET} tools build_install 469 ${MAKEDIRTARGET} tools build_install
473 470
474do-lib: .PHONY .MAKE 471do-lib: .PHONY .MAKE
475 ${MAKEDIRTARGET} lib build_install 472 ${MAKEDIRTARGET} lib build_install
476 473
477do-compat-lib: .PHONY .MAKE 474do-compat-lib: .PHONY .MAKE
478 ${MAKEDIRTARGET} compat build_install BOOTSTRAP_SUBDIRS="../../../lib" 475 ${MAKEDIRTARGET} compat build_install BOOTSTRAP_SUBDIRS="../../../lib"
479 476
480do-sanitizer: .PHONY .MAKE 477do-sanitizer: .PHONY .MAKE
481 ${MAKEDIRTARGET} external/bsd/compiler_rt build_install 478 ${MAKEDIRTARGET} external/bsd/compiler_rt build_install
482 479
483do-sanitizer-tools: .PHONY .MAKE 480do-sanitizer-tools: .PHONY .MAKE
484.if !exists(${TOOLDIR}/lib/clang) && ${HAVE_LLVM:Uno} == "yes" 481.if !exists(${TOOLDIR}/lib/clang) && ${HAVE_LLVM:Uno} == "yes"
485 mkdir -p ${TOOLDIR}/lib/clang 482 mkdir -p ${TOOLDIR}/lib/clang
486 cd ${DESTDIR}/usr/lib/clang && \ 483 cd ${DESTDIR}/usr/lib/clang && \
487 ${TOOL_PAX} -rw . ${TOOLDIR}/lib/clang 484 ${TOOL_PAX} -rw . ${TOOLDIR}/lib/clang
488.endif 485.endif
489 486
490do-top-obj: .PHONY .MAKE 487do-top-obj: .PHONY .MAKE
491 ${MAKEDIRTARGET} . obj NOSUBDIR= 488 ${MAKEDIRTARGET} . obj NOSUBDIR=
492 489
493do-tools-obj: .PHONY .MAKE 490do-tools-obj: .PHONY .MAKE
494 ${MAKEDIRTARGET} tools obj 491 ${MAKEDIRTARGET} tools obj
495 492
496do-build: .PHONY .MAKE 493do-build: .PHONY .MAKE
497.for targ in dependall install 494.for targ in dependall install
498 ${MAKEDIRTARGET} . ${targ} BUILD_tools=no BUILD_lib=no 495 ${MAKEDIRTARGET} . ${targ} BUILD_tools=no BUILD_lib=no
499.endfor 496.endfor
500 497
501do-x11: .PHONY .MAKE 498do-x11: .PHONY .MAKE
502.if ${MKX11} != "no" 499.if ${MKX11} != "no"
503 ${MAKEDIRTARGET} external/mit/xorg/tools all 500 ${MAKEDIRTARGET} external/mit/xorg/tools all
504 ${MAKEDIRTARGET} external/mit/xorg/lib build_install 501 ${MAKEDIRTARGET} external/mit/xorg/lib build_install
505.if ${MKCOMPATX11} != "no" 502.if ${MKCOMPATX11} != "no"
506 ${MAKEDIRTARGET} compat build_install BOOTSTRAP_SUBDIRS="../../../external/mit/xorg/lib" 503 ${MAKEDIRTARGET} compat build_install BOOTSTRAP_SUBDIRS="../../../external/mit/xorg/lib"
507.endif 504.endif
508.else 505.else
509 @echo "MKX11 is not enabled" 506 @echo "MKX11 is not enabled"
510 @false 507 @false
511.endif 508.endif
512 509
513do-obsolete: .PHONY .MAKE 510do-obsolete: .PHONY .MAKE
514 ${MAKEDIRTARGET} etc install-obsolete-lists 511 ${MAKEDIRTARGET} etc install-obsolete-lists
515 512
516# 513#
517# Speedup stubs for some subtrees that don't need to run these rules. 514# Speedup stubs for some subtrees that don't need to run these rules.
518# (Tells <bsd.subdir.mk> not to recurse for them.) 515# (Tells <bsd.subdir.mk> not to recurse for them.)
519# 516#
520 517
521.for dir in bin etc distrib games libexec regress sbin usr.bin usr.sbin tools 518.for dir in bin etc distrib games libexec regress sbin usr.bin usr.sbin tools
522includes-${dir}: .PHONY 519includes-${dir}: .PHONY
523 @true 520 @true
524.endfor 521.endfor
525.for dir in etc distrib regress 522.for dir in etc distrib regress
526install-${dir}: .PHONY 523install-${dir}: .PHONY
527 @true 524 @true
528.endfor 525.endfor
529 526
530# 527#
531# XXX this needs to change when distrib Makefiles are recursion compliant 528# XXX this needs to change when distrib Makefiles are recursion compliant
532# XXX many distrib subdirs need "cd etc && make snap_pre snap_kern" first... 529# XXX many distrib subdirs need "cd etc && make snap_pre snap_kern" first...
533# 530#
534dependall-distrib depend-distrib all-distrib: .PHONY 531dependall-distrib depend-distrib all-distrib: .PHONY
535 @true 532 @true
536 533
537.include <bsd.obj.mk> 534.include <bsd.obj.mk>
538.include <bsd.kernobj.mk> 535.include <bsd.kernobj.mk>
539.include <bsd.subdir.mk> 536.include <bsd.subdir.mk>
540.include <bsd.clean.mk> 537.include <bsd.clean.mk>

cvs diff -r1.141 -r1.142 src/doc/BUILDING.mdoc (switch to unified diff)

--- src/doc/BUILDING.mdoc 2023/06/05 22:36:17 1.141
+++ src/doc/BUILDING.mdoc 2023/06/11 10:43:51 1.142
@@ -1,2498 +1,2490 @@ @@ -1,2498 +1,2490 @@
1.\" $NetBSD: BUILDING.mdoc,v 1.141 2023/06/05 22:36:17 lukem Exp $ 1.\" $NetBSD: BUILDING.mdoc,v 1.142 2023/06/11 10:43:51 lukem Exp $
2.\" 2.\"
3.\" Copyright (c) 2001-2023 The NetBSD Foundation, Inc. 3.\" Copyright (c) 2001-2023 The NetBSD Foundation, Inc.
4.\" All rights reserved. 4.\" All rights reserved.
5.\" 5.\"
6.\" This code is derived from software contributed to The NetBSD Foundation 6.\" This code is derived from software contributed to The NetBSD Foundation
7.\" by Todd Vierling and Luke Mewburn. 7.\" by Todd Vierling and Luke Mewburn.
8.\" 8.\"
9.\" Redistribution and use in source and binary forms, with or without 9.\" Redistribution and use in source and binary forms, with or without
10.\" modification, are permitted provided that the following conditions 10.\" modification, are permitted provided that the following conditions
11.\" are met: 11.\" are met:
12.\" 1. Redistributions of source code must retain the above copyright 12.\" 1. Redistributions of source code must retain the above copyright
13.\" notice, this list of conditions and the following disclaimer. 13.\" notice, this list of conditions and the following disclaimer.
14.\" 2. Redistributions in binary form must reproduce the above copyright 14.\" 2. Redistributions in binary form must reproduce the above copyright
15.\" notice, this list of conditions and the following disclaimer in the 15.\" notice, this list of conditions and the following disclaimer in the
16.\" documentation and/or other materials provided with the distribution. 16.\" documentation and/or other materials provided with the distribution.
17.\" 17.\"
18.\" THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS 18.\" THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
19.\" ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED 19.\" ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
20.\" TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR 20.\" TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
21.\" PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS 21.\" PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
22.\" BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 22.\" BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
23.\" CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 23.\" CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
24.\" SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 24.\" SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
25.\" INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 25.\" INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
26.\" CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 26.\" CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
27.\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 27.\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
28.\" POSSIBILITY OF SUCH DAMAGE. 28.\" POSSIBILITY OF SUCH DAMAGE.
29.\" 29.\"
30.\" NOTE: After changing this file, run "make regen" in the src/doc 30.\" NOTE: After changing this file, run "make regen" in the src/doc
31.\" directory, and check in both src/BUILDING and src/doc/BUILDING.mdoc. 31.\" directory, and check in both src/BUILDING and src/doc/BUILDING.mdoc.
32.\" 32.\"
33.\" Toolchain prefix for commands 33.\" Toolchain prefix for commands
34.ds toolprefix nb 34.ds toolprefix nb
35. 35.
36.Dd June 5, 2023 36.Dd June 10, 2023
37.Dt BUILDING 8 37.Dt BUILDING 8
38.Os NetBSD 38.Os NetBSD
39.\" turn off hyphenation 39.\" turn off hyphenation
40.hym 999 40.hym 999
41. 41.
42.\" if this file is processed with real roff (doc.tmac) 42.\" if this file is processed with real roff (doc.tmac)
43.\" now that the tmac files have been lazily read, 43.\" now that the tmac files have been lazily read,
44.\" we can override ``quotes'' with "quotes" for ascii output 44.\" we can override ``quotes'' with "quotes" for ascii output
45.ie '\*[Lq]'``' \{\ 45.ie '\*[Lq]'``' \{\
46.ds Lq \*q 46.ds Lq \*q
47.ds Rq \*q 47.ds Rq \*q
48.\} 48.\}
49.\" and disable hyphenation 49.\" and disable hyphenation
50.nr hyphen-flags 0 50.nr hyphen-flags 0
51. 51.
52.Sh NAME 52.Sh NAME
53. 53.
54.Nm BUILDING 54.Nm BUILDING
55.Nd Procedure for building 55.Nd Procedure for building
56.Nx 56.Nx
57from source code 57from source code
58. 58.
59.Sh REQUIREMENTS 59.Sh REQUIREMENTS
60. 60.
61.Nx 61.Nx
62is designed to be buildable on most POSIX-compliant host systems. 62is designed to be buildable on most POSIX-compliant host systems.
63The basic build procedure is the same whether compiling 63The basic build procedure is the same whether compiling
64.Em natively 64.Em natively
65(on the same 65(on the same
66.Nx 66.Nx
67architecture) or 67architecture) or
68.Em cross compiling 68.Em cross compiling
69(on another architecture or OS). 69(on another architecture or OS).
70.Pp 70.Pp
71This source tree contains a special subtree, 71This source tree contains a special subtree,
72.Dq tools , 72.Dq tools ,
73which uses the host system to create a build toolchain for the target 73which uses the host system to create a build toolchain for the target
74architecture. 74architecture.
75The host system must have at least C and C++ 75The host system must have at least C and C++
76compilers in order to create the toolchain 76compilers in order to create the toolchain
77.Nm ( make 77.Nm ( make
78is not required); all other tools are created as part of the 78is not required); all other tools are created as part of the
79.Nx 79.Nx
80build process. 80build process.
81(See the 81(See the
82.Sx Environment variables 82.Sx Environment variables
83section below if you need 83section below if you need
84to override or manually select your compilers.) 84to override or manually select your compilers.)
85. 85.
86.Sh FILES 86.Sh FILES
87. 87.
88.Ss Source tree layout 88.Ss Source tree layout
89. 89.
90.Bl -tag -width "BUILDING.mdoc" 90.Bl -tag -width "BUILDING.mdoc"
91. 91.
92.It Pa BUILDING 92.It Pa BUILDING
93This document (in plaintext). 93This document (in plaintext).
94Generated from 94Generated from
95.Pa doc/BUILDING.mdoc . 95.Pa doc/BUILDING.mdoc .
96. 96.
97.It Pa Makefile 97.It Pa Makefile
98The main Makefile for 98The main Makefile for
99.Nx ; 99.Nx ;
100should only be run for native builds with an appropriately up-to-date 100should only be run for native builds with an appropriately up-to-date
101version of 101version of
102.Nx 102.Nx
103.Xr make 1 . 103.Xr make 1 .
104Intended for expert use with knowledge of its shortcomings, 104Intended for expert use with knowledge of its shortcomings,
105it has been superseded by the 105it has been superseded by the
106.Nm build.sh 106.Nm build.sh
107shell script as the recommended means for building 107shell script as the recommended means for building
108.Nx . 108.Nx .
109. 109.
110.It Pa UPDATING 110.It Pa UPDATING
111Special notes for updating from an earlier revision of 111Special notes for updating from an earlier revision of
112.Nx . 112.Nx .
113It is important to read this file before every build of an updated 113It is important to read this file before every build of an updated
114source tree. 114source tree.
115. 115.
116.It Pa build.sh 116.It Pa build.sh
117Bourne-compatible shell script used for building the host build tools 117Bourne-compatible shell script used for building the host build tools
118and the 118and the
119.Nx 119.Nx
120system from scratch. 120system from scratch.
121Can be used for both native and cross builds, and should be used instead of 121Can be used for both native and cross builds, and should be used instead of
122.Xr make 1 122.Xr make 1
123as it performs additional checks to prevent common issues going undetected, such 123as it performs additional checks to prevent common issues going undetected, such
124as building with an outdated version of 124as building with an outdated version of
125.Xr make 1 . 125.Xr make 1 .
126. 126.
127.It Pa crypto/dist/ , dist/ , gnu/dist/ 127.It Pa crypto/dist/ , dist/ , gnu/dist/
128Sources imported verbatim from third parties, without mangling the 128Sources imported verbatim from third parties, without mangling the
129existing build structure. 129existing build structure.
130Other source trees in 130Other source trees in
131.Sy bin 131.Sy bin
132through 132through
133.Sy usr.sbin 133.Sy usr.sbin
134use the 134use the
135.Nx 135.Nx
136.Xr make 1 136.Xr make 1
137.Dq reachover 137.Dq reachover
138Makefile semantics when building these programs for a native host. 138Makefile semantics when building these programs for a native host.
139. 139.
140.It Pa distrib/ , etc/ 140.It Pa distrib/ , etc/
141Sources for items used when making a full release snapshot, such as 141Sources for items used when making a full release snapshot, such as
142files installed in 142files installed in
143.Sy DESTDIR Ns Pa /etc 143.Sy DESTDIR Ns Pa /etc
144on the destination system, boot media, and release notes. 144on the destination system, boot media, and release notes.
145. 145.
146.It Pa doc/BUILDING.mdoc 146.It Pa doc/BUILDING.mdoc
147This document, in -mdoc troff format; the original copy. 147This document, in -mdoc troff format; the original copy.
148Used to generate 148Used to generate
149.Pa BUILDING . 149.Pa BUILDING .
150. 150.
151.It Pa external , sys/external 151.It Pa external , sys/external
152Sources and build infrastructure for components imported (mostly) unchanged 152Sources and build infrastructure for components imported (mostly) unchanged
153from upstream maintainers, sorted by applicable license. 153from upstream maintainers, sorted by applicable license.
154This is (slowly) replacing the 154This is (slowly) replacing the
155.Pa crypto/dist , 155.Pa crypto/dist ,
156.Pa dist , 156.Pa dist ,
157and 157and
158.Pa gnu/dist 158.Pa gnu/dist
159directories. 159directories.
160. 160.
161.It Pa external/mit/xorg/ 161.It Pa external/mit/xorg/
162.Dq Reachover 162.Dq Reachover
163build structure for modular Xorg; the source is in 163build structure for modular Xorg; the source is in
164.Sy X11SRCDIR . 164.Sy X11SRCDIR .
165. 165.
166.It Pa regress/ , tests/ 166.It Pa regress/ , tests/
167Regression test harness. 167Regression test harness.
168Can be cross-compiled, but only run natively. 168Can be cross-compiled, but only run natively.
169.Pa tests/ 169.Pa tests/
170uses the 170uses the
171.Xr atf 7 171.Xr atf 7
172test framework; 172test framework;
173.Pa regress/ 173.Pa regress/
174contains older tests that have not yet been migrated to 174contains older tests that have not yet been migrated to
175.Xr atf 7 . 175.Xr atf 7 .
176. 176.
177.It Pa sys/ 177.It Pa sys/
178.Nx 178.Nx
179kernel sources. 179kernel sources.
180. 180.
181.It Pa tools/ 181.It Pa tools/
182.Dq Reachover 182.Dq Reachover
183build structure for the host build tools. 183build structure for the host build tools.
184This has a special method of determining out-of-date status. 184This has a special method of determining out-of-date status.
185. 185.
186.It Pa tools/compat/README 186.It Pa tools/compat/README
187Special notes for cross-hosting a NetBSD build on non-NetBSD platforms. 187Special notes for cross-hosting a NetBSD build on non-NetBSD platforms.
188. 188.
189.It Other directories including Pa bin/ ... usr.sbin/ 189.It Other directories including Pa bin/ ... usr.sbin/
190Sources to the 190Sources to the
191.Nx 191.Nx
192userland (non-kernel) programs. 192userland (non-kernel) programs.
193If any of these directories are missing, they will be skipped during the build. 193If any of these directories are missing, they will be skipped during the build.
194. 194.
195.El 195.El
196. 196.
197.Ss Build tree layout 197.Ss Build tree layout
198. 198.
199The 199The
200.Nx 200.Nx
201build tree is described in 201build tree is described in
202.Xr hier 7 , 202.Xr hier 7 ,
203and the release layout is described in 203and the release layout is described in
204.Xr release 7 . 204.Xr release 7 .
205. 205.
206.Sh CONFIGURATION 206.Sh CONFIGURATION
207. 207.
208.Ss Environment variables 208.Ss Environment variables
209. 209.
210.de DFLT 210.de DFLT
211.Pp 211.Pp
212.Em Default : 212.Em Default :
213.. 213..
214.de DFLTn 214.de DFLTn
215.DFLT 215.DFLT
216.Dq no 216.Dq no
217.. 217..
218.de DFLTu 218.de DFLTu
219.DFLT 219.DFLT
220Unset. 220Unset.
221.. 221..
222.de DFLTy 222.de DFLTy
223.DFLT 223.DFLT
224.Dq yes 224.Dq yes
225.. 225..
226.de NODEF 226.de NODEF
227.Pp 227.Pp
228Forced to 228Forced to
229.Dq no 229.Dq no
230if 230if
231.Sy \\$* 231.Sy \\$*
232is defined, 232is defined,
233usually in the Makefile before any 233usually in the Makefile before any
234.Xr make 1 234.Xr make 1
235.Cm \&.include 235.Cm \&.include
236directives. 236directives.
237.. 237..
238.de NOVAR 238.de NOVAR
239.Pp 239.Pp
240Forced to 240Forced to
241.Dq no 241.Dq no
242if 242if
243.Sy \\$* . 243.Sy \\$* .
244.. 244..
245.de YorN 245.de YorN
246Can be set to 246Can be set to
247.Dq yes 247.Dq yes
248or 248or
249.Dq no . 249.Dq no .
250.. 250..
251. 251.
252Several environment variables control the behaviour of 252Several environment variables control the behaviour of
253.Nx 253.Nx
254builds. 254builds.
255. 255.
256.Bl -tag -width 14n 256.Bl -tag -width 14n
257. 257.
258.\" These entries are sorted alphabetically. 258.\" These entries are sorted alphabetically.
259. 259.
260.It Sy HOST_CC 260.It Sy HOST_CC
261Path name to C compiler used to create the toolchain. 261Path name to C compiler used to create the toolchain.
262. 262.
263.It Sy HOST_CFLAGS 263.It Sy HOST_CFLAGS
264Flags passed to the host C compiler. 264Flags passed to the host C compiler.
265. 265.
266.It Sy HOST_CXX 266.It Sy HOST_CXX
267Path name to C++ compiler used to create the toolchain. 267Path name to C++ compiler used to create the toolchain.
268. 268.
269.It Sy HOST_CXXFLAGS 269.It Sy HOST_CXXFLAGS
270Flags passed to the host C++ compiler. 270Flags passed to the host C++ compiler.
271. 271.
272.It Sy HOST_SH 272.It Sy HOST_SH
273Path name to a shell available on the host system 273Path name to a shell available on the host system
274and suitable for use during the build. 274and suitable for use during the build.
275The 275The
276.Nx 276.Nx
277build system requires a modern Bourne-like shell 277build system requires a modern Bourne-like shell
278with POSIX-compliant features, 278with POSIX-compliant features,
279and also requires support for the 279and also requires support for the
280.Dq local 280.Dq local
281keyword to declare local variables in shell functions 281keyword to declare local variables in shell functions
282(which is a widely-implemented but non-standardised feature). 282(which is a widely-implemented but non-standardised feature).
283.Pp 283.Pp
284Depending on the host system, a suitable shell may be 284Depending on the host system, a suitable shell may be
285.Pa /bin/sh , 285.Pa /bin/sh ,
286.Pa /usr/xpg4/bin/sh , 286.Pa /usr/xpg4/bin/sh ,
287.Pa /bin/ksh 287.Pa /bin/ksh
288(provided it is a variant of ksh that supports the 288(provided it is a variant of ksh that supports the
289.Dq local 289.Dq local
290keyword, 290keyword,
291such as ksh88, but not ksh93), 291such as ksh88, but not ksh93),
292or 292or
293.Pa /usr/local/bin/bash . 293.Pa /usr/local/bin/bash .
294.Pp 294.Pp
295Most parts of the build require 295Most parts of the build require
296.Sy HOST_SH 296.Sy HOST_SH
297to be an absolute path; however, 297to be an absolute path; however,
298.Nm build.sh 298.Nm build.sh
299allows it to be a simple command name, which will be converted 299allows it to be a simple command name, which will be converted
300to an absolute path by searching the 300to an absolute path by searching the
301.Sy PATH . 301.Sy PATH .
302. 302.
303.It Sy INSTALLBOOT_UBOOT_PATHS 303.It Sy INSTALLBOOT_UBOOT_PATHS
304A colon-separated list of search paths used by 304A colon-separated list of search paths used by
305.Xr installboot 8 305.Xr installboot 8
306to find U-Boot packages. 306to find U-Boot packages.
307. 307.
308.It Sy MACHINE 308.It Sy MACHINE
309Machine type, e.g., 309Machine type, e.g.,
310.Dq macppc . 310.Dq macppc .
311. 311.
312.It Sy MACHINE_ARCH 312.It Sy MACHINE_ARCH
313Machine architecture, e.g., 313Machine architecture, e.g.,
314.Dq powerpc . 314.Dq powerpc .
315. 315.
316.It Sy MAKE 316.It Sy MAKE
317Path name to invoke 317Path name to invoke
318.Xr make 1 318.Xr make 1
319as. 319as.
320. 320.
321.It Sy MAKECONF 321.It Sy MAKECONF
322The name of the 322The name of the
323.Xr make 1 323.Xr make 1
324configuration file. 324configuration file.
325See 325See
326.Sx \*qmake\*q variables 326.Sx \*qmake\*q variables
327and 327and
328.Xr mk.conf 5 . 328.Xr mk.conf 5 .
329.Pp 329.Pp
330.Em Note : 330.Em Note :
331Only settable in the process environment. 331Only settable in the process environment.
332.DFLT 332.DFLT
333.Dq /etc/mk.conf 333.Dq /etc/mk.conf
334. 334.
335.It Sy MAKEFLAGS 335.It Sy MAKEFLAGS
336Flags to invoke 336Flags to invoke
337.Xr make 1 337.Xr make 1
338with. 338with.
339.Pp 339.Pp
340.Em Note : 340.Em Note :
341.Sy build.sh 341.Sy build.sh
342ignores the value of 342ignores the value of
343.Sy MAKEFLAGS 343.Sy MAKEFLAGS
344passed in the environment, but allows 344passed in the environment, but allows
345.Sy MAKEFLAGS 345.Sy MAKEFLAGS
346to be set via the 346to be set via the
347.Fl V 347.Fl V
348option. 348option.
349. 349.
350.It Sy MAKEOBJDIR 350.It Sy MAKEOBJDIR
351Directory to use as the 351Directory to use as the
352.Sy .OBJDIR 352.Sy .OBJDIR
353for the current directory. 353for the current directory.
354The value is subjected to variable expansion by 354The value is subjected to variable expansion by
355.Xr make 1 . 355.Xr make 1 .
356Typical usage is to set this variable to a value involving the use of 356Typical usage is to set this variable to a value involving the use of
357.Sq ${.CURDIR:S...} 357.Sq ${.CURDIR:S...}
358or 358or
359.Sq ${.CURDIR:C...} , 359.Sq ${.CURDIR:C...} ,
360to derive the value of 360to derive the value of
361.Sy .OBJDIR 361.Sy .OBJDIR
362from the value of 362from the value of
363.Sy .CURDIR . 363.Sy .CURDIR .
364Used only if 364Used only if
365.Sy MAKEOBJDIRPREFIX 365.Sy MAKEOBJDIRPREFIX
366is not defined. 366is not defined.
367.Pp 367.Pp
368.Em Note : 368.Em Note :
369.Sy MAKEOBJDIR 369.Sy MAKEOBJDIR
370can be provided only in the environment or via the 370can be provided only in the environment or via the
371.Fl O 371.Fl O
372flag of 372flag of
373.Nm build.sh ; 373.Nm build.sh ;
374it cannot usefully be set inside a Makefile, including in 374it cannot usefully be set inside a Makefile, including in
375.Xr mk.conf 5 375.Xr mk.conf 5
376or 376or
377.Sy MAKECONF . 377.Sy MAKECONF .
378. 378.
379.It Sy MAKEOBJDIRPREFIX 379.It Sy MAKEOBJDIRPREFIX
380Top level directory of the object directory tree. 380Top level directory of the object directory tree.
381The value is subjected to variable expansion by 381The value is subjected to variable expansion by
382.Xr make 1 . 382.Xr make 1 .
383.Sy build.sh 383.Sy build.sh
384will create the 384will create the
385${MAKEOBJDIRPREFIX} 385${MAKEOBJDIRPREFIX}
386directory if necessary, but if 386directory if necessary, but if
387.Xr make 1 387.Xr make 1
388is used without 388is used without
389.Sy build.sh , 389.Sy build.sh ,
390then rules in 390then rules in
391.Aq bsd.obj.mk 391.Aq bsd.obj.mk
392will abort the build if the 392will abort the build if the
393${MAKEOBJDIRPREFIX} 393${MAKEOBJDIRPREFIX}
394directory does not exist. 394directory does not exist.
395If the value is defined and valid, then 395If the value is defined and valid, then
396${MAKEOBJDIRPREFIX}/${.CURDIR} 396${MAKEOBJDIRPREFIX}/${.CURDIR}
397is used as the 397is used as the
398.Sy .OBJDIR 398.Sy .OBJDIR
399for the current directory. 399for the current directory.
400The current directory may be read only. 400The current directory may be read only.
401.Pp 401.Pp
402.Em Note : 402.Em Note :
403.Sy MAKEOBJDIRPREFIX 403.Sy MAKEOBJDIRPREFIX
404can be provided only in the environment or via the 404can be provided only in the environment or via the
405.Fl M 405.Fl M
406flag of 406flag of
407.Nm build.sh ; 407.Nm build.sh ;
408it cannot usefully be set inside a Makefile, including in 408it cannot usefully be set inside a Makefile, including in
409.Xr mk.conf 5 409.Xr mk.conf 5
410or 410or
411.Sy MAKECONF . 411.Sy MAKECONF .
412. 412.
413.It Sy TMPDIR 413.It Sy TMPDIR
414Top-level directory to store temporary directories used by 414Top-level directory to store temporary directories used by
415.Sy build.sh 415.Sy build.sh
416before paths to other directories such as 416before paths to other directories such as
417.Sy .OBJDIR 417.Sy .OBJDIR
418can be determined. 418can be determined.
419.Pp 419.Pp
420.Em Note : 420.Em Note :
421Must support execution of binaries. 421Must support execution of binaries.
422I.e., without 422I.e., without
423.Xr mount 8 Ns 's 423.Xr mount 8 Ns 's
424.Fl o 424.Fl o
425.Sy noexec 425.Sy noexec
426option. 426option.
427.DFLT 427.DFLT
428.Dq /tmp . 428.Dq /tmp .
429. 429.
430.El 430.El
431. 431.
432.Ss \*qmake\*q variables 432.Ss \*qmake\*q variables
433. 433.
434Several variables control the behavior of 434Several variables control the behavior of
435.Nx 435.Nx
436builds. 436builds.
437Unless otherwise specified, these variables may be set in 437Unless otherwise specified, these variables may be set in
438either the process environment or the 438either the process environment or the
439.Xr make 1 439.Xr make 1
440configuration file 440configuration file
441.Xr mk.conf 5 441.Xr mk.conf 5
442specified by 442specified by
443.Sy MAKECONF . 443.Sy MAKECONF .
444.Pp 444.Pp
445This list is not comprehensive; 445This list is not comprehensive;
446all supported variables and their defaults are documented in 446all supported variables and their defaults are documented in
447.Xr mk.conf 5 . 447.Xr mk.conf 5 .
448. 448.
449.Bl -tag -width 14n 449.Bl -tag -width 14n
450. 450.
451.\" These entries are sorted alphabetically. 451.\" These entries are sorted alphabetically.
452.\" Keep in sync with canonical reference share/man/man5/mk.conf.5 452.\" Keep in sync with canonical reference share/man/man5/mk.conf.5
453.\" and with share/mk/bsd.README. 453.\" and with share/mk/bsd.README.
454. 454.
455.It Sy BSDOBJDIR 455.It Sy BSDOBJDIR
456The real path to the object directory tree for the 456The real path to the object directory tree for the
457.Nx 457.Nx
458source tree. 458source tree.
459.DFLT 459.DFLT
460.Dq Pa /usr/obj 460.Dq Pa /usr/obj
461. 461.
462.It Sy BSDSRCDIR 462.It Sy BSDSRCDIR
463The real path to the 463The real path to the
464.Nx 464.Nx
465source tree, if 465source tree, if
466.Sy NETBSDSRCDIR 466.Sy NETBSDSRCDIR
467isn't defined. 467isn't defined.
468.DFLT 468.DFLT
469.Dq Pa /usr/src 469.Dq Pa /usr/src
470. 470.
471.It Sy BUILDID 471.It Sy BUILDID
472Identifier for the build. 472Identifier for the build.
473If set, this should be a short string that is suitable for use as 473If set, this should be a short string that is suitable for use as
474part of a file or directory name. 474part of a file or directory name.
475The identifier will be appended to 475The identifier will be appended to
476object directory names, and can be consulted in the 476object directory names, and can be consulted in the
477.Xr make 1 477.Xr make 1
478configuration file in order to set additional build parameters, 478configuration file in order to set additional build parameters,
479such as compiler flags. 479such as compiler flags.
480It will also be used as part of the kernel version string, 480It will also be used as part of the kernel version string,
481which can be shown by 481which can be shown by
482.Dq Li uname \-v . 482.Dq Li uname \-v .
483.DFLTu 483.DFLTu
484. 484.
485.It Sy BUILDINFO 485.It Sy BUILDINFO
486Optional multi-line string containing information about the build. 486Optional multi-line string containing information about the build.
487This will appear in 487This will appear in
488.Sy DESTDIR Ns Pa /etc/release , 488.Sy DESTDIR Ns Pa /etc/release ,
489and it will be stored in the 489and it will be stored in the
490.Va buildinfo 490.Va buildinfo
491variable in any kernels that are built. 491variable in any kernels that are built.
492When such kernels are booted, the 492When such kernels are booted, the
493.Xr sysctl 7 493.Xr sysctl 7
494.Va kern.buildinfo 494.Va kern.buildinfo
495variable will report this value. 495variable will report this value.
496The string may contain backslash escape sequences, such as 496The string may contain backslash escape sequences, such as
497.Dq "\e\e" 497.Dq "\e\e"
498(representing a backslash character) 498(representing a backslash character)
499and 499and
500.Dq "\en" 500.Dq "\en"
501(representing a newline). 501(representing a newline).
502.DFLTu 502.DFLTu
503. 503.
504.It Sy BUILDSEED 504.It Sy BUILDSEED
505.Xr g++ 1 505.Xr g++ 1
506uses random numbers when compiling C++ code. 506uses random numbers when compiling C++ code.
507This variable seeds the 507This variable seeds the
508.Xr g++ 1 508.Xr g++ 1
509random number generator using 509random number generator using
510.Fl frandom-seed 510.Fl frandom-seed
511with this value. 511with this value.
512By default, it is set to 512By default, it is set to
513.Do NetBSD-( Ns Em majorversion ) Dc . 513.Do NetBSD-( Ns Em majorversion ) Dc .
514Using a fixed value causes C++ binaries to be the same when 514Using a fixed value causes C++ binaries to be the same when
515built from the same sources, resulting in identical (reproducible) builds. 515built from the same sources, resulting in identical (reproducible) builds.
516Additional information is available in the 516Additional information is available in the
517.Xr g++ 1 517.Xr g++ 1
518documentation of 518documentation of
519.Fl frandom-seed . 519.Fl frandom-seed .
520.DFLTu 520.DFLTu
521. 521.
522.It Sy CPUFLAGS 522.It Sy CPUFLAGS
523Additional flags to the compiler/assembler to select 523Additional flags to the compiler/assembler to select
524CPU instruction set options, CPU tuning options, etc. 524CPU instruction set options, CPU tuning options, etc.
525.DFLTu 525.DFLTu
526. 526.
527.It Sy DESTDIR 527.It Sy DESTDIR
528Directory to contain the built 528Directory to contain the built
529.Nx 529.Nx
530system. 530system.
531If set, special options are passed to the compilation tools to 531If set, special options are passed to the compilation tools to
532prevent their default use of the host system's 532prevent their default use of the host system's
533.Pa /usr/include , /usr/lib , 533.Pa /usr/include , /usr/lib ,
534and so forth. 534and so forth.
535This pathname must be an absolute path, and should 535This pathname must be an absolute path, and should
536.Em not 536.Em not
537end with a slash 537end with a slash
538.Pq / 538.Pq /
539character. 539character.
540(For installation into the system's root directory, set 540(For installation into the system's root directory, set
541.Sy DESTDIR 541.Sy DESTDIR
542to an empty string, not to 542to an empty string, not to
543.Dq / ) . 543.Dq / ) .
544The directory must reside on a file system which supports long file 544The directory must reside on a file system which supports long file
545names and hard links. 545names and hard links.
546.Pp 546.Pp
547.Em Note : 547.Em Note :
548.Sy build.sh 548.Sy build.sh
549will provide a default of 549will provide a default of
550.Pa destdir . Ns Sy MACHINE 550.Pa destdir . Ns Sy MACHINE
551(in the top-level 551(in the top-level
552.Sy .OBJDIR ) 552.Sy .OBJDIR )
553unless run in 553unless run in
554.Sq expert 554.Sq expert
555mode. 555mode.
556.DFLT 556.DFLT
557Empty string if 557Empty string if
558.Sy USETOOLS 558.Sy USETOOLS
559is 559is
560.Dq yes ; 560.Dq yes ;
561unset otherwise. 561unset otherwise.
562. 562.
563.It Sy EXTERNAL_TOOLCHAIN 563.It Sy EXTERNAL_TOOLCHAIN
564If defined, this variable indicates the root directory of 564If defined, this variable indicates the root directory of
565an external toolchain which will be used to build the tree. 565an external toolchain which will be used to build the tree.
566For example, if a platform is a 566For example, if a platform is a
567.Sy TOOLCHAIN_MISSING 567.Sy TOOLCHAIN_MISSING
568platform, 568platform,
569.Sy EXTERNAL_TOOLCHAIN 569.Sy EXTERNAL_TOOLCHAIN
570can be used to re-enable the cross-compile framework. 570can be used to re-enable the cross-compile framework.
571.Pp 571.Pp
572If 572If
573.Sy EXTERNAL_TOOLCHAIN 573.Sy EXTERNAL_TOOLCHAIN
574is defined, act as 574is defined, act as
575.Sy MKGCC=no , 575.Sy MKGCC=no ,
576since the external version of the compiler may not be 576since the external version of the compiler may not be
577able to build the library components of the in-tree compiler. 577able to build the library components of the in-tree compiler.
578.Pp 578.Pp
579This variable should be used in conjunction with an appropriate 579This variable should be used in conjunction with an appropriate
580.Sy HAVE_GCC 580.Sy HAVE_GCC
581or 581or
582.Sy HAVE_LLVM 582.Sy HAVE_LLVM
583setting to control the compiler flags. 583setting to control the compiler flags.
584.Pp 584.Pp
585.Em Note : 585.Em Note :
586This variable is not yet used in as many places as it should be. 586This variable is not yet used in as many places as it should be.
587Expect the exact semantics of this variable to change in the short 587Expect the exact semantics of this variable to change in the short
588term as parts of the cross-compile framework continue to be cleaned up. 588term as parts of the cross-compile framework continue to be cleaned up.
589.DFLTu 589.DFLTu
590. 590.
591.It Sy MAKEVERBOSE 591.It Sy MAKEVERBOSE
592Level of verbosity of status messages. 592Level of verbosity of status messages.
593Supported values: 593Supported values:
594.Bl -tag -width 2n 594.Bl -tag -width 2n
595.It 0 595.It 0
596No descriptive messages or commands executed by 596No descriptive messages or commands executed by
597.Xr make 1 597.Xr make 1
598are shown. 598are shown.
599.It 1 599.It 1
600Brief messages are shown describing what is being done, 600Brief messages are shown describing what is being done,
601but the actual commands executed by 601but the actual commands executed by
602.Xr make 1 602.Xr make 1
603are not shown. 603are not shown.
604.It 2 604.It 2
605Descriptive messages are shown as above (prefixed with a 605Descriptive messages are shown as above (prefixed with a
606.Sq # ) , 606.Sq # ) ,
607and ordinary commands performed by 607and ordinary commands performed by
608.Xr make 1 608.Xr make 1
609are shown. 609are shown.
610.It 3 610.It 3
611In addition to the above, all commands performed by 611In addition to the above, all commands performed by
612.Xr make 1 612.Xr make 1
613are shown, even if they would ordinarily have been hidden 613are shown, even if they would ordinarily have been hidden
614through use of the 614through use of the
615.Dq \&@ 615.Dq \&@
616prefix in the relevant makefile. 616prefix in the relevant makefile.
617.It 4 617.It 4
618In addition to the above, commands executed by 618In addition to the above, commands executed by
619.Xr make 1 619.Xr make 1
620are traced through use of the 620are traced through use of the
621.Xr sh 1 621.Xr sh 1
622.Dq Fl x 622.Dq Fl x
623flag. 623flag.
624.El 624.El
625.DFLT 625.DFLT
6262 6262
627. 627.
628.It Sy MKCATPAGES 628.It Sy MKCATPAGES
629.YorN 629.YorN
630Indicates whether preformatted plaintext manual pages will be created 630Indicates whether preformatted plaintext manual pages will be created
631and installed. 631and installed.
632.NOVAR MKMAN=no No or Sy MKSHARE=no 632.NOVAR MKMAN=no No or Sy MKSHARE=no
633.DFLTn 633.DFLTn
634. 634.
635.It Sy MKCROSSGDB 635.It Sy MKCROSSGDB
636.YorN 636.YorN
637Create a cross-gdb as a host tool. 637Create a cross-gdb as a host tool.
638.DFLTn 638.DFLTn
639. 639.
640.It Sy MKDEBUG 640.It Sy MKDEBUG
641.YorN 641.YorN
642Indicates whether debug information should be generated for 642Indicates whether debug information should be generated for
643all userland binaries. 643all userland binaries.
644The result is collected as an additional 644The result is collected as an additional
645.Sy debug.tgz 645.Sy debug.tgz
646and 646and
647.Sy xdebug.tgz 647.Sy xdebug.tgz
648set and installed in 648set and installed in
649.Sy DESTDIR Ns Pa /usr/libdata/debug . 649.Sy DESTDIR Ns Pa /usr/libdata/debug .
650.NODEF NODEBUG 650.NODEF NODEBUG
651.DFLTn 651.DFLTn
652. 652.
653.It Sy MKDEBUGKERNEL 653.It Sy MKDEBUGKERNEL
654.YorN 654.YorN
655Indicates whether debugging symbols will be built for kernels 655Indicates whether debugging symbols will be built for kernels
656by default; pretend as if 656by default; pretend as if
657.Em makeoptions DEBUG="-g" 657.Em makeoptions DEBUG="-g"
658is specified in kernel configuration files. 658is specified in kernel configuration files.
659This will also put the debug kernel 659This will also put the debug kernel
660.Pa netbsd.gdb 660.Pa netbsd.gdb
661in the kernel sets. 661in the kernel sets.
662See 662See
663.Xr options 4 663.Xr options 4
664for details. 664for details.
665This is useful if a cross-gdb is built as well (see 665This is useful if a cross-gdb is built as well (see
666.Sy MKCROSSGDB ) . 666.Sy MKCROSSGDB ) .
667.DFLTn 667.DFLTn
668. 668.
669.It Sy MKDEBUGLIB 669.It Sy MKDEBUGLIB
670.YorN 670.YorN
671Indicates whether debug libraries 671Indicates whether debug libraries
672.Sy ( lib*_g.a ) 672.Sy ( lib*_g.a )
673will be built and installed. 673will be built and installed.
674Debug libraries are compiled with 674Debug libraries are compiled with
675.Dq Li -g -DDEBUG . 675.Dq Li -g -DDEBUG .
676.NODEF NODEBUGLIB 676.NODEF NODEBUGLIB
677.DFLTn 677.DFLTn
678. 678.
679.It Sy MKDEBUGTOOLS 679.It Sy MKDEBUGTOOLS
680.YorN 680.YorN
681Indicates whether debug information 681Indicates whether debug information
682.Sy ( lib*_g.a ) 682.Sy ( lib*_g.a )
683will be included in the build toolchain. 683will be included in the build toolchain.
684.DFLTn 684.DFLTn
685. 685.
686.It Sy MKDOC 686.It Sy MKDOC
687.YorN 687.YorN
688Indicates whether system documentation destined for 688Indicates whether system documentation destined for
689.Sy DESTDIR Ns Pa /usr/share/doc 689.Sy DESTDIR Ns Pa /usr/share/doc
690will be installed. 690will be installed.
691.NODEF NODOC 691.NODEF NODOC
692.NOVAR MKSHARE=no 692.NOVAR MKSHARE=no
693.DFLTy 693.DFLTy
694. 694.
695.It Sy MKHOSTOBJ 695.It Sy MKHOSTOBJ
696.YorN 696.YorN
697If set to 697If set to
698.Dq yes , 698.Dq yes ,
699then for programs intended to be run on the compile host, 699then for programs intended to be run on the compile host,
700the name, release, and architecture of the host operating system 700the name, release, and architecture of the host operating system
701will be suffixed to the name of the object directory created by 701will be suffixed to the name of the object directory created by
702.Dq make obj . 702.Dq make obj .
703(This allows multiple host systems to compile NetBSD for a single target.) 703(This allows multiple host systems to compile NetBSD for a single target.)
704If set to 704If set to
705.Dq no , 705.Dq no ,
706then programs built to be run on the compile host will use the same 706then programs built to be run on the compile host will use the same
707object directory names as programs built to be run on the target. 707object directory names as programs built to be run on the target.
708.DFLTn 708.DFLTn
709. 709.
710.It Sy MKHTML 710.It Sy MKHTML
711.YorN 711.YorN
712Indicates whether the HTML manual pages are created and installed. 712Indicates whether the HTML manual pages are created and installed.
713and installed 713and installed
714.NODEF NOHTML 714.NODEF NOHTML
715.NOVAR MKMAN=no No or Sy MKSHARE=no 715.NOVAR MKMAN=no No or Sy MKSHARE=no
716.DFLTy 716.DFLTy
717. 717.
718.It Sy MKINFO 718.It Sy MKINFO
719.YorN 719.YorN
720Indicates whether GNU Info files, used for the documentation for 720Indicates whether GNU Info files, used for the documentation for
721most of the compilation tools, will be built and installed. 721most of the compilation tools, will be built and installed.
722.NODEF NOINFO 722.NODEF NOINFO
723.NOVAR MKSHARE=no 723.NOVAR MKSHARE=no
724.DFLTy 724.DFLTy
725. 725.
726.It Sy MKKDEBUG 726.It Sy MKKDEBUG
727Deprecated, use 727Deprecated, use
728.Sy MKDEBUGKERNEL . 728.Sy MKDEBUGKERNEL .
729. 729.
730.It Sy MKKMOD 730.It Sy MKKMOD
731.YorN 731.YorN
732Indicates whether kernel modules are built and installed. 732Indicates whether kernel modules are built and installed.
733.DFLTn 733.DFLTn
734on 734on
735.Sy or1k ; 735.Sy or1k ;
736.Dq yes 736.Dq yes
737on other platforms. 737on other platforms.
738. 738.
739.It Sy MKLINKLIB 739.It Sy MKLINKLIB
740.YorN 740.YorN
741Indicates whether all of the shared library infrastructure 741Indicates whether all of the shared library infrastructure
742will be built and installed. 742will be built and installed.
743If 743If
744.Dq no , 744.Dq no ,
745prevents: 745prevents:
746installation of the 746installation of the
747.Sy *.a 747.Sy *.a
748libraries, 748libraries,
749installation of the 749installation of the
750.Sy *_pic.a 750.Sy *_pic.a
751libraries on PIC systems, 751libraries on PIC systems,
752building of 752building of
753.Sy *.a 753.Sy *.a
754libraries on PIC systems, 754libraries on PIC systems,
755or 755or
756installation of 756installation of
757.Sy .so 757.Sy .so
758symlinks on ELF systems. 758symlinks on ELF systems.
759.NODEF NOLINKLIB 759.NODEF NOLINKLIB
760.Pp 760.Pp
761If 761If
762.Dq no , 762.Dq no ,
763acts as 763acts as
764.Sy MKLINT=no MKPICINSTALL=no MKPROFILE=no . 764.Sy MKLINT=no MKPICINSTALL=no MKPROFILE=no .
765.DFLTy 765.DFLTy
766. 766.
767.It Sy MKLINT 767.It Sy MKLINT
768.YorN 768.YorN
769Indicates whether 769Indicates whether
770.Xr lint 1 770.Xr lint 1
771will be run against portions of the 771will be run against portions of the
772.Nx 772.Nx
773source code during the build, and whether lint libraries will be 773source code during the build, and whether lint libraries will be
774installed into 774installed into
775.Sy DESTDIR Ns Pa /usr/libdata/lint . 775.Sy DESTDIR Ns Pa /usr/libdata/lint .
776.NODEF NOLINT 776.NODEF NOLINT
777.NOVAR MKLINKLIB=no 777.NOVAR MKLINKLIB=no
778.DFLTn 778.DFLTn
779. 779.
780.It Sy MKMAN 780.It Sy MKMAN
781.YorN 781.YorN
782Indicates whether manual pages will be installed. 782Indicates whether manual pages will be installed.
783.NODEF NOMAN 783.NODEF NOMAN
784.NOVAR MKSHARE=no 784.NOVAR MKSHARE=no
785.Pp 785.Pp
786If 786If
787.Dq no , 787.Dq no ,
788acts as 788acts as
789.Sy MKCATPAGES=no MKHTML=no . 789.Sy MKCATPAGES=no MKHTML=no .
790.DFLTy 790.DFLTy
791. 791.
792.It Sy MKNLS 792.It Sy MKNLS
793.YorN 793.YorN
794Indicates whether Native Language System (NLS) locale zone files will be 794Indicates whether Native Language System (NLS) locale zone files will be
795built and installed. 795built and installed.
796.NODEF NONLS 796.NODEF NONLS
797.NOVAR MKSHARE=no 797.NOVAR MKSHARE=no
798.DFLTy 798.DFLTy
799. 799.
800.It Sy MKOBJ 800.It Sy MKOBJ
801.YorN 801.YorN
802Indicates whether object directories will be created when running 802Indicates whether object directories will be created when running
803.Dq make obj . 803.Dq make obj .
804If set to 804If set to
805.Dq no , 805.Dq no ,
806then all built files will be located inside the regular source tree. 806then all built files will be located inside the regular source tree.
807.NODEF NOOBJ 807.NODEF NOOBJ
808.Pp 808.Pp
809If 809If
810.Dq no , 810.Dq no ,
811acts as 811acts as
812.Sy MKOBJDIRS=no . 812.Sy MKOBJDIRS=no .
813.Pp 813.Pp
814.Em Note : 814.Em Note :
815Setting 815Setting
816.Sy MKOBJ 816.Sy MKOBJ
817to 817to
818.Dq no 818.Dq no
819is not recommended and may cause problems when updating the tree with 819is not recommended and may cause problems when updating the tree with
820.Xr cvs 1 . 820.Xr cvs 1 .
821.DFLTy 821.DFLTy
822. 822.
823.It Sy MKOBJDIRS 823.It Sy MKOBJDIRS
824.YorN 824.YorN
825Indicates whether object directories will be created automatically 825Indicates whether object directories will be created automatically
826(via a 826(via a
827.Dq make obj 827.Dq make obj
828pass) at the start of a build. 828pass) at the start of a build.
829.NOVAR MKOBJ=no 829.NOVAR MKOBJ=no
830.DFLTn 830.DFLTn
831. 831.
832.It Sy MKPIC 832.It Sy MKPIC
833.YorN 833.YorN
834Indicates whether shared objects and libraries will be created and 834Indicates whether shared objects and libraries will be created and
835installed. 835installed.
836If 836If
837.Dq no , 837.Dq no ,
838the entire built system will be statically linked. 838the entire built system will be statically linked.
839.NODEF NOPIC 839.NODEF NOPIC
840.Pp 840.Pp
841If 841If
842.Dq no , 842.Dq no ,
843acts as 843acts as
844.Sy MKPICLIB=no . 844.Sy MKPICLIB=no .
845.DFLTn 845.DFLTn
846on 846on
847.Sy m68000 ; 847.Sy m68000 ;
848.Dq yes 848.Dq yes
849on other platforms. 849on other platforms.
850. 850.
851.It Sy MKPICINSTALL 851.It Sy MKPICINSTALL
852.YorN 852.YorN
853Indicates whether the 853Indicates whether the
854.Xr ar 1 854.Xr ar 1
855format libraries 855format libraries
856.Sy ( lib*_pic.a ) , 856.Sy ( lib*_pic.a ) ,
857used to generate shared libraries, are installed. 857used to generate shared libraries, are installed.
858.NODEF NOPICINSTALL 858.NODEF NOPICINSTALL
859.NOVAR MKLINKLIB=no 859.NOVAR MKLINKLIB=no
860.DFLTn 860.DFLTn
861. 861.
862.It Sy MKPROFILE 862.It Sy MKPROFILE
863.YorN 863.YorN
864Indicates whether profiled libraries 864Indicates whether profiled libraries
865.Sy ( lib*_p.a ) 865.Sy ( lib*_p.a )
866will be built and installed. 866will be built and installed.
867.NODEF NOPROFILE 867.NODEF NOPROFILE
868.NOVAR MKLINKLIB=no 868.NOVAR MKLINKLIB=no
869.DFLTn 869.DFLTn
870on 870on
871.Sy or1k , 871.Sy or1k ,
872.Sy riscv32 , 872.Sy riscv32 ,
873and 873and
874.Sy riscv64 874.Sy riscv64
875(due to toolchain problems with profiled code); 875(due to toolchain problems with profiled code);
876.Dq yes 876.Dq yes
877on other platforms. 877on other platforms.
878. 878.
879.It Sy MKREPRO 879.It Sy MKREPRO
880.YorN 880.YorN
881Indicates whether builds are to be reproducible. 881Indicates whether builds are to be reproducible.
882If 882If
883.Dq yes , 883.Dq yes ,
884two builds from the same source tree will produce the same build 884two builds from the same source tree will produce the same build
885results. 885results.
886.Pp 886.Pp
887Used as the default for 887Used as the default for
888.Sy MKARZERO . 888.Sy MKARZERO .
889.Pp 889.Pp
890.\" Note: This paragraph is not in share/man/man5/mk.conf.5. 890.\" Note: This paragraph is not in share/man/man5/mk.conf.5.
891This may be set to 891This may be set to
892.Dq yes 892.Dq yes
893by giving 893by giving
894.Sy build.sh 894.Sy build.sh
895the 895the
896.Fl P 896.Fl P
897option. 897option.
898.DFLTn 898.DFLTn
899.YorN 899.YorN
900. 900.
901.It Sy MKREPRO_TIMESTAMP 901.It Sy MKREPRO_TIMESTAMP
902Unix timestamp. 902Unix timestamp.
903When 903When
904.Sy MKREPRO 904.Sy MKREPRO
905is set, the timestamp of all files in the sets will be set 905is set, the timestamp of all files in the sets will be set
906to this value. 906to this value.
907.Pp 907.Pp
908.\" Note: This paragraph is not in share/man/man5/mk.conf.5. 908.\" Note: This paragraph is not in share/man/man5/mk.conf.5.
909This may be set automatically to the latest source tree timestamp 909This may be set automatically to the latest source tree timestamp
910using 910using
911.Xr cvslatest 1 911.Xr cvslatest 1
912by giving 912by giving
913.Sy build.sh 913.Sy build.sh
914the 914the
915.Fl P 915.Fl P
916option. 916option.
917.DFLTu 917.DFLTu
918. 918.
919.It Sy MKSHARE 919.It Sy MKSHARE
920.YorN 920.YorN
921Indicates whether files destined to reside in 921Indicates whether files destined to reside in
922.Sy DESTDIR Ns Pa /usr/share 922.Sy DESTDIR Ns Pa /usr/share
923will be built and installed. 923will be built and installed.
924.NODEF NOSHARE 924.NODEF NOSHARE
925.Pp 925.Pp
926If 926If
927.Dq no , 927.Dq no ,
928acts as 928acts as
929.Sy MKCATPAGES=no MKDOC=no MKINFO=no MKHTML=no MKMAN=no MKNLS=no . 929.Sy MKCATPAGES=no MKDOC=no MKINFO=no MKHTML=no MKMAN=no MKNLS=no .
930.DFLTy 930.DFLTy
931. 931.
932.It Sy MKSTRIPIDENT 932.It Sy MKSTRIPIDENT
933.YorN 933.YorN
934Indicates whether RCS IDs, for use with 934Indicates whether RCS IDs, for use with
935.Xr ident 1 , 935.Xr ident 1 ,
936should be stripped from program binaries and shared libraries. 936should be stripped from program binaries and shared libraries.
937.DFLTn 937.DFLTn
938. 938.
939.It Sy MKSTRIPSYM 939.It Sy MKSTRIPSYM
940.YorN 940.YorN
941Indicates whether all local symbols should be stripped from shared libraries. 941Indicates whether all local symbols should be stripped from shared libraries.
942If 942If
943.Dq yes , 943.Dq yes ,
944strip all local symbols from shared libraries; 944strip all local symbols from shared libraries;
945the affect is equivalent to the 945the affect is equivalent to the
946.Fl x 946.Fl x
947option of 947option of
948.Xr ld 1 . 948.Xr ld 1 .
949If 949If
950.Dq no , 950.Dq no ,
951strip only temporary local symbols; the affect is equivalent 951strip only temporary local symbols; the affect is equivalent
952to the 952to the
953.Fl X 953.Fl X
954option of 954option of
955.Xr ld 1 . 955.Xr ld 1 .
956Keeping non-temporary local symbols 956Keeping non-temporary local symbols
957such as static function names is useful on using DTrace for 957such as static function names is useful on using DTrace for
958userland libraries and getting a backtrace from a rump kernel 958userland libraries and getting a backtrace from a rump kernel
959loading shared libraries. 959loading shared libraries.
960.DFLTy 960.DFLTy
961. 961.
962.It Sy MKUNPRIVED 962.It Sy MKUNPRIVED
963.YorN 963.YorN
964Indicates whether an unprivileged install will occur. 964Indicates whether an unprivileged install will occur.
965The user, group, permissions, and file flags, will not be set on 965The user, group, permissions, and file flags, will not be set on
966the installed items; instead the information will be appended to 966the installed items; instead the information will be appended to
967a file called 967a file called
968.Pa METALOG 968.Pa METALOG
969in 969in
970.Sy DESTDIR . 970.Sy DESTDIR .
971The contents of 971The contents of
972.Pa METALOG 972.Pa METALOG
973are used during the generation of the distribution tar files to ensure 973are used during the generation of the distribution tar files to ensure
974that the appropriate file ownership is stored. 974that the appropriate file ownership is stored.
975.DFLTn 975.DFLTn
976. 976.
977.It Sy MKUPDATE 977.It Sy MKUPDATE
978.YorN 978.YorN
979Indicates whether all install operations intended to write to 979Indicates whether all install operations intended to write to
980.Sy DESTDIR 980.Sy DESTDIR
981will compare file timestamps before installing, and skip the install 981will compare file timestamps before installing, and skip the install
982phase if the destination files are up-to-date. 982phase if the destination files are up-to-date.
983.Pp 983.Pp
984.\" Note: This paragraph is not in share/man/man5/mk.conf.5. 984.\" Note: This paragraph is not in share/man/man5/mk.conf.5.
985.Em Note : 985.Em Note :
986This also has implications on full builds (see next subsection). 986This also has implications on full builds (see next subsection).
987.DFLTn 987.DFLTn
988. 988.
989.It Sy MKX11 989.It Sy MKX11
990.YorN 990.YorN
991Indicates whether X11 is built and installed from 991Indicates whether X11 is built and installed from
992.Sy X11SRCDIR , 992.Sy X11SRCDIR ,
993and whether the X sets will be created. 993and whether the X sets will be created.
994.Pp 994.Pp
995.Em Note : 995.Em Note :
996If 996If
997.Dq yes , 997.Dq yes ,
998requires 998requires
999.Sy MKINET6=yes . 999.Sy MKINET6=yes .
1000.DFLTn 1000.DFLTn
1001. 1001.
1002.It Sy NETBSDSRCDIR 1002.It Sy NETBSDSRCDIR
1003The path to the top level of the 1003The path to the top level of the
1004.Nx 1004.Nx
1005sources. 1005sources.
1006.DFLT 1006.DFLT
1007Top level of the 1007Top level of the
1008.Nx 1008.Nx
1009source tree (as determined by the presence of 1009source tree (as determined by the presence of
1010.Pa build.sh 1010.Pa build.sh
1011and 1011and
1012.Pa tools/ ) 1012.Pa tools/ )
1013if 1013if
1014.Xr make 1 1014.Xr make 1
1015is run from within that tree; 1015is run from within that tree;
1016otherwise 1016otherwise
1017.Sy BSDSRCDIR 1017.Sy BSDSRCDIR
1018will be used. 1018will be used.
1019. 1019.
1020.It Sy TOOLCHAIN_MISSING 1020.It Sy TOOLCHAIN_MISSING
1021.YorN 1021.YorN
1022If not 1022If not
1023.Dq no , 1023.Dq no ,
1024this indicates that the platform 1024this indicates that the platform
1025.Dq Sy MACHINE_ARCH 1025.Dq Sy MACHINE_ARCH
1026being built does not have a working in-tree toolchain. 1026being built does not have a working in-tree toolchain.
1027.Pp 1027.Pp
1028If not 1028If not
1029.Dq no , 1029.Dq no ,
1030acts as 1030acts as
1031.Sy MKBINUTILS=no MKGCC=no MKGDB=no . 1031.Sy MKBINUTILS=no MKGCC=no MKGDB=no .
1032.DFLTn 1032.DFLTn
1033. 1033.
1034.It Sy TOOLDIR 1034.It Sy TOOLDIR
1035Directory to hold the host tools, once built. 1035Directory to hold the host tools, once built.
1036If specified, must be an absolute path. 1036If specified, must be an absolute path.
1037This directory should be unique to a given host system and 1037This directory should be unique to a given host system and
1038.Nx 1038.Nx
1039source tree. 1039source tree.
1040(However, multiple targets may share the same 1040(However, multiple targets may share the same
1041.Sy TOOLDIR ; 1041.Sy TOOLDIR ;
1042the target-dependent files have unique names.) If unset, a default based 1042the target-dependent files have unique names.) If unset, a default based
1043on the 1043on the
1044.Xr uname 1 1044.Xr uname 1
1045information of the host platform will be created in the 1045information of the host platform will be created in the
1046.Sy .OBJDIR 1046.Sy .OBJDIR
1047of 1047of
1048.Pa src . 1048.Pa src .
1049.DFLTu 1049.DFLTu
1050. 1050.
1051.It Sy USETOOLS 1051.It Sy USETOOLS
1052.YorN 1052.YorN
1053Indicates whether the tools specified by 1053Indicates whether the tools specified by
1054.Sy TOOLDIR 1054.Sy TOOLDIR
1055should be used as part of a build in progress. 1055should be used as part of a build in progress.
1056Must be set to 1056Must be set to
1057.Dq yes 1057.Dq yes
1058if cross-compiling. 1058if cross-compiling.
1059.Bl -tag -width "never" 1059.Bl -tag -width "never"
1060.It yes 1060.It yes
1061Use the tools from 1061Use the tools from
1062.Sy TOOLDIR . 1062.Sy TOOLDIR .
1063.It no 1063.It no
1064Do not use the tools from 1064Do not use the tools from
1065.Sy TOOLDIR , 1065.Sy TOOLDIR ,
1066but refuse to build native compilation tool components that are 1066but refuse to build native compilation tool components that are
1067version-specific for that tool. 1067version-specific for that tool.
1068.It never 1068.It never
1069Do not use the tools from 1069Do not use the tools from
1070.Sy TOOLDIR , 1070.Sy TOOLDIR ,
1071even when building native tool components. 1071even when building native tool components.
1072This is similar to the traditional 1072This is similar to the traditional
1073.Nx 1073.Nx
1074build method, but does 1074build method, but does
1075.Em not 1075.Em not
1076verify that the compilation tools in use are up-to-date enough in order 1076verify that the compilation tools in use are up-to-date enough in order
1077to build the tree successfully. 1077to build the tree successfully.
1078This may cause build or runtime problems when building the whole 1078This may cause build or runtime problems when building the whole
1079.Nx 1079.Nx
1080source tree. 1080source tree.
1081.El 1081.El
1082.DFLTn 1082.DFLTn
1083when using 1083when using
1084.Aq bsd.*.mk 1084.Aq bsd.*.mk
1085outside the 1085outside the
1086.Nx 1086.Nx
1087source tree (detected automatically) or if 1087source tree (detected automatically) or if
1088.Sy TOOLCHAIN_MISSING=yes ; 1088.Sy TOOLCHAIN_MISSING=yes ;
1089.Dq yes 1089.Dq yes
1090otherwise. 1090otherwise.
1091. 1091.
1092.It Sy X11SRCDIR 1092.It Sy X11SRCDIR
1093Directory containing the modular Xorg source. 1093Directory containing the modular Xorg source.
1094If specified, must be an absolute path. 1094If specified, must be an absolute path.
1095The main modular Xorg source is found in 1095The main modular Xorg source is found in
1096.Sy X11SRCDIR Ns Pa /external/mit . 1096.Sy X11SRCDIR Ns Pa /external/mit .
1097.DFLT 1097.DFLT
1098.Sy NETBSDSRCDIR Ns Pa /../xsrc , 1098.Sy NETBSDSRCDIR Ns Pa /../xsrc ,
1099if that exists; otherwise 1099if that exists; otherwise
1100.Pa /usr/xsrc . 1100.Pa /usr/xsrc .
1101. 1101.
1102.El 1102.El
1103. 1103.
1104.Ss \*qmake\*q variables for full builds 1104.Ss \*qmake\*q variables for full builds
1105. 1105.
1106These variables only affect the top level 1106These variables only affect the top level
1107.Dq Makefile 1107.Dq Makefile
1108and do not affect manually building subtrees of the 1108and do not affect manually building subtrees of the
1109.Nx 1109.Nx
1110source code. 1110source code.
1111. 1111.
1112.Bl -tag -width 14n 1112.Bl -tag -width 14n
1113. 1113.
1114.\" These entries are sorted alphabetically. 1114.\" These entries are sorted alphabetically.
1115. 1115.
1116.It Sy INSTALLBOOT_BOARDS 1116.It Sy INSTALLBOOT_BOARDS
1117A list of boards to create bootable images for. 1117A list of boards to create bootable images for.
1118If corresponding U-Boot packages are installed, 1118If corresponding U-Boot packages are installed,
1119bootable images are created as part of a release. 1119bootable images are created as part of a release.
1120See the 1120See the
1121.Bk -words 1121.Bk -words
1122.Fl o Sy board= Ns Ar name 1122.Fl o Sy board= Ns Ar name
1123.Ek 1123.Ek
1124option of 1124option of
1125.Xr installboot 8 . 1125.Xr installboot 8 .
1126. 1126.
1127.It Sy INSTALLWORLDDIR 1127.It Sy INSTALLWORLDDIR
1128Location for the 1128Location for the
1129.Dq make installworld 1129.Dq make installworld
1130target to install to. 1130target to install to.
1131If specified, must be an absolute path. 1131If specified, must be an absolute path.
1132.DFLT 1132.DFLT
1133.Dq / 1133.Dq /
1134. 1134.
1135.It Sy MKOBJDIRS 1135.It Sy MKOBJDIRS
1136.YorN 1136.YorN
1137Indicates whether object directories will be created automatically 1137Indicates whether object directories will be created automatically
1138(via a 1138(via a
1139.Dq make obj 1139.Dq make obj
1140pass) at the start of a build. 1140pass) at the start of a build.
1141.DFLTn 1141.DFLTn
1142.Pp 1142.Pp
1143If using 1143If using
1144.Sy build.sh , 1144.Sy build.sh ,
1145the default is 1145the default is
1146.Dq yes . 1146.Dq yes .
1147This may be set back to 1147This may be set back to
1148.Dq no 1148.Dq no
1149by giving 1149by giving
1150.Sy build.sh 1150.Sy build.sh
1151the 1151the
1152.Fl o 1152.Fl o
1153option. 1153option.
1154. 1154.
1155.It Sy MKUPDATE 1155.It Sy MKUPDATE
1156.YorN 1156.YorN
1157If set, then in addition to the effects described for 1157If set, then in addition to the effects described for
1158.Sy MKUPDATE=yes 1158.Sy MKUPDATE=yes
1159above, this implies the effects of 1159above, this implies the effects of
1160.Sy NOCLEANDIR 1160.Sy NOCLEANDIR
1161(i.e., 1161(i.e.,
1162.Dq make cleandir 1162.Dq make cleandir
1163is avoided). 1163is avoided).
1164.DFLTn 1164.DFLTn
1165.Pp 1165.Pp
1166If using 1166If using
1167.Sy build.sh , 1167.Sy build.sh ,
1168this may be set by giving the 1168this may be set by giving the
1169.Fl u 1169.Fl u
1170option. 1170option.
1171. 1171.
1172.It Sy NBUILDJOBS 
1173Now obsolete. 
1174Use the 
1175.Xr make 1 
1176option 
1177.Fl j , 
1178instead. 
1179See below. 
1180.DFLTu 
1181. 
1182.It Sy NOCLEANDIR 1172.It Sy NOCLEANDIR
1183If set, avoids the 1173If set, avoids the
1184.Dq make cleandir 1174.Dq make cleandir
1185phase of a full build. 1175phase of a full build.
1186This has the effect of allowing only changed 1176This has the effect of allowing only changed
1187files in a source tree to be recompiled. 1177files in a source tree to be recompiled.
1188This can speed up builds when updating only a few files in the tree. 1178This can speed up builds when updating only a few files in the tree.
1189.DFLTu 1179.DFLTu
1190.Pp 1180.Pp
1191See also 1181See also
1192.Sy MKUPDATE . 1182.Sy MKUPDATE .
1193. 1183.
1194.It Sy NODISTRIBDIRS 1184.It Sy NODISTRIBDIRS
1195If set, avoids the 1185If set, avoids the
1196.Dq make distrib-dirs 1186.Dq make distrib-dirs
1197phase of a full build. 1187phase of a full build.
1198This skips running 1188This skips running
1199.Xr mtree 8 1189.Xr mtree 8
1200on 1190on
1201.Sy DESTDIR , 1191.Sy DESTDIR ,
1202useful on systems where building as an unprivileged user, or where it is 1192useful on systems where building as an unprivileged user, or where it is
1203known that the system-wide mtree files have not changed. 1193known that the system-wide mtree files have not changed.
1204.DFLTu 1194.DFLTu
1205. 1195.
1206.It Sy NOINCLUDES 1196.It Sy NOINCLUDES
1207If set, avoids the 1197If set, avoids the
1208.Dq make includes 1198.Dq make includes
1209phase of a full build. 1199phase of a full build.
1210This has the effect of preventing 1200This has the effect of preventing
1211.Xr make 1 1201.Xr make 1
1212from thinking that some programs are out-of-date simply because the 1202from thinking that some programs are out-of-date simply because the
1213system include files have changed. 1203system include files have changed.
1214However, this option should not be used when updating the entire 1204However, this option should not be used when updating the entire
1215.Nx 1205.Nx
1216source tree arbitrarily; it is suggested to use 1206source tree arbitrarily; it is suggested to use
1217.Sy MKUPDATE=yes 1207.Sy MKUPDATE=yes
1218instead in that case. 1208instead in that case.
1219.DFLTu 1209.DFLTu
1220. 1210.
1221.It Sy RELEASEDIR 1211.It Sy RELEASEDIR
1222If set, specifies the directory to which a 1212If set, specifies the directory to which a
1223.Xr release 7 1213.Xr release 7
1224layout will be written at the end of a 1214layout will be written at the end of a
1225.Dq make release . 1215.Dq make release .
1226If specified, must be an absolute path. 1216If specified, must be an absolute path.
1227.Pp 1217.Pp
1228.Em Note : 1218.Em Note :
1229.Sy build.sh 1219.Sy build.sh
1230will provide a default of 1220will provide a default of
1231.Pa releasedir 1221.Pa releasedir
1232(in the top-level 1222(in the top-level
1233.Sy .OBJDIR ) 1223.Sy .OBJDIR )
1234unless run in 1224unless run in
1235.Sq expert 1225.Sq expert
1236mode. 1226mode.
1237.DFLTu 1227.DFLTu
1238. 1228.
1239.El 1229.El
1240. 1230.
1241.Sh BUILDING 1231.Sh BUILDING
1242. 1232.
1243.Ss \*qmake\*q command line options 1233.Ss \*qmake\*q command line options
1244This is not a summary of all the options available to 1234This is not a summary of all the options available to
1245.Xr make 1 ; 1235.Xr make 1 ;
1246only the options used most frequently with 1236only the options used most frequently with
1247.Nx 1237.Nx
1248builds are listed here. 1238builds are listed here.
1249. 1239.
1250.Bl -tag -width "var=value" 1240.Bl -tag -width "var=value"
1251. 1241.
1252.It Fl j Ar njob 1242.It Fl j Ar njob
1253Run up to 1243Run up to
1254.Ar njob 1244.Ar njob
1255.Xr make 1 1245.Xr make 1
1256subjobs in parallel. 1246subjobs in parallel.
1257Makefiles should use .WAIT or have explicit dependencies 1247Makefiles should use .WAIT or have explicit dependencies
1258as necessary to enforce build ordering. 1248as necessary to enforce build ordering.
1259. 1249.
1260.It Fl m Ar dir 1250.It Fl m Ar dir
1261Specify the default directory for searching for system Makefile 1251Specify the default directory for searching for system Makefile
1262segments, mainly the 1252segments, mainly the
1263.Aq bsd.*.mk 1253.Aq bsd.*.mk
1264files. 1254files.
1265When building any full 1255When building any full
1266.Nx 1256.Nx
1267source tree, this should be set to the 1257source tree, this should be set to the
1268.Dq Pa share/mk 1258.Dq Pa share/mk
1269directory in the source tree. 1259directory in the source tree.
1270This is set automatically when building from the top level, or when using 1260This is set automatically when building from the top level, or when using
1271.Sy build.sh . 1261.Sy build.sh .
1272. 1262.
1273.It Fl n 1263.It Fl n
1274Show the commands that would have been executed, but do not 1264Show the commands that would have been executed, but do not
1275actually execute them. 1265actually execute them.
1276This will still cause recursion to take place. 1266This will still cause recursion to take place.
1277. 1267.
1278.It Fl V Ar var 1268.It Fl V Ar var
1279Show 1269Show
1280.Xr make 1 Ns 's 1270.Xr make 1 Ns 's
1281idea of the value of 1271idea of the value of
1282.Ar var . 1272.Ar var .
1283Does not build any targets. 1273Does not build any targets.
1284. 1274.
1285.It Ar var Ns Sy = Ns Ar value 1275.It Ar var Ns Sy = Ns Ar value
1286Set the variable 1276Set the variable
1287.Ar var 1277.Ar var
1288to 1278to
1289.Ar value , 1279.Ar value ,
1290overriding any setting specified by the process environment, the 1280overriding any setting specified by the process environment, the
1291.Sy MAKECONF 1281.Sy MAKECONF
1292configuration file, or the system Makefile segments. 1282configuration file, or the system Makefile segments.
1293. 1283.
1294.El 1284.El
1295. 1285.
1296.Ss \*qmake\*q targets 1286.Ss \*qmake\*q targets
1297. 1287.
1298These default targets may be built by running 1288These default targets may be built by running
1299.Xr make 1 1289.Xr make 1
1300in any subtree of the 1290in any subtree of the
1301.Nx 1291.Nx
1302source code. 1292source code.
1303It is recommended that none of these be used from the top 1293It is recommended that none of these be used from the top
1304level Makefile; as a specific exception, 1294level Makefile; as a specific exception,
1305.Dq make obj 1295.Dq make obj
1306and 1296and
1307.Dq make cleandir 1297.Dq make cleandir
1308are useful in that context. 1298are useful in that context.
1309. 1299.
1310.Bl -tag -width "dependall" 1300.Bl -tag -width "dependall"
1311. 1301.
1312.It Sy all 1302.It Sy all
1313Build programs, libraries, and preformatted documentation. 1303Build programs, libraries, and preformatted documentation.
1314. 1304.
1315.It Sy clean 1305.It Sy clean
1316Remove program and library object code files. 1306Remove program and library object code files.
1317. 1307.
1318.It Sy cleandir 1308.It Sy cleandir
1319Same as 1309Same as
1320.Sy clean , 1310.Sy clean ,
1321but also remove preformatted documentation, dependency files generated 1311but also remove preformatted documentation, dependency files generated
1322by 1312by
1323.Dq make depend , 1313.Dq make depend ,
1324and any other files known to be created at build time. 1314and any other files known to be created at build time.
1325. 1315.
1326.It Sy depend 1316.It Sy depend
1327Create dependency files 1317Create dependency files
1328.Sy ( .depend ) 1318.Sy ( .depend )
1329containing more detailed information about the dependencies of source 1319containing more detailed information about the dependencies of source
1330code on header files. 1320code on header files.
1331Allows programs to be recompiled automatically when a dependency changes. 1321Allows programs to be recompiled automatically when a dependency changes.
1332. 1322.
1333.It Sy dependall 1323.It Sy dependall
1334Does a 1324Does a
1335.Dq make depend 1325.Dq make depend
1336immediately followed by a 1326immediately followed by a
1337.Dq make all . 1327.Dq make all .
1338This improves cache locality of the build since both passes read the source 1328This improves cache locality of the build since both passes read the source
1339files in their entirety. 1329files in their entirety.
1340. 1330.
1341.It Sy distclean 1331.It Sy distclean
1342Synonym for 1332Synonym for
1343.Sy cleandir . 1333.Sy cleandir .
1344. 1334.
1345.It Sy includes 1335.It Sy includes
1346Build and install system header files. 1336Build and install system header files.
1347Typically needed before any system libraries or programs can be built. 1337Typically needed before any system libraries or programs can be built.
1348. 1338.
1349.It Sy install 1339.It Sy install
1350Install programs, libraries, and documentation into 1340Install programs, libraries, and documentation into
1351.Sy DESTDIR . 1341.Sy DESTDIR .
1352Few files will be installed to 1342Few files will be installed to
1353.Sy DESTDIR Ns Pa /dev , 1343.Sy DESTDIR Ns Pa /dev ,
1354.Sy DESTDIR Ns Pa /etc , 1344.Sy DESTDIR Ns Pa /etc ,
1355.Sy DESTDIR Ns Pa /root 1345.Sy DESTDIR Ns Pa /root
1356or 1346or
1357.Sy DESTDIR Ns Pa /var 1347.Sy DESTDIR Ns Pa /var
1358in order to prevent user supplied configuration data from being overwritten. 1348in order to prevent user supplied configuration data from being overwritten.
1359.It Sy lint 1349.It Sy lint
1360Run 1350Run
1361.Xr lint 1 1351.Xr lint 1
1362against the C source code, where appropriate, and generate 1352against the C source code, where appropriate, and generate
1363system-installed lint libraries. 1353system-installed lint libraries.
1364. 1354.
1365.It Sy obj 1355.It Sy obj
1366Create object directories to be used for built files, instead of 1356Create object directories to be used for built files, instead of
1367building directly in the source tree. 1357building directly in the source tree.
1368. 1358.
1369.It Sy tags 1359.It Sy tags
1370Create 1360Create
1371.Xr ctags 1 1361.Xr ctags 1
1372searchable function lists usable by the 1362searchable function lists usable by the
1373.Xr ex 1 1363.Xr ex 1
1374and 1364and
1375.Xr vi 1 1365.Xr vi 1
1376text editors. 1366text editors.
1377. 1367.
1378.El 1368.El
1379. 1369.
1380.Ss \*qmake\*q targets for the top level 1370.Ss \*qmake\*q targets for the top level
1381. 1371.
1382Additional 1372Additional
1383.Xr make 1 1373.Xr make 1
1384targets are usable specifically from the top source level to facilitate 1374targets are usable specifically from the top source level to facilitate
1385building the entire 1375building the entire
1386.Nx 1376.Nx
1387source tree. 1377source tree.
1388. 1378.
1389.Bl -tag -width "distribution" 1379.Bl -tag -width "distribution"
1390. 1380.
1391.It Sy build 1381.It Sy build
1392Build the entire 1382Build the entire
1393.Nx 1383.Nx
1394system (except the kernel). 1384system (except the kernel).
1395This orders portions of the source tree such that prerequisites 1385This orders portions of the source tree such that prerequisites
1396will be built in the proper order. 1386will be built in the proper order.
1397. 1387.
1398.It Sy distribution 1388.It Sy distribution
1399Do a 1389Do a
1400.Dq make build , 1390.Dq make build ,
1401and then install a full distribution (which does not include a kernel) into 1391and then install a full distribution (which does not include a kernel) into
1402.Sy DESTDIR , 1392.Sy DESTDIR ,
1403including files in 1393including files in
1404.Sy DESTDIR Ns Pa /dev , 1394.Sy DESTDIR Ns Pa /dev ,
1405.Sy DESTDIR Ns Pa /etc , 1395.Sy DESTDIR Ns Pa /etc ,
1406.Sy DESTDIR Ns Pa /root 1396.Sy DESTDIR Ns Pa /root
1407and 1397and
1408.Sy DESTDIR Ns Pa /var . 1398.Sy DESTDIR Ns Pa /var .
1409. 1399.
1410.It Sy buildworld 1400.It Sy buildworld
1411As per 1401As per
1412.Dq make distribution , 1402.Dq make distribution ,
1413except that it ensures that 1403except that it ensures that
1414.Sy DESTDIR 1404.Sy DESTDIR
1415is not the root directory. 1405is not the root directory.
1416. 1406.
1417.It Sy installworld 1407.It Sy installworld
1418Install the distribution from 1408Install the distribution from
1419.Sy DESTDIR 1409.Sy DESTDIR
1420to 1410to
1421.Sy INSTALLWORLDDIR , 1411.Sy INSTALLWORLDDIR ,
1422which defaults to the root directory. 1412which defaults to the root directory.
1423Ensures that 1413Ensures that
1424.Sy INSTALLWORLDDIR 1414.Sy INSTALLWORLDDIR
1425is not the root directory if cross compiling. 1415is not the root directory if cross compiling.
1426.Pp 1416.Pp
1427The 1417The
1428.Sy INSTALLSETS 1418.Sy INSTALLSETS
1429environment variable may be set to a space-separated list of 1419environment variable may be set to a space-separated list of
1430distribution sets to be installed. 1420distribution sets to be installed.
1431By default, all sets except 1421By default, all sets except
1432.Dq etc 1422.Dq etc
1433and 1423and
1434.Dq xetc 1424.Dq xetc
1435are installed, so most files in 1425are installed, so most files in
1436.Sy INSTALLWORLDDIR Ns Pa /etc 1426.Sy INSTALLWORLDDIR Ns Pa /etc
1437will not be installed or modified. 1427will not be installed or modified.
1438.Pp 1428.Pp
1439.Em Note : 1429.Em Note :
1440Before performing this operation with 1430Before performing this operation with
1441.Sy INSTALLWORLDDIR Ns = Ns Pa / , 1431.Sy INSTALLWORLDDIR Ns = Ns Pa / ,
1442it is highly recommended that you upgrade your kernel and reboot. 1432it is highly recommended that you upgrade your kernel and reboot.
1443After performing this operation, 1433After performing this operation,
1444it is recommended that you use 1434it is recommended that you use
1445.Xr etcupdate 8 1435.Xr etcupdate 8
1446to update files in 1436to update files in
1447.Sy INSTALLWORLDDIR Ns Pa /etc , 1437.Sy INSTALLWORLDDIR Ns Pa /etc ,
1448and 1438and
1449.Xr postinstall 8 1439.Xr postinstall 8
1450to check for or fix inconsistencies. 1440to check for or fix inconsistencies.
1451.It Sy sets 1441.It Sy sets
1452Create distribution sets from 1442Create distribution sets from
1453.Sy DESTDIR 1443.Sy DESTDIR
1454into 1444into
1455.Sy RELEASEDIR/RELEASEMACHINEDIR Ns Pa /binary/sets . 1445.Sy RELEASEDIR/RELEASEMACHINEDIR Ns Pa /binary/sets .
1456Should be run after 1446Should be run after
1457.Dq make distribution , 1447.Dq make distribution ,
1458as 1448as
1459.Dq make build 1449.Dq make build
1460alone does not install all of the required files. 1450alone does not install all of the required files.
1461. 1451.
1462.It Sy sourcesets 1452.It Sy sourcesets
1463Create source sets of the source tree into 1453Create source sets of the source tree into
1464.Sy RELEASEDIR Ns Pa /source/sets . 1454.Sy RELEASEDIR Ns Pa /source/sets .
1465. 1455.
1466.It Sy syspkgs 1456.It Sy syspkgs
1467Create syspkgs from 1457Create syspkgs from
1468.Sy DESTDIR 1458.Sy DESTDIR
1469into 1459into
1470.Sy RELEASEDIR/RELEASEMACHINEDIR Ns Pa /binary/syspkgs . 1460.Sy RELEASEDIR/RELEASEMACHINEDIR Ns Pa /binary/syspkgs .
1471Should be run after 1461Should be run after
1472.Dq make distribution , 1462.Dq make distribution ,
1473as 1463as
1474.Dq make build 1464.Dq make build
1475alone does not install all of the required files. 1465alone does not install all of the required files.
1476. 1466.
1477.It Sy release 1467.It Sy release
1478Do a 1468Do a
1479.Dq make distribution , 1469.Dq make distribution ,
1480build kernels, distribution media, and install sets 1470build kernels, distribution media, and install sets
1481(this as per 1471(this as per
1482.Dq make sets ) , 1472.Dq make sets ) ,
1483and 1473and
1484then package the system into a standard release layout as described by 1474then package the system into a standard release layout as described by
1485.Xr release 7 . 1475.Xr release 7 .
1486This requires that 1476This requires that
1487.Sy RELEASEDIR 1477.Sy RELEASEDIR
1488be set (see above). 1478be set (see above).
1489. 1479.
1490.It Sy iso-image 1480.It Sy iso-image
1491Create a 1481Create a
1492.Nx 1482.Nx
1493installation CD-ROM image in the 1483installation CD-ROM image in the
1494.Sy RELEASEDIR Ns Pa /images 1484.Sy RELEASEDIR Ns Pa /images
1495directory. 1485directory.
1496The CD-ROM file system will have a layout as described in 1486The CD-ROM file system will have a layout as described in
1497.Xr release 7 . 1487.Xr release 7 .
1498.Pp 1488.Pp
1499For most machine types, the CD-ROM will be bootable, and will automatically 1489For most machine types, the CD-ROM will be bootable, and will automatically
1500run the 1490run the
1501.Xr sysinst 8 1491.Xr sysinst 8
1502menu-based installation program, which can be used to install or upgrade a 1492menu-based installation program, which can be used to install or upgrade a
1503.Nx 1493.Nx
1504system. 1494system.
1505Bootable CD-ROMs also contain tools that may be useful in 1495Bootable CD-ROMs also contain tools that may be useful in
1506repairing a damaged 1496repairing a damaged
1507.Nx 1497.Nx
1508installation. 1498installation.
1509.Pp 1499.Pp
1510Before 1500Before
1511.Dq make iso-image 1501.Dq make iso-image
1512is attempted, RELEASEDIR must be populated by 1502is attempted, RELEASEDIR must be populated by
1513.Dq make release 1503.Dq make release
1514or equivalent. 1504or equivalent.
1515.Pp 1505.Pp
1516.Em Note : 1506.Em Note :
1517Other, smaller, CD-ROM images may be created in the 1507Other, smaller, CD-ROM images may be created in the
1518.Sy RELEASEDIR/RELEASEMACHINEDIR Ns Pa /installation/cdrom 1508.Sy RELEASEDIR/RELEASEMACHINEDIR Ns Pa /installation/cdrom
1519directory by 1509directory by
1520.Dq "make release" . 1510.Dq "make release" .
1521These smaller images usually contain the same tools as the larger images in 1511These smaller images usually contain the same tools as the larger images in
1522.Sy RELEASEDIR Ns Pa /images , 1512.Sy RELEASEDIR Ns Pa /images ,
1523but do not contain additional content such as the distribution sets. 1513but do not contain additional content such as the distribution sets.
1524.Pp 1514.Pp
1525.Em Note : 1515.Em Note :
1526The mac68k port still uses an older method of creating 1516The mac68k port still uses an older method of creating
1527CD-ROM images. 1517CD-ROM images.
1528This requires the 1518This requires the
1529.Xr mkisofs 1 1519.Xr mkisofs 1
1530utility, which is not part of 1520utility, which is not part of
1531.Nx , 1521.Nx ,
1532but which can be installed from 1522but which can be installed from
1533.Pa pkgsrc/sysutils/cdrtools . 1523.Pa pkgsrc/sysutils/cdrtools .
1534. 1524.
1535.It Sy iso-image-source 1525.It Sy iso-image-source
1536Create a 1526Create a
1537.Nx 1527.Nx
1538installation CD-ROM image in the 1528installation CD-ROM image in the
1539.Sy RELEASEDIR Ns Pa /images 1529.Sy RELEASEDIR Ns Pa /images
1540directory. 1530directory.
1541The CD-ROM file system will have a layout as described in 1531The CD-ROM file system will have a layout as described in
1542.Xr release 7 . 1532.Xr release 7 .
1543It will have top level directories for the machine type and source. 1533It will have top level directories for the machine type and source.
1544.Pp 1534.Pp
1545For most machine types, the CD-ROM will be bootable, and will automatically 1535For most machine types, the CD-ROM will be bootable, and will automatically
1546run the 1536run the
1547.Xr sysinst 8 1537.Xr sysinst 8
1548menu-based installation program, which can be used to install or upgrade a 1538menu-based installation program, which can be used to install or upgrade a
1549.Nx 1539.Nx
1550system. 1540system.
1551Bootable CD-ROMs also contain tools that may be useful in 1541Bootable CD-ROMs also contain tools that may be useful in
1552repairing a damaged 1542repairing a damaged
1553.Nx 1543.Nx
1554installation. 1544installation.
1555.Pp 1545.Pp
1556Before 1546Before
1557.Dq make iso-image-source 1547.Dq make iso-image-source
1558is attempted, RELEASEDIR must be populated by 1548is attempted, RELEASEDIR must be populated by
1559.Dq make sourcesets release 1549.Dq make sourcesets release
1560or equivalent. 1550or equivalent.
1561.Pp 1551.Pp
1562.Em Note : 1552.Em Note :
1563Other, smaller, CD-ROM images may be created in the 1553Other, smaller, CD-ROM images may be created in the
1564.Sy RELEASEDIR/RELEASEMACHINEDIR Ns Pa /installation/cdrom 1554.Sy RELEASEDIR/RELEASEMACHINEDIR Ns Pa /installation/cdrom
1565directory by 1555directory by
1566.Dq make release . 1556.Dq make release .
1567These smaller images usually contain the same tools as the larger images in 1557These smaller images usually contain the same tools as the larger images in
1568.Sy RELEASEDIR Ns Pa /images , 1558.Sy RELEASEDIR Ns Pa /images ,
1569but do not contain additional content such as the distribution sets. 1559but do not contain additional content such as the distribution sets.
1570.Pp 1560.Pp
1571.Em Note : 1561.Em Note :
1572The mac68k port still uses an older method of creating 1562The mac68k port still uses an older method of creating
1573CD-ROM images. 1563CD-ROM images.
1574This requires the 1564This requires the
1575.Xr mkisofs 1 1565.Xr mkisofs 1
1576utility, which is not part of 1566utility, which is not part of
1577.Nx , 1567.Nx ,
1578but which can be installed from 1568but which can be installed from
1579.Pa pkgsrc/sysutils/cdrtools . 1569.Pa pkgsrc/sysutils/cdrtools .
1580. 1570.
1581.It Sy install-image 1571.It Sy install-image
1582Create a bootable 1572Create a bootable
1583.Nx 1573.Nx
1584installation disk image in the 1574installation disk image in the
1585.Sy RELEASEDIR Ns Pa /images 1575.Sy RELEASEDIR Ns Pa /images
1586directory. 1576directory.
1587The installation disk image is suitable for copying to 1577The installation disk image is suitable for copying to
1588bootable USB flash memory sticks, etc., for machines which 1578bootable USB flash memory sticks, etc., for machines which
1589are able to boot from such devices. 1579are able to boot from such devices.
1590The file system in the bootable disk image will have a layout 1580The file system in the bootable disk image will have a layout
1591as described in 1581as described in
1592.Xr release 7 . 1582.Xr release 7 .
1593.Pp 1583.Pp
1594The installation image is bootable, and will automatically 1584The installation image is bootable, and will automatically
1595run the 1585run the
1596.Xr sysinst 8 1586.Xr sysinst 8
1597menu-based installation program, which can be used to install or upgrade a 1587menu-based installation program, which can be used to install or upgrade a
1598.Nx 1588.Nx
1599system. 1589system.
1600The image also contains tools that may be 1590The image also contains tools that may be
1601useful in repairing a damaged 1591useful in repairing a damaged
1602.Nx 1592.Nx
1603installation. 1593installation.
1604.Pp 1594.Pp
1605Before 1595Before
1606.Dq make install-image 1596.Dq make install-image
1607is attempted, 1597is attempted,
1608.Sy RELEASEDIR 1598.Sy RELEASEDIR
1609must be populated by 1599must be populated by
1610.Dq make release 1600.Dq make release
1611or equivalent. 1601or equivalent.
1612The build must have been performed with 1602The build must have been performed with
1613.Sy MKUNPRIVED=yes 1603.Sy MKUNPRIVED=yes
1614because 1604because
1615.Dq make install-image 1605.Dq make install-image
1616relies on information in 1606relies on information in
1617.Sy DESTDIR Ns Pa /METALOG . 1607.Sy DESTDIR Ns Pa /METALOG .
1618. 1608.
1619.It Sy live-image 1609.It Sy live-image
1620Create 1610Create
1621.Nx 1611.Nx
1622live images in the 1612live images in the
1623.Sy RELEASEDIR/images 1613.Sy RELEASEDIR/images
1624directory. 1614directory.
1625The live image contains all necessary files 1615The live image contains all necessary files
1626to boot 1616to boot
1627.Nx 1617.Nx
1628up to multi-user mode, including all files 1618up to multi-user mode, including all files
1629which should be extracted during installation, 1619which should be extracted during installation,
1630.Nx 1620.Nx
1631disklabel, bootloaders, etc. 1621disklabel, bootloaders, etc.
1632.Pp 1622.Pp
1633The live image is suitable for use as a disk image in 1623The live image is suitable for use as a disk image in
1634virtual machine environments such as QEMU, 1624virtual machine environments such as QEMU,
1635and also useful to boot 1625and also useful to boot
1636.Nx 1626.Nx
1637from a USB flash memory stick 1627from a USB flash memory stick
1638on a real machine, without the need for installation. 1628on a real machine, without the need for installation.
1639.Pp 1629.Pp
1640Before 1630Before
1641.Dq make live-image 1631.Dq make live-image
1642is attempted, RELEASEDIR must be populated by 1632is attempted, RELEASEDIR must be populated by
1643.Dq make release 1633.Dq make release
1644or equivalent. 1634or equivalent.
1645The build must have been performed with 1635The build must have been performed with
1646.Sy MKUNPRIVED=yes 1636.Sy MKUNPRIVED=yes
1647because 1637because
1648.Dq make install-image 1638.Dq make install-image
1649relies on information in 1639relies on information in
1650.Sy DESTDIR Ns Pa /METALOG . 1640.Sy DESTDIR Ns Pa /METALOG .
1651. 1641.
1652.It Sy regression-tests 1642.It Sy regression-tests
1653Can only be run after building the regression tests in the directory 1643Can only be run after building the regression tests in the directory
1654.Dq regress . 1644.Dq regress .
1655Runs those compiled regression tests on the local host. 1645Runs those compiled regression tests on the local host.
1656.Pp 1646.Pp
1657.Em Note : 1647.Em Note :
1658Most tests are now managed instead using 1648Most tests are now managed instead using
1659.Xr atf 7 ; 1649.Xr atf 7 ;
1660this target should probably run those as well but currently does not. 1650this target should probably run those as well but currently does not.
1661. 1651.
1662.El 1652.El
1663. 1653.
1664.Ss The \*qbuild.sh\*q script 1654.Ss The \*qbuild.sh\*q script
1665. 1655.
1666This script file is a shell script designed to build the 1656This script file is a shell script designed to build the
1667entire 1657entire
1668.Nx 1658.Nx
1669system on any host with a suitable modern shell and some common 1659system on any host with a suitable modern shell and some common
1670utilities. 1660utilities.
1671The required shell features are described under the 1661The required shell features are described under the
1672.Sy HOST_SH 1662.Sy HOST_SH
1673variable. 1663variable.
1674.Pp 1664.Pp
1675If a host system's default shell does support the required 1665If a host system's default shell does support the required
1676features, then we suggest that you explicitly specify 1666features, then we suggest that you explicitly specify
1677a suitable shell using a command like 1667a suitable shell using a command like
1678.Bd -unfilled -offset indent 1668.Bd -unfilled -offset indent
1679.Li /path/to/suitable/shell build.sh Op Ar options 1669.Li /path/to/suitable/shell build.sh Op Ar options
1680.Ed 1670.Ed
1681.Pp 1671.Pp
1682The above command will usually enable 1672The above command will usually enable
1683.Nm build.sh 1673.Nm build.sh
1684to automatically set 1674to automatically set
1685.Sy HOST_SH Ns Cm = Ns Pa /path/to/suitable/shell , 1675.Sy HOST_SH Ns Cm = Ns Pa /path/to/suitable/shell ,
1686but if that fails, then the following set of commands may be used instead: 1676but if that fails, then the following set of commands may be used instead:
1687.Bd -unfilled -offset indent 1677.Bd -unfilled -offset indent
1688.Li HOST_SH= Ns Va /path/to/suitable/shell 1678.Li HOST_SH= Ns Va /path/to/suitable/shell
1689.Li export HOST_SH 1679.Li export HOST_SH
1690.Li ${HOST_SH} build.sh Op Ar options 1680.Li ${HOST_SH} build.sh Op Ar options
1691.Ed 1681.Ed
1692.Pp 1682.Pp
1693If 1683If
1694.Sy build.sh 1684.Sy build.sh
1695detects that it is being executed under an unsuitable shell, it attempts 1685detects that it is being executed under an unsuitable shell, it attempts
1696to exec a suitable shell instead, or shows an error message. 1686to exec a suitable shell instead, or shows an error message.
1697If 1687If
1698.Sy HOST_SH 1688.Sy HOST_SH
1699is not set explicitly, then 1689is not set explicitly, then
1700.Nm build.sh 1690.Nm build.sh
1701sets a default using heuristics dependent on the host platform, 1691sets a default using heuristics dependent on the host platform,
1702or from the shell under which 1692or from the shell under which
1703.Nm build.sh 1693.Nm build.sh
1704is executed (if that can be determined), 1694is executed (if that can be determined),
1705or using the first copy of 1695or using the first copy of
1706.Pa sh 1696.Pa sh
1707found in 1697found in
1708.Sy PATH . 1698.Sy PATH .
1709.Pp 1699.Pp
1710All cross-compile builds, and most native builds, of the entire system 1700All cross-compile builds, and most native builds, of the entire system
1711should make use of 1701should make use of
1712.Sy build.sh 1702.Sy build.sh
1713rather than just running 1703rather than just running
1714.Dq make . 1704.Dq make .
1715This way, the 1705This way, the
1716.Xr make 1 1706.Xr make 1
1717program will be bootstrapped properly, in case the host system has an 1707program will be bootstrapped properly, in case the host system has an
1718older or incompatible 1708older or incompatible
1719.Dq make 1709.Dq make
1720program. 1710program.
1721.Pp 1711.Pp
1722When compiling the entire system via 1712When compiling the entire system via
1723.Sy build.sh , 1713.Sy build.sh ,
1724many 1714many
1725.Xr make 1 1715.Xr make 1
1726variables are set for you in order to help encapsulate the build 1716variables are set for you in order to help encapsulate the build
1727process. 1717process.
1728In the list of options below, variables that are automatically set by 1718In the list of options below, variables that are automatically set by
1729.Sy build.sh 1719.Sy build.sh
1730are noted where applicable. 1720are noted where applicable.
1731. 1721.
1732.Pp 1722.Pp
1733The following operations are supported by 1723The following operations are supported by
1734.Sy build.sh : 1724.Sy build.sh :
1735. 1725.
1736.Bl -tag -width "distribution" 1726.Bl -tag -width "distribution"
1737. 1727.
1738.It Sy build 1728.It Sy build
1739Build the system as per 1729Build the system as per
1740.Dq make build . 1730.Dq make build .
1741Before the main part of the build commences, this command runs the 1731Before the main part of the build commences, this command runs the
1742.Sy obj 1732.Sy obj
1743operation (unless the 1733operation (unless the
1744.Fl o 1734.Fl o
1745option is given), 1735option is given),
1746.Dq make cleandir 1736.Dq make cleandir
1747(unless the 1737(unless the
1748.Fl u 1738.Fl u
1749option is given), 1739option is given),
1750and the 1740and the
1751.Sy tools 1741.Sy tools
1752operation. 1742operation.
1753. 1743.
1754.It Sy distribution 1744.It Sy distribution
1755Build a full distribution as per 1745Build a full distribution as per
1756.Dq make distribution . 1746.Dq make distribution .
1757This command first runs the 1747This command first runs the
1758.Sy build 1748.Sy build
1759operation. 1749operation.
1760. 1750.
1761.It Sy release 1751.It Sy release
1762Build a full release as per 1752Build a full release as per
1763.Dq make release . 1753.Dq make release .
1764This command first runs the 1754This command first runs the
1765.Sy distribution 1755.Sy distribution
1766operation. 1756operation.
1767. 1757.
1768.It Sy help 1758.It Sy help
1769Show a help message, and exit. 1759Show a help message, and exit.
1770. 1760.
1771.It Sy makewrapper 1761.It Sy makewrapper
1772Create the 1762Create the
1773.Sy \*[toolprefix]make-MACHINE 1763.Sy \*[toolprefix]make-MACHINE
1774wrapper. 1764wrapper.
1775This operation is automatically performed for any of the other 1765This operation is automatically performed for any of the other
1776operations. 1766operations.
1777. 1767.
1778.It Sy cleandir 1768.It Sy cleandir
1779Perform 1769Perform
1780.Dq make cleandir . 1770.Dq make cleandir .
1781. 1771.
1782.It Sy obj 1772.It Sy obj
1783Perform 1773Perform
1784.Dq make obj . 1774.Dq make obj .
1785. 1775.
1786.It Sy tools 1776.It Sy tools
1787Build and install the host tools from 1777Build and install the host tools from
1788.Pa src/tools . 1778.Pa src/tools .
1789This command will first run 1779This command will first run
1790.Dq make obj 1780.Dq make obj
1791and 1781and
1792.Dq make cleandir 1782.Dq make cleandir
1793in the 1783in the
1794.Pa tools 1784.Pa tools
1795subdirectory unless the 1785subdirectory unless the
1796.Fl o 1786.Fl o
1797or 1787or
1798.Fl u 1788.Fl u
1799options (respectively) are given. 1789options (respectively) are given.
1800. 1790.
1801.It Sy install Ns = Ns Ar idir 1791.It Sy install Ns = Ns Ar idir
1802Install the contents of 1792Install the contents of
1803.Sy DESTDIR 1793.Sy DESTDIR
1804to 1794to
1805.Ar idir , 1795.Ar idir ,
1806using 1796using
1807.Dq make installworld . 1797.Dq make installworld .
1808.Pp 1798.Pp
1809.Em Note : 1799.Em Note :
1810Files that are part of the 1800Files that are part of the
1811.Dq etc 1801.Dq etc
1812or 1802or
1813.Dq xetc 1803.Dq xetc
1814sets will not be installed, unless overridden by 1804sets will not be installed, unless overridden by
1815the INSTALLSETS environment variable. 1805the INSTALLSETS environment variable.
1816. 1806.
1817.It Sy kernel Ns = Ns Ar kconf 1807.It Sy kernel Ns = Ns Ar kconf
1818Build a new kernel. 1808Build a new kernel.
1819The 1809The
1820.Ar kconf 1810.Ar kconf
1821argument is the name of a configuration file suitable 1811argument is the name of a configuration file suitable
1822for use by 1812for use by
1823.Xr config 1 . 1813.Xr config 1 .
1824If 1814If
1825.Ar kconf 1815.Ar kconf
1826does not contain any 1816does not contain any
1827.Sq / 1817.Sq /
1828characters, the configuration file is expected to be found in the 1818characters, the configuration file is expected to be found in the
1829.Sy KERNCONFDIR 1819.Sy KERNCONFDIR
1830directory, which is typically 1820directory, which is typically
1831.Pa sys/arch/MACHINE/conf . 1821.Pa sys/arch/MACHINE/conf .
1832The new kernel will be built in a subdirectory of 1822The new kernel will be built in a subdirectory of
1833.Sy KERNOBJDIR , 1823.Sy KERNOBJDIR ,
1834which is typically 1824which is typically
1835.Pa sys/arch/MACHINE/compile 1825.Pa sys/arch/MACHINE/compile
1836or an associated object directory. 1826or an associated object directory.
1837.Pp 1827.Pp
1838This command does 1828This command does
1839.Em not 1829.Em not
1840imply the 1830imply the
1841.Sy tools 1831.Sy tools
1842command; run the 1832command; run the
1843.Sy tools 1833.Sy tools
1844command first unless it is 1834command first unless it is
1845.Em certain 1835.Em certain
1846that the tools already exist and are up to date. 1836that the tools already exist and are up to date.
1847.Pp 1837.Pp
1848This command will run 1838This command will run
1849.Dq make cleandir 1839.Dq make cleandir
1850on the kernel in question first unless the 1840on the kernel in question first unless the
1851.Fl u 1841.Fl u
1852option is given. 1842option is given.
1853. 1843.
1854.It Sy kernel.gdb Ns = Ns Ar kconf 1844.It Sy kernel.gdb Ns = Ns Ar kconf
1855Build a new kernel with debug information. 1845Build a new kernel with debug information.
1856Similar to the above 1846Similar to the above
1857.Sy kernel Ns = Ns Ar kconf 1847.Sy kernel Ns = Ns Ar kconf
1858operation, but creates a 1848operation, but creates a
1859.Pa netbsd.gdb 1849.Pa netbsd.gdb
1860file alongside of the kernel 1850file alongside of the kernel
1861.Pa netbsd , 1851.Pa netbsd ,
1862which contains a full symbol table and can be used for debugging 1852which contains a full symbol table and can be used for debugging
1863(for example with a cross-gdb built by 1853(for example with a cross-gdb built by
1864.Sy MKCROSSGDB ) . 1854.Sy MKCROSSGDB ) .
1865.It Sy kernels 1855.It Sy kernels
1866This command will build all kernels defined in port specific release build 1856This command will build all kernels defined in port specific release build
1867procedure. 1857procedure.
1868.Pp 1858.Pp
1869This command internally calls the 1859This command internally calls the
1870.Sy kernel Ns = Ns Ar kconf 1860.Sy kernel Ns = Ns Ar kconf
1871operation for each found kernel configuration file. 1861operation for each found kernel configuration file.
1872.It Sy modules 1862.It Sy modules
1873This command will build kernel modules and install them into 1863This command will build kernel modules and install them into
1874.Sy DESTDIR . 1864.Sy DESTDIR .
1875. 1865.
1876.It Sy releasekernel Ns = Ns Ar kconf 1866.It Sy releasekernel Ns = Ns Ar kconf
1877Install a 1867Install a
1878.Xr gzip 1 Ns ed 1868.Xr gzip 1 Ns ed
1879copy of the kernel previously built by 1869copy of the kernel previously built by
1880.Sy kernel Ns = Ns Ar kconf 1870.Sy kernel Ns = Ns Ar kconf
1881into 1871into
1882.Sy RELEASEDIR/RELEASEMACHINEDIR Ns Pa /binary/kernel , 1872.Sy RELEASEDIR/RELEASEMACHINEDIR Ns Pa /binary/kernel ,
1883usually as 1873usually as
1884.Pa netbsd- Ns Ar kconf Ns Pa .gz , 1874.Pa netbsd- Ns Ar kconf Ns Pa .gz ,
1885although the 1875although the
1886.Dq Pa netbsd 1876.Dq Pa netbsd
1887prefix is determined from the 1877prefix is determined from the
1888.Dq Sy config 1878.Dq Sy config
1889directives in 1879directives in
1890.Ar kconf . 1880.Ar kconf .
1891. 1881.
1892.It Sy sets 1882.It Sy sets
1893Perform 1883Perform
1894.Dq make sets . 1884.Dq make sets .
1895. 1885.
1896.It Sy sourcesets 1886.It Sy sourcesets
1897Perform 1887Perform
1898.Dq make sourcesets . 1888.Dq make sourcesets .
1899. 1889.
1900.It Sy syspkgs 1890.It Sy syspkgs
1901Perform 1891Perform
1902.Dq make syspkgs . 1892.Dq make syspkgs .
1903. 1893.
1904.It Sy iso-image 1894.It Sy iso-image
1905Perform 1895Perform
1906.Dq make iso-image . 1896.Dq make iso-image .
1907. 1897.
1908.It Sy iso-image-source 1898.It Sy iso-image-source
1909Perform 1899Perform
1910.Dq make iso-image-source . 1900.Dq make iso-image-source .
1911. 1901.
1912.It Sy install-image 1902.It Sy install-image
1913Perform 1903Perform
1914.Dq make install-image . 1904.Dq make install-image .
1915. 1905.
1916.It Sy live-image 1906.It Sy live-image
1917Perform 1907Perform
1918.Dq make live-image . 1908.Dq make live-image .
1919. 1909.
1920.It Sy list-arch 1910.It Sy list-arch
1921Show a list of valid 1911Show a list of valid
1922.Sy MACHINE 1912.Sy MACHINE
1923and 1913and
1924.Sy MACHINE_ARCH 1914.Sy MACHINE_ARCH
1925settings, the default 1915settings, the default
1926.Sy MACHINE_ARCH 1916.Sy MACHINE_ARCH
1927for each 1917for each
1928.Sy MACHINE , 1918.Sy MACHINE ,
1929and aliases for 1919and aliases for
1930.Sy MACHINE Ns No / Ns Sy MACHINE_ARCH 1920.Sy MACHINE Ns No / Ns Sy MACHINE_ARCH
1931pairs, and then exits. 1921pairs, and then exits.
1932The 1922The
1933.Fl m 1923.Fl m
1934or 1924or
1935.Fl a 1925.Fl a
1936options (or both) may be used to specify glob patterns 1926options (or both) may be used to specify glob patterns
1937that will be used to narrow the list of results; 1927that will be used to narrow the list of results;
1938for example, 1928for example,
1939.Dq Li build.sh -m 'evb*' -a '*arm*' list-arch 1929.Dq Li build.sh -m 'evb*' -a '*arm*' list-arch
1940will list all known 1930will list all known
1941.Sy MACHINE Ns No / Ns Sy MACHINE_ARCH 1931.Sy MACHINE Ns No / Ns Sy MACHINE_ARCH
1942values in which either 1932values in which either
1943.Sy MACHINE 1933.Sy MACHINE
1944or 1934or
1945.Sy ALIAS 1935.Sy ALIAS
1946matches the pattern 1936matches the pattern
1947.Ql evb* , 1937.Ql evb* ,
1948and 1938and
1949.Sy MACHINE_ARCH 1939.Sy MACHINE_ARCH
1950matches the pattern 1940matches the pattern
1951.Ql *arm* . 1941.Ql *arm* .
1952. 1942.
1953.El 1943.El
1954. 1944.
1955.Pp 1945.Pp
1956The following command line options alter the behaviour of the 1946The following command line options alter the behaviour of the
1957.Sy build.sh 1947.Sy build.sh
1958operations described above: 1948operations described above:
1959. 1949.
1960.Bl -tag -width "-T tools" 1950.Bl -tag -width "-T tools"
1961. 1951.
1962.It Fl a Ar arch 1952.It Fl a Ar arch
1963Set the value of 1953Set the value of
1964.Sy MACHINE_ARCH 1954.Sy MACHINE_ARCH
1965to 1955to
1966.Ar arch . 1956.Ar arch .
1967See the 1957See the
1968.Fl m 1958.Fl m
1969option for more information. 1959option for more information.
1970. 1960.
1971.It Fl B Ar buildid 1961.It Fl B Ar buildid
1972Set the value of 1962Set the value of
1973.Sy BUILDID 1963.Sy BUILDID
1974to 1964to
1975.Ar buildid . 1965.Ar buildid .
1976This will also append the build identifier to the name of the 1966This will also append the build identifier to the name of the
1977.Dq make 1967.Dq make
1978wrapper script so that the resulting name is of the form 1968wrapper script so that the resulting name is of the form
1979.Dq Sy \*[toolprefix]make-MACHINE-BUILDID . 1969.Dq Sy \*[toolprefix]make-MACHINE-BUILDID .
1980. 1970.
1981.It Fl C Ar cdextras 1971.It Fl C Ar cdextras
1982Append 1972Append
1983.Ar cdextras 1973.Ar cdextras
1984to the 1974to the
1985.Sy CDEXTRA 1975.Sy CDEXTRA
1986variable, 1976variable,
1987which is a space-separated list of files or directories that will be 1977which is a space-separated list of files or directories that will be
1988added to the CD-ROM image that may be create by the 1978added to the CD-ROM image that may be create by the
1989.Dq iso-image 1979.Dq iso-image
1990or 1980or
1991.Dq iso-image-source 1981.Dq iso-image-source
1992operations. 1982operations.
1993Files will be added to the root of the CD-ROM image, whereas directories 1983Files will be added to the root of the CD-ROM image, whereas directories
1994will be copied recursively. 1984will be copied recursively.
1995If relative paths are specified, they will be converted to 1985If relative paths are specified, they will be converted to
1996absolute paths before being used. 1986absolute paths before being used.
1997Multiple paths may be specified via multiple 1987Multiple paths may be specified via multiple
1998.Fl C 1988.Fl C
1999options, or via a single option whose argument contains multiple 1989options, or via a single option whose argument contains multiple
2000space-separated paths. 1990space-separated paths.
2001. 1991.
2002.It Fl c Ar compiler 1992.It Fl c Ar compiler
2003Select the compiler for the toolchain to build 1993Select the compiler for the toolchain to build
2004.Nx 1994.Nx
2005and for inclusion in the 1995and for inclusion in the
2006.Nx 1996.Nx
2007distribution. 1997distribution.
2008Supported choices: 1998Supported choices:
2009.Bl -inset -offset indent 1999.Bl -inset -offset indent
2010.It clang 2000.It clang
2011.It gcc 2001.It gcc
2012[default] 2002[default]
2013.El 2003.El
2014.Pp 2004.Pp
2015The compiler used to build the toolchain can be different; see 2005The compiler used to build the toolchain can be different; see
2016.Sy HOST_CC 2006.Sy HOST_CC
2017and 2007and
2018.Sy HOST_CXX . 2008.Sy HOST_CXX .
2019.It Fl D Ar dest 2009.It Fl D Ar dest
2020Set the value of 2010Set the value of
2021.Sy DESTDIR 2011.Sy DESTDIR
2022to 2012to
2023.Ar dest . 2013.Ar dest .
2024If a relative path is specified, it will be converted to an 2014If a relative path is specified, it will be converted to an
2025absolute path before being used. 2015absolute path before being used.
2026. 2016.
2027.It Fl E 2017.It Fl E
2028Set 2018Set
2029.Sq expert 2019.Sq expert
2030mode. 2020mode.
2031This overrides various sanity checks, and allows: 2021This overrides various sanity checks, and allows:
2032.Sy DESTDIR 2022.Sy DESTDIR
2033does not have to be set to a non-root path for builds, 2023does not have to be set to a non-root path for builds,
2034and 2024and
2035.Sy MKUNPRIVED=yes 2025.Sy MKUNPRIVED=yes
2036does not have to be set when building as a non-root user. 2026does not have to be set when building as a non-root user.
2037.Pp 2027.Pp
2038.Em Note : 2028.Em Note :
2039It is highly recommended that you know what you are doing when 2029It is highly recommended that you know what you are doing when
2040you use this option. 2030you use this option.
2041. 2031.
2042.It Fl h 2032.It Fl h
2043Show a help message, and exit. 2033Show a help message, and exit.
2044. 2034.
2045.It Fl j Ar njob 2035.It Fl j Ar njob
2046Run up to 2036Run up to
2047.Ar njob 2037.Ar njob
2048.Xr make 1 2038.Xr make 1
2049subjobs in parallel; 2039subjobs in parallel;
2050passed through to 2040passed through to
2051.Xr make 1 . 2041.Xr make 1 .
2052If you see failures for reasons other than running out of memory 2042If you see failures for reasons other than running out of memory
2053while using 2043while using
2054.Sy build.sh 2044.Sy build.sh
2055with 2045with
2056.Fl j , 2046.Fl j ,
2057please save complete build logs 2047please save complete build logs
2058so the failures can be analyzed. 2048so the failures can be analyzed.
2059.Pp 2049.Pp
2060To achieve the fastest builds, 2050To achieve the fastest builds,
2061.Fl j 2051.Fl j
2062values between (1 + the number of CPUs) and (2 * the number of CPUs) 2052values between (1 + the number of CPUs) and (2 * the number of CPUs)
2063are recommended. 2053are recommended.
2064Use lower values on machines with limited memory or I/O bandwidth. 2054Use lower values on machines with limited memory or I/O bandwidth.
2065. 2055.
2066.It Fl M Ar obj 2056.It Fl M Ar obj
2067Set 2057Set
2068.Sy MAKEOBJDIRPREFIX 2058.Sy MAKEOBJDIRPREFIX
2069to 2059to
2070.Ar obj . 2060.Ar obj .
2071Unsets 2061Unsets
2072.Sy MAKEOBJDIR . 2062.Sy MAKEOBJDIR .
2073See 2063See
2074.Dq Fl O Ar obj 2064.Dq Fl O Ar obj
2075for more information. 2065for more information.
2076.Pp 2066.Pp
2077For instance, if the source directory is 2067For instance, if the source directory is
2078.Pa /usr/src , 2068.Pa /usr/src ,
2079a setting of 2069a setting of
2080.Dq Fl M Pa /usr/obj 2070.Dq Fl M Pa /usr/obj
2081will place build-time files under 2071will place build-time files under
2082.Pa /usr/obj/usr/src/bin , 2072.Pa /usr/obj/usr/src/bin ,
2083.Pa /usr/obj/usr/src/lib , 2073.Pa /usr/obj/usr/src/lib ,
2084.Pa /usr/obj/usr/src/usr.bin , 2074.Pa /usr/obj/usr/src/usr.bin ,
2085and so forth. 2075and so forth.
2086.Pp 2076.Pp
2087If a relative path is specified, it will be converted to an 2077If a relative path is specified, it will be converted to an
2088absolute path before being used. 2078absolute path before being used.
2089.Sy build.sh 2079.Sy build.sh
2090imposes the restriction that the argument to the 2080imposes the restriction that the argument to the
2091.Fl M 2081.Fl M
2092option must not begin with a 2082option must not begin with a
2093.Dq \&$ 2083.Dq \&$
2094(dollar sign) 2084(dollar sign)
2095character; otherwise it would be too difficult 2085character; otherwise it would be too difficult
2096to determine whether the value is an absolute or a relative path. 2086to determine whether the value is an absolute or a relative path.
2097If the directory does not already exist, 2087If the directory does not already exist,
2098.Sy build.sh 2088.Sy build.sh
2099will create it. 2089will create it.
2100. 2090.
2101.It Fl m Ar mach 2091.It Fl m Ar mach
2102Set the value of 2092Set the value of
2103.Sy MACHINE 2093.Sy MACHINE
2104to 2094to
2105.Ar mach , 2095.Ar mach ,
2106unless the 2096unless the
2107.Ar mach 2097.Ar mach
2108argument is an alias that refers to a 2098argument is an alias that refers to a
2109.Sy MACHINE Ns No / Ns Sy MACHINE_ARCH 2099.Sy MACHINE Ns No / Ns Sy MACHINE_ARCH
2110pair, in which case both 2100pair, in which case both
2111.Sy MACHINE 2101.Sy MACHINE
2112and 2102and
2113.Sy MACHINE_ARCH 2103.Sy MACHINE_ARCH
2114are set from the alias. 2104are set from the alias.
2115Such aliases are interpreted entirely by 2105Such aliases are interpreted entirely by
2116.Sy build.sh ; 2106.Sy build.sh ;
2117they are not used by any other part of the build system. 2107they are not used by any other part of the build system.
2118The 2108The
2119.Sy MACHINE_ARCH 2109.Sy MACHINE_ARCH
2120setting implied by 2110setting implied by
2121.Ar mach 2111.Ar mach
2122will override any value of 2112will override any value of
2123.Sy MACHINE_ARCH 2113.Sy MACHINE_ARCH
2124in the process environment, but will not override a value set by the 2114in the process environment, but will not override a value set by the
2125.Fl a 2115.Fl a
2126option. 2116option.
2127All cross builds require 2117All cross builds require
2128.Fl m , 2118.Fl m ,
2129but if unset on a NetBSD host, the host's value of MACHINE will be 2119but if unset on a NetBSD host, the host's value of MACHINE will be
2130detected and used automatically. 2120detected and used automatically.
2131.Pp 2121.Pp
2132See the 2122See the
2133.Cm list-arch 2123.Cm list-arch
2134operation for a way to get a list of valid 2124operation for a way to get a list of valid
2135.Sy MACHINE 2125.Sy MACHINE
2136and 2126and
2137.Sy MACHINE_ARCH 2127.Sy MACHINE_ARCH
2138settings. 2128settings.
2139. 2129.
2140.It Fl N Ar noiselevel 2130.It Fl N Ar noiselevel
2141Set the 2131Set the
2142.Dq noisyness 2132.Dq noisyness
2143level of the build, by setting 2133level of the build, by setting
2144.Sy MAKEVERBOSE 2134.Sy MAKEVERBOSE
2145to 2135to
2146.Ar noiselevel . 2136.Ar noiselevel .
2147. 2137.
2148.It Fl n 2138.It Fl n
2149Show the commands that would be executed by 2139Show the commands that would be executed by
2150.Sy build.sh , 2140.Sy build.sh ,
2151but do not make any changes. 2141but do not make any changes.
2152This is similar in concept to 2142This is similar in concept to
2153.Dq make -n . 2143.Dq make -n .
2154. 2144.
2155.It Fl O Ar obj 2145.It Fl O Ar obj
2156Create an appropriate transform macro for 2146Create an appropriate transform macro for
2157.Sy MAKEOBJDIR 2147.Sy MAKEOBJDIR
2158that will place the built object files under 2148that will place the built object files under
2159.Ar obj . 2149.Ar obj .
2160Unsets 2150Unsets
2161.Sy MAKEOBJDIRPREFIX . 2151.Sy MAKEOBJDIRPREFIX .
2162.Pp 2152.Pp
2163For instance, a setting of 2153For instance, a setting of
2164.Dq Fl O Pa /usr/obj 2154.Dq Fl O Pa /usr/obj
2165will place build-time files under 2155will place build-time files under
2166.Pa /usr/obj/bin , 2156.Pa /usr/obj/bin ,
2167.Pa /usr/obj/lib , 2157.Pa /usr/obj/lib ,
2168.Pa /usr/obj/usr.bin , 2158.Pa /usr/obj/usr.bin ,
2169and so forth. 2159and so forth.
2170.Pp 2160.Pp
2171If a relative path is specified, it will be converted to an 2161If a relative path is specified, it will be converted to an
2172absolute path before being used. 2162absolute path before being used.
2173.Sy build.sh 2163.Sy build.sh
2174imposes the restriction that the argument to the 2164imposes the restriction that the argument to the
2175.Fl O 2165.Fl O
2176option must not contain a 2166option must not contain a
2177.Dq \&$ 2167.Dq \&$
2178(dollar sign) 2168(dollar sign)
2179character. 2169character.
2180If the directory does not already exist, 2170If the directory does not already exist,
2181.Sy build.sh 2171.Sy build.sh
2182will create it. 2172will create it.
2183.Pp 2173.Pp
2184In normal use, exactly one of the 2174In normal use, exactly one of the
2185.Fl M 2175.Fl M
2186or 2176or
2187.Fl O 2177.Fl O
2188options should be specified. 2178options should be specified.
2189If neither 2179If neither
2190.Fl M 2180.Fl M
2191nor 2181nor
2192.Fl O 2182.Fl O
2193is specified, then a default object directory will be chosen 2183is specified, then a default object directory will be chosen
2194according to rules in 2184according to rules in
2195.Aq bsd.obj.mk . 2185.Aq bsd.obj.mk .
2196Relying on this default is not recommended because 2186Relying on this default is not recommended because
2197it is determined by complex rules that are influenced 2187it is determined by complex rules that are influenced
2198by the values of several variables and 2188by the values of several variables and
2199by the location of the source directory. 2189by the location of the source directory.
2200.Pp 2190.Pp
2201.Em Note : 2191.Em Note :
2202Placing the 2192Placing the
2203.Ar obj 2193.Ar obj
2204directory location outside of the default source tree hierarchy makes 2194directory location outside of the default source tree hierarchy makes
2205it easier to manually clear out old files in the event the 2195it easier to manually clear out old files in the event the
2206.Dq make cleandir 2196.Dq make cleandir
2207operation is unable to do so. 2197operation is unable to do so.
2208(See 2198(See
2209.Sx CAVEATS 2199.Sx CAVEATS
2210below.) 2200below.)
2211.Pp 2201.Pp
2212.Em Note : 2202.Em Note :
2213The use of one of 2203The use of one of
2214.Fl M 2204.Fl M
2215or 2205or
2216.Fl O 2206.Fl O
2217is the only means of building multiple machine architecture userlands 2207is the only means of building multiple machine architecture userlands
2218from the same source tree without cleaning between builds (in which 2208from the same source tree without cleaning between builds (in which
2219case, one would specify distinct 2209case, one would specify distinct
2220.Ar obj 2210.Ar obj
2221locations for each). 2211locations for each).
2222. 2212.
2223.It Fl o 2213.It Fl o
2224Set the value of 2214Set the value of
2225.Sy MKOBJDIRS 2215.Sy MKOBJDIRS
2226to 2216to
2227.Dq no . 2217.Dq no .
2228Otherwise, it will be automatically set to 2218Otherwise, it will be automatically set to
2229.Dq yes . 2219.Dq yes .
2230This default is opposite to the behaviour when not using 2220This default is opposite to the behaviour when not using
2231.Sy build.sh . 2221.Sy build.sh .
2232. 2222.
2233.It Fl P 2223.It Fl P
2234Set the value of 2224Set the value of
2235.Sy MKREPRO 2225.Sy MKREPRO
2236and 2226and
2237.Sy MKREPRO_TIMESTAMP 2227.Sy MKREPRO_TIMESTAMP
2238to the latest source CVS timestamp for reproducible builds. 2228to the latest source CVS timestamp for reproducible builds.
2239. 2229.
2240.It Fl R Ar rel 2230.It Fl R Ar rel
2241Set the value of 2231Set the value of
2242.Sy RELEASEDIR 2232.Sy RELEASEDIR
2243to 2233to
2244.Ar rel . 2234.Ar rel .
2245If a relative path is specified, it will be converted to an 2235If a relative path is specified, it will be converted to an
2246absolute path before being used. 2236absolute path before being used.
2247. 2237.
2248.It Fl r 2238.It Fl r
2249Remove the contents of 2239Remove the contents of
2250.Sy DESTDIR 2240.Sy DESTDIR
2251and 2241and
2252.Sy TOOLDIR 2242.Sy TOOLDIR
2253before building (provides a clean starting point). 2243before building (provides a clean starting point).
2254This will skip deleting 2244This will skip deleting
2255.Sy DESTDIR 2245.Sy DESTDIR
2256if building on a native system to the root directory. 2246if building on a native system to the root directory.
2257. 2247.
2258.It Fl S Ar seed 2248.It Fl S Ar seed
2259Change the value of 2249Change the value of
2260.Sy BUILDSEED 2250.Sy BUILDSEED
2261to 2251to
2262.Ar seed . 2252.Ar seed .
2263This should rarely be necessary. 2253This should rarely be necessary.
2264. 2254.
2265.It Fl T Ar tools 2255.It Fl T Ar tools
2266Set the value of 2256Set the value of
2267.Sy TOOLDIR 2257.Sy TOOLDIR
2268to 2258to
2269.Ar tools . 2259.Ar tools .
2270If a relative path is specified, it will be converted to an 2260If a relative path is specified, it will be converted to an
2271absolute path before being used. 2261absolute path before being used.
2272If set, the bootstrap 2262If set, the bootstrap
2273.Dq make 2263.Dq make
2274will only be rebuilt if the source files for 2264will only be rebuilt if the source files for
2275.Xr make 1 2265.Xr make 1
2276have changed. 2266have changed.
2277. 2267.
2278.It Fl U 2268.It Fl U
2279Set 2269Set
2280.Sy MKUNPRIVED=yes . 2270.Sy MKUNPRIVED=yes .
2281. 2271.
2282.It Fl u 2272.It Fl u
2283Set 2273Set
2284.Sy MKUPDATE=yes . 2274.Sy MKUPDATE=yes .
2285. 2275.
2286.It Xo 2276.It Xo
2287.Fl V 2277.Fl V
2288.Sm off 2278.Sm off
2289.Ar var 2279.Ar var
2290.Li = 2280.Li =
2291.Op Ar value 2281.Op Ar value
2292.Sm on 2282.Sm on
2293.Xc 2283.Xc
2294Set the environment variable 2284Set the environment variable
2295.Ar var 2285.Ar var
2296to an optional 2286to an optional
2297.Ar value . 2287.Ar value .
2298This is propagated to the 2288This is propagated to the
2299.Sy \*[toolprefix]make 2289.Sy \*[toolprefix]make
2300wrapper. 2290wrapper.
2301. 2291.
2302.It Fl w Ar wrapper 2292.It Fl w Ar wrapper
2303Create the 2293Create the
2304.Sy \*[toolprefix]make 2294.Sy \*[toolprefix]make
2305wrapper script (see below) in a custom location, 2295wrapper script (see below) in a custom location,
2306specified by 2296specified by
2307.Ar wrapper . 2297.Ar wrapper .
2308This allows, for instance, to place the wrapper in 2298This allows, for instance, to place the wrapper in
2309.Sy PATH 2299.Sy PATH
2310automatically. 2300automatically.
2311.Pp 2301.Pp
2312.Em Note : 2302.Em Note :
2313.Ar wrapper 2303.Ar wrapper
2314is the full name of the file, not just a directory name. 2304is the full name of the file, not just a directory name.
2315If a relative path is specified, it will be converted to an 2305If a relative path is specified, it will be converted to an
2316absolute path before being used. 2306absolute path before being used.
2317. 2307.
2318.It Fl X Ar x11src 2308.It Fl X Ar x11src
2319Set the value of 2309Set the value of
2320.Sy X11SRCDIR 2310.Sy X11SRCDIR
2321to 2311to
2322.Ar x11src . 2312.Ar x11src .
2323If a relative path is specified, it will be converted to an 2313If a relative path is specified, it will be converted to an
2324absolute path before being used. 2314absolute path before being used.
2325. 2315.
2326.It Fl x 2316.It Fl x
2327Set 2317Set
2328.Sy MKX11=yes . 2318.Sy MKX11=yes .
2329. 2319.
2330.It Fl Z Ar var 2320.It Fl Z Ar var
2331Unset ("zap") the environment variable 2321Unset ("zap") the environment variable
2332.Ar var . 2322.Ar var .
2333This is propagated to the 2323This is propagated to the
2334.Sy \*[toolprefix]make 2324.Sy \*[toolprefix]make
2335wrapper. 2325wrapper.
2336. 2326.
2337.It Fl ? 2327.It Fl ?
2338Show a help message, and exit. 2328Show a help message, and exit.
2339. 2329.
2340.El 2330.El
2341. 2331.
2342.Ss The \*q\*[toolprefix]make-MACHINE\*q wrapper script 2332.Ss The \*q\*[toolprefix]make-MACHINE\*q wrapper script
2343. 2333.
2344If using the 2334If using the
2345.Sy build.sh 2335.Sy build.sh
2346script to build 2336script to build
2347.Nx , 2337.Nx ,
2348a 2338a
2349.Sy \*[toolprefix]make-MACHINE 2339.Sy \*[toolprefix]make-MACHINE
2350script will be created in 2340script will be created in
2351.Sy TOOLDIR Ns Pa /bin 2341.Sy TOOLDIR Ns Pa /bin
2352upon the first build to assist in building subtrees on a cross-compile 2342upon the first build to assist in building subtrees on a cross-compile
2353host. 2343host.
2354.Pp 2344.Pp
2355.Sy \*[toolprefix]make-MACHINE 2345.Sy \*[toolprefix]make-MACHINE
2356can be invoked in lieu of 2346can be invoked in lieu of
2357.Xr make 1 , 2347.Xr make 1 ,
2358and will instead call the up-to-date version of 2348and will instead call the up-to-date version of
2359.Dq \*[toolprefix]make 2349.Dq \*[toolprefix]make
2360installed into 2350installed into
2361.Sy TOOLDIR Ns Pa /bin 2351.Sy TOOLDIR Ns Pa /bin
2362with several key variables pre-set, including 2352with several key variables pre-set, including
2363.Sy MACHINE , MACHINE_ARCH , 2353.Sy MACHINE , MACHINE_ARCH ,
2364and 2354and
2365.Sy TOOLDIR . 2355.Sy TOOLDIR .
2366.Sy \*[toolprefix]make-MACHINE 2356.Sy \*[toolprefix]make-MACHINE
2367will also set variables specified with 2357will also set variables specified with
2368.Fl V , 2358.Fl V ,
2369and unset variables specified with 2359and unset variables specified with
2370.Fl Z . 2360.Fl Z .
2371.Pp 2361.Pp
2372This script can be symlinked into a directory listed in 2362This script can be symlinked into a directory listed in
2373.Sy PATH , 2363.Sy PATH ,
2374or called with an absolute path. 2364or called with an absolute path.
2375. 2365.
2376.Sh EXAMPLES 2366.Sh EXAMPLES
2377. 2367.
2378.Bl -enum 2368.Bl -enum
2379. 2369.
2380.It 2370.It
2381.Li "% ./build.sh [OPTIONS] tools kernel=GENERIC" 2371.Li "% ./build.sh [OPTIONS] tools kernel=GENERIC"
2382.Pp 2372.Pp
2383Build a new toolchain, and use the new toolchain to 2373Build a new toolchain, and use the new toolchain to
2384configure and build a new GENERIC kernel. 2374configure and build a new GENERIC kernel.
2385. 2375.
2386.It 2376.It
2387.Li "% ./build.sh [OPTIONS] -U distribution" 2377.Li "% ./build.sh [OPTIONS] -U distribution"
2388.Pp 2378.Pp
2389Using unprivileged mode, 2379Using unprivileged mode,
2390build a complete distribution to a 2380build a complete distribution to a
2391.Sy DESTDIR 2381.Sy DESTDIR
2392directory that 2382directory that
2393.Sy build.sh 2383.Sy build.sh
2394selects (and will show). 2384selects (and will show).
2395. 2385.
2396.It 2386.It
2397.Li "# ./build.sh [OPTIONS] -U install=/" 2387.Li "# ./build.sh [OPTIONS] -U install=/"
2398.Pp 2388.Pp
2399As root, install to 2389As root, install to
2400.Pa / 2390.Pa /
2401the distribution that was built 2391the distribution that was built
2402by example 2. 2392by example 2.
2403Even though this is run as root, 2393Even though this is run as root,
2404.Fl U 2394.Fl U
2405is required so that the permissions stored in 2395is required so that the permissions stored in
2406.Sy DESTDIR Ns Pa /METALOG 2396.Sy DESTDIR Ns Pa /METALOG
2407are correctly applied to the files as they're copied to 2397are correctly applied to the files as they're copied to
2408.Pa / . 2398.Pa / .
2409. 2399.
2410.It 2400.It
2411.Li "% ./build.sh [OPTIONS] -U -u release" 2401.Li "% ./build.sh [OPTIONS] -U -u release"
2412.Pp 2402.Pp
2413Using unprivileged mode, 2403Using unprivileged mode,
2414build a complete release to 2404build a complete release to
2415.Sy DESTDIR 2405.Sy DESTDIR
2416and 2406and
2417.Sy RELEASEDIR 2407.Sy RELEASEDIR
2418directories that 2408directories that
2419.Sy build.sh 2409.Sy build.sh
2420selects (and will show). 2410selects (and will show).
2421.Sy MKUPDATE=yes 2411.Sy MKUPDATE=yes
2422.Pq Fl u 2412.Pq Fl u
2423is set to prevent the 2413is set to prevent the
2424.Dq make cleandir , 2414.Dq make cleandir ,
2425so that if this is run after example 2, it doesn't need to redo that 2415so that if this is run after example 2, it doesn't need to redo that
2426portion of the release build. 2416portion of the release build.
2427.El 2417.El
2428. 2418.
2429.Sh OBSOLETE VARIABLES 2419.Sh OBSOLETE VARIABLES
2430. 2420.
2431.Bl -tag -width "NBUILDJOBS" 2421.Bl -tag -width "NBUILDJOBS"
2432. 2422.
2433.It Sy NBUILDJOBS 2423.It Sy NBUILDJOBS
2434Use the 2424Use the
 2425.Nm build.sh
 2426and
2435.Xr make 1 2427.Xr make 1
2436option 2428option
2437.Fl j 2429.Fl j
2438instead. 2430instead.
2439. 2431.
2440.It Sy USE_NEW_TOOLCHAIN 2432.It Sy USE_NEW_TOOLCHAIN
2441The new toolchain is now the default. 2433The new toolchain is now the default.
2442To disable, use 2434To disable, use
2443.Sy TOOLCHAIN_MISSING=yes . 2435.Sy TOOLCHAIN_MISSING=yes .
2444.El 2436.El
2445.Sh SEE ALSO 2437.Sh SEE ALSO
2446.Xr ar 1 , 2438.Xr ar 1 ,
2447.Xr config 1 , 2439.Xr config 1 ,
2448.Xr ctags 1 , 2440.Xr ctags 1 ,
2449.Xr cvs 1 , 2441.Xr cvs 1 ,
2450.Xr cvslatest 1 , 2442.Xr cvslatest 1 ,
2451.Xr ex 1 , 2443.Xr ex 1 ,
2452.Xr g++ 1 , 2444.Xr g++ 1 ,
2453.Xr gzip 1 , 2445.Xr gzip 1 ,
2454.Xr ident 1 , 2446.Xr ident 1 ,
2455.Xr ld 1 , 2447.Xr ld 1 ,
2456.Xr lint 1 , 2448.Xr lint 1 ,
2457.Xr make 1 , 2449.Xr make 1 ,
2458.Xr mkisofs 1 , 2450.Xr mkisofs 1 ,
2459.Xr sh 1 , 2451.Xr sh 1 ,
2460.Xr uname 1 , 2452.Xr uname 1 ,
2461.Xr vi 1 , 2453.Xr vi 1 ,
2462.Xr options 4 , 2454.Xr options 4 ,
2463.Xr mk.conf 5 , 2455.Xr mk.conf 5 ,
2464.Xr atf 7 , 2456.Xr atf 7 ,
2465.Xr hier 7 , 2457.Xr hier 7 ,
2466.Xr release 7 , 2458.Xr release 7 ,
2467.Xr sysctl 7 , 2459.Xr sysctl 7 ,
2468.Xr etcupdate 8 , 2460.Xr etcupdate 8 ,
2469.Xr installboot 8 , 2461.Xr installboot 8 ,
2470.Xr mount 8 , 2462.Xr mount 8 ,
2471.Xr mtree 8 , 2463.Xr mtree 8 ,
2472.Xr postinstall 8 , 2464.Xr postinstall 8 ,
2473.Xr sysinst 8 , 2465.Xr sysinst 8 ,
2474.Pa pkgsrc/sysutils/cdrtools 2466.Pa pkgsrc/sysutils/cdrtools
2475. 2467.
2476.Sh HISTORY 2468.Sh HISTORY
2477. 2469.
2478The 2470The
2479.Nm build.sh 2471.Nm build.sh
2480based build scheme was introduced for 2472based build scheme was introduced for
2481.Nx 1.6 2473.Nx 1.6
2482as 2474as
2483.Sy USE_NEW_TOOLCHAIN , 2475.Sy USE_NEW_TOOLCHAIN ,
2484and re-worked to 2476and re-worked to
2485.Sy TOOLCHAIN_MISSING 2477.Sy TOOLCHAIN_MISSING
2486after that. 2478after that.
2487. 2479.
2488.Sh CAVEATS 2480.Sh CAVEATS
2489. 2481.
2490After significant updates to third-party components in the source 2482After significant updates to third-party components in the source
2491tree, the 2483tree, the
2492.Dq make cleandir 2484.Dq make cleandir
2493operation may be insufficient to clean out old files in object 2485operation may be insufficient to clean out old files in object
2494directories. 2486directories.
2495Instead, one may have to manually remove the files. 2487Instead, one may have to manually remove the files.
2496Consult the 2488Consult the
2497.Pa UPDATING 2489.Pa UPDATING
2498file for notices concerning this. 2490file for notices concerning this.

cvs diff -r1.22 -r1.23 src/etc/Makefile.params (switch to unified diff)

--- src/etc/Makefile.params 2021/02/14 18:45:44 1.22
+++ src/etc/Makefile.params 2023/06/11 10:43:51 1.23
@@ -1,121 +1,121 @@ @@ -1,121 +1,121 @@
1# $NetBSD: Makefile.params,v 1.22 2021/02/14 18:45:44 pgoyette Exp $ 1# $NetBSD: Makefile.params,v 1.23 2023/06/11 10:43:51 lukem Exp $
2# 2#
3# Makefile fragment for printing build parameters. 3# Makefile fragment for printing build parameters.
4# 4#
5# Public variables: 5# Public variables:
6# RELEASEVARS 6# RELEASEVARS
7# List of variables whose value should be printed. 7# List of variables whose value should be printed.
8# 8#
9# PRINT_PARAMS 9# PRINT_PARAMS
10# A command to print the desired variables and values 10# A command to print the desired variables and values
11# to stdout, without any additional debugging information. 11# to stdout, without any additional debugging information.
12# Values are printed as single-quoted strings, with 12# Values are printed as single-quoted strings, with
13# embedded quotes and newlines escaped in a way that's 13# embedded quotes and newlines escaped in a way that's
14# acceptable to sh(1). Undefined values are printed 14# acceptable to sh(1). Undefined values are printed
15# as "(undefined)" (without quotation marks). 15# as "(undefined)" (without quotation marks).
16# 16#
17# Internal targets: 17# Internal targets:
18# _params: 18# _params:
19# Prints the names and values of all the variables 19# Prints the names and values of all the variables
20# listed in ${RELEASEVARS}. The desired results may be 20# listed in ${RELEASEVARS}. The desired results may be
21# redirected somewhere other than stdout, for example by 21# redirected somewhere other than stdout, for example by
22# setting _params_redirect='>&3'. stdout and stderr may 22# setting _params_redirect='>&3'. stdout and stderr may
23# contain unwanted debugging information, from make and 23# contain unwanted debugging information, from make and
24# the shell. 24# the shell.
25# 25#
26# Internal variables: 26# Internal variables:
27# _params_redirect: 27# _params_redirect:
28# If set, this should be a shell redirection specification, such 28# If set, this should be a shell redirection specification, such
29# as '>&3', controlling where the output from "make _params" will 29# as '>&3', controlling where the output from "make _params" will
30# be sent. 30# be sent.
31# 31#
32# Example: 32# Example:
33# . ${NETBSDSRCDIR}/etc/Makefile.params 33# . ${NETBSDSRCDIR}/etc/Makefile.params
34# show-params: .MAKE .PHONY # print params to stdout 34# show-params: .MAKE .PHONY # print params to stdout
35# @${PRINT_PARAMS} 35# @${PRINT_PARAMS}
36# 36#
37 37
38.include <bsd.own.mk> # for some variables 38.include <bsd.own.mk> # for some variables
39 39
40RELEASEVARS= DISTRIBVER EXTERNAL_TOOLCHAIN HAVE_GCC HAVE_GDB \ 40RELEASEVARS= DISTRIBVER EXTERNAL_TOOLCHAIN HAVE_GCC HAVE_GDB \
41 HAVE_LLVM HAVE_PCC INSTALLWORLDDIR \ 41 HAVE_LLVM HAVE_PCC INSTALLWORLDDIR \
42 MACHINE MACHINE_ARCH \ 42 MACHINE MACHINE_ARCH \
43 NETBSD_OFFICIAL_RELEASE NOCLEANDIR NODISTRIBDIRS NOINCLUDES \ 43 NETBSD_OFFICIAL_RELEASE NOCLEANDIR NODISTRIBDIRS NOINCLUDES \
44 TOOLCHAIN_MISSING \ 44 TOOLCHAIN_MISSING \
45 USE_HESIOD USE_INET6 USE_JEMALLOC USE_KERBEROS USE_LDAP \ 45 USE_HESIOD USE_INET6 USE_JEMALLOC USE_KERBEROS USE_LDAP \
46 USE_PAM USE_SKEY USE_YP \ 46 USE_PAM USE_SKEY USE_YP \
47 USETOOLS 47 USETOOLS
48 48
49.if ${MKREPRO:Uno} != "yes" 49.if ${MKREPRO:Uno} != "yes"
50RELEASEVARS+= BSDOBJDIR BSDSRCDIR BUILDID BUILDINFO BUILDSEED \ 50RELEASEVARS+= BSDOBJDIR BSDSRCDIR BUILDID BUILDINFO BUILDSEED \
51 DESTDIR KERNARCHDIR KERNCONFDIR KERNOBJDIR KERNSRCDIR MAKE \ 51 DESTDIR KERNARCHDIR KERNCONFDIR KERNOBJDIR KERNSRCDIR MAKE \
52 KERNEL_DIR MAKECONF MAKEFLAGS MAKEOBJDIR MAKEOBJDIRPREFIX \ 52 KERNEL_DIR MAKECONF MAKEFLAGS MAKEOBJDIR MAKEOBJDIRPREFIX \
53 MAKEVERBOSE NBUILDJOBS NETBSDSRCDIR OBJMACHINE OBJMACHINE_ARCH \ 53 MAKEVERBOSE NETBSDSRCDIR OBJMACHINE OBJMACHINE_ARCH \
54 RELEASEDIR RELEASEMACHINEDIR TOOLDIR USR_OBJMACHINE X11SRCDIR 54 RELEASEDIR RELEASEMACHINEDIR TOOLDIR USR_OBJMACHINE X11SRCDIR
55.endif 55.endif
56 56
57RELEASEVARS+= ${_MKVARS.yes} ${_MKVARS.no} 57RELEASEVARS+= ${_MKVARS.yes} ${_MKVARS.no}
58 58
59# 59#
60# Duplicate the DISTRIBVER setting from src/etc/Makefile. 60# Duplicate the DISTRIBVER setting from src/etc/Makefile.
61# 61#
62.ifndef DISTRIBVER 62.ifndef DISTRIBVER
63DISTRIBVER!= ${HOST_SH} ${NETBSDSRCDIR}/sys/conf/osrelease.sh 63DISTRIBVER!= ${HOST_SH} ${NETBSDSRCDIR}/sys/conf/osrelease.sh
64.endif 64.endif
65 65
66# 66#
67# _params does the printing. 67# _params does the printing.
68# 68#
69_params_redirect?= # empty 69_params_redirect?= # empty
70 70
71_params: .PHONY 71_params: .PHONY
72.for var in ${RELEASEVARS:O} 72.for var in ${RELEASEVARS:O}
73.if defined(${var}) 73.if defined(${var})
74 @printf "%20s = '%-s'\n" ${var} ${${var}:C/'/'\\\\''/gW:Q} \ 74 @printf "%20s = '%-s'\n" ${var} ${${var}:C/'/'\\\\''/gW:Q} \
75 ${_params_redirect} 75 ${_params_redirect}
76.else 76.else
77 @printf "%20s = (undefined)\n" ${var} \ 77 @printf "%20s = (undefined)\n" ${var} \
78 ${_params_redirect} 78 ${_params_redirect}
79.endif 79.endif
80.endfor 80.endfor
81 81
82# PRINT_PARAMS: 82# PRINT_PARAMS:
83# 83#
84# The output from the "make _params" can include the following types of 84# The output from the "make _params" can include the following types of
85# unwanted lines: 85# unwanted lines:
86# 86#
87# make -j prints "--- _params ---"; 87# make -j prints "--- _params ---";
88# 88#
89# if MAKEVERBOSE is set to 3 or more then make prints each "printf" 89# if MAKEVERBOSE is set to 3 or more then make prints each "printf"
90# command in addition to executing it; 90# command in addition to executing it;
91# 91#
92# if MAKEVERBOSE is set to 4 then the shell prints each command 92# if MAKEVERBOSE is set to 4 then the shell prints each command
93# (prefixed with "+"). 93# (prefixed with "+").
94# 94#
95# So the resulting output can look like this: 95# So the resulting output can look like this:
96# 96#
97# --- _params --- 97# --- _params ---
98# + echo 'printf "%20s = '\''%-s'\''\n" BSDOBJDIR /usr/obj' 98# + echo 'printf "%20s = '\''%-s'\''\n" BSDOBJDIR /usr/obj'
99# printf "%20s = '%-s'\n" BSDOBJDIR /usr/obj 99# printf "%20s = '%-s'\n" BSDOBJDIR /usr/obj
100# + printf '%20s = '\''%-s'\''\n' BSDOBJDIR /usr/obj 100# + printf '%20s = '\''%-s'\''\n' BSDOBJDIR /usr/obj
101# BSDOBJDIR = '/usr/obj' 101# BSDOBJDIR = '/usr/obj'
102# + echo 'printf "%20s = '\''%-s'\''\n" BSDSRCDIR /usr/src' 102# + echo 'printf "%20s = '\''%-s'\''\n" BSDSRCDIR /usr/src'
103# printf "%20s = '%-s'\n" BSDSRCDIR /usr/src 103# printf "%20s = '%-s'\n" BSDSRCDIR /usr/src
104# + printf '%20s = '\''%-s'\''\n' BSDSRCDIR /usr/src 104# + printf '%20s = '\''%-s'\''\n' BSDSRCDIR /usr/src
105# BSDSRCDIR = '/usr/src' 105# BSDSRCDIR = '/usr/src'
106# [...] 106# [...]
107# 107#
108# where what we want is just this: 108# where what we want is just this:
109# 109#
110# BSDOBJDIR = '/usr/obj' 110# BSDOBJDIR = '/usr/obj'
111# BSDSRCDIR = '/usr/src' 111# BSDSRCDIR = '/usr/src'
112# [...] 112# [...]
113# 113#
114# The shell redirections in ${PRINT_PARAMS} ensure that the unwanted 114# The shell redirections in ${PRINT_PARAMS} ensure that the unwanted
115# noise is discarded (via ">/dev/null"), while the desired information 115# noise is discarded (via ">/dev/null"), while the desired information
116# ends up on the subshell's stdout (via ">&3" and "3>&1"). The value 116# ends up on the subshell's stdout (via ">&3" and "3>&1"). The value
117# of _params_redirect is passed in the environment instead of on the 117# of _params_redirect is passed in the environment instead of on the
118# command line, to prevent it from appearing in MAKEFLAGS (which would 118# command line, to prevent it from appearing in MAKEFLAGS (which would
119# appear in the output). 119# appear in the output).
120# 120#
121PRINT_PARAMS:= (_params_redirect='>&3' ${MAKE} -f ${.PARSEDIR:Q}/${.PARSEFILE:Q} _params 3>&1 >/dev/null) 121PRINT_PARAMS:= (_params_redirect='>&3' ${MAKE} -f ${.PARSEDIR:Q}/${.PARSEFILE:Q} _params 3>&1 >/dev/null)