]> CyberLeo.Net >> Repos - FreeBSD/FreeBSD.git/blob - share/man/man7/build.7
Connect mitigations(7) to the build
[FreeBSD/FreeBSD.git] / share / man / man7 / build.7
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 .Dd August 1, 2023
26 .Dt BUILD 7
27 .Os
28 .Sh NAME
29 .Nm build
30 .Nd General instructions on how to build the system
31 .Sh DESCRIPTION
32 The sources for the
33 .Fx
34 system and its applications are contained in three different directories,
35 normally
36 .Pa /usr/src ,
37 .Pa /usr/doc ,
38 and
39 .Pa /usr/ports .
40 These directories may be initially empty or non-existent until updated with
41 Git
42 .Po installed from packages with
43 .Xr pkg 7
44 or from
45 .Xr ports 7 Pc .
46 Directory
47 .Pa /usr/src
48 contains the
49 .Dq "base system"
50 sources, which is loosely defined as the things required to rebuild
51 the system to a useful state.
52 Directory
53 .Pa /usr/doc
54 contains the source for the system documentation, excluding the manual
55 pages.
56 Directory
57 .Pa /usr/ports
58 contains a tree that provides a consistent interface for building and
59 installing third party applications.
60 For more information about the ports build process, see
61 .Xr ports 7 .
62 .Pp
63 The
64 .Xr make 1
65 command is used in each of these directories to build and install the
66 things in that directory.
67 Issuing the
68 .Xr make 1
69 command in any directory issues the
70 .Xr make 1
71 command recursively in all subdirectories.
72 With no target specified, the items in the directories are built
73 and no further action is taken.
74 .Pp
75 A source tree is allowed to be read-only.
76 As described in
77 .Xr make 1 ,
78 objects are usually built in a separate object directory hierarchy
79 specified by the environment variable
80 .Va MAKEOBJDIRPREFIX ,
81 or under
82 .Pa /usr/obj
83 if variable
84 .Va MAKEOBJDIRPREFIX
85 is not set.
86 The canonical object directory is described in the documentation for the
87 .Cm buildworld
88 target below.
89 .Pp
90 The build may be controlled by defining
91 .Xr make 1
92 variables described in the
93 .Sx ENVIRONMENT
94 section below, and by the variables documented in
95 .Xr make.conf 5 .
96 .Pp
97 The default components included in the build are specified in the file
98 .Pa /etc/src.conf
99 in the source tree.
100 To override the default file, include the SRCCONF option in the make steps,
101 pointing to a custom src.conf file.
102 For more information see
103 .Xr src.conf 5 .
104 .Pp
105 The following list provides the names and actions for the targets
106 supported by the build system:
107 .Bl -tag -width ".Cm cleandepend"
108 .It Cm analyze
109 Run Clang static analyzer against all objects and present output on stdout.
110 .It Cm check
111 Run tests for a given subdirectory.
112 The default directory used is
113 .Pa ${.OBJDIR} ,
114 but the check directory can be changed with
115 .Pa ${CHECKDIR} .
116 .It Cm checkworld
117 Run the
118 .Fx
119 test suite on installed world.
120 .It Cm clean
121 Remove any files created during the build process.
122 .It Cm cleandepend
123 Remove the
124 .Pa ${.OBJDIR}/${DEPENDFILE}*
125 files generated by prior
126 .Dq Li "make"
127 and
128 .Dq Li "make depend"
129 steps.
130 .It Cm cleandir
131 Remove the canonical object directory if it exists, or perform
132 actions equivalent to
133 .Dq Li "make clean cleandepend"
134 if it does not.
135 This target will also remove an
136 .Pa obj
137 link in
138 .Pa ${.CURDIR}
139 if that exists.
140 .Pp
141 It is advisable to run
142 .Dq Li "make cleandir"
143 twice: the first invocation will remove the canonical object directory
144 and the second one will clean up
145 .Pa ${.CURDIR} .
146 .It Cm depend
147 Generate a list of build dependencies in file
148 .Pa ${.OBJDIR}/${DEPENDFILE} .
149 Per-object dependencies are generated at build time and stored in
150 .Pa ${.OBJDIR}/${DEPENDFILE}.${OBJ} .
151 .It Cm install
152 Install the results of the build to the appropriate location in the
153 installation directory hierarchy specified in variable
154 .Va DESTDIR .
155 .It Cm obj
156 Create the canonical object directory associated with the current
157 directory.
158 .It Cm objlink
159 Create a symbolic link to the canonical object directory in
160 .Pa ${.CURDIR} .
161 .It Cm tags
162 Generate a tags file using the program specified in the
163 .Xr make 1
164 variable
165 .Va CTAGS .
166 The build system supports
167 .Xr ctags 1
168 and
169 .Nm "GNU Global" .
170 .El
171 .Pp
172 The other supported targets under directory
173 .Pa /usr/src
174 are:
175 .Bl -tag -width ".Cm distributeworld"
176 .It Cm buildenv
177 Spawn an interactive shell with environment variables set up for
178 building the system or individual components.
179 For cross-building the target architecture needs to be specified with
180 .Xr make 1
181 variables
182 .Va TARGET_ARCH
183 and
184 .Va TARGET .
185 .Pp
186 This target is only useful after a complete toolchain (including
187 the compiler, linker, assembler, headers and libraries) has been
188 built; see the
189 .Cm toolchain
190 target below.
191 .It Cm buildworld
192 Build everything but the kernel, configure files in
193 .Pa etc ,
194 and
195 .Pa release .
196 The object directory can be changed from the default
197 .Pa /usr/obj
198 by setting the
199 .Pa MAKEOBJDIRPREFIX
200 .Xr make 1
201 variable.
202 The actual build location prefix used
203 depends on the
204 .Va WITH_UNIFIED_OBJDIR
205 option from
206 .Xr src.conf 5 .
207 If enabled it is
208 .Pa ${MAKEOBJDIRPREFIX}${.CURDIR}/${TARGET}.${TARGET_ARCH}
209 for all builds.
210 If disabled it is
211 .Pa ${MAKEOBJDIRPREFIX}${.CURDIR}
212 for native builds, and
213 .Pa ${MAKEOBJDIRPREFIX}/${TARGET}.${TARGET_ARCH}${.CURDIR}
214 for cross builds and native builds with variable
215 .Va CROSS_BUILD_TESTING
216 set.
217 .It Cm cleankernel
218 Attempts to clean up targets built by a preceding
219 .Cm buildkernel ,
220 or similar step, built from the same source directory and
221 .Va KERNCONF .
222 .It Cm cleanworld
223 Attempt to clean up targets built by a preceding
224 .Cm buildworld ,
225 or similar step, built from this source directory.
226 .It Cm cleanuniverse
227 When
228 .Va WITH_UNIFIED_OBJDIR
229 is enabled, attempt to clean up targets built by a preceding
230 .Cm buildworld ,
231 .Cm universe ,
232 or similar step, for any architecture built from this source directory.
233 .It Cm distributeworld
234 Distribute everything compiled by a preceding
235 .Cm buildworld
236 step.
237 Files are placed in the directory hierarchy specified by
238 .Xr make 1
239 variable
240 .Va DISTDIR .
241 This target is used while building a release; see
242 .Xr release 7 .
243 .It Cm native-xtools
244 This target builds a cross-toolchain for the given
245 .Sy TARGET
246 and
247 .Sy TARGET_ARCH ,
248 as well as a select list of static userland tools for the host system.
249 This is intended to be used in a jail where QEMU is used to improve
250 performance by avoiding emulating binaries that do not need to be emulated.
251 .Sy TARGET
252 and
253 .Sy TARGET_ARCH
254 should be defined.
255 .It Cm native-xtools-install
256 Installs the results to
257 .Pa ${DESTDIR}/${NXTP}
258 where
259 .Va NXTP
260 defaults to
261 .Pa nxb-bin .
262 .Sy TARGET
263 and
264 .Sy TARGET_ARCH
265 must be defined.
266 .It Cm packageworld
267 Archive the results of
268 .Cm distributeworld ,
269 placing the results in
270 .Va DISTDIR .
271 This target is used while building a release; see
272 .Xr release 7 .
273 .It Cm installworld
274 Install everything built by a preceding
275 .Cm buildworld
276 step into the directory hierarchy pointed to by
277 .Xr make 1
278 variable
279 .Va DESTDIR .
280 .Pp
281 If installing onto an NFS file system and running
282 .Xr make 1
283 with the
284 .Fl j
285 option, make sure that
286 .Xr rpc.lockd 8
287 is running on both client and server.
288 See
289 .Xr rc.conf 5
290 on how to make it start at boot time.
291 .It Cm toolchain
292 Create the build toolchain needed to build the rest of the system.
293 For cross-architecture builds, this step creates a cross-toolchain.
294 .It Cm universe
295 For each architecture,
296 execute a
297 .Cm buildworld
298 followed by a
299 .Cm buildkernel
300 for all kernels for that architecture,
301 including
302 .Pa LINT .
303 This command takes a long time.
304 .It Cm kernels
305 Like
306 .Cm universe
307 with
308 .Va WITHOUT_WORLDS
309 defined so only the kernels for each architecture are built.
310 .It Cm worlds
311 Like
312 .Cm universe
313 with
314 .Va WITHOUT_KERNELS
315 defined so only the worlds for each architecture are built.
316 .It Cm targets
317 Print a list of supported
318 .Va TARGET
319 /
320 .Va TARGET_ARCH
321 pairs for world and kernel targets.
322 .It Cm tinderbox
323 Execute the same targets as
324 .Cm universe .
325 In addition print a summary of all failed targets at the end and
326 exit with an error if there were any.
327 .It Cm toolchains
328 Create a build toolchain for each architecture supported by the build system.
329 .It Cm xdev
330 Builds and installs a cross-toolchain and sysroot for the given
331 .Sy TARGET
332 and
333 .Sy TARGET_ARCH .
334 The sysroot contains target library and headers.
335 The target is an alias for
336 .Cm xdev-build
337 and
338 .Cm xdev-install .
339 The location of the files installed can be controlled with
340 .Va DESTDIR .
341 The target location in
342 .Va DESTDIR
343 is
344 .Pa ${DESTDIR}/${XDTP}
345 where
346 .Va XDTP
347 defaults to
348 .Pa /usr/${XDDIR}
349 and
350 .Va XDDIR
351 defaults to
352 .Pa ${TARGET_ARCH}-freebsd .
353 .It Cm xdev-build
354 Builds for the
355 .Cm xdev
356 target.
357 .It Cm xdev-install
358 Installs the files for the
359 .Cm xdev
360 target.
361 .It Cm xdev-links
362 Installs autoconf-style symlinks to
363 .Pa ${DESTDIR}/usr/bin
364 pointing into the xdev toolchain in
365 .Pa ${DESTDIR}/${XDTP} .
366 .El
367 .Pp
368 Kernel specific build targets in
369 .Pa /usr/src
370 are:
371 .Bl -tag -width ".Cm distributekernel"
372 .It Cm buildkernel
373 Rebuild the kernel and the kernel modules.
374 The object directory can be changed from the default
375 .Pa /usr/obj
376 by setting the
377 .Pa MAKEOBJDIRPREFIX
378 .Xr make 1
379 variable.
380 .It Cm installkernel
381 Install the kernel and the kernel modules to directory
382 .Pa ${DESTDIR}/boot/kernel ,
383 renaming any pre-existing directory with this name to
384 .Pa kernel.old
385 if it contained the currently running kernel.
386 The target directory under
387 .Pa ${DESTDIR}
388 may be modified using the
389 .Va INSTKERNNAME
390 and
391 .Va KODIR
392 .Xr make 1
393 variables.
394 .It Cm distributekernel
395 Install the kernel to the directory
396 .Pa ${DISTDIR}/kernel/boot/kernel .
397 This target is used while building a release; see
398 .Xr release 7 .
399 .It Cm packagekernel
400 Archive the results of
401 .Cm distributekernel ,
402 placing the results in
403 .Va DISTDIR .
404 This target is used while building a release; see
405 .Xr release 7 .
406 .It Cm kernel
407 Equivalent to
408 .Cm buildkernel
409 followed by
410 .Cm installkernel
411 .It Cm kernel-toolchain
412 Rebuild the tools needed for kernel compilation.
413 Use this if you did not do a
414 .Cm buildworld
415 first.
416 .It Cm reinstallkernel
417 Reinstall the kernel and the kernel modules, overwriting the contents
418 of the target directory.
419 As with the
420 .Cm installkernel
421 target, the target directory can be specified using the
422 .Xr make 1
423 variable
424 .Va INSTKERNNAME .
425 .El
426 .Pp
427 Convenience targets for cleaning up the install destination directory
428 denoted by variable
429 .Va DESTDIR
430 include:
431 .Bl -tag -width ".Cm delete-old-libs"
432 .It Cm check-old
433 Print a list of old files and directories in the system.
434 .It Cm delete-old
435 Delete obsolete base system files and directories interactively.
436 When
437 .Li -DBATCH_DELETE_OLD_FILES
438 is specified at the command line, the delete operation will be
439 non-interactive.
440 The variables
441 .Va DESTDIR ,
442 .Va TARGET_ARCH
443 and
444 .Va TARGET
445 should be set as with
446 .Dq Li "make installworld" .
447 .It Cm delete-old-libs
448 Delete obsolete base system libraries interactively.
449 This target should only be used if no third party software uses these
450 libraries.
451 When
452 .Li -DBATCH_DELETE_OLD_FILES
453 is specified at the command line, the delete operation will be
454 non-interactive.
455 The variables
456 .Va DESTDIR ,
457 .Va TARGET_ARCH
458 and
459 .Va TARGET
460 should be set as with
461 .Dq Li "make installworld" .
462 .El
463 .Sh ENVIRONMENT
464 Variables that influence all builds include:
465 .Bl -tag -width ".Va MAKEOBJDIRPREFIX"
466 .It Va DEBUG_FLAGS
467 Defines a set of debugging flags that will be used to build all userland
468 binaries under
469 .Pa /usr/src .
470 When
471 .Va DEBUG_FLAGS
472 is defined, the
473 .Cm install
474 and
475 .Cm installworld
476 targets install binaries from the current
477 .Va MAKEOBJDIRPREFIX
478 without stripping,
479 so that debugging information is retained in the installed binaries.
480 .It Va DESTDIR
481 The directory hierarchy prefix where built objects will be installed.
482 If not set,
483 .Va DESTDIR
484 defaults to the empty string.
485 .It Va MAKEOBJDIRPREFIX
486 Defines the prefix for directory names in the tree of built objects.
487 Defaults to
488 .Pa /usr/obj
489 if not defined.
490 This variable should only be set in the environment or
491 .Pa /etc/src-env.conf
492 and not via
493 .Pa /etc/make.conf
494 or
495 .Pa /etc/src.conf
496 or the command line.
497 .It Va WITHOUT_WERROR
498 If defined, compiler warnings will not cause the build to halt,
499 even if the makefile says otherwise.
500 .It Va WITH_CTF
501 If defined, the build process will run the DTrace CTF conversion
502 tools on built objects.
503 .El
504 .Pp
505 Additionally, builds in
506 .Pa /usr/src
507 are influenced by the following
508 .Xr make 1
509 variables:
510 .Bl -tag -width ".Va LOCAL_MODULES_DIR"
511 .It Va CROSS_TOOLCHAIN
512 Requests use of an external toolchain to build either the world or kernel.
513 This value of this variable can either be the full path to a file,
514 or the base name of a file in
515 .Pa ${LOCALBASE}/share/toolchains .
516 The file should be a make file which sets variables to request an external
517 toolchain such as
518 .Va XCC .
519 .Pp
520 External toolchains are available in ports for both LLVM and GCC/binutils.
521 For external toolchains available in ports,
522 .Va CROSS_TOOLCHAIN
523 should be set to the name of the package.
524 LLVM toolchain packages use the name llvm<major version>.
525 GCC toolchains provide separate packages for each architecture and use the
526 name ${MACHINE_ARCH}-gcc<major version>.
527 .It Va KERNCONF
528 Overrides which kernel to build and install for the various kernel
529 make targets.
530 It defaults to
531 .Cm GENERIC .
532 .It Va KERNCONFDIR
533 Overrides the directory in which
534 .Va KERNCONF
535 and any files included by
536 .Va KERNCONF
537 should be found.
538 Defaults to
539 .Pa sys/${ARCH}/conf .
540 .It Va KERNFAST
541 If set, the build target
542 .Cm buildkernel
543 defaults to setting
544 .Va NO_KERNELCLEAN ,
545 .Va NO_KERNELCONFIG ,
546 and
547 .Va NO_KERNELOBJ .
548 When set to a value other than
549 .Cm 1
550 then
551 .Va KERNCONF
552 is set to the value of
553 .Va KERNFAST .
554 .It Va LOCAL_DIRS
555 If set, this variable supplies a list of additional directories relative to
556 the root of the source tree to build as part of the
557 .Cm everything
558 target.
559 The directories are built in parallel with each other,
560 and with the base system directories.
561 Insert a
562 .Va .WAIT
563 directive at the beginning of the
564 .Va LOCAL_DIRS
565 list to ensure all base system directories are built first.
566 .Va .WAIT
567 may also be used as needed elsewhere within the list.
568 .It Va LOCAL_ITOOLS
569 If set, this variable supplies a list of additional tools that are used by the
570 .Cm installworld
571 and
572 .Cm distributeworld
573 targets.
574 .It Va LOCAL_LIB_DIRS
575 If set, this variable supplies a list of additional directories relative to
576 the root of the source tree to build as part of the
577 .Cm libraries
578 target.
579 The directories are built in parallel with each other,
580 and with the base system libraries.
581 Insert a
582 .Va .WAIT
583 directive at the beginning of the
584 .Va LOCAL_DIRS
585 list to ensure all base system libraries are built first.
586 .Va .WAIT
587 may also be used as needed elsewhere within the list.
588 .It Va LOCAL_MTREE
589 If set, this variable supplies a list of additional mtrees relative to the
590 root of the source tree to use as part of the
591 .Cm hierarchy
592 target.
593 .It Va LOCAL_LEGACY_DIRS
594 If set, this variable supplies a list of additional directories relative to
595 the root of the source tree to build as part of the
596 .Cm legacy
597 target.
598 .It Va LOCAL_BSTOOL_DIRS
599 If set, this variable supplies a list of additional directories relative to
600 the root of the source tree to build as part of the
601 .Cm bootstrap-tools
602 target.
603 .It Va LOCAL_TOOL_DIRS
604 If set, this variable supplies a list of additional directories relative to
605 the root of the source tree to build as part of the
606 .Cm build-tools
607 target.
608 .It Va LOCAL_XTOOL_DIRS
609 If set, this variable supplies a list of additional directories relative to
610 the root of the source tree to build as part of the
611 .Cm cross-tools
612 target.
613 .It Va PORTS_MODULES
614 A list of ports with kernel modules that should be built and installed
615 as part of the
616 .Cm buildkernel
617 and
618 .Cm installkernel
619 process.
620 .Bd -literal -offset indent
621 make PORTS_MODULES=emulators/virtualbox-ose-kmod kernel
622 .Ed
623 .It Va LOCAL_MODULES
624 A list of external kernel modules that should be built and installed
625 as part of the
626 .Cm buildkernel
627 and
628 .Cm installkernel
629 process.
630 Defaults to the list of sub-directories of
631 .Va LOCAL_MODULES_DIR .
632 .It Va LOCAL_MODULES_DIR
633 The directory in which to search for the kernel modules specified by
634 .Va LOCAL_MODULES .
635 Each kernel module should consist of a directory containing a makefile.
636 Defaults to
637 .Pa ${LOCALBASE}/sys/modules .
638 .It Va SRCCONF
639 Specify a file to override the default
640 .Pa /etc/src.conf .
641 The src.conf file controls the components to build.
642 See
643 .Xr src.conf 5
644 .It Va STRIPBIN
645 Command to use at install time when stripping binaries.
646 Be sure to add any additional tools required to run
647 .Va STRIPBIN
648 to the
649 .Va LOCAL_ITOOLS
650 .Xr make 1
651 variable before running the
652 .Cm distributeworld
653 or
654 .Cm installworld
655 targets.
656 See
657 .Xr install 1
658 for more details.
659 .It Va SUBDIR_OVERRIDE
660 Override the default list of sub-directories and only build the
661 sub-directory named in this variable.
662 If combined with
663 .Cm buildworld
664 then all libraries and includes, and some of the build tools will still build
665 as well.
666 Specifying
667 .Cm -DNO_LIBS ,
668 and
669 .Cm -DWORLDFAST
670 will only build the specified directory as was done historically.
671 When combined with
672 .Cm buildworld
673 it is necesarry to override
674 .Va LOCAL_LIB_DIRS
675 with any custom directories containing libraries.
676 This allows building a subset of the system in the same way as
677 .Cm buildworld
678 does using its sysroot handling.
679 This variable can also be useful when debugging failed builds.
680 .Bd -literal -offset indent
681 make some-target SUBDIR_OVERRIDE=foo/bar
682 .Ed
683 .It Va SYSDIR
684 Specify the location of the kernel source to override the default
685 .Pa /usr/src/sys .
686 The kernel source is located in the
687 .Pa sys
688 subdirectory of the source tree checked out from the
689 .Pa src.git
690 repository.
691 .It Va TARGET
692 The target hardware platform.
693 This is analogous to the
694 .Dq Nm uname Fl m
695 output.
696 This is necessary to cross-build some target architectures.
697 For example, cross-building for ARM64 machines requires
698 .Va TARGET_ARCH Ns = Ns Li aarch64
699 and
700 .Va TARGET Ns = Ns Li arm64 .
701 If not set,
702 .Va TARGET
703 defaults to the current hardware platform, unless
704 .Va TARGET_ARCH
705 is also set, in which case it defaults to the appropriate
706 value for that architecture.
707 .It Va TARGET_ARCH
708 The target machine processor architecture.
709 This is analogous to the
710 .Dq Nm uname Fl p
711 output.
712 Set this to cross-build for a different architecture.
713 If not set,
714 .Va TARGET_ARCH
715 defaults to the current machine architecture, unless
716 .Va TARGET
717 is also set, in which case it defaults to the appropriate
718 value for that platform.
719 Typically, one only needs to set
720 .Va TARGET .
721 .El
722 .Pp
723 Builds under directory
724 .Pa /usr/src
725 are also influenced by defining one or more of the following symbols,
726 using the
727 .Fl D
728 option of
729 .Xr make 1 :
730 .Bl -tag -width ".Va LOADER_DEFAULT_INTERP"
731 .It Va LOADER_DEFAULT_INTERP
732 Defines what interpreter the default loader program will have.
733 Valid values include
734 .Dq 4th ,
735 .Dq lua ,
736 and
737 .Dq simp .
738 This creates the default link for
739 .Pa /boot/loader
740 to the loader with that interpreter.
741 It also determines what interpreter is compiled into
742 .Pa userboot .
743 .It Va NO_CLEANDIR
744 If set, the build targets that clean parts of the object tree use the
745 equivalent of
746 .Dq make clean
747 instead of
748 .Dq make cleandir .
749 .It Va NO_CLEAN
750 If set, no object tree files are cleaned at all.
751 This is the default when
752 .Va WITH_META_MODE
753 is used with
754 .Xr filemon 4
755 loaded.
756 See
757 .Xr src.conf 5
758 for more details.
759 Setting
760 .Va NO_CLEAN
761 implies
762 .Va NO_KERNELCLEAN ,
763 so when
764 .Va NO_CLEAN
765 is set no kernel objects are cleaned either.
766 .It Va NO_CTF
767 If set, the build process does not run the DTrace CTF conversion tools
768 on built objects.
769 .It Va NO_SHARE
770 If set, the build does not descend into the
771 .Pa /usr/src/share
772 subdirectory (i.e., manual pages, locale data files, timezone data files and
773 other
774 .Pa /usr/src/share
775 files will not be rebuild from their sources).
776 .It Va NO_KERNELCLEAN
777 If set, the build process does not run
778 .Dq make clean
779 as part of the
780 .Cm buildkernel
781 target.
782 .It Va NO_KERNELCONFIG
783 If set, the build process does not run
784 .Xr config 8
785 as part of the
786 .Cm buildkernel
787 target.
788 .It Va NO_KERNELOBJ
789 If set, the build process does not run
790 .Dq make obj
791 as part of the
792 .Cm buildkernel
793 target.
794 .It Va NO_LIBS
795 If set, the libraries phase will be skipped.
796 .It Va NO_OBJWALK
797 If set, no object directories will be created.
798 This should only be used if object directories were created in a
799 previous build and no new directories are connected.
800 .It Va UNIVERSE_TOOLCHAIN
801 Requests use of the toolchain built as part of the
802 .Cm universe
803 target as an external toolchain.
804 .It Va WORLDFAST
805 If set, the build target
806 .Cm buildworld
807 defaults to setting
808 .Va NO_CLEAN ,
809 .Va NO_OBJWALK ,
810 and will skip most bootstrap phases.
811 It will only bootstrap libraries and build all of userland.
812 This option should be used only when it is known that none of the bootstrap
813 needs changed and that no new directories have been connected to the build.
814 .El
815 .Pp
816 Builds under directory
817 .Pa /usr/doc
818 are influenced by the following
819 .Xr make 1
820 variables:
821 .Bl -tag -width ".Va DOC_LANG"
822 .It Va DOC_LANG
823 If set, restricts the documentation build to the language subdirectories
824 specified as its content.
825 The default action is to build documentation for all languages.
826 .El
827 .Pp
828 Builds using the
829 .Cm universe
830 and related targets are influenced by the following
831 .Xr make 1
832 variables:
833 .Bl -tag -width ".Va USE_GCC_TOOLCHAINS"
834 .It Va JFLAG
835 Pass the value of this variable to each
836 .Xr make 1
837 invocation used to build worlds and kernels.
838 This can be used to enable multiple jobs within a single architecture's build
839 while still building each architecture serially.
840 .It Va MAKE_JUST_KERNELS
841 Only build kernels for each supported architecture.
842 .It Va MAKE_JUST_WORLDS
843 Only build worlds for each supported architecture.
844 .It Va WITHOUT_WORLDS
845 Only build kernels for each supported architecture.
846 .It Va WITHOUT_KERNELS
847 Only build worlds for each supported architecture.
848 .It Va UNIVERSE_TARGET
849 Execute the specified
850 .Xr make 1
851 target for each supported architecture instead of the default action of
852 building a world and one or more kernels.
853 This variable implies
854 .Va WITHOUT_KERNELS .
855 .It Va USE_GCC_TOOLCHAINS
856 Use external GCC toolchains to build the requested targets.
857 If the required toolchain package for a supported architecture is not installed,
858 the build for that architecture is skipped.
859 .It Va TARGETS
860 Only build the listed targets instead of each supported architecture.
861 .It Va EXTRA_TARGETS
862 In addition to the supported architectures, build the semi-supported
863 architectures.
864 A semi-supported architecture has build support in the
865 .Fx
866 tree, but receives significantly less testing and is generally for
867 fringe uses that do not have a wide appeal.
868 .El
869 .Sh FILES
870 .Bl -tag -width ".Pa /usr/share/examples/etc/make.conf" -compact
871 .It Pa /usr/doc/Makefile
872 .It Pa /usr/doc/share/mk/doc.project.mk
873 .It Pa /usr/ports/Mk/bsd.port.mk
874 .It Pa /usr/ports/Mk/bsd.sites.mk
875 .It Pa /usr/share/examples/etc/make.conf
876 .It Pa /usr/src/Makefile
877 .It Pa /usr/src/Makefile.inc1
878 .El
879 .Sh EXAMPLES
880 For an
881 .Dq approved
882 method of updating your system from the latest sources, please see the
883 .Sx COMMON ITEMS
884 section in
885 .Pa src/UPDATING .
886 .Pp
887 The following sequence of commands can be used to cross-build the
888 system for the armv6 architecture on an amd64 host:
889 .Bd -literal -offset indent
890 cd /usr/src
891 make TARGET_ARCH=armv6 buildworld buildkernel
892 make TARGET_ARCH=armv6 DESTDIR=/clients/arm installworld installkernel
893 .Ed
894 .Sh HISTORY
895 The
896 .Nm
897 manpage first appeared in
898 .Fx 4.3 .
899 .Sh SEE ALSO
900 .Xr cc 1 ,
901 .Xr install 1 ,
902 .Xr make 1 ,
903 .Xr make.conf 5 ,
904 .Xr src.conf 5 ,
905 .Xr arch 7 ,
906 .Xr pkg 7 ,
907 .Xr ports 7 ,
908 .Xr release 7 ,
909 .Xr tests 7 ,
910 .Xr config 8 ,
911 .Xr etcupdate 8 ,
912 .Xr reboot 8 ,
913 .Xr shutdown 8
914 .Sh AUTHORS
915 .An Mike W. Meyer Aq Mt mwm@mired.org