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