Deleted Added
full compact
build.7 (219857) build.7 (223148)
1.\" Copyright (c) 2000
2.\" Mike W. Meyer
3.\"
4.\" Redistribution and use in source and binary forms, with or without
5.\" modification, are permitted provided that the following conditions
6.\" are met:
7.\" 1. Redistributions of source code must retain the above copyright
8.\" notice, this list of conditions and the following disclaimer.
9.\" 2. Redistributions in binary form must reproduce the above copyright
10.\" notice, this list of conditions and the following disclaimer in the
11.\" documentation and/or other materials provided with the distribution.
12.\"
13.\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND
14.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
15.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
16.\" ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE
17.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
18.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
19.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
20.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
21.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
22.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
23.\" SUCH DAMAGE.
24.\"
1.\" Copyright (c) 2000
2.\" Mike W. Meyer
3.\"
4.\" Redistribution and use in source and binary forms, with or without
5.\" modification, are permitted provided that the following conditions
6.\" are met:
7.\" 1. Redistributions of source code must retain the above copyright
8.\" notice, this list of conditions and the following disclaimer.
9.\" 2. Redistributions in binary form must reproduce the above copyright
10.\" notice, this list of conditions and the following disclaimer in the
11.\" documentation and/or other materials provided with the distribution.
12.\"
13.\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND
14.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
15.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
16.\" ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE
17.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
18.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
19.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
20.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
21.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
22.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
23.\" SUCH DAMAGE.
24.\"
25.\" $FreeBSD: head/share/man/man7/build.7 219857 2011-03-22 01:21:51Z nwhitehorn $
25.\" $FreeBSD: head/share/man/man7/build.7 223148 2011-06-16 12:28:37Z ru $
26.\"
26.\"
27.Dd March 18, 2011
27.Dd June 16, 2011
28.Dt BUILD 7
29.Os
30.Sh NAME
31.Nm build
32.Nd information on how to build the system
33.Sh DESCRIPTION
34The sources for the
35.Fx
36system and its applications are contained in three different directories,
37normally
38.Pa /usr/src ,
39.Pa /usr/doc ,
40and
41.Pa /usr/ports .
42Directory
43.Pa /usr/src
44contains the
45.Dq "base system"
46sources, which is loosely defined as the things required to rebuild
47the system to a useful state.
48Directory
49.Pa /usr/doc
50contains the source for the system documentation, excluding the manual
51pages.
52Directory
53.Pa /usr/ports
54contains a tree that provides a consistent interface for building and
55installing third party applications.
56For more information about the ports build process, see
57.Xr ports 7 .
58.Pp
59The
60.Xr make 1
61command is used in each of these directories to build and install the
62things in that directory.
63Issuing the
64.Xr make 1
65command in any directory or
66subdirectory of those directories has the same effect as issuing the
67same command in all subdirectories of that directory.
68With no target specified, the things in that directory are just built.
69.Pp
70A source tree is allowed to be read-only.
71As described in
72.Xr make 1 ,
73objects are usually built in a separate object directory hierarchy
74specified by the environment variable
75.Va MAKEOBJDIRPREFIX ,
76or under
77.Pa /usr/obj
78if variable
79.Va MAKEOBJDIRPREFIX
80is not set.
81For a given source directory, its canonical object directory
82would be
83.Pa ${MAKEOBJDIRPREFIX}${.CURDIR}
84if
85.Xr make 1
86variable
87.Va MAKEOBJDIRPREFIX
88is set, or
89.Pa /usr/obj${.CURDIR}
90if this variable is not set.
91Cross-builds set the object directory as described in the
92documentation for the
93.Cm buildworld
94target below.
95.Pp
96The build may be controlled by defining
97.Xr make 1
98variables described in the
99.Sx ENVIRONMENT
100section below, and by the variables documented in
101.Xr make.conf 5 .
102.Pp
103The following list provides the names and actions for the targets
104supported by the build system:
105.Bl -tag -width ".Cm cleandepend"
106.It Cm clean
107Remove any files created during the build process.
108.It Cm cleandepend
109Remove the file
110.Pa ${.OBJDIR}/${DEPENDFILE}
111generated by a prior
112.Dq Li "make depend"
113step.
114.It Cm cleandir
115Remove the canonical object directory if it exists, or perform
116actions equivalent to
117.Dq Li "make clean cleandepend"
118if it does not.
119This target will also remove an
120.Pa obj
121link in
122.Pa ${.CURDIR}
123if that exists.
124.Pp
125It is advisable to run
126.Dq Li "make cleandir"
127twice: the first invocation will remove the canonical object directory
128and the second one will clean up
129.Pa ${.CURDIR} .
130.It Cm depend
131Generate a list of build dependencies in file
132.Pa ${.OBJDIR}/${DEPENDFILE} .
133.It Cm install
134Install the results of the build to the appropriate location in the
135installation directory hierarchy specified in variable
136.Va DESTDIR .
137.It Cm obj
138Create the canonical object directory associated with the current
139directory.
140.It Cm objlink
141Create a symbolic link to the canonical object directory in
142.Pa ${.CURDIR} .
143.It Cm tags
144Generate a tags file using the program specified in the
145.Xr make 1
146variable
147.Va CTAGS .
148The build system supports
149.Xr ctags 1
150and
151.Nm "GNU Global" .
152.El
153.Pp
154The other supported targets under directory
155.Pa /usr/src
156are:
157.Bl -tag -width ".Cm distributeworld"
158.It Cm buildenv
159Spawn an interactive shell with environment variables set up for
160cross-building the system.
161The target architecture needs to be specified with
162.Xr make 1
163variables
164.Va TARGET_ARCH
165and
166.Va TARGET .
167.Pp
168This target is only useful after a complete cross-toolchain including
169the compiler, linker, assembler, headers and libraries has been
170built; see the
171.Cm toolchain
172target below.
173.It Cm buildworld
174Build everything but the kernel, configure files in
175.Pa etc ,
176and
177.Pa release .
178The actual build location prefix used is
179.Pa ${MAKEOBJDIRPREFIX}${.CURDIR}
180for native builds, and
181.Pa ${MAKEOBJDIRPREFIX}/${TARGET}${.CURDIR}
182for cross builds and native builds with variable
183.Va CROSS_BUILD_TESTING
184set.
185.It Cm cleanworld
186Attempt to clean up targets built by a preceding
187.Cm buildworld
188step.
189.It Cm distributeworld
190Distribute everything compiled by a preceding
191.Cm buildworld
192step.
193Files are placed in the directory hierarchy specified by
194.Xr make 1
195variable
196.Va DISTDIR .
197This target is used while building a release; see
198.Xr release 7 .
199.It Cm packageworld
200Archive the results of
201.Cm distributeworld ,
202placing the results in
203.Va DISTDIR .
204This target is used while building a release; see
205.Xr release 7 .
206.It Cm installworld
207Install everything built by a preceding
208.Cm buildworld
209step into the directory hierarchy pointed to by
210.Xr make 1
211variable
212.Va DESTDIR .
213.Pp
214If installing onto an NFS file system and running
215.Xr make 1
216with the
217.Fl j
218option, make sure that
219.Xr rpc.lockd 8
220is running on both client and server.
221See
222.Xr rc.conf 5
223on how to make it start at boot time.
224.It Cm toolchain
225Create the build toolchain needed to build the rest of the system.
226For cross-architecture builds, this step creates a cross-toolchain.
227.It Cm universe
228For each architecture,
229execute a
230.Cm buildworld
231followed by a
232.Cm buildkernel
233for all kernels for that architecture,
234including
235.Pa LINT .
236This command takes a long time.
237.It Cm update
238Get updated sources as configured in
239.Xr make.conf 5 .
240.It Cm targets
241Print a list of supported
242.Va TARGET
243/
244.Va TARGET_ARCH
245pairs for world and kernel targets.
246.It Cm tinderbox
247Execute the same targets as
248.Cm universe .
249In addition print a summary of all failed targets at the end and
250exit with an error if there were any.
251.It Cm toolchains
252Create a build toolchain for each architecture supported by the build system.
253.El
254.Pp
255Kernel specific build targets in
256.Pa /usr/src
257are:
258.Bl -tag -width ".Cm distributekernel"
259.It Cm buildkernel
260Rebuild the kernel and the kernel modules.
261.It Cm installkernel
262Install the kernel and the kernel modules to directory
263.Pa ${DESTDIR}/boot/kernel ,
264renaming any pre-existing directory with this name to
265.Pa kernel.old
266if it contained the currently running kernel.
267The target directory under
268.Pa ${DESTDIR}
269may be modified using the
270.Va INSTKERNNAME
271and
272.Va KODIR
273.Xr make 1
274variables.
275.It Cm distributekernel
276Install the kernel to the directory
277.Pa ${DISTDIR}/kernel/boot/kernel .
278This target is used while building a release; see
279.Xr release 7 .
280.It Cm packagekernel
281Archive the results of
282.Cm distributekernel ,
283placing the results in
284.Va DISTDIR .
285This target is used while building a release; see
286.Xr release 7 .
287.It Cm kernel
288Equivalent to
289.Cm buildkernel
290followed by
291.Cm installkernel
292.It Cm kernel-toolchain
293Rebuild the tools needed for kernel compilation.
294Use this if you did not do a
295.Cm buildworld
296first.
297.It Cm reinstallkernel
298Reinstall the kernel and the kernel modules, overwriting the contents
299of the target directory.
300As with the
301.Cm installkernel
302target, the target directory can be specified using the
303.Xr make 1
304variable
305.Va INSTKERNNAME .
306.El
307.Pp
308Convenience targets for cleaning up the install destination directory
309denoted by variable
310.Va DESTDIR
311include:
312.Bl -tag -width ".Cm delete-old-libs"
313.It Cm check-old
314Print a list of old files and directories in the system.
315.It Cm delete-old
316Delete obsolete base system files and directories interactively.
317When
318.Li -DBATCH_DELETE_OLD_FILES
319is specified at the command line, the delete operation will be
320non-interactive.
321The variables
322.Va DESTDIR ,
323.Va TARGET_ARCH
324and
325.Va TARGET
326should be set as with
327.Dq Li "make installworld" .
328.It Cm delete-old-libs
329Delete obsolete base system libraries interactively.
330This target should only be used if no 3rd party software uses these
331libraries.
332When
333.Li -DBATCH_DELETE_OLD_FILES
334is specified at the command line, the delete operation will be
335non-interactive.
336The variables
337.Va DESTDIR ,
338.Va TARGET_ARCH
339and
340.Va TARGET
341should be set as with
342.Dq Li "make installworld" .
343.El
344.Sh ENVIRONMENT
345Variables that influence all builds include:
346.Bl -tag -width ".Va MAKEOBJDIRPREFIX"
347.It Va DEBUG_FLAGS
348Defines a set of debugging flags that will be used to build all userland
349binaries under
350.Pa /usr/src .
351When
352.Va DEBUG_FLAGS
353is defined, the
354.Cm install
355and
356.Cm installworld
357targets install binaries from the current
358.Va MAKEOBJDIRPREFIX
359without stripping,
360so that debugging information is retained in the installed binaries.
361.It Va DESTDIR
362The directory hierarchy prefix where built objects will be installed.
363If not set,
364.Va DESTDIR
365defaults to the empty string.
366.It Va MAKEOBJDIRPREFIX
367Defines the prefix for directory names in the tree of built objects.
368Defaults to
369.Pa /usr/obj
370if not defined.
371This variable should only be set in the environment and not via
372.Pa /etc/make.conf
373or the command line.
374.It Va NO_WERROR
375If defined, compiler warnings will not cause the build to halt,
376even if the makefile says otherwise.
377.It Va WITH_CTF
378If defined, the build process will run the DTrace CTF conversion
379tools on built objects.
380Please note that this WITH_ option is handled differently than all
381other WITH_ options (there is no
382.Va WITHOUT_CTF ,
383or corresponding
384.Va MK_CTF
385in the build system).
386.El
387.Pp
388Additionally, builds in
389.Pa /usr/src
390are influenced by the following
391.Xr make 1
392variables:
393.Bl -tag -width ".Va SUBDIR_OVERRIDE"
394.It Va KERNCONF
395Overrides which kernel to build and install for the various kernel
396make targets.
397It defaults to
398.Cm GENERIC .
399.It Va KERNFAST
400If set, the build target
401.Cm buildkernel
402defaults to setting
403.Va NO_KERNELCLEAN ,
404.Va NO_KERNELCONFIG ,
405.Va NO_KERNELDEPEND
406and
407.Va NO_KERNELOBJ .
408When set to a value other than
409.Cm 1
410then
411.Va KERNCONF
412is set to the value of
413.Va KERNFAST .
414.It Va LOCAL_DIRS
415If set, this variable supplies a list of additional directories to
416build, relative to the root of the source tree.
417.It Va SUBDIR_OVERRIDE
418Override the default list of sub-directories and only build the
419sub-directory named in this variable.
420This variable is useful when debugging failed builds.
421.Bd -literal -offset indent
422make some-target SUBDIR_OVERRIDE=foo/bar
423.Ed
424.It Va TARGET
425The target hardware platform.
426This is analogous to the
427.Dq Nm uname Fl m
428output.
429This is necessary to cross-build some target architectures.
430For example, cross-building for PC98 machines requires
431.Va TARGET_ARCH Ns = Ns Li i386
432and
433.Va TARGET Ns = Ns Li pc98 .
434If not set,
435.Va TARGET
436defaults to the current hardware platform.
437.It Va TARGET_ARCH
438The target machine processor architecture.
439This is analogous to the
440.Dq Nm uname Fl p
441output.
442Set this to cross-build for a different architecture.
443If not set,
444.Va TARGET_ARCH
445defaults to the current machine architecture, unless
446.Va TARGET
447is also set, in which case it defaults to the appropriate
448value for that platform.
449Typically, one only needs to set
450.Va TARGET .
451.El
452.Pp
453Builds under directory
454.Pa /usr/src
455are also influenced by defining one or more of the following symbols,
456using the
457.Fl D
458option of
459.Xr make 1 :
460.Bl -tag -width ".Va -DNO_KERNELDEPEND"
461.It Va NO_CLEANDIR
462If set, the build targets that clean parts of the object tree use the
463equivalent of
464.Dq make clean
465instead of
466.Dq make cleandir .
467.It Va NO_CLEAN
468If set, no object tree files are cleaned at all.
469Setting
470.Va NO_CLEAN
471implies
472.Va NO_KERNELCLEAN ,
473so when
474.Va NO_CLEAN
475is set no kernel objects are cleaned either.
476.It Va NO_CTF
477If set, the build process does not run the DTrace CTF conversion tools
478on built objects.
479.It Va NO_SHARE
480If set, the build does not descend into the
481.Pa /usr/src/share
482subdirectory (i.e. manpages, locale data files, timezone data files and
483other
484.Pa /usr/src/share
485files will not be rebuild from their sources).
486.It Va NO_KERNELCLEAN
487If set, the build process does not run
488.Dq make clean
489as part of the
490.Cm buildkernel
491target.
492.It Va NO_KERNELCONFIG
493If set, the build process does not run
494.Xr config 8
495as part of the
496.Cm buildkernel
497target.
498.It Va NO_KERNELDEPEND
499If set, the build process does not run
500.Dq make depend
501as part of the
502.Cm buildkernel
503target.
504.It Va NO_KERNELOBJ
505If set, the build process does not run
506.Dq make obj
507as part of the
508.Cm buildkernel
509target.
510.It Va NO_DOCUPDATE
511If set, the update process does not update the source of the
512.Fx
513documentation as part of the
514.Dq make update
515target.
516.It Va NO_PORTSUPDATE
517If set, the update process does not update the Ports tree as part of the
518.Dq make update
519target.
28.Dt BUILD 7
29.Os
30.Sh NAME
31.Nm build
32.Nd information on how to build the system
33.Sh DESCRIPTION
34The sources for the
35.Fx
36system and its applications are contained in three different directories,
37normally
38.Pa /usr/src ,
39.Pa /usr/doc ,
40and
41.Pa /usr/ports .
42Directory
43.Pa /usr/src
44contains the
45.Dq "base system"
46sources, which is loosely defined as the things required to rebuild
47the system to a useful state.
48Directory
49.Pa /usr/doc
50contains the source for the system documentation, excluding the manual
51pages.
52Directory
53.Pa /usr/ports
54contains a tree that provides a consistent interface for building and
55installing third party applications.
56For more information about the ports build process, see
57.Xr ports 7 .
58.Pp
59The
60.Xr make 1
61command is used in each of these directories to build and install the
62things in that directory.
63Issuing the
64.Xr make 1
65command in any directory or
66subdirectory of those directories has the same effect as issuing the
67same command in all subdirectories of that directory.
68With no target specified, the things in that directory are just built.
69.Pp
70A source tree is allowed to be read-only.
71As described in
72.Xr make 1 ,
73objects are usually built in a separate object directory hierarchy
74specified by the environment variable
75.Va MAKEOBJDIRPREFIX ,
76or under
77.Pa /usr/obj
78if variable
79.Va MAKEOBJDIRPREFIX
80is not set.
81For a given source directory, its canonical object directory
82would be
83.Pa ${MAKEOBJDIRPREFIX}${.CURDIR}
84if
85.Xr make 1
86variable
87.Va MAKEOBJDIRPREFIX
88is set, or
89.Pa /usr/obj${.CURDIR}
90if this variable is not set.
91Cross-builds set the object directory as described in the
92documentation for the
93.Cm buildworld
94target below.
95.Pp
96The build may be controlled by defining
97.Xr make 1
98variables described in the
99.Sx ENVIRONMENT
100section below, and by the variables documented in
101.Xr make.conf 5 .
102.Pp
103The following list provides the names and actions for the targets
104supported by the build system:
105.Bl -tag -width ".Cm cleandepend"
106.It Cm clean
107Remove any files created during the build process.
108.It Cm cleandepend
109Remove the file
110.Pa ${.OBJDIR}/${DEPENDFILE}
111generated by a prior
112.Dq Li "make depend"
113step.
114.It Cm cleandir
115Remove the canonical object directory if it exists, or perform
116actions equivalent to
117.Dq Li "make clean cleandepend"
118if it does not.
119This target will also remove an
120.Pa obj
121link in
122.Pa ${.CURDIR}
123if that exists.
124.Pp
125It is advisable to run
126.Dq Li "make cleandir"
127twice: the first invocation will remove the canonical object directory
128and the second one will clean up
129.Pa ${.CURDIR} .
130.It Cm depend
131Generate a list of build dependencies in file
132.Pa ${.OBJDIR}/${DEPENDFILE} .
133.It Cm install
134Install the results of the build to the appropriate location in the
135installation directory hierarchy specified in variable
136.Va DESTDIR .
137.It Cm obj
138Create the canonical object directory associated with the current
139directory.
140.It Cm objlink
141Create a symbolic link to the canonical object directory in
142.Pa ${.CURDIR} .
143.It Cm tags
144Generate a tags file using the program specified in the
145.Xr make 1
146variable
147.Va CTAGS .
148The build system supports
149.Xr ctags 1
150and
151.Nm "GNU Global" .
152.El
153.Pp
154The other supported targets under directory
155.Pa /usr/src
156are:
157.Bl -tag -width ".Cm distributeworld"
158.It Cm buildenv
159Spawn an interactive shell with environment variables set up for
160cross-building the system.
161The target architecture needs to be specified with
162.Xr make 1
163variables
164.Va TARGET_ARCH
165and
166.Va TARGET .
167.Pp
168This target is only useful after a complete cross-toolchain including
169the compiler, linker, assembler, headers and libraries has been
170built; see the
171.Cm toolchain
172target below.
173.It Cm buildworld
174Build everything but the kernel, configure files in
175.Pa etc ,
176and
177.Pa release .
178The actual build location prefix used is
179.Pa ${MAKEOBJDIRPREFIX}${.CURDIR}
180for native builds, and
181.Pa ${MAKEOBJDIRPREFIX}/${TARGET}${.CURDIR}
182for cross builds and native builds with variable
183.Va CROSS_BUILD_TESTING
184set.
185.It Cm cleanworld
186Attempt to clean up targets built by a preceding
187.Cm buildworld
188step.
189.It Cm distributeworld
190Distribute everything compiled by a preceding
191.Cm buildworld
192step.
193Files are placed in the directory hierarchy specified by
194.Xr make 1
195variable
196.Va DISTDIR .
197This target is used while building a release; see
198.Xr release 7 .
199.It Cm packageworld
200Archive the results of
201.Cm distributeworld ,
202placing the results in
203.Va DISTDIR .
204This target is used while building a release; see
205.Xr release 7 .
206.It Cm installworld
207Install everything built by a preceding
208.Cm buildworld
209step into the directory hierarchy pointed to by
210.Xr make 1
211variable
212.Va DESTDIR .
213.Pp
214If installing onto an NFS file system and running
215.Xr make 1
216with the
217.Fl j
218option, make sure that
219.Xr rpc.lockd 8
220is running on both client and server.
221See
222.Xr rc.conf 5
223on how to make it start at boot time.
224.It Cm toolchain
225Create the build toolchain needed to build the rest of the system.
226For cross-architecture builds, this step creates a cross-toolchain.
227.It Cm universe
228For each architecture,
229execute a
230.Cm buildworld
231followed by a
232.Cm buildkernel
233for all kernels for that architecture,
234including
235.Pa LINT .
236This command takes a long time.
237.It Cm update
238Get updated sources as configured in
239.Xr make.conf 5 .
240.It Cm targets
241Print a list of supported
242.Va TARGET
243/
244.Va TARGET_ARCH
245pairs for world and kernel targets.
246.It Cm tinderbox
247Execute the same targets as
248.Cm universe .
249In addition print a summary of all failed targets at the end and
250exit with an error if there were any.
251.It Cm toolchains
252Create a build toolchain for each architecture supported by the build system.
253.El
254.Pp
255Kernel specific build targets in
256.Pa /usr/src
257are:
258.Bl -tag -width ".Cm distributekernel"
259.It Cm buildkernel
260Rebuild the kernel and the kernel modules.
261.It Cm installkernel
262Install the kernel and the kernel modules to directory
263.Pa ${DESTDIR}/boot/kernel ,
264renaming any pre-existing directory with this name to
265.Pa kernel.old
266if it contained the currently running kernel.
267The target directory under
268.Pa ${DESTDIR}
269may be modified using the
270.Va INSTKERNNAME
271and
272.Va KODIR
273.Xr make 1
274variables.
275.It Cm distributekernel
276Install the kernel to the directory
277.Pa ${DISTDIR}/kernel/boot/kernel .
278This target is used while building a release; see
279.Xr release 7 .
280.It Cm packagekernel
281Archive the results of
282.Cm distributekernel ,
283placing the results in
284.Va DISTDIR .
285This target is used while building a release; see
286.Xr release 7 .
287.It Cm kernel
288Equivalent to
289.Cm buildkernel
290followed by
291.Cm installkernel
292.It Cm kernel-toolchain
293Rebuild the tools needed for kernel compilation.
294Use this if you did not do a
295.Cm buildworld
296first.
297.It Cm reinstallkernel
298Reinstall the kernel and the kernel modules, overwriting the contents
299of the target directory.
300As with the
301.Cm installkernel
302target, the target directory can be specified using the
303.Xr make 1
304variable
305.Va INSTKERNNAME .
306.El
307.Pp
308Convenience targets for cleaning up the install destination directory
309denoted by variable
310.Va DESTDIR
311include:
312.Bl -tag -width ".Cm delete-old-libs"
313.It Cm check-old
314Print a list of old files and directories in the system.
315.It Cm delete-old
316Delete obsolete base system files and directories interactively.
317When
318.Li -DBATCH_DELETE_OLD_FILES
319is specified at the command line, the delete operation will be
320non-interactive.
321The variables
322.Va DESTDIR ,
323.Va TARGET_ARCH
324and
325.Va TARGET
326should be set as with
327.Dq Li "make installworld" .
328.It Cm delete-old-libs
329Delete obsolete base system libraries interactively.
330This target should only be used if no 3rd party software uses these
331libraries.
332When
333.Li -DBATCH_DELETE_OLD_FILES
334is specified at the command line, the delete operation will be
335non-interactive.
336The variables
337.Va DESTDIR ,
338.Va TARGET_ARCH
339and
340.Va TARGET
341should be set as with
342.Dq Li "make installworld" .
343.El
344.Sh ENVIRONMENT
345Variables that influence all builds include:
346.Bl -tag -width ".Va MAKEOBJDIRPREFIX"
347.It Va DEBUG_FLAGS
348Defines a set of debugging flags that will be used to build all userland
349binaries under
350.Pa /usr/src .
351When
352.Va DEBUG_FLAGS
353is defined, the
354.Cm install
355and
356.Cm installworld
357targets install binaries from the current
358.Va MAKEOBJDIRPREFIX
359without stripping,
360so that debugging information is retained in the installed binaries.
361.It Va DESTDIR
362The directory hierarchy prefix where built objects will be installed.
363If not set,
364.Va DESTDIR
365defaults to the empty string.
366.It Va MAKEOBJDIRPREFIX
367Defines the prefix for directory names in the tree of built objects.
368Defaults to
369.Pa /usr/obj
370if not defined.
371This variable should only be set in the environment and not via
372.Pa /etc/make.conf
373or the command line.
374.It Va NO_WERROR
375If defined, compiler warnings will not cause the build to halt,
376even if the makefile says otherwise.
377.It Va WITH_CTF
378If defined, the build process will run the DTrace CTF conversion
379tools on built objects.
380Please note that this WITH_ option is handled differently than all
381other WITH_ options (there is no
382.Va WITHOUT_CTF ,
383or corresponding
384.Va MK_CTF
385in the build system).
386.El
387.Pp
388Additionally, builds in
389.Pa /usr/src
390are influenced by the following
391.Xr make 1
392variables:
393.Bl -tag -width ".Va SUBDIR_OVERRIDE"
394.It Va KERNCONF
395Overrides which kernel to build and install for the various kernel
396make targets.
397It defaults to
398.Cm GENERIC .
399.It Va KERNFAST
400If set, the build target
401.Cm buildkernel
402defaults to setting
403.Va NO_KERNELCLEAN ,
404.Va NO_KERNELCONFIG ,
405.Va NO_KERNELDEPEND
406and
407.Va NO_KERNELOBJ .
408When set to a value other than
409.Cm 1
410then
411.Va KERNCONF
412is set to the value of
413.Va KERNFAST .
414.It Va LOCAL_DIRS
415If set, this variable supplies a list of additional directories to
416build, relative to the root of the source tree.
417.It Va SUBDIR_OVERRIDE
418Override the default list of sub-directories and only build the
419sub-directory named in this variable.
420This variable is useful when debugging failed builds.
421.Bd -literal -offset indent
422make some-target SUBDIR_OVERRIDE=foo/bar
423.Ed
424.It Va TARGET
425The target hardware platform.
426This is analogous to the
427.Dq Nm uname Fl m
428output.
429This is necessary to cross-build some target architectures.
430For example, cross-building for PC98 machines requires
431.Va TARGET_ARCH Ns = Ns Li i386
432and
433.Va TARGET Ns = Ns Li pc98 .
434If not set,
435.Va TARGET
436defaults to the current hardware platform.
437.It Va TARGET_ARCH
438The target machine processor architecture.
439This is analogous to the
440.Dq Nm uname Fl p
441output.
442Set this to cross-build for a different architecture.
443If not set,
444.Va TARGET_ARCH
445defaults to the current machine architecture, unless
446.Va TARGET
447is also set, in which case it defaults to the appropriate
448value for that platform.
449Typically, one only needs to set
450.Va TARGET .
451.El
452.Pp
453Builds under directory
454.Pa /usr/src
455are also influenced by defining one or more of the following symbols,
456using the
457.Fl D
458option of
459.Xr make 1 :
460.Bl -tag -width ".Va -DNO_KERNELDEPEND"
461.It Va NO_CLEANDIR
462If set, the build targets that clean parts of the object tree use the
463equivalent of
464.Dq make clean
465instead of
466.Dq make cleandir .
467.It Va NO_CLEAN
468If set, no object tree files are cleaned at all.
469Setting
470.Va NO_CLEAN
471implies
472.Va NO_KERNELCLEAN ,
473so when
474.Va NO_CLEAN
475is set no kernel objects are cleaned either.
476.It Va NO_CTF
477If set, the build process does not run the DTrace CTF conversion tools
478on built objects.
479.It Va NO_SHARE
480If set, the build does not descend into the
481.Pa /usr/src/share
482subdirectory (i.e. manpages, locale data files, timezone data files and
483other
484.Pa /usr/src/share
485files will not be rebuild from their sources).
486.It Va NO_KERNELCLEAN
487If set, the build process does not run
488.Dq make clean
489as part of the
490.Cm buildkernel
491target.
492.It Va NO_KERNELCONFIG
493If set, the build process does not run
494.Xr config 8
495as part of the
496.Cm buildkernel
497target.
498.It Va NO_KERNELDEPEND
499If set, the build process does not run
500.Dq make depend
501as part of the
502.Cm buildkernel
503target.
504.It Va NO_KERNELOBJ
505If set, the build process does not run
506.Dq make obj
507as part of the
508.Cm buildkernel
509target.
510.It Va NO_DOCUPDATE
511If set, the update process does not update the source of the
512.Fx
513documentation as part of the
514.Dq make update
515target.
516.It Va NO_PORTSUPDATE
517If set, the update process does not update the Ports tree as part of the
518.Dq make update
519target.
520.It Va NO_WWWUPDATE
521If set, the update process does not update the www tree as part of the
522.Dq make update
523target.
520.El
521.Pp
522Builds under directory
523.Pa /usr/doc
524are influenced by the following
525.Xr make 1
526variables:
527.Bl -tag -width ".Va DOC_LANG"
528.It Va DOC_LANG
529If set, restricts the documentation build to the language subdirectories
530specified as its content.
531The default action is to build documentation for all languages.
532.El
533.Pp
534Builds using the
535.Cm universe
536target are influenced by the following
537.Xr make 1
538variables:
539.Bl -tag -width ".Va MAKE_JUST_KERNELS"
540.It Va JFLAG
541Pass the value of this variable to each
542.Xr make 1
543invocation used to build worlds and kernels.
544This can be used to enable multiple jobs within a single architecture's build
545while still building each architecture serially.
546.It Va MAKE_JUST_KERNELS
547Only build kernels for each supported architecture.
548.It Va MAKE_JUST_WORLDS
549Only build worlds for each supported architecture.
550.It Va UNIVERSE_TARGET
551Execute the specified
552.Xr make 1
553target for each supported architecture instead of the default action of
554building a world and one or more kernels.
555.El
556.Sh FILES
557.Bl -tag -width ".Pa /usr/share/examples/etc/make.conf" -compact
558.It Pa /usr/doc/Makefile
559.It Pa /usr/doc/share/mk/doc.project.mk
560.It Pa /usr/ports/Mk/bsd.port.mk
561.It Pa /usr/ports/Mk/bsd.sites.mk
562.It Pa /usr/share/examples/etc/make.conf
563.It Pa /usr/src/Makefile
564.It Pa /usr/src/Makefile.inc1
565.El
566.Sh EXAMPLES
567For an
568.Dq approved
569method of updating your system from the latest sources, please see the
570.Sx COMMON ITEMS
571section in
572.Pa src/UPDATING .
573.Pp
574The following sequence of commands can be used to cross-build the
575system for the sparc64 architecture on an i386 host:
576.Bd -literal -offset indent
577cd /usr/src
578make TARGET=sparc64 buildworld
579make TARGET=sparc64 DESTDIR=/clients/sparc64 installworld
580.Ed
581.Sh SEE ALSO
582.Xr cc 1 ,
583.Xr install 1 ,
584.Xr make 1 ,
585.Xr make.conf 5 ,
586.Xr src.conf 5 ,
587.Xr ports 7 ,
588.Xr release 7 ,
589.Xr config 8 ,
590.Xr mergemaster 8 ,
591.Xr reboot 8 ,
592.Xr shutdown 8
593.Sh AUTHORS
594.An Mike W. Meyer Aq mwm@mired.org .
524.El
525.Pp
526Builds under directory
527.Pa /usr/doc
528are influenced by the following
529.Xr make 1
530variables:
531.Bl -tag -width ".Va DOC_LANG"
532.It Va DOC_LANG
533If set, restricts the documentation build to the language subdirectories
534specified as its content.
535The default action is to build documentation for all languages.
536.El
537.Pp
538Builds using the
539.Cm universe
540target are influenced by the following
541.Xr make 1
542variables:
543.Bl -tag -width ".Va MAKE_JUST_KERNELS"
544.It Va JFLAG
545Pass the value of this variable to each
546.Xr make 1
547invocation used to build worlds and kernels.
548This can be used to enable multiple jobs within a single architecture's build
549while still building each architecture serially.
550.It Va MAKE_JUST_KERNELS
551Only build kernels for each supported architecture.
552.It Va MAKE_JUST_WORLDS
553Only build worlds for each supported architecture.
554.It Va UNIVERSE_TARGET
555Execute the specified
556.Xr make 1
557target for each supported architecture instead of the default action of
558building a world and one or more kernels.
559.El
560.Sh FILES
561.Bl -tag -width ".Pa /usr/share/examples/etc/make.conf" -compact
562.It Pa /usr/doc/Makefile
563.It Pa /usr/doc/share/mk/doc.project.mk
564.It Pa /usr/ports/Mk/bsd.port.mk
565.It Pa /usr/ports/Mk/bsd.sites.mk
566.It Pa /usr/share/examples/etc/make.conf
567.It Pa /usr/src/Makefile
568.It Pa /usr/src/Makefile.inc1
569.El
570.Sh EXAMPLES
571For an
572.Dq approved
573method of updating your system from the latest sources, please see the
574.Sx COMMON ITEMS
575section in
576.Pa src/UPDATING .
577.Pp
578The following sequence of commands can be used to cross-build the
579system for the sparc64 architecture on an i386 host:
580.Bd -literal -offset indent
581cd /usr/src
582make TARGET=sparc64 buildworld
583make TARGET=sparc64 DESTDIR=/clients/sparc64 installworld
584.Ed
585.Sh SEE ALSO
586.Xr cc 1 ,
587.Xr install 1 ,
588.Xr make 1 ,
589.Xr make.conf 5 ,
590.Xr src.conf 5 ,
591.Xr ports 7 ,
592.Xr release 7 ,
593.Xr config 8 ,
594.Xr mergemaster 8 ,
595.Xr reboot 8 ,
596.Xr shutdown 8
597.Sh AUTHORS
598.An Mike W. Meyer Aq mwm@mired.org .