xref: /freebsd/share/man/man7/build.7 (revision 9dc4bcb1a63acbbe32b4e80b690a843dd37315e7)
18327796cSAlexander Ziaee.\"-
28327796cSAlexander Ziaee.\" SPDX-License-Identifier: BSD-2-Clause
38327796cSAlexander Ziaee.\"
4786aa69aSBen Smithurst.\" Copyright (c) 2000
5786aa69aSBen Smithurst.\"	Mike W. Meyer
6786aa69aSBen Smithurst.\"
7786aa69aSBen Smithurst.\" Redistribution and use in source and binary forms, with or without
8786aa69aSBen Smithurst.\" modification, are permitted provided that the following conditions
9786aa69aSBen Smithurst.\" are met:
10786aa69aSBen Smithurst.\" 1. Redistributions of source code must retain the above copyright
11786aa69aSBen Smithurst.\"    notice, this list of conditions and the following disclaimer.
12786aa69aSBen Smithurst.\" 2. Redistributions in binary form must reproduce the above copyright
13786aa69aSBen Smithurst.\"    notice, this list of conditions and the following disclaimer in the
14786aa69aSBen Smithurst.\"    documentation and/or other materials provided with the distribution.
15786aa69aSBen Smithurst.\"
16786aa69aSBen Smithurst.\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND
17786aa69aSBen Smithurst.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
18786aa69aSBen Smithurst.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
19786aa69aSBen Smithurst.\" ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR BE LIABLE
20786aa69aSBen Smithurst.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
21786aa69aSBen Smithurst.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
22786aa69aSBen Smithurst.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
23786aa69aSBen Smithurst.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
24786aa69aSBen Smithurst.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
25786aa69aSBen Smithurst.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
26786aa69aSBen Smithurst.\" SUCH DAMAGE.
27786aa69aSBen Smithurst.\"
28*9dc4bcb1SWarner Losh.Dd March 8, 2025
29786aa69aSBen Smithurst.Dt BUILD 7
303d45e180SRuslan Ermilov.Os
31786aa69aSBen Smithurst.Sh NAME
32786aa69aSBen Smithurst.Nm build
33a8a2d5efSAlexander Ziaee.Nd general instructions on how to build the
34a8a2d5efSAlexander Ziaee.Fx
35a8a2d5efSAlexander Ziaeesystem
36786aa69aSBen Smithurst.Sh DESCRIPTION
377b710ab2SJoseph KoshyThe sources for the
38d003b779SRuslan Ermilov.Fx
397b710ab2SJoseph Koshysystem and its applications are contained in three different directories,
40786aa69aSBen Smithurstnormally
41786aa69aSBen Smithurst.Pa /usr/src ,
42786aa69aSBen Smithurst.Pa /usr/doc ,
43786aa69aSBen Smithurstand
44786aa69aSBen Smithurst.Pa /usr/ports .
4550a994c9SWarren BlockThese directories may be initially empty or non-existent until updated with
46e444a4c6SFernando ApesteguíaGit
47e444a4c6SFernando Apesteguía.Po installed from packages with
48e444a4c6SFernando Apesteguía.Xr pkg 7
49e444a4c6SFernando Apesteguíaor from
50e444a4c6SFernando Apesteguía.Xr ports 7 Pc .
517b710ab2SJoseph KoshyDirectory
52786aa69aSBen Smithurst.Pa /usr/src
53786aa69aSBen Smithurstcontains the
54786aa69aSBen Smithurst.Dq "base system"
55786aa69aSBen Smithurstsources, which is loosely defined as the things required to rebuild
56786aa69aSBen Smithurstthe system to a useful state.
577b710ab2SJoseph KoshyDirectory
58786aa69aSBen Smithurst.Pa /usr/doc
59786aa69aSBen Smithurstcontains the source for the system documentation, excluding the manual
60786aa69aSBen Smithurstpages.
617b710ab2SJoseph KoshyDirectory
62786aa69aSBen Smithurst.Pa /usr/ports
637b710ab2SJoseph Koshycontains a tree that provides a consistent interface for building and
64786aa69aSBen Smithurstinstalling third party applications.
657b710ab2SJoseph KoshyFor more information about the ports build process, see
667b710ab2SJoseph Koshy.Xr ports 7 .
67786aa69aSBen Smithurst.Pp
68786aa69aSBen SmithurstThe
69786aa69aSBen Smithurst.Xr make 1
70786aa69aSBen Smithurstcommand is used in each of these directories to build and install the
711caae057SRuslan Ermilovthings in that directory.
721caae057SRuslan ErmilovIssuing the
731caae057SRuslan Ermilov.Xr make 1
74e6ca6901SGordon Berglingcommand in any directory issues the
75e6ca6901SGordon Bergling.Xr make 1
76e6ca6901SGordon Berglingcommand recursively in all subdirectories.
77e6ca6901SGordon BerglingWith no target specified, the items in the directories are built
78e6ca6901SGordon Berglingand no further action is taken.
797b710ab2SJoseph Koshy.Pp
807b710ab2SJoseph KoshyA source tree is allowed to be read-only.
817b710ab2SJoseph KoshyAs described in
827b710ab2SJoseph Koshy.Xr make 1 ,
837b710ab2SJoseph Koshyobjects are usually built in a separate object directory hierarchy
847b710ab2SJoseph Koshyspecified by the environment variable
857b710ab2SJoseph Koshy.Va MAKEOBJDIRPREFIX ,
867b710ab2SJoseph Koshyor under
877b710ab2SJoseph Koshy.Pa /usr/obj
887b710ab2SJoseph Koshyif variable
897b710ab2SJoseph Koshy.Va MAKEOBJDIRPREFIX
907b710ab2SJoseph Koshyis not set.
91dfa09989SBryan DreweryThe canonical object directory is described in the documentation for the
927b710ab2SJoseph Koshy.Cm buildworld
937b710ab2SJoseph Koshytarget below.
947b710ab2SJoseph Koshy.Pp
957b710ab2SJoseph KoshyThe build may be controlled by defining
967b710ab2SJoseph Koshy.Xr make 1
977b710ab2SJoseph Koshyvariables described in the
987b710ab2SJoseph Koshy.Sx ENVIRONMENT
997b710ab2SJoseph Koshysection below, and by the variables documented in
1007b710ab2SJoseph Koshy.Xr make.conf 5 .
1017b710ab2SJoseph Koshy.Pp
102e6ca6901SGordon BerglingThe default components included in the build are specified in the file
103e6ca6901SGordon Bergling.Pa /etc/src.conf
104e6ca6901SGordon Berglingin the source tree.
105e6ca6901SGordon BerglingTo override the default file, include the SRCCONF option in the make steps,
106e6ca6901SGordon Berglingpointing to a custom src.conf file.
107e6ca6901SGordon BerglingFor more information see
108e6ca6901SGordon Bergling.Xr src.conf 5 .
109e6ca6901SGordon Bergling.Pp
1107b710ab2SJoseph KoshyThe following list provides the names and actions for the targets
1117b710ab2SJoseph Koshysupported by the build system:
1127b710ab2SJoseph Koshy.Bl -tag -width ".Cm cleandepend"
113aae63957SBryan Drewery.It Cm analyze
114aae63957SBryan DreweryRun Clang static analyzer against all objects and present output on stdout.
11571b7fa12SEnji Cooper.It Cm check
11671b7fa12SEnji CooperRun tests for a given subdirectory.
11771b7fa12SEnji CooperThe default directory used is
11871b7fa12SEnji Cooper.Pa ${.OBJDIR} ,
11971b7fa12SEnji Cooperbut the check directory can be changed with
12071b7fa12SEnji Cooper.Pa ${CHECKDIR} .
12171b7fa12SEnji Cooper.It Cm checkworld
12271b7fa12SEnji CooperRun the
12371b7fa12SEnji Cooper.Fx
12471b7fa12SEnji Coopertest suite on installed world.
1251caae057SRuslan Ermilov.It Cm clean
1267b710ab2SJoseph KoshyRemove any files created during the build process.
1277b710ab2SJoseph Koshy.It Cm cleandepend
128497e8091SBryan DreweryRemove the
129497e8091SBryan Drewery.Pa ${.OBJDIR}/${DEPENDFILE}*
130497e8091SBryan Dreweryfiles generated by prior
131497e8091SBryan Drewery.Dq Li "make"
132497e8091SBryan Dreweryand
1337b710ab2SJoseph Koshy.Dq Li "make depend"
134497e8091SBryan Drewerysteps.
1357b710ab2SJoseph Koshy.It Cm cleandir
1367b710ab2SJoseph KoshyRemove the canonical object directory if it exists, or perform
1377b710ab2SJoseph Koshyactions equivalent to
1387b710ab2SJoseph Koshy.Dq Li "make clean cleandepend"
1397b710ab2SJoseph Koshyif it does not.
1407b710ab2SJoseph KoshyThis target will also remove an
1417b710ab2SJoseph Koshy.Pa obj
1427b710ab2SJoseph Koshylink in
1437b710ab2SJoseph Koshy.Pa ${.CURDIR}
1447b710ab2SJoseph Koshyif that exists.
1457b710ab2SJoseph Koshy.Pp
1467b710ab2SJoseph KoshyIt is advisable to run
1477b710ab2SJoseph Koshy.Dq Li "make cleandir"
1487b710ab2SJoseph Koshytwice: the first invocation will remove the canonical object directory
1497b710ab2SJoseph Koshyand the second one will clean up
1507b710ab2SJoseph Koshy.Pa ${.CURDIR} .
1517b710ab2SJoseph Koshy.It Cm depend
1527b710ab2SJoseph KoshyGenerate a list of build dependencies in file
1537b710ab2SJoseph Koshy.Pa ${.OBJDIR}/${DEPENDFILE} .
154497e8091SBryan DreweryPer-object dependencies are generated at build time and stored in
155497e8091SBryan Drewery.Pa ${.OBJDIR}/${DEPENDFILE}.${OBJ} .
1561caae057SRuslan Ermilov.It Cm install
1577b710ab2SJoseph KoshyInstall the results of the build to the appropriate location in the
1587b710ab2SJoseph Koshyinstallation directory hierarchy specified in variable
1597b710ab2SJoseph Koshy.Va DESTDIR .
1607b710ab2SJoseph Koshy.It Cm obj
1617b710ab2SJoseph KoshyCreate the canonical object directory associated with the current
1627b710ab2SJoseph Koshydirectory.
1637b710ab2SJoseph Koshy.It Cm objlink
1647b710ab2SJoseph KoshyCreate a symbolic link to the canonical object directory in
1657b710ab2SJoseph Koshy.Pa ${.CURDIR} .
1667b710ab2SJoseph Koshy.It Cm tags
1677b710ab2SJoseph KoshyGenerate a tags file using the program specified in the
1687b710ab2SJoseph Koshy.Xr make 1
1697b710ab2SJoseph Koshyvariable
1707b710ab2SJoseph Koshy.Va CTAGS .
1717b710ab2SJoseph KoshyThe build system supports
1727b710ab2SJoseph Koshy.Xr ctags 1
1737b710ab2SJoseph Koshyand
1747b710ab2SJoseph Koshy.Nm "GNU Global" .
1757b710ab2SJoseph Koshy.El
1767b710ab2SJoseph Koshy.Pp
1777b710ab2SJoseph KoshyThe other supported targets under directory
1787b710ab2SJoseph Koshy.Pa /usr/src
1797b710ab2SJoseph Koshyare:
1807b710ab2SJoseph Koshy.Bl -tag -width ".Cm distributeworld"
1817b710ab2SJoseph Koshy.It Cm buildenv
1827b710ab2SJoseph KoshySpawn an interactive shell with environment variables set up for
1834a238795SEd Mastebuilding the system or individual components.
1844a238795SEd MasteFor cross-building the target architecture needs to be specified with
1857b710ab2SJoseph Koshy.Xr make 1
1867b710ab2SJoseph Koshyvariables
1877b710ab2SJoseph Koshy.Va TARGET_ARCH
1887b710ab2SJoseph Koshyand
1897b710ab2SJoseph Koshy.Va TARGET .
1907b710ab2SJoseph Koshy.Pp
1914a238795SEd MasteThis target is only useful after a complete toolchain (including
1924a238795SEd Mastethe compiler, linker, assembler, headers and libraries) has been
1937b710ab2SJoseph Koshybuilt; see the
1947b710ab2SJoseph Koshy.Cm toolchain
1957b710ab2SJoseph Koshytarget below.
1967b710ab2SJoseph Koshy.It Cm buildworld
1977b710ab2SJoseph KoshyBuild everything but the kernel, configure files in
1987b710ab2SJoseph Koshy.Pa etc ,
1997b710ab2SJoseph Koshyand
2007b710ab2SJoseph Koshy.Pa release .
201d90f12e3SWarren BlockThe object directory can be changed from the default
202d90f12e3SWarren Block.Pa /usr/obj
203d90f12e3SWarren Blockby setting the
204d90f12e3SWarren Block.Pa MAKEOBJDIRPREFIX
205d90f12e3SWarren Block.Xr make 1
206d90f12e3SWarren Blockvariable.
207dfa09989SBryan DreweryThe actual build location prefix used
208dfa09989SBryan Drewerydepends on the
209dfa09989SBryan Drewery.Va WITH_UNIFIED_OBJDIR
210dfa09989SBryan Dreweryoption from
211dfa09989SBryan Drewery.Xr src.conf 5 .
212dfa09989SBryan DreweryIf enabled it is
213dfa09989SBryan Drewery.Pa ${MAKEOBJDIRPREFIX}${.CURDIR}/${TARGET}.${TARGET_ARCH}
214dfa09989SBryan Dreweryfor all builds.
215dfa09989SBryan DreweryIf disabled it is
2167b710ab2SJoseph Koshy.Pa ${MAKEOBJDIRPREFIX}${.CURDIR}
2177b710ab2SJoseph Koshyfor native builds, and
218dfa09989SBryan Drewery.Pa ${MAKEOBJDIRPREFIX}/${TARGET}.${TARGET_ARCH}${.CURDIR}
2197b710ab2SJoseph Koshyfor cross builds and native builds with variable
2207b710ab2SJoseph Koshy.Va CROSS_BUILD_TESTING
2217b710ab2SJoseph Koshyset.
2223e65b7d9SWarner Losh.It Cm cleankernel
2233e65b7d9SWarner LoshAttempts to clean up targets built by a preceding
2243e65b7d9SWarner Losh.Cm buildkernel ,
2253e65b7d9SWarner Loshor similar step, built from the same source directory and
2263e65b7d9SWarner Losh.Va KERNCONF .
2277b710ab2SJoseph Koshy.It Cm cleanworld
2287b710ab2SJoseph KoshyAttempt to clean up targets built by a preceding
229c10062b9SBryan Drewery.Cm buildworld ,
2303e65b7d9SWarner Loshor similar step, built from this source directory.
231c10062b9SBryan Drewery.It Cm cleanuniverse
232c10062b9SBryan DreweryWhen
233c10062b9SBryan Drewery.Va WITH_UNIFIED_OBJDIR
234c10062b9SBryan Dreweryis enabled, attempt to clean up targets built by a preceding
235c10062b9SBryan Drewery.Cm buildworld ,
236c10062b9SBryan Drewery.Cm universe ,
237c10062b9SBryan Dreweryor similar step, for any architecture built from this source directory.
2387b710ab2SJoseph Koshy.It Cm distributeworld
2397b710ab2SJoseph KoshyDistribute everything compiled by a preceding
2407b710ab2SJoseph Koshy.Cm buildworld
2417b710ab2SJoseph Koshystep.
2427b710ab2SJoseph KoshyFiles are placed in the directory hierarchy specified by
2437b710ab2SJoseph Koshy.Xr make 1
2447b710ab2SJoseph Koshyvariable
2457b710ab2SJoseph Koshy.Va DISTDIR .
2467b710ab2SJoseph KoshyThis target is used while building a release; see
2477b710ab2SJoseph Koshy.Xr release 7 .
2487441e255SBryan Drewery.It Cm native-xtools
2497441e255SBryan DreweryThis target builds a cross-toolchain for the given
2507441e255SBryan Drewery.Sy TARGET
2517441e255SBryan Dreweryand
2527441e255SBryan Drewery.Sy TARGET_ARCH ,
2537441e255SBryan Dreweryas well as a select list of static userland tools for the host system.
2547441e255SBryan DreweryThis is intended to be used in a jail where QEMU is used to improve
2557441e255SBryan Dreweryperformance by avoiding emulating binaries that do not need to be emulated.
2567441e255SBryan Drewery.Sy TARGET
2577441e255SBryan Dreweryand
2587441e255SBryan Drewery.Sy TARGET_ARCH
2597441e255SBryan Dreweryshould be defined.
2605bd47cc5SBryan Drewery.It Cm native-xtools-install
2615bd47cc5SBryan DreweryInstalls the results to
2625bd47cc5SBryan Drewery.Pa ${DESTDIR}/${NXTP}
2635bd47cc5SBryan Drewerywhere
2645bd47cc5SBryan Drewery.Va NXTP
2655bd47cc5SBryan Drewerydefaults to
2665bd47cc5SBryan Drewery.Pa nxb-bin .
2675bd47cc5SBryan Drewery.Sy TARGET
2685bd47cc5SBryan Dreweryand
2695bd47cc5SBryan Drewery.Sy TARGET_ARCH
2705bd47cc5SBryan Drewerymust be defined.
271e8423d00SNathan Whitehorn.It Cm packageworld
272e8423d00SNathan WhitehornArchive the results of
273e8423d00SNathan Whitehorn.Cm distributeworld ,
274e8423d00SNathan Whitehornplacing the results in
275e8423d00SNathan Whitehorn.Va DISTDIR .
276e8423d00SNathan WhitehornThis target is used while building a release; see
277e8423d00SNathan Whitehorn.Xr release 7 .
2787b710ab2SJoseph Koshy.It Cm installworld
2797b710ab2SJoseph KoshyInstall everything built by a preceding
2807b710ab2SJoseph Koshy.Cm buildworld
2817b710ab2SJoseph Koshystep into the directory hierarchy pointed to by
2827b710ab2SJoseph Koshy.Xr make 1
2837b710ab2SJoseph Koshyvariable
2847b710ab2SJoseph Koshy.Va DESTDIR .
285a3aed80dSRuslan Ermilov.Pp
28604876cf3SRuslan ErmilovIf installing onto an NFS file system and running
2878ed6451eSRuslan Ermilov.Xr make 1
2888ed6451eSRuslan Ermilovwith the
28904876cf3SRuslan Ermilov.Fl j
29004876cf3SRuslan Ermilovoption, make sure that
291a3aed80dSRuslan Ermilov.Xr rpc.lockd 8
292a3aed80dSRuslan Ermilovis running on both client and server.
293a3aed80dSRuslan ErmilovSee
294a3aed80dSRuslan Ermilov.Xr rc.conf 5
295a3aed80dSRuslan Ermilovon how to make it start at boot time.
2967b710ab2SJoseph Koshy.It Cm toolchain
2977b710ab2SJoseph KoshyCreate the build toolchain needed to build the rest of the system.
2987b710ab2SJoseph KoshyFor cross-architecture builds, this step creates a cross-toolchain.
2997b710ab2SJoseph Koshy.It Cm universe
3004e889921SJohn BaldwinFor each architecture,
3014e889921SJohn Baldwinexecute a
3027b710ab2SJoseph Koshy.Cm buildworld
3034e889921SJohn Baldwinfollowed by a
3047b710ab2SJoseph Koshy.Cm buildkernel
3054e889921SJohn Baldwinfor all kernels for that architecture,
3064e889921SJohn Baldwinincluding
3074e889921SJohn Baldwin.Pa LINT .
3087b710ab2SJoseph KoshyThis command takes a long time.
309e1b9162fSWarner Losh.It Cm kernels
310e1b9162fSWarner LoshLike
311e1b9162fSWarner Losh.Cm universe
312e1b9162fSWarner Loshwith
313e1b9162fSWarner Losh.Va WITHOUT_WORLDS
314e1b9162fSWarner Loshdefined so only the kernels for each architecture are built.
315e1b9162fSWarner Losh.It Cm worlds
316e1b9162fSWarner LoshLike
317e1b9162fSWarner Losh.Cm universe
318e1b9162fSWarner Loshwith
319e1b9162fSWarner Losh.Va WITHOUT_KERNELS
320e1b9162fSWarner Loshdefined so only the worlds for each architecture are built.
321f1d16bd8SBjoern A. Zeeb.It Cm targets
322f1d16bd8SBjoern A. ZeebPrint a list of supported
323f1d16bd8SBjoern A. Zeeb.Va TARGET
324f1d16bd8SBjoern A. Zeeb/
325f1d16bd8SBjoern A. Zeeb.Va TARGET_ARCH
326f1d16bd8SBjoern A. Zeebpairs for world and kernel targets.
327eee8163bSBjoern A. Zeeb.It Cm tinderbox
328eee8163bSBjoern A. ZeebExecute the same targets as
329eee8163bSBjoern A. Zeeb.Cm universe .
330eee8163bSBjoern A. ZeebIn addition print a summary of all failed targets at the end and
331eee8163bSBjoern A. Zeebexit with an error if there were any.
3324e889921SJohn Baldwin.It Cm toolchains
3334e889921SJohn BaldwinCreate a build toolchain for each architecture supported by the build system.
334b135fb6eSBryan Drewery.It Cm xdev
335b135fb6eSBryan DreweryBuilds and installs a cross-toolchain and sysroot for the given
336b135fb6eSBryan Drewery.Sy TARGET
337b135fb6eSBryan Dreweryand
338b135fb6eSBryan Drewery.Sy TARGET_ARCH .
339b135fb6eSBryan DreweryThe sysroot contains target library and headers.
340b135fb6eSBryan DreweryThe target is an alias for
341b135fb6eSBryan Drewery.Cm xdev-build
342b135fb6eSBryan Dreweryand
343b135fb6eSBryan Drewery.Cm xdev-install .
344b135fb6eSBryan DreweryThe location of the files installed can be controlled with
345b135fb6eSBryan Drewery.Va DESTDIR .
346b135fb6eSBryan DreweryThe target location in
347b135fb6eSBryan Drewery.Va DESTDIR
348b135fb6eSBryan Dreweryis
349b135fb6eSBryan Drewery.Pa ${DESTDIR}/${XDTP}
350b135fb6eSBryan Drewerywhere
351b135fb6eSBryan Drewery.Va XDTP
352b135fb6eSBryan Drewerydefaults to
353b135fb6eSBryan Drewery.Pa /usr/${XDDIR}
354b135fb6eSBryan Dreweryand
355b135fb6eSBryan Drewery.Va XDDIR
356b135fb6eSBryan Drewerydefaults to
357b135fb6eSBryan Drewery.Pa ${TARGET_ARCH}-freebsd .
358b135fb6eSBryan Drewery.It Cm xdev-build
359b135fb6eSBryan DreweryBuilds for the
360b135fb6eSBryan Drewery.Cm xdev
361b135fb6eSBryan Drewerytarget.
362b135fb6eSBryan Drewery.It Cm xdev-install
363b135fb6eSBryan DreweryInstalls the files for the
364b135fb6eSBryan Drewery.Cm xdev
365b135fb6eSBryan Drewerytarget.
366b135fb6eSBryan Drewery.It Cm xdev-links
367b135fb6eSBryan DreweryInstalls autoconf-style symlinks to
368b135fb6eSBryan Drewery.Pa ${DESTDIR}/usr/bin
369b135fb6eSBryan Drewerypointing into the xdev toolchain in
370b135fb6eSBryan Drewery.Pa ${DESTDIR}/${XDTP} .
371786aa69aSBen Smithurst.El
372786aa69aSBen Smithurst.Pp
3737b710ab2SJoseph KoshyKernel specific build targets in
374786aa69aSBen Smithurst.Pa /usr/src
3757b710ab2SJoseph Koshyare:
376e8423d00SNathan Whitehorn.Bl -tag -width ".Cm distributekernel"
3771caae057SRuslan Ermilov.It Cm buildkernel
3781caae057SRuslan ErmilovRebuild the kernel and the kernel modules.
379d90f12e3SWarren BlockThe object directory can be changed from the default
380d90f12e3SWarren Block.Pa /usr/obj
381d90f12e3SWarren Blockby setting the
382d90f12e3SWarren Block.Pa MAKEOBJDIRPREFIX
383d90f12e3SWarren Block.Xr make 1
384d90f12e3SWarren Blockvariable.
3851caae057SRuslan Ermilov.It Cm installkernel
3867b710ab2SJoseph KoshyInstall the kernel and the kernel modules to directory
3877b710ab2SJoseph Koshy.Pa ${DESTDIR}/boot/kernel ,
3887b710ab2SJoseph Koshyrenaming any pre-existing directory with this name to
3897b710ab2SJoseph Koshy.Pa kernel.old
3907b710ab2SJoseph Koshyif it contained the currently running kernel.
3917b710ab2SJoseph KoshyThe target directory under
3927b710ab2SJoseph Koshy.Pa ${DESTDIR}
3937b710ab2SJoseph Koshymay be modified using the
3947b710ab2SJoseph Koshy.Va INSTKERNNAME
3957b710ab2SJoseph Koshyand
3967b710ab2SJoseph Koshy.Va KODIR
3977b710ab2SJoseph Koshy.Xr make 1
3987b710ab2SJoseph Koshyvariables.
399e8423d00SNathan Whitehorn.It Cm distributekernel
400e8423d00SNathan WhitehornInstall the kernel to the directory
401e8423d00SNathan Whitehorn.Pa ${DISTDIR}/kernel/boot/kernel .
402e8423d00SNathan WhitehornThis target is used while building a release; see
403e8423d00SNathan Whitehorn.Xr release 7 .
4041d26746cSMark Johnston.It Cm packages
4051d26746cSMark JohnstonCreate a
4061d26746cSMark Johnston.Xr pkg 7
4071d26746cSMark Johnstonrepository containing packages that can be used to create or upgrade an
4081d26746cSMark Johnstoninstallation of the base system.
4091d26746cSMark JohnstonThe output repository is placed in the object directory, under
4101d26746cSMark Johnston.Pa repo/${PKG_ABI}
4111d26746cSMark Johnstonwhere
4121d26746cSMark Johnston.Va PKG_ABI
4131d26746cSMark Johnstonis the
4141d26746cSMark Johnston.Xr pkg 7
4151d26746cSMark JohnstonABI for the build target, for example,
4161d26746cSMark Johnston.Pa /usr/obj/${SRCDIR}/repo/FreeBSD:15:amd64 .
417e8423d00SNathan Whitehorn.It Cm packagekernel
418e8423d00SNathan WhitehornArchive the results of
419e8423d00SNathan Whitehorn.Cm distributekernel ,
420e8423d00SNathan Whitehornplacing the results in
421e8423d00SNathan Whitehorn.Va DISTDIR .
422e8423d00SNathan WhitehornThis target is used while building a release; see
423e8423d00SNathan Whitehorn.Xr release 7 .
424389e98a7STom Rhodes.It Cm kernel
425389e98a7STom RhodesEquivalent to
426389e98a7STom Rhodes.Cm buildkernel
427389e98a7STom Rhodesfollowed by
428389e98a7STom Rhodes.Cm installkernel
4297b710ab2SJoseph Koshy.It Cm kernel-toolchain
4307b710ab2SJoseph KoshyRebuild the tools needed for kernel compilation.
4317b710ab2SJoseph KoshyUse this if you did not do a
4327b710ab2SJoseph Koshy.Cm buildworld
4337b710ab2SJoseph Koshyfirst.
4347b710ab2SJoseph Koshy.It Cm reinstallkernel
4357b710ab2SJoseph KoshyReinstall the kernel and the kernel modules, overwriting the contents
4367b710ab2SJoseph Koshyof the target directory.
4377b710ab2SJoseph KoshyAs with the
4387b710ab2SJoseph Koshy.Cm installkernel
4397b710ab2SJoseph Koshytarget, the target directory can be specified using the
4407b710ab2SJoseph Koshy.Xr make 1
4417b710ab2SJoseph Koshyvariable
4427b710ab2SJoseph Koshy.Va INSTKERNNAME .
4437b710ab2SJoseph Koshy.El
4447b710ab2SJoseph Koshy.Pp
4457b710ab2SJoseph KoshyConvenience targets for cleaning up the install destination directory
4467b710ab2SJoseph Koshydenoted by variable
4477b710ab2SJoseph Koshy.Va DESTDIR
4487b710ab2SJoseph Koshyinclude:
4497b710ab2SJoseph Koshy.Bl -tag -width ".Cm delete-old-libs"
4507b710ab2SJoseph Koshy.It Cm check-old
451abfabbeaSMike PritchardPrint a list of old files and directories in the system.
45270ccb89dSMaxim Konovalov.It Cm check-old-libs
45370ccb89dSMaxim KonovalovPrint a list of obsolete base system libraries.
454e2a36081SAlexander Leidinger.It Cm delete-old
455e2a36081SAlexander LeidingerDelete obsolete base system files and directories interactively.
45678ad5421SRuslan ErmilovWhen
45778ad5421SRuslan Ermilov.Li -DBATCH_DELETE_OLD_FILES
4587b710ab2SJoseph Koshyis specified at the command line, the delete operation will be
4597b710ab2SJoseph Koshynon-interactive.
460c8ef0ed5SRuslan ErmilovThe variables
4617b710ab2SJoseph Koshy.Va DESTDIR ,
4627b710ab2SJoseph Koshy.Va TARGET_ARCH
463c8ef0ed5SRuslan Ermilovand
464c8ef0ed5SRuslan Ermilov.Va TARGET
465c8ef0ed5SRuslan Ermilovshould be set as with
466c8ef0ed5SRuslan Ermilov.Dq Li "make installworld" .
467e2a36081SAlexander Leidinger.It Cm delete-old-libs
468e2a36081SAlexander LeidingerDelete obsolete base system libraries interactively.
469d90f12e3SWarren BlockThis target should only be used if no third party software uses these
4707b710ab2SJoseph Koshylibraries.
47178ad5421SRuslan ErmilovWhen
47278ad5421SRuslan Ermilov.Li -DBATCH_DELETE_OLD_FILES
4737b710ab2SJoseph Koshyis specified at the command line, the delete operation will be
4747b710ab2SJoseph Koshynon-interactive.
475c8ef0ed5SRuslan ErmilovThe variables
4767b710ab2SJoseph Koshy.Va DESTDIR ,
4777b710ab2SJoseph Koshy.Va TARGET_ARCH
478c8ef0ed5SRuslan Ermilovand
479c8ef0ed5SRuslan Ermilov.Va TARGET
480c8ef0ed5SRuslan Ermilovshould be set as with
481c8ef0ed5SRuslan Ermilov.Dq Li "make installworld" .
482786aa69aSBen Smithurst.El
483b82e53e2SMurray Stokely.Sh ENVIRONMENT
4847b710ab2SJoseph KoshyVariables that influence all builds include:
4857b710ab2SJoseph Koshy.Bl -tag -width ".Va MAKEOBJDIRPREFIX"
486fea87c03SGiorgos Keramidas.It Va DEBUG_FLAGS
487fea87c03SGiorgos KeramidasDefines a set of debugging flags that will be used to build all userland
488fea87c03SGiorgos Keramidasbinaries under
489fea87c03SGiorgos Keramidas.Pa /usr/src .
490fea87c03SGiorgos KeramidasWhen
491fea87c03SGiorgos Keramidas.Va DEBUG_FLAGS
492fea87c03SGiorgos Keramidasis defined, the
493fea87c03SGiorgos Keramidas.Cm install
494fea87c03SGiorgos Keramidasand
495fea87c03SGiorgos Keramidas.Cm installworld
496fea87c03SGiorgos Keramidastargets install binaries from the current
497fea87c03SGiorgos Keramidas.Va MAKEOBJDIRPREFIX
498fea87c03SGiorgos Keramidaswithout stripping,
499fea87c03SGiorgos Keramidasso that debugging information is retained in the installed binaries.
5007b710ab2SJoseph Koshy.It Va DESTDIR
5017b710ab2SJoseph KoshyThe directory hierarchy prefix where built objects will be installed.
5027b710ab2SJoseph KoshyIf not set,
5037b710ab2SJoseph Koshy.Va DESTDIR
5047b710ab2SJoseph Koshydefaults to the empty string.
50502dc1582SEd MasteIf set,
50602dc1582SEd Maste.Va DESTDIR
50702dc1582SEd Mastemust specify an absolute path.
5087b710ab2SJoseph Koshy.It Va MAKEOBJDIRPREFIX
5097b710ab2SJoseph KoshyDefines the prefix for directory names in the tree of built objects.
5107b710ab2SJoseph KoshyDefaults to
5117b710ab2SJoseph Koshy.Pa /usr/obj
5127b710ab2SJoseph Koshyif not defined.
513dfa09989SBryan DreweryThis variable should only be set in the environment or
514dfa09989SBryan Drewery.Pa /etc/src-env.conf
515dfa09989SBryan Dreweryand not via
5167b710ab2SJoseph Koshy.Pa /etc/make.conf
517dfa09989SBryan Dreweryor
518dfa09989SBryan Drewery.Pa /etc/src.conf
5197b710ab2SJoseph Koshyor the command line.
52075af1320SEd Maste.Va MAKEOBJDIRPREFIX
52175af1320SEd Mastemust specify an absolute path.
5227fa2f2a6SAlex Richardson.It Va WITHOUT_WERROR
5237b710ab2SJoseph KoshyIf defined, compiler warnings will not cause the build to halt,
5247b710ab2SJoseph Koshyeven if the makefile says otherwise.
52521edb039SAlexander Leidinger.It Va WITH_CTF
52621edb039SAlexander LeidingerIf defined, the build process will run the DTrace CTF conversion
52721edb039SAlexander Leidingertools on built objects.
5287b710ab2SJoseph Koshy.El
5297b710ab2SJoseph Koshy.Pp
5307b710ab2SJoseph KoshyAdditionally, builds in
5317b710ab2SJoseph Koshy.Pa /usr/src
5327b710ab2SJoseph Koshyare influenced by the following
5337b710ab2SJoseph Koshy.Xr make 1
5347b710ab2SJoseph Koshyvariables:
53521ef3591SJohn Baldwin.Bl -tag -width ".Va LOCAL_MODULES_DIR"
53621ef3591SJohn Baldwin.It Va CROSS_TOOLCHAIN
53721ef3591SJohn BaldwinRequests use of an external toolchain to build either the world or kernel.
53821ef3591SJohn BaldwinThis value of this variable can either be the full path to a file,
53921ef3591SJohn Baldwinor the base name of a file in
54021ef3591SJohn Baldwin.Pa ${LOCALBASE}/share/toolchains .
54121ef3591SJohn BaldwinThe file should be a make file which sets variables to request an external
54221ef3591SJohn Baldwintoolchain such as
54321ef3591SJohn Baldwin.Va XCC .
54421ef3591SJohn Baldwin.Pp
54521ef3591SJohn BaldwinExternal toolchains are available in ports for both LLVM and GCC/binutils.
54621ef3591SJohn BaldwinFor external toolchains available in ports,
54721ef3591SJohn Baldwin.Va CROSS_TOOLCHAIN
54821ef3591SJohn Baldwinshould be set to the name of the package.
54921ef3591SJohn BaldwinLLVM toolchain packages use the name llvm<major version>.
55021ef3591SJohn BaldwinGCC toolchains provide separate packages for each architecture and use the
55121ef3591SJohn Baldwinname ${MACHINE_ARCH}-gcc<major version>.
552e6cdeeddSWarner Losh.It Va KERNCONF
553e6cdeeddSWarner LoshOverrides which kernel to build and install for the various kernel
554e6cdeeddSWarner Loshmake targets.
555e6cdeeddSWarner LoshIt defaults to
556e6cdeeddSWarner Losh.Cm GENERIC .
557*9dc4bcb1SWarner Losh.It Va KERNBUILDDIR
558*9dc4bcb1SWarner LoshOverrides the default directory to get all the opt_*.h files for
559*9dc4bcb1SWarner Loshbuilding a kernel module.
560*9dc4bcb1SWarner LoshUseful for stand-alone modules that depend on
561*9dc4bcb1SWarner Losh.Xr config 8
562*9dc4bcb1SWarner Loshoptions.
563*9dc4bcb1SWarner LoshAutomatically set for modules built with a kernel.
5644b2cc4d1SKyle Evans.It Va KERNCONFDIR
5654b2cc4d1SKyle EvansOverrides the directory in which
5664b2cc4d1SKyle Evans.Va KERNCONF
5674b2cc4d1SKyle Evansand any files included by
5684b2cc4d1SKyle Evans.Va KERNCONF
5694b2cc4d1SKyle Evansshould be found.
5704b2cc4d1SKyle EvansDefaults to
5714b2cc4d1SKyle Evans.Pa sys/${ARCH}/conf .
572e6cdeeddSWarner Losh.It Va KERNFAST
573e6cdeeddSWarner LoshIf set, the build target
574e6cdeeddSWarner Losh.Cm buildkernel
575e6cdeeddSWarner Loshdefaults to setting
576e6cdeeddSWarner Losh.Va NO_KERNELCLEAN ,
5776d50d5e4SWarner Losh.Va NO_KERNELCONFIG ,
578e6cdeeddSWarner Loshand
5796d50d5e4SWarner Losh.Va NO_KERNELOBJ .
580e6cdeeddSWarner LoshWhen set to a value other than
581e6cdeeddSWarner Losh.Cm 1
582e6cdeeddSWarner Loshthen
583e6cdeeddSWarner Losh.Va KERNCONF
584e6cdeeddSWarner Loshis set to the value of
585e6cdeeddSWarner Losh.Va KERNFAST .
5867b710ab2SJoseph Koshy.It Va LOCAL_DIRS
587ca6a54ceSBryan DreweryIf set, this variable supplies a list of additional directories relative to
588ca6a54ceSBryan Drewerythe root of the source tree to build as part of the
589ca6a54ceSBryan Drewery.Cm everything
590ca6a54ceSBryan Drewerytarget.
591e93e5bb0SIan LeporeThe directories are built in parallel with each other,
592e93e5bb0SIan Leporeand with the base system directories.
593e93e5bb0SIan LeporeInsert a
594e93e5bb0SIan Lepore.Va .WAIT
595e93e5bb0SIan Leporedirective at the beginning of the
596e93e5bb0SIan Lepore.Va LOCAL_DIRS
597e93e5bb0SIan Leporelist to ensure all base system directories are built first.
598e93e5bb0SIan Lepore.Va .WAIT
599e93e5bb0SIan Leporemay also be used as needed elsewhere within the list.
600a0e6a013SBryan Drewery.It Va LOCAL_ITOOLS
601a0e6a013SBryan DreweryIf set, this variable supplies a list of additional tools that are used by the
602a0e6a013SBryan Drewery.Cm installworld
603a0e6a013SBryan Dreweryand
604a0e6a013SBryan Drewery.Cm distributeworld
605a0e6a013SBryan Drewerytargets.
606ca6a54ceSBryan Drewery.It Va LOCAL_LIB_DIRS
607ca6a54ceSBryan DreweryIf set, this variable supplies a list of additional directories relative to
608ca6a54ceSBryan Drewerythe root of the source tree to build as part of the
609ca6a54ceSBryan Drewery.Cm libraries
610ca6a54ceSBryan Drewerytarget.
611e93e5bb0SIan LeporeThe directories are built in parallel with each other,
612e93e5bb0SIan Leporeand with the base system libraries.
613e93e5bb0SIan LeporeInsert a
614e93e5bb0SIan Lepore.Va .WAIT
615e93e5bb0SIan Leporedirective at the beginning of the
616e93e5bb0SIan Lepore.Va LOCAL_DIRS
617e93e5bb0SIan Leporelist to ensure all base system libraries are built first.
618e93e5bb0SIan Lepore.Va .WAIT
619e93e5bb0SIan Leporemay also be used as needed elsewhere within the list.
620ca6a54ceSBryan Drewery.It Va LOCAL_MTREE
621ca6a54ceSBryan DreweryIf set, this variable supplies a list of additional mtrees relative to the
622ca6a54ceSBryan Dreweryroot of the source tree to use as part of the
623ca6a54ceSBryan Drewery.Cm hierarchy
624ca6a54ceSBryan Drewerytarget.
62580cedb80SBryan Drewery.It Va LOCAL_LEGACY_DIRS
62680cedb80SBryan DreweryIf set, this variable supplies a list of additional directories relative to
62780cedb80SBryan Drewerythe root of the source tree to build as part of the
62880cedb80SBryan Drewery.Cm legacy
62980cedb80SBryan Drewerytarget.
63080cedb80SBryan Drewery.It Va LOCAL_BSTOOL_DIRS
63180cedb80SBryan DreweryIf set, this variable supplies a list of additional directories relative to
63280cedb80SBryan Drewerythe root of the source tree to build as part of the
63380cedb80SBryan Drewery.Cm bootstrap-tools
63480cedb80SBryan Drewerytarget.
635ca6a54ceSBryan Drewery.It Va LOCAL_TOOL_DIRS
636ca6a54ceSBryan DreweryIf set, this variable supplies a list of additional directories relative to
637ca6a54ceSBryan Drewerythe root of the source tree to build as part of the
638ca6a54ceSBryan Drewery.Cm build-tools
639ca6a54ceSBryan Drewerytarget.
6404143850bSBryan Drewery.It Va LOCAL_XTOOL_DIRS
6414143850bSBryan DreweryIf set, this variable supplies a list of additional directories relative to
6424143850bSBryan Drewerythe root of the source tree to build as part of the
6434143850bSBryan Drewery.Cm cross-tools
6444143850bSBryan Drewerytarget.
645170c2788SGlen Barber.It Va PORTS_MODULES
646170c2788SGlen BarberA list of ports with kernel modules that should be built and installed
647170c2788SGlen Barberas part of the
648170c2788SGlen Barber.Cm buildkernel
649170c2788SGlen Barberand
650170c2788SGlen Barber.Cm installkernel
651170c2788SGlen Barberprocess.
652170c2788SGlen Barber.Bd -literal -offset indent
6537fbc0c98SMitchell Hornemake PORTS_MODULES=emulators/virtualbox-ose-kmod kernel
654170c2788SGlen Barber.Ed
655e7a13643SMark Johnston.It Va LOCAL_MODULES
656e7a13643SMark JohnstonA list of external kernel modules that should be built and installed
657e7a13643SMark Johnstonas part of the
658e7a13643SMark Johnston.Cm buildkernel
659e7a13643SMark Johnstonand
660e7a13643SMark Johnston.Cm installkernel
661e7a13643SMark Johnstonprocess.
662805c3af8SMark JohnstonDefaults to the list of sub-directories of
663805c3af8SMark Johnston.Va LOCAL_MODULES_DIR .
664e7a13643SMark Johnston.It Va LOCAL_MODULES_DIR
665e7a13643SMark JohnstonThe directory in which to search for the kernel modules specified by
666e7a13643SMark Johnston.Va LOCAL_MODULES .
667e7a13643SMark JohnstonEach kernel module should consist of a directory containing a makefile.
668e7a13643SMark JohnstonDefaults to
669e7a13643SMark Johnston.Pa ${LOCALBASE}/sys/modules .
670e6ca6901SGordon Bergling.It Va SRCCONF
671e6ca6901SGordon BerglingSpecify a file to override the default
672e6ca6901SGordon Bergling.Pa /etc/src.conf .
673e6ca6901SGordon BerglingThe src.conf file controls the components to build.
674e6ca6901SGordon BerglingSee
675e6ca6901SGordon Bergling.Xr src.conf 5
67642e7be20SEnji Cooper.It Va STRIPBIN
6773547290fSEnji CooperCommand to use at install time when stripping binaries.
6783547290fSEnji CooperBe sure to add any additional tools required to run
67942e7be20SEnji Cooper.Va STRIPBIN
6803547290fSEnji Cooperto the
6813547290fSEnji Cooper.Va LOCAL_ITOOLS
6823547290fSEnji Cooper.Xr make 1
6833547290fSEnji Coopervariable before running the
6843547290fSEnji Cooper.Cm distributeworld
6853547290fSEnji Cooperor
6863547290fSEnji Cooper.Cm installworld
6873547290fSEnji Coopertargets.
6883547290fSEnji CooperSee
6893547290fSEnji Cooper.Xr install 1
6903547290fSEnji Cooperfor more details.
6917b710ab2SJoseph Koshy.It Va SUBDIR_OVERRIDE
6927b710ab2SJoseph KoshyOverride the default list of sub-directories and only build the
6937b710ab2SJoseph Koshysub-directory named in this variable.
6947f1636b7SBryan DreweryIf combined with
6957f1636b7SBryan Drewery.Cm buildworld
6967f1636b7SBryan Drewerythen all libraries and includes, and some of the build tools will still build
6977f1636b7SBryan Dreweryas well.
698c889d480SBryan DrewerySpecifying
699c889d480SBryan Drewery.Cm -DNO_LIBS ,
700c889d480SBryan Dreweryand
701c889d480SBryan Drewery.Cm -DWORLDFAST
702c889d480SBryan Drewerywill only build the specified directory as was done historically.
7037f1636b7SBryan DreweryWhen combined with
7047f1636b7SBryan Drewery.Cm buildworld
705ffc4f93eSBenedict Reuschlingit is necessary to override
7067f1636b7SBryan Drewery.Va LOCAL_LIB_DIRS
7077f1636b7SBryan Drewerywith any custom directories containing libraries.
7087f1636b7SBryan DreweryThis allows building a subset of the system in the same way as
7097f1636b7SBryan Drewery.Cm buildworld
7107f1636b7SBryan Drewerydoes using its sysroot handling.
7117f1636b7SBryan DreweryThis variable can also be useful when debugging failed builds.
7127b710ab2SJoseph Koshy.Bd -literal -offset indent
7137b710ab2SJoseph Koshymake some-target SUBDIR_OVERRIDE=foo/bar
7147b710ab2SJoseph Koshy.Ed
715def657b8SWarner Losh.It Va SYSDIR
716def657b8SWarner LoshSpecify the location of the kernel source to override the default
717def657b8SWarner Losh.Pa /usr/src/sys .
718def657b8SWarner LoshThe kernel source is located in the
719def657b8SWarner Losh.Pa sys
720def657b8SWarner Loshsubdirectory of the source tree checked out from the
721def657b8SWarner Losh.Pa src.git
722def657b8SWarner Loshrepository.
7236f9ac6feSMurray Stokely.It Va TARGET
724b3a43ea3SMurray StokelyThe target hardware platform.
725365a17c0SMurray StokelyThis is analogous to the
7261caae057SRuslan Ermilov.Dq Nm uname Fl m
727b3a43ea3SMurray Stokelyoutput.
728b3a43ea3SMurray StokelyThis is necessary to cross-build some target architectures.
7292f6a7e42SEnji CooperFor example, cross-building for ARM64 machines requires
7302f6a7e42SEnji Cooper.Va TARGET_ARCH Ns = Ns Li aarch64
731b3a43ea3SMurray Stokelyand
7322f6a7e42SEnji Cooper.Va TARGET Ns = Ns Li arm64 .
7337b710ab2SJoseph KoshyIf not set,
7347b710ab2SJoseph Koshy.Va TARGET
735f4721165SEdward Tomasz Napieraladefaults to the current hardware platform, unless
736f4721165SEdward Tomasz Napierala.Va TARGET_ARCH
737f4721165SEdward Tomasz Napieralais also set, in which case it defaults to the appropriate
738f4721165SEdward Tomasz Napieralavalue for that architecture.
7397b710ab2SJoseph Koshy.It Va TARGET_ARCH
7407b710ab2SJoseph KoshyThe target machine processor architecture.
7417b710ab2SJoseph KoshyThis is analogous to the
7427b710ab2SJoseph Koshy.Dq Nm uname Fl p
7437b710ab2SJoseph Koshyoutput.
7447b710ab2SJoseph KoshySet this to cross-build for a different architecture.
7457b710ab2SJoseph KoshyIf not set,
7467b710ab2SJoseph Koshy.Va TARGET_ARCH
747531b260aSWarner Loshdefaults to the current machine architecture, unless
748531b260aSWarner Losh.Va TARGET
749531b260aSWarner Loshis also set, in which case it defaults to the appropriate
750531b260aSWarner Loshvalue for that platform.
751c22c7f86SWarner LoshTypically, one only needs to set
752c22c7f86SWarner Losh.Va TARGET .
7537b710ab2SJoseph Koshy.El
7547b710ab2SJoseph Koshy.Pp
7557b710ab2SJoseph KoshyBuilds under directory
756fd23b461SGiorgos Keramidas.Pa /usr/src
7577d6af40dSGlen Barberare also influenced by defining one or more of the following symbols,
758fd23b461SGiorgos Keramidasusing the
759fd23b461SGiorgos Keramidas.Fl D
760fd23b461SGiorgos Keramidasoption of
761fd23b461SGiorgos Keramidas.Xr make 1 :
76221ef3591SJohn Baldwin.Bl -tag -width ".Va LOADER_DEFAULT_INTERP"
76301012c64SWarner Losh.It Va LOADER_DEFAULT_INTERP
76401012c64SWarner LoshDefines what interpreter the default loader program will have.
76501012c64SWarner LoshValid values include
76601012c64SWarner Losh.Dq 4th ,
76701012c64SWarner Losh.Dq lua ,
76801012c64SWarner Loshand
76901012c64SWarner Losh.Dq simp .
77001012c64SWarner LoshThis creates the default link for
77101012c64SWarner Losh.Pa /boot/loader
77201012c64SWarner Loshto the loader with that interpreter.
77301012c64SWarner LoshIt also determines what interpreter is compiled into
77401012c64SWarner Losh.Pa userboot .
775fd23b461SGiorgos Keramidas.It Va NO_CLEANDIR
776fd23b461SGiorgos KeramidasIf set, the build targets that clean parts of the object tree use the
777fd23b461SGiorgos Keramidasequivalent of
778fd23b461SGiorgos Keramidas.Dq make clean
779fd23b461SGiorgos Keramidasinstead of
780fd23b461SGiorgos Keramidas.Dq make cleandir .
781fd23b461SGiorgos Keramidas.It Va NO_CLEAN
782fd23b461SGiorgos KeramidasIf set, no object tree files are cleaned at all.
783473fda75SBryan DreweryThis is the default when
784473fda75SBryan Drewery.Va WITH_META_MODE
785473fda75SBryan Dreweryis used with
786473fda75SBryan Drewery.Xr filemon 4
787473fda75SBryan Dreweryloaded.
788473fda75SBryan DrewerySee
789473fda75SBryan Drewery.Xr src.conf 5
790473fda75SBryan Dreweryfor more details.
791fd23b461SGiorgos KeramidasSetting
792fd23b461SGiorgos Keramidas.Va NO_CLEAN
793fd23b461SGiorgos Keramidasimplies
794fd23b461SGiorgos Keramidas.Va NO_KERNELCLEAN ,
795fd23b461SGiorgos Keramidasso when
796fd23b461SGiorgos Keramidas.Va NO_CLEAN
797fd23b461SGiorgos Keramidasis set no kernel objects are cleaned either.
798fd23b461SGiorgos Keramidas.It Va NO_CTF
799fd23b461SGiorgos KeramidasIf set, the build process does not run the DTrace CTF conversion tools
800fd23b461SGiorgos Keramidason built objects.
801fd23b461SGiorgos Keramidas.It Va NO_SHARE
802fd23b461SGiorgos KeramidasIf set, the build does not descend into the
803fd23b461SGiorgos Keramidas.Pa /usr/src/share
804d90f12e3SWarren Blocksubdirectory (i.e., manual pages, locale data files, timezone data files and
805fd23b461SGiorgos Keramidasother
806fd23b461SGiorgos Keramidas.Pa /usr/src/share
807fd23b461SGiorgos Keramidasfiles will not be rebuild from their sources).
808fd23b461SGiorgos Keramidas.It Va NO_KERNELCLEAN
809fd23b461SGiorgos KeramidasIf set, the build process does not run
810fd23b461SGiorgos Keramidas.Dq make clean
811fd23b461SGiorgos Keramidasas part of the
812fd23b461SGiorgos Keramidas.Cm buildkernel
813fd23b461SGiorgos Keramidastarget.
814fd23b461SGiorgos Keramidas.It Va NO_KERNELCONFIG
815fd23b461SGiorgos KeramidasIf set, the build process does not run
816fd23b461SGiorgos Keramidas.Xr config 8
817fd23b461SGiorgos Keramidasas part of the
818fd23b461SGiorgos Keramidas.Cm buildkernel
819fd23b461SGiorgos Keramidastarget.
8206d50d5e4SWarner Losh.It Va NO_KERNELOBJ
8216d50d5e4SWarner LoshIf set, the build process does not run
8226d50d5e4SWarner Losh.Dq make obj
8236d50d5e4SWarner Loshas part of the
8246d50d5e4SWarner Losh.Cm buildkernel
8256d50d5e4SWarner Loshtarget.
826c596c287SBryan Drewery.It Va NO_LIBS
827c596c287SBryan DreweryIf set, the libraries phase will be skipped.
8282abeba9dSBryan Drewery.It Va NO_OBJWALK
8296d75a7a8SBryan DreweryIf set, no object directories will be created.
8306d75a7a8SBryan DreweryThis should only be used if object directories were created in a
8316d75a7a8SBryan Dreweryprevious build and no new directories are connected.
83221ef3591SJohn Baldwin.It Va UNIVERSE_TOOLCHAIN
83321ef3591SJohn BaldwinRequests use of the toolchain built as part of the
83421ef3591SJohn Baldwin.Cm universe
83521ef3591SJohn Baldwintarget as an external toolchain.
83616892c77SBryan Drewery.It Va WORLDFAST
83716892c77SBryan DreweryIf set, the build target
83816892c77SBryan Drewery.Cm buildworld
83916892c77SBryan Drewerydefaults to setting
84016892c77SBryan Drewery.Va NO_CLEAN ,
8412abeba9dSBryan Drewery.Va NO_OBJWALK ,
84216892c77SBryan Dreweryand will skip most bootstrap phases.
84316892c77SBryan DreweryIt will only bootstrap libraries and build all of userland.
84416892c77SBryan DreweryThis option should be used only when it is known that none of the bootstrap
84516892c77SBryan Dreweryneeds changed and that no new directories have been connected to the build.
846fd23b461SGiorgos Keramidas.El
847fd23b461SGiorgos Keramidas.Pp
848fd23b461SGiorgos KeramidasBuilds under directory
8497b710ab2SJoseph Koshy.Pa /usr/doc
8507b710ab2SJoseph Koshyare influenced by the following
8517b710ab2SJoseph Koshy.Xr make 1
8527b710ab2SJoseph Koshyvariables:
8537b710ab2SJoseph Koshy.Bl -tag -width ".Va DOC_LANG"
8547b710ab2SJoseph Koshy.It Va DOC_LANG
8557b710ab2SJoseph KoshyIf set, restricts the documentation build to the language subdirectories
8567b710ab2SJoseph Koshyspecified as its content.
8577b710ab2SJoseph KoshyThe default action is to build documentation for all languages.
858b82e53e2SMurray Stokely.El
8594e889921SJohn Baldwin.Pp
8604e889921SJohn BaldwinBuilds using the
8614e889921SJohn Baldwin.Cm universe
862e1b9162fSWarner Loshand related targets are influenced by the following
8634e889921SJohn Baldwin.Xr make 1
8644e889921SJohn Baldwinvariables:
86521ef3591SJohn Baldwin.Bl -tag -width ".Va USE_GCC_TOOLCHAINS"
8664e889921SJohn Baldwin.It Va JFLAG
8674e889921SJohn BaldwinPass the value of this variable to each
8684e889921SJohn Baldwin.Xr make 1
8694e889921SJohn Baldwininvocation used to build worlds and kernels.
8704e889921SJohn BaldwinThis can be used to enable multiple jobs within a single architecture's build
8714e889921SJohn Baldwinwhile still building each architecture serially.
8724e889921SJohn Baldwin.It Va MAKE_JUST_KERNELS
8734e889921SJohn BaldwinOnly build kernels for each supported architecture.
8744e889921SJohn Baldwin.It Va MAKE_JUST_WORLDS
8754e889921SJohn BaldwinOnly build worlds for each supported architecture.
876a7783b5aSWarner Losh.It Va WITHOUT_WORLDS
877a7783b5aSWarner LoshOnly build kernels for each supported architecture.
878a7783b5aSWarner Losh.It Va WITHOUT_KERNELS
879a7783b5aSWarner LoshOnly build worlds for each supported architecture.
8804e889921SJohn Baldwin.It Va UNIVERSE_TARGET
8814e889921SJohn BaldwinExecute the specified
8824e889921SJohn Baldwin.Xr make 1
8834e889921SJohn Baldwintarget for each supported architecture instead of the default action of
8844e889921SJohn Baldwinbuilding a world and one or more kernels.
885a7783b5aSWarner LoshThis variable implies
886a7783b5aSWarner Losh.Va WITHOUT_KERNELS .
88721ef3591SJohn Baldwin.It Va USE_GCC_TOOLCHAINS
88821ef3591SJohn BaldwinUse external GCC toolchains to build the requested targets.
88921ef3591SJohn BaldwinIf the required toolchain package for a supported architecture is not installed,
89021ef3591SJohn Baldwinthe build for that architecture is skipped.
891550137eaSJohn Baldwin.Pp
892550137eaSJohn BaldwinA specific version of GCC can be used by setting the value of this variable
893550137eaSJohn Baldwinto the desired version
894550137eaSJohn Baldwin.Pq for example, Dq gcc14 ;
895550137eaSJohn Baldwinotherwise a default version of GCC is used.
896e1b9162fSWarner Losh.It Va TARGETS
897e1b9162fSWarner LoshOnly build the listed targets instead of each supported architecture.
898e1b9162fSWarner Losh.It Va EXTRA_TARGETS
899e1b9162fSWarner LoshIn addition to the supported architectures, build the semi-supported
900e1b9162fSWarner Losharchitectures.
901e1b9162fSWarner LoshA semi-supported architecture has build support in the
902e1b9162fSWarner Losh.Fx
903e1b9162fSWarner Loshtree, but receives significantly less testing and is generally for
904e1b9162fSWarner Loshfringe uses that do not have a wide appeal.
9054e889921SJohn Baldwin.El
906786aa69aSBen Smithurst.Sh FILES
9070c0eb9beSRuslan Ermilov.Bl -tag -width ".Pa /usr/share/examples/etc/make.conf" -compact
908786aa69aSBen Smithurst.It Pa /usr/doc/Makefile
909786aa69aSBen Smithurst.It Pa /usr/doc/share/mk/doc.project.mk
910786aa69aSBen Smithurst.It Pa /usr/ports/Mk/bsd.port.mk
911786aa69aSBen Smithurst.It Pa /usr/ports/Mk/bsd.sites.mk
9121caae057SRuslan Ermilov.It Pa /usr/share/examples/etc/make.conf
9130c0eb9beSRuslan Ermilov.It Pa /usr/src/Makefile
9140c0eb9beSRuslan Ermilov.It Pa /usr/src/Makefile.inc1
9153136363fSRuslan Ermilov.El
9163faf5fc9SBen Smithurst.Sh EXAMPLES
917be6a4760SRuslan ErmilovFor an
9183faf5fc9SBen Smithurst.Dq approved
9197b710ab2SJoseph Koshymethod of updating your system from the latest sources, please see the
920be6a4760SRuslan Ermilov.Sx COMMON ITEMS
921be6a4760SRuslan Ermilovsection in
922be6a4760SRuslan Ermilov.Pa src/UPDATING .
923b82e53e2SMurray Stokely.Pp
924afa166beSMitchell HorneThe following sequence of commands can be used to cross-build the system for
925afa166beSMitchell Hornethe arm64 (aarch64) architecture on a different host architecture, such as
926afa166beSMitchell Horneamd64:
927b82e53e2SMurray Stokely.Bd -literal -offset indent
928b82e53e2SMurray Stokelycd /usr/src
929afa166beSMitchell Hornemake TARGET=arm64 buildworld buildkernel
930afa166beSMitchell Hornemake TARGET=arm64 DESTDIR=/clients/arm64 installworld installkernel
931b82e53e2SMurray Stokely.Ed
932786aa69aSBen Smithurst.Sh SEE ALSO
9337c20a493SBen Smithurst.Xr cc 1 ,
934786aa69aSBen Smithurst.Xr install 1 ,
935786aa69aSBen Smithurst.Xr make 1 ,
936786aa69aSBen Smithurst.Xr make.conf 5 ,
937157376baSJoseph Koshy.Xr src.conf 5 ,
938f4721165SEdward Tomasz Napierala.Xr arch 7 ,
939a8a2d5efSAlexander Ziaee.Xr development 7 ,
940e444a4c6SFernando Apesteguía.Xr pkg 7 ,
941a81996b6SBen Smithurst.Xr ports 7 ,
942a54bda91SMurray Stokely.Xr release 7 ,
94353837b18SEnji Cooper.Xr tests 7 ,
94461001d75STom Rhodes.Xr config 8 ,
945664eefe2SMateusz Piotrowski.Xr etcupdate 8 ,
946a81996b6SBen Smithurst.Xr reboot 8 ,
94753837b18SEnji Cooper.Xr shutdown 8
9488327796cSAlexander Ziaee.Sh HISTORY
9498327796cSAlexander ZiaeeThe
9508327796cSAlexander Ziaee.Nm
9518327796cSAlexander Ziaeemanpage first appeared in
9528327796cSAlexander Ziaee.Fx 4.3 .
953786aa69aSBen Smithurst.Sh AUTHORS
954a63d6c94SBaptiste Daroussin.An Mike W. Meyer Aq Mt mwm@mired.org
955