1786aa69aSBen Smithurst.\" Copyright (c) 2000 2786aa69aSBen Smithurst.\" Mike W. Meyer 3786aa69aSBen Smithurst.\" 4786aa69aSBen Smithurst.\" Redistribution and use in source and binary forms, with or without 5786aa69aSBen Smithurst.\" modification, are permitted provided that the following conditions 6786aa69aSBen Smithurst.\" are met: 7786aa69aSBen Smithurst.\" 1. Redistributions of source code must retain the above copyright 8786aa69aSBen Smithurst.\" notice, this list of conditions and the following disclaimer. 9786aa69aSBen Smithurst.\" 2. Redistributions in binary form must reproduce the above copyright 10786aa69aSBen Smithurst.\" notice, this list of conditions and the following disclaimer in the 11786aa69aSBen Smithurst.\" documentation and/or other materials provided with the distribution. 12786aa69aSBen Smithurst.\" 13786aa69aSBen Smithurst.\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND 14786aa69aSBen Smithurst.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 15786aa69aSBen Smithurst.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 16786aa69aSBen Smithurst.\" ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE 17786aa69aSBen Smithurst.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 18786aa69aSBen Smithurst.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 19786aa69aSBen Smithurst.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 20786aa69aSBen Smithurst.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 21786aa69aSBen Smithurst.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 22786aa69aSBen Smithurst.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 23786aa69aSBen Smithurst.\" SUCH DAMAGE. 24786aa69aSBen Smithurst.\" 25786aa69aSBen Smithurst.\" $FreeBSD$ 26786aa69aSBen Smithurst.\" 2753837b18SEnji Cooper.Dd March 22, 2017 28786aa69aSBen Smithurst.Dt BUILD 7 293d45e180SRuslan Ermilov.Os 30786aa69aSBen Smithurst.Sh NAME 31786aa69aSBen Smithurst.Nm build 32eb083802SRuslan Ermilov.Nd information on how to build the system 33786aa69aSBen Smithurst.Sh DESCRIPTION 347b710ab2SJoseph KoshyThe sources for the 35d003b779SRuslan Ermilov.Fx 367b710ab2SJoseph Koshysystem and its applications are contained in three different directories, 37786aa69aSBen Smithurstnormally 38786aa69aSBen Smithurst.Pa /usr/src , 39786aa69aSBen Smithurst.Pa /usr/doc , 40786aa69aSBen Smithurstand 41786aa69aSBen Smithurst.Pa /usr/ports . 4250a994c9SWarren BlockThese directories may be initially empty or non-existent until updated with 43d335e7a1SGavin Atkinson.Xr svn 1 4450a994c9SWarren Blockor 45d732418bSWarren Block.Xr portsnap 8 . 467b710ab2SJoseph KoshyDirectory 47786aa69aSBen Smithurst.Pa /usr/src 48786aa69aSBen Smithurstcontains the 49786aa69aSBen Smithurst.Dq "base system" 50786aa69aSBen Smithurstsources, which is loosely defined as the things required to rebuild 51786aa69aSBen Smithurstthe system to a useful state. 527b710ab2SJoseph KoshyDirectory 53786aa69aSBen Smithurst.Pa /usr/doc 54786aa69aSBen Smithurstcontains the source for the system documentation, excluding the manual 55786aa69aSBen Smithurstpages. 567b710ab2SJoseph KoshyDirectory 57786aa69aSBen Smithurst.Pa /usr/ports 587b710ab2SJoseph Koshycontains a tree that provides a consistent interface for building and 59786aa69aSBen Smithurstinstalling third party applications. 607b710ab2SJoseph KoshyFor more information about the ports build process, see 617b710ab2SJoseph Koshy.Xr ports 7 . 62786aa69aSBen Smithurst.Pp 63786aa69aSBen SmithurstThe 64786aa69aSBen Smithurst.Xr make 1 65786aa69aSBen Smithurstcommand is used in each of these directories to build and install the 661caae057SRuslan Ermilovthings in that directory. 671caae057SRuslan ErmilovIssuing the 681caae057SRuslan Ermilov.Xr make 1 691caae057SRuslan Ermilovcommand in any directory or 70786aa69aSBen Smithurstsubdirectory of those directories has the same effect as issuing the 711caae057SRuslan Ermilovsame command in all subdirectories of that directory. 721caae057SRuslan ErmilovWith no target specified, the things in that directory are just built. 737b710ab2SJoseph Koshy.Pp 747b710ab2SJoseph KoshyA source tree is allowed to be read-only. 757b710ab2SJoseph KoshyAs described in 767b710ab2SJoseph Koshy.Xr make 1 , 777b710ab2SJoseph Koshyobjects are usually built in a separate object directory hierarchy 787b710ab2SJoseph Koshyspecified by the environment variable 797b710ab2SJoseph Koshy.Va MAKEOBJDIRPREFIX , 807b710ab2SJoseph Koshyor under 817b710ab2SJoseph Koshy.Pa /usr/obj 827b710ab2SJoseph Koshyif variable 837b710ab2SJoseph Koshy.Va MAKEOBJDIRPREFIX 847b710ab2SJoseph Koshyis not set. 857b710ab2SJoseph KoshyFor a given source directory, its canonical object directory 867b710ab2SJoseph Koshywould be 877b710ab2SJoseph Koshy.Pa ${MAKEOBJDIRPREFIX}${.CURDIR} 887b710ab2SJoseph Koshyif 897b710ab2SJoseph Koshy.Xr make 1 907b710ab2SJoseph Koshyvariable 917b710ab2SJoseph Koshy.Va MAKEOBJDIRPREFIX 927b710ab2SJoseph Koshyis set, or 937b710ab2SJoseph Koshy.Pa /usr/obj${.CURDIR} 947b710ab2SJoseph Koshyif this variable is not set. 957b710ab2SJoseph KoshyCross-builds set the object directory as described in the 967b710ab2SJoseph Koshydocumentation for the 977b710ab2SJoseph Koshy.Cm buildworld 987b710ab2SJoseph Koshytarget below. 997b710ab2SJoseph Koshy.Pp 1007b710ab2SJoseph KoshyThe build may be controlled by defining 1017b710ab2SJoseph Koshy.Xr make 1 1027b710ab2SJoseph Koshyvariables described in the 1037b710ab2SJoseph Koshy.Sx ENVIRONMENT 1047b710ab2SJoseph Koshysection below, and by the variables documented in 1057b710ab2SJoseph Koshy.Xr make.conf 5 . 1067b710ab2SJoseph Koshy.Pp 1077b710ab2SJoseph KoshyThe following list provides the names and actions for the targets 1087b710ab2SJoseph Koshysupported by the build system: 1097b710ab2SJoseph Koshy.Bl -tag -width ".Cm cleandepend" 110aae63957SBryan Drewery.It Cm analyze 111aae63957SBryan DreweryRun Clang static analyzer against all objects and present output on stdout. 11271b7fa12SEnji Cooper.It Cm check 11371b7fa12SEnji CooperRun tests for a given subdirectory. 11471b7fa12SEnji CooperThe default directory used is 11571b7fa12SEnji Cooper.Pa ${.OBJDIR} , 11671b7fa12SEnji Cooperbut the check directory can be changed with 11771b7fa12SEnji Cooper.Pa ${CHECKDIR} . 11871b7fa12SEnji Cooper.It Cm checkworld 11971b7fa12SEnji CooperRun the 12071b7fa12SEnji Cooper.Fx 12171b7fa12SEnji Coopertest suite on installed world. 1221caae057SRuslan Ermilov.It Cm clean 1237b710ab2SJoseph KoshyRemove any files created during the build process. 1247b710ab2SJoseph Koshy.It Cm cleandepend 125497e8091SBryan DreweryRemove the 126497e8091SBryan Drewery.Pa ${.OBJDIR}/${DEPENDFILE}* 127497e8091SBryan Dreweryfiles generated by prior 128497e8091SBryan Drewery.Dq Li "make" 129497e8091SBryan Dreweryand 1307b710ab2SJoseph Koshy.Dq Li "make depend" 131497e8091SBryan Drewerysteps. 1327b710ab2SJoseph Koshy.It Cm cleandir 1337b710ab2SJoseph KoshyRemove the canonical object directory if it exists, or perform 1347b710ab2SJoseph Koshyactions equivalent to 1357b710ab2SJoseph Koshy.Dq Li "make clean cleandepend" 1367b710ab2SJoseph Koshyif it does not. 1377b710ab2SJoseph KoshyThis target will also remove an 1387b710ab2SJoseph Koshy.Pa obj 1397b710ab2SJoseph Koshylink in 1407b710ab2SJoseph Koshy.Pa ${.CURDIR} 1417b710ab2SJoseph Koshyif that exists. 1427b710ab2SJoseph Koshy.Pp 1437b710ab2SJoseph KoshyIt is advisable to run 1447b710ab2SJoseph Koshy.Dq Li "make cleandir" 1457b710ab2SJoseph Koshytwice: the first invocation will remove the canonical object directory 1467b710ab2SJoseph Koshyand the second one will clean up 1477b710ab2SJoseph Koshy.Pa ${.CURDIR} . 1487b710ab2SJoseph Koshy.It Cm depend 1497b710ab2SJoseph KoshyGenerate a list of build dependencies in file 1507b710ab2SJoseph Koshy.Pa ${.OBJDIR}/${DEPENDFILE} . 151497e8091SBryan DreweryPer-object dependencies are generated at build time and stored in 152497e8091SBryan Drewery.Pa ${.OBJDIR}/${DEPENDFILE}.${OBJ} . 1531caae057SRuslan Ermilov.It Cm install 1547b710ab2SJoseph KoshyInstall the results of the build to the appropriate location in the 1557b710ab2SJoseph Koshyinstallation directory hierarchy specified in variable 1567b710ab2SJoseph Koshy.Va DESTDIR . 1577b710ab2SJoseph Koshy.It Cm obj 1587b710ab2SJoseph KoshyCreate the canonical object directory associated with the current 1597b710ab2SJoseph Koshydirectory. 1607b710ab2SJoseph Koshy.It Cm objlink 1617b710ab2SJoseph KoshyCreate a symbolic link to the canonical object directory in 1627b710ab2SJoseph Koshy.Pa ${.CURDIR} . 1637b710ab2SJoseph Koshy.It Cm tags 1647b710ab2SJoseph KoshyGenerate a tags file using the program specified in the 1657b710ab2SJoseph Koshy.Xr make 1 1667b710ab2SJoseph Koshyvariable 1677b710ab2SJoseph Koshy.Va CTAGS . 1687b710ab2SJoseph KoshyThe build system supports 1697b710ab2SJoseph Koshy.Xr ctags 1 1707b710ab2SJoseph Koshyand 1717b710ab2SJoseph Koshy.Nm "GNU Global" . 1727b710ab2SJoseph Koshy.El 1737b710ab2SJoseph Koshy.Pp 1747b710ab2SJoseph KoshyThe other supported targets under directory 1757b710ab2SJoseph Koshy.Pa /usr/src 1767b710ab2SJoseph Koshyare: 1777b710ab2SJoseph Koshy.Bl -tag -width ".Cm distributeworld" 1787b710ab2SJoseph Koshy.It Cm buildenv 1797b710ab2SJoseph KoshySpawn an interactive shell with environment variables set up for 1807b710ab2SJoseph Koshycross-building the system. 1817b710ab2SJoseph KoshyThe target architecture needs to be specified with 1827b710ab2SJoseph Koshy.Xr make 1 1837b710ab2SJoseph Koshyvariables 1847b710ab2SJoseph Koshy.Va TARGET_ARCH 1857b710ab2SJoseph Koshyand 1867b710ab2SJoseph Koshy.Va TARGET . 1877b710ab2SJoseph Koshy.Pp 1887b710ab2SJoseph KoshyThis target is only useful after a complete cross-toolchain including 1897b710ab2SJoseph Koshythe compiler, linker, assembler, headers and libraries has been 1907b710ab2SJoseph Koshybuilt; see the 1917b710ab2SJoseph Koshy.Cm toolchain 1927b710ab2SJoseph Koshytarget below. 1937b710ab2SJoseph Koshy.It Cm buildworld 1947b710ab2SJoseph KoshyBuild everything but the kernel, configure files in 1957b710ab2SJoseph Koshy.Pa etc , 1967b710ab2SJoseph Koshyand 1977b710ab2SJoseph Koshy.Pa release . 198d90f12e3SWarren BlockThe object directory can be changed from the default 199d90f12e3SWarren Block.Pa /usr/obj 200d90f12e3SWarren Blockby setting the 201d90f12e3SWarren Block.Pa MAKEOBJDIRPREFIX 202d90f12e3SWarren Block.Xr make 1 203d90f12e3SWarren Blockvariable. 2047b710ab2SJoseph KoshyThe actual build location prefix used is 2057b710ab2SJoseph Koshy.Pa ${MAKEOBJDIRPREFIX}${.CURDIR} 2067b710ab2SJoseph Koshyfor native builds, and 2077b710ab2SJoseph Koshy.Pa ${MAKEOBJDIRPREFIX}/${TARGET}${.CURDIR} 2087b710ab2SJoseph Koshyfor cross builds and native builds with variable 2097b710ab2SJoseph Koshy.Va CROSS_BUILD_TESTING 2107b710ab2SJoseph Koshyset. 2117b710ab2SJoseph Koshy.It Cm cleanworld 2127b710ab2SJoseph KoshyAttempt to clean up targets built by a preceding 2137b710ab2SJoseph Koshy.Cm buildworld 2147b710ab2SJoseph Koshystep. 2157b710ab2SJoseph Koshy.It Cm distributeworld 2167b710ab2SJoseph KoshyDistribute everything compiled by a preceding 2177b710ab2SJoseph Koshy.Cm buildworld 2187b710ab2SJoseph Koshystep. 2197b710ab2SJoseph KoshyFiles are placed in the directory hierarchy specified by 2207b710ab2SJoseph Koshy.Xr make 1 2217b710ab2SJoseph Koshyvariable 2227b710ab2SJoseph Koshy.Va DISTDIR . 2237b710ab2SJoseph KoshyThis target is used while building a release; see 2247b710ab2SJoseph Koshy.Xr release 7 . 225e8423d00SNathan Whitehorn.It Cm packageworld 226e8423d00SNathan WhitehornArchive the results of 227e8423d00SNathan Whitehorn.Cm distributeworld , 228e8423d00SNathan Whitehornplacing the results in 229e8423d00SNathan Whitehorn.Va DISTDIR . 230e8423d00SNathan WhitehornThis target is used while building a release; see 231e8423d00SNathan Whitehorn.Xr release 7 . 2327b710ab2SJoseph Koshy.It Cm installworld 2337b710ab2SJoseph KoshyInstall everything built by a preceding 2347b710ab2SJoseph Koshy.Cm buildworld 2357b710ab2SJoseph Koshystep into the directory hierarchy pointed to by 2367b710ab2SJoseph Koshy.Xr make 1 2377b710ab2SJoseph Koshyvariable 2387b710ab2SJoseph Koshy.Va DESTDIR . 239a3aed80dSRuslan Ermilov.Pp 24004876cf3SRuslan ErmilovIf installing onto an NFS file system and running 2418ed6451eSRuslan Ermilov.Xr make 1 2428ed6451eSRuslan Ermilovwith the 24304876cf3SRuslan Ermilov.Fl j 24404876cf3SRuslan Ermilovoption, make sure that 245a3aed80dSRuslan Ermilov.Xr rpc.lockd 8 246a3aed80dSRuslan Ermilovis running on both client and server. 247a3aed80dSRuslan ErmilovSee 248a3aed80dSRuslan Ermilov.Xr rc.conf 5 249a3aed80dSRuslan Ermilovon how to make it start at boot time. 2507b710ab2SJoseph Koshy.It Cm toolchain 2517b710ab2SJoseph KoshyCreate the build toolchain needed to build the rest of the system. 2527b710ab2SJoseph KoshyFor cross-architecture builds, this step creates a cross-toolchain. 2537b710ab2SJoseph Koshy.It Cm universe 2544e889921SJohn BaldwinFor each architecture, 2554e889921SJohn Baldwinexecute a 2567b710ab2SJoseph Koshy.Cm buildworld 2574e889921SJohn Baldwinfollowed by a 2587b710ab2SJoseph Koshy.Cm buildkernel 2594e889921SJohn Baldwinfor all kernels for that architecture, 2604e889921SJohn Baldwinincluding 2614e889921SJohn Baldwin.Pa LINT . 2627b710ab2SJoseph KoshyThis command takes a long time. 2631caae057SRuslan Ermilov.It Cm update 2647b710ab2SJoseph KoshyGet updated sources as configured in 26508b91343SYaroslav Tykhiy.Xr make.conf 5 . 266f1d16bd8SBjoern A. Zeeb.It Cm targets 267f1d16bd8SBjoern A. ZeebPrint a list of supported 268f1d16bd8SBjoern A. Zeeb.Va TARGET 269f1d16bd8SBjoern A. Zeeb/ 270f1d16bd8SBjoern A. Zeeb.Va TARGET_ARCH 271f1d16bd8SBjoern A. Zeebpairs for world and kernel targets. 272eee8163bSBjoern A. Zeeb.It Cm tinderbox 273eee8163bSBjoern A. ZeebExecute the same targets as 274eee8163bSBjoern A. Zeeb.Cm universe . 275eee8163bSBjoern A. ZeebIn addition print a summary of all failed targets at the end and 276eee8163bSBjoern A. Zeebexit with an error if there were any. 2774e889921SJohn Baldwin.It Cm toolchains 2784e889921SJohn BaldwinCreate a build toolchain for each architecture supported by the build system. 279786aa69aSBen Smithurst.El 280786aa69aSBen Smithurst.Pp 2817b710ab2SJoseph KoshyKernel specific build targets in 282786aa69aSBen Smithurst.Pa /usr/src 2837b710ab2SJoseph Koshyare: 284e8423d00SNathan Whitehorn.Bl -tag -width ".Cm distributekernel" 2851caae057SRuslan Ermilov.It Cm buildkernel 2861caae057SRuslan ErmilovRebuild the kernel and the kernel modules. 287d90f12e3SWarren BlockThe object directory can be changed from the default 288d90f12e3SWarren Block.Pa /usr/obj 289d90f12e3SWarren Blockby setting the 290d90f12e3SWarren Block.Pa MAKEOBJDIRPREFIX 291d90f12e3SWarren Block.Xr make 1 292d90f12e3SWarren Blockvariable. 2931caae057SRuslan Ermilov.It Cm installkernel 2947b710ab2SJoseph KoshyInstall the kernel and the kernel modules to directory 2957b710ab2SJoseph Koshy.Pa ${DESTDIR}/boot/kernel , 2967b710ab2SJoseph Koshyrenaming any pre-existing directory with this name to 2977b710ab2SJoseph Koshy.Pa kernel.old 2987b710ab2SJoseph Koshyif it contained the currently running kernel. 2997b710ab2SJoseph KoshyThe target directory under 3007b710ab2SJoseph Koshy.Pa ${DESTDIR} 3017b710ab2SJoseph Koshymay be modified using the 3027b710ab2SJoseph Koshy.Va INSTKERNNAME 3037b710ab2SJoseph Koshyand 3047b710ab2SJoseph Koshy.Va KODIR 3057b710ab2SJoseph Koshy.Xr make 1 3067b710ab2SJoseph Koshyvariables. 307e8423d00SNathan Whitehorn.It Cm distributekernel 308e8423d00SNathan WhitehornInstall the kernel to the directory 309e8423d00SNathan Whitehorn.Pa ${DISTDIR}/kernel/boot/kernel . 310e8423d00SNathan WhitehornThis target is used while building a release; see 311e8423d00SNathan Whitehorn.Xr release 7 . 312e8423d00SNathan Whitehorn.It Cm packagekernel 313e8423d00SNathan WhitehornArchive the results of 314e8423d00SNathan Whitehorn.Cm distributekernel , 315e8423d00SNathan Whitehornplacing the results in 316e8423d00SNathan Whitehorn.Va DISTDIR . 317e8423d00SNathan WhitehornThis target is used while building a release; see 318e8423d00SNathan Whitehorn.Xr release 7 . 319389e98a7STom Rhodes.It Cm kernel 320389e98a7STom RhodesEquivalent to 321389e98a7STom Rhodes.Cm buildkernel 322389e98a7STom Rhodesfollowed by 323389e98a7STom Rhodes.Cm installkernel 3247b710ab2SJoseph Koshy.It Cm kernel-toolchain 3257b710ab2SJoseph KoshyRebuild the tools needed for kernel compilation. 3267b710ab2SJoseph KoshyUse this if you did not do a 3277b710ab2SJoseph Koshy.Cm buildworld 3287b710ab2SJoseph Koshyfirst. 3297b710ab2SJoseph Koshy.It Cm reinstallkernel 3307b710ab2SJoseph KoshyReinstall the kernel and the kernel modules, overwriting the contents 3317b710ab2SJoseph Koshyof the target directory. 3327b710ab2SJoseph KoshyAs with the 3337b710ab2SJoseph Koshy.Cm installkernel 3347b710ab2SJoseph Koshytarget, the target directory can be specified using the 3357b710ab2SJoseph Koshy.Xr make 1 3367b710ab2SJoseph Koshyvariable 3377b710ab2SJoseph Koshy.Va INSTKERNNAME . 3387b710ab2SJoseph Koshy.El 3397b710ab2SJoseph Koshy.Pp 3407b710ab2SJoseph KoshyConvenience targets for cleaning up the install destination directory 3417b710ab2SJoseph Koshydenoted by variable 3427b710ab2SJoseph Koshy.Va DESTDIR 3437b710ab2SJoseph Koshyinclude: 3447b710ab2SJoseph Koshy.Bl -tag -width ".Cm delete-old-libs" 3457b710ab2SJoseph Koshy.It Cm check-old 346abfabbeaSMike PritchardPrint a list of old files and directories in the system. 347e2a36081SAlexander Leidinger.It Cm delete-old 348e2a36081SAlexander LeidingerDelete obsolete base system files and directories interactively. 34978ad5421SRuslan ErmilovWhen 35078ad5421SRuslan Ermilov.Li -DBATCH_DELETE_OLD_FILES 3517b710ab2SJoseph Koshyis specified at the command line, the delete operation will be 3527b710ab2SJoseph Koshynon-interactive. 353c8ef0ed5SRuslan ErmilovThe variables 3547b710ab2SJoseph Koshy.Va DESTDIR , 3557b710ab2SJoseph Koshy.Va TARGET_ARCH 356c8ef0ed5SRuslan Ermilovand 357c8ef0ed5SRuslan Ermilov.Va TARGET 358c8ef0ed5SRuslan Ermilovshould be set as with 359c8ef0ed5SRuslan Ermilov.Dq Li "make installworld" . 360e2a36081SAlexander Leidinger.It Cm delete-old-libs 361e2a36081SAlexander LeidingerDelete obsolete base system libraries interactively. 362d90f12e3SWarren BlockThis target should only be used if no third party software uses these 3637b710ab2SJoseph Koshylibraries. 36478ad5421SRuslan ErmilovWhen 36578ad5421SRuslan Ermilov.Li -DBATCH_DELETE_OLD_FILES 3667b710ab2SJoseph Koshyis specified at the command line, the delete operation will be 3677b710ab2SJoseph Koshynon-interactive. 368c8ef0ed5SRuslan ErmilovThe variables 3697b710ab2SJoseph Koshy.Va DESTDIR , 3707b710ab2SJoseph Koshy.Va TARGET_ARCH 371c8ef0ed5SRuslan Ermilovand 372c8ef0ed5SRuslan Ermilov.Va TARGET 373c8ef0ed5SRuslan Ermilovshould be set as with 374c8ef0ed5SRuslan Ermilov.Dq Li "make installworld" . 375786aa69aSBen Smithurst.El 376b82e53e2SMurray Stokely.Sh ENVIRONMENT 3777b710ab2SJoseph KoshyVariables that influence all builds include: 3787b710ab2SJoseph Koshy.Bl -tag -width ".Va MAKEOBJDIRPREFIX" 379fea87c03SGiorgos Keramidas.It Va DEBUG_FLAGS 380fea87c03SGiorgos KeramidasDefines a set of debugging flags that will be used to build all userland 381fea87c03SGiorgos Keramidasbinaries under 382fea87c03SGiorgos Keramidas.Pa /usr/src . 383fea87c03SGiorgos KeramidasWhen 384fea87c03SGiorgos Keramidas.Va DEBUG_FLAGS 385fea87c03SGiorgos Keramidasis defined, the 386fea87c03SGiorgos Keramidas.Cm install 387fea87c03SGiorgos Keramidasand 388fea87c03SGiorgos Keramidas.Cm installworld 389fea87c03SGiorgos Keramidastargets install binaries from the current 390fea87c03SGiorgos Keramidas.Va MAKEOBJDIRPREFIX 391fea87c03SGiorgos Keramidaswithout stripping, 392fea87c03SGiorgos Keramidasso that debugging information is retained in the installed binaries. 3937b710ab2SJoseph Koshy.It Va DESTDIR 3947b710ab2SJoseph KoshyThe directory hierarchy prefix where built objects will be installed. 3957b710ab2SJoseph KoshyIf not set, 3967b710ab2SJoseph Koshy.Va DESTDIR 3977b710ab2SJoseph Koshydefaults to the empty string. 3987b710ab2SJoseph Koshy.It Va MAKEOBJDIRPREFIX 3997b710ab2SJoseph KoshyDefines the prefix for directory names in the tree of built objects. 4007b710ab2SJoseph KoshyDefaults to 4017b710ab2SJoseph Koshy.Pa /usr/obj 4027b710ab2SJoseph Koshyif not defined. 4037b710ab2SJoseph KoshyThis variable should only be set in the environment and not via 4047b710ab2SJoseph Koshy.Pa /etc/make.conf 4057b710ab2SJoseph Koshyor the command line. 4067b710ab2SJoseph Koshy.It Va NO_WERROR 4077b710ab2SJoseph KoshyIf defined, compiler warnings will not cause the build to halt, 4087b710ab2SJoseph Koshyeven if the makefile says otherwise. 40921edb039SAlexander Leidinger.It Va WITH_CTF 41021edb039SAlexander LeidingerIf defined, the build process will run the DTrace CTF conversion 41121edb039SAlexander Leidingertools on built objects. 4127b710ab2SJoseph Koshy.El 4137b710ab2SJoseph Koshy.Pp 4147b710ab2SJoseph KoshyAdditionally, builds in 4157b710ab2SJoseph Koshy.Pa /usr/src 4167b710ab2SJoseph Koshyare influenced by the following 4177b710ab2SJoseph Koshy.Xr make 1 4187b710ab2SJoseph Koshyvariables: 4197b710ab2SJoseph Koshy.Bl -tag -width ".Va SUBDIR_OVERRIDE" 420e6cdeeddSWarner Losh.It Va KERNCONF 421e6cdeeddSWarner LoshOverrides which kernel to build and install for the various kernel 422e6cdeeddSWarner Loshmake targets. 423e6cdeeddSWarner LoshIt defaults to 424e6cdeeddSWarner Losh.Cm GENERIC . 425e6cdeeddSWarner Losh.It Va KERNFAST 426e6cdeeddSWarner LoshIf set, the build target 427e6cdeeddSWarner Losh.Cm buildkernel 428e6cdeeddSWarner Loshdefaults to setting 429e6cdeeddSWarner Losh.Va NO_KERNELCLEAN , 4306d50d5e4SWarner Losh.Va NO_KERNELCONFIG , 431e6cdeeddSWarner Loshand 4326d50d5e4SWarner Losh.Va NO_KERNELOBJ . 433e6cdeeddSWarner LoshWhen set to a value other than 434e6cdeeddSWarner Losh.Cm 1 435e6cdeeddSWarner Loshthen 436e6cdeeddSWarner Losh.Va KERNCONF 437e6cdeeddSWarner Loshis set to the value of 438e6cdeeddSWarner Losh.Va KERNFAST . 4397b710ab2SJoseph Koshy.It Va LOCAL_DIRS 440ca6a54ceSBryan DreweryIf set, this variable supplies a list of additional directories relative to 441ca6a54ceSBryan Drewerythe root of the source tree to build as part of the 442ca6a54ceSBryan Drewery.Cm everything 443ca6a54ceSBryan Drewerytarget. 444a0e6a013SBryan Drewery.It Va LOCAL_ITOOLS 445a0e6a013SBryan DreweryIf set, this variable supplies a list of additional tools that are used by the 446a0e6a013SBryan Drewery.Cm installworld 447a0e6a013SBryan Dreweryand 448a0e6a013SBryan Drewery.Cm distributeworld 449a0e6a013SBryan Drewerytargets. 450ca6a54ceSBryan Drewery.It Va LOCAL_LIB_DIRS 451ca6a54ceSBryan DreweryIf set, this variable supplies a list of additional directories relative to 452ca6a54ceSBryan Drewerythe root of the source tree to build as part of the 453ca6a54ceSBryan Drewery.Cm libraries 454ca6a54ceSBryan Drewerytarget. 455ca6a54ceSBryan Drewery.It Va LOCAL_MTREE 456ca6a54ceSBryan DreweryIf set, this variable supplies a list of additional mtrees relative to the 457ca6a54ceSBryan Dreweryroot of the source tree to use as part of the 458ca6a54ceSBryan Drewery.Cm hierarchy 459ca6a54ceSBryan Drewerytarget. 460ca6a54ceSBryan Drewery.It Va LOCAL_TOOL_DIRS 461ca6a54ceSBryan DreweryIf set, this variable supplies a list of additional directories relative to 462ca6a54ceSBryan Drewerythe root of the source tree to build as part of the 463ca6a54ceSBryan Drewery.Cm build-tools 464ca6a54ceSBryan Drewerytarget. 4654143850bSBryan Drewery.It Va LOCAL_XTOOL_DIRS 4664143850bSBryan DreweryIf set, this variable supplies a list of additional directories relative to 4674143850bSBryan Drewerythe root of the source tree to build as part of the 4684143850bSBryan Drewery.Cm cross-tools 4694143850bSBryan Drewerytarget. 470170c2788SGlen Barber.It Va PORTS_MODULES 471170c2788SGlen BarberA list of ports with kernel modules that should be built and installed 472170c2788SGlen Barberas part of the 473170c2788SGlen Barber.Cm buildkernel 474170c2788SGlen Barberand 475170c2788SGlen Barber.Cm installkernel 476170c2788SGlen Barberprocess. 477170c2788SGlen Barber.Bd -literal -offset indent 478170c2788SGlen Barbermake PORTS_MODULES=emulators/kqemu-kmod kernel 479170c2788SGlen Barber.Ed 48042e7be20SEnji Cooper.It Va STRIPBIN 4813547290fSEnji CooperCommand to use at install time when stripping binaries. 4823547290fSEnji CooperBe sure to add any additional tools required to run 48342e7be20SEnji Cooper.Va STRIPBIN 4843547290fSEnji Cooperto the 4853547290fSEnji Cooper.Va LOCAL_ITOOLS 4863547290fSEnji Cooper.Xr make 1 4873547290fSEnji Coopervariable before running the 4883547290fSEnji Cooper.Cm distributeworld 4893547290fSEnji Cooperor 4903547290fSEnji Cooper.Cm installworld 4913547290fSEnji Coopertargets. 4923547290fSEnji CooperSee 4933547290fSEnji Cooper.Xr install 1 4943547290fSEnji Cooperfor more details. 4957b710ab2SJoseph Koshy.It Va SUBDIR_OVERRIDE 4967b710ab2SJoseph KoshyOverride the default list of sub-directories and only build the 4977b710ab2SJoseph Koshysub-directory named in this variable. 4987f1636b7SBryan DreweryIf combined with 4997f1636b7SBryan Drewery.Cm buildworld 5007f1636b7SBryan Drewerythen all libraries and includes, and some of the build tools will still build 5017f1636b7SBryan Dreweryas well. 502*c889d480SBryan DrewerySpecifying 503*c889d480SBryan Drewery.Cm -DNO_LIBS , 504*c889d480SBryan Dreweryand 505*c889d480SBryan Drewery.Cm -DWORLDFAST 506*c889d480SBryan Drewerywill only build the specified directory as was done historically. 5077f1636b7SBryan DreweryWhen combined with 5087f1636b7SBryan Drewery.Cm buildworld 5097f1636b7SBryan Dreweryit is necesarry to override 5107f1636b7SBryan Drewery.Va LOCAL_LIB_DIRS 5117f1636b7SBryan Drewerywith any custom directories containing libraries. 5127f1636b7SBryan DreweryThis allows building a subset of the system in the same way as 5137f1636b7SBryan Drewery.Cm buildworld 5147f1636b7SBryan Drewerydoes using its sysroot handling. 5157f1636b7SBryan DreweryThis variable can also be useful when debugging failed builds. 5167b710ab2SJoseph Koshy.Bd -literal -offset indent 5177b710ab2SJoseph Koshymake some-target SUBDIR_OVERRIDE=foo/bar 5187b710ab2SJoseph Koshy.Ed 5196f9ac6feSMurray Stokely.It Va TARGET 520b3a43ea3SMurray StokelyThe target hardware platform. 521365a17c0SMurray StokelyThis is analogous to the 5221caae057SRuslan Ermilov.Dq Nm uname Fl m 523b3a43ea3SMurray Stokelyoutput. 524b3a43ea3SMurray StokelyThis is necessary to cross-build some target architectures. 5252f6a7e42SEnji CooperFor example, cross-building for ARM64 machines requires 5262f6a7e42SEnji Cooper.Va TARGET_ARCH Ns = Ns Li aarch64 527b3a43ea3SMurray Stokelyand 5282f6a7e42SEnji Cooper.Va TARGET Ns = Ns Li arm64 . 5297b710ab2SJoseph KoshyIf not set, 5307b710ab2SJoseph Koshy.Va TARGET 5317b710ab2SJoseph Koshydefaults to the current hardware platform. 5327b710ab2SJoseph Koshy.It Va TARGET_ARCH 5337b710ab2SJoseph KoshyThe target machine processor architecture. 5347b710ab2SJoseph KoshyThis is analogous to the 5357b710ab2SJoseph Koshy.Dq Nm uname Fl p 5367b710ab2SJoseph Koshyoutput. 5377b710ab2SJoseph KoshySet this to cross-build for a different architecture. 5387b710ab2SJoseph KoshyIf not set, 5397b710ab2SJoseph Koshy.Va TARGET_ARCH 540531b260aSWarner Loshdefaults to the current machine architecture, unless 541531b260aSWarner Losh.Va TARGET 542531b260aSWarner Loshis also set, in which case it defaults to the appropriate 543531b260aSWarner Loshvalue for that platform. 544c22c7f86SWarner LoshTypically, one only needs to set 545c22c7f86SWarner Losh.Va TARGET . 5467b710ab2SJoseph Koshy.El 5477b710ab2SJoseph Koshy.Pp 5487b710ab2SJoseph KoshyBuilds under directory 549fd23b461SGiorgos Keramidas.Pa /usr/src 5507d6af40dSGlen Barberare also influenced by defining one or more of the following symbols, 551fd23b461SGiorgos Keramidasusing the 552fd23b461SGiorgos Keramidas.Fl D 553fd23b461SGiorgos Keramidasoption of 554fd23b461SGiorgos Keramidas.Xr make 1 : 555497e8091SBryan Drewery.Bl -tag -width ".Va -DNO_KERNELCONFIG" 556fd23b461SGiorgos Keramidas.It Va NO_CLEANDIR 557fd23b461SGiorgos KeramidasIf set, the build targets that clean parts of the object tree use the 558fd23b461SGiorgos Keramidasequivalent of 559fd23b461SGiorgos Keramidas.Dq make clean 560fd23b461SGiorgos Keramidasinstead of 561fd23b461SGiorgos Keramidas.Dq make cleandir . 562fd23b461SGiorgos Keramidas.It Va NO_CLEAN 563fd23b461SGiorgos KeramidasIf set, no object tree files are cleaned at all. 564473fda75SBryan DreweryThis is the default when 565473fda75SBryan Drewery.Va WITH_META_MODE 566473fda75SBryan Dreweryis used with 567473fda75SBryan Drewery.Xr filemon 4 568473fda75SBryan Dreweryloaded. 569473fda75SBryan DrewerySee 570473fda75SBryan Drewery.Xr src.conf 5 571473fda75SBryan Dreweryfor more details. 572fd23b461SGiorgos KeramidasSetting 573fd23b461SGiorgos Keramidas.Va NO_CLEAN 574fd23b461SGiorgos Keramidasimplies 575fd23b461SGiorgos Keramidas.Va NO_KERNELCLEAN , 576fd23b461SGiorgos Keramidasso when 577fd23b461SGiorgos Keramidas.Va NO_CLEAN 578fd23b461SGiorgos Keramidasis set no kernel objects are cleaned either. 579fd23b461SGiorgos Keramidas.It Va NO_CTF 580fd23b461SGiorgos KeramidasIf set, the build process does not run the DTrace CTF conversion tools 581fd23b461SGiorgos Keramidason built objects. 582fd23b461SGiorgos Keramidas.It Va NO_SHARE 583fd23b461SGiorgos KeramidasIf set, the build does not descend into the 584fd23b461SGiorgos Keramidas.Pa /usr/src/share 585d90f12e3SWarren Blocksubdirectory (i.e., manual pages, locale data files, timezone data files and 586fd23b461SGiorgos Keramidasother 587fd23b461SGiorgos Keramidas.Pa /usr/src/share 588fd23b461SGiorgos Keramidasfiles will not be rebuild from their sources). 589fd23b461SGiorgos Keramidas.It Va NO_KERNELCLEAN 590fd23b461SGiorgos KeramidasIf set, the build process does not run 591fd23b461SGiorgos Keramidas.Dq make clean 592fd23b461SGiorgos Keramidasas part of the 593fd23b461SGiorgos Keramidas.Cm buildkernel 594fd23b461SGiorgos Keramidastarget. 595fd23b461SGiorgos Keramidas.It Va NO_KERNELCONFIG 596fd23b461SGiorgos KeramidasIf set, the build process does not run 597fd23b461SGiorgos Keramidas.Xr config 8 598fd23b461SGiorgos Keramidasas part of the 599fd23b461SGiorgos Keramidas.Cm buildkernel 600fd23b461SGiorgos Keramidastarget. 6016d50d5e4SWarner Losh.It Va NO_KERNELOBJ 6026d50d5e4SWarner LoshIf set, the build process does not run 6036d50d5e4SWarner Losh.Dq make obj 6046d50d5e4SWarner Loshas part of the 6056d50d5e4SWarner Losh.Cm buildkernel 6066d50d5e4SWarner Loshtarget. 607fd23b461SGiorgos Keramidas.It Va NO_DOCUPDATE 608fd23b461SGiorgos KeramidasIf set, the update process does not update the source of the 609fd23b461SGiorgos Keramidas.Fx 610fd23b461SGiorgos Keramidasdocumentation as part of the 611fd23b461SGiorgos Keramidas.Dq make update 612fd23b461SGiorgos Keramidastarget. 613c596c287SBryan Drewery.It Va NO_LIBS 614c596c287SBryan DreweryIf set, the libraries phase will be skipped. 6156d75a7a8SBryan Drewery.It Va NO_OBJ 6166d75a7a8SBryan DreweryIf set, no object directories will be created. 6176d75a7a8SBryan DreweryThis should only be used if object directories were created in a 6186d75a7a8SBryan Dreweryprevious build and no new directories are connected. 619fd23b461SGiorgos Keramidas.It Va NO_PORTSUPDATE 620fd23b461SGiorgos KeramidasIf set, the update process does not update the Ports tree as part of the 621fd23b461SGiorgos Keramidas.Dq make update 622fd23b461SGiorgos Keramidastarget. 62369c488cdSRuslan Ermilov.It Va NO_WWWUPDATE 62469c488cdSRuslan ErmilovIf set, the update process does not update the www tree as part of the 62569c488cdSRuslan Ermilov.Dq make update 62669c488cdSRuslan Ermilovtarget. 62716892c77SBryan Drewery.It Va WORLDFAST 62816892c77SBryan DreweryIf set, the build target 62916892c77SBryan Drewery.Cm buildworld 63016892c77SBryan Drewerydefaults to setting 63116892c77SBryan Drewery.Va NO_CLEAN , 63216892c77SBryan Drewery.Va NO_OBJ , 63316892c77SBryan Dreweryand will skip most bootstrap phases. 63416892c77SBryan DreweryIt will only bootstrap libraries and build all of userland. 63516892c77SBryan DreweryThis option should be used only when it is known that none of the bootstrap 63616892c77SBryan Dreweryneeds changed and that no new directories have been connected to the build. 637fd23b461SGiorgos Keramidas.El 638fd23b461SGiorgos Keramidas.Pp 639fd23b461SGiorgos KeramidasBuilds under directory 6407b710ab2SJoseph Koshy.Pa /usr/doc 6417b710ab2SJoseph Koshyare influenced by the following 6427b710ab2SJoseph Koshy.Xr make 1 6437b710ab2SJoseph Koshyvariables: 6447b710ab2SJoseph Koshy.Bl -tag -width ".Va DOC_LANG" 6457b710ab2SJoseph Koshy.It Va DOC_LANG 6467b710ab2SJoseph KoshyIf set, restricts the documentation build to the language subdirectories 6477b710ab2SJoseph Koshyspecified as its content. 6487b710ab2SJoseph KoshyThe default action is to build documentation for all languages. 649b82e53e2SMurray Stokely.El 6504e889921SJohn Baldwin.Pp 6514e889921SJohn BaldwinBuilds using the 6524e889921SJohn Baldwin.Cm universe 6534e889921SJohn Baldwintarget are influenced by the following 6544e889921SJohn Baldwin.Xr make 1 6554e889921SJohn Baldwinvariables: 6564e889921SJohn Baldwin.Bl -tag -width ".Va MAKE_JUST_KERNELS" 6574e889921SJohn Baldwin.It Va JFLAG 6584e889921SJohn BaldwinPass the value of this variable to each 6594e889921SJohn Baldwin.Xr make 1 6604e889921SJohn Baldwininvocation used to build worlds and kernels. 6614e889921SJohn BaldwinThis can be used to enable multiple jobs within a single architecture's build 6624e889921SJohn Baldwinwhile still building each architecture serially. 6634e889921SJohn Baldwin.It Va MAKE_JUST_KERNELS 6644e889921SJohn BaldwinOnly build kernels for each supported architecture. 6654e889921SJohn Baldwin.It Va MAKE_JUST_WORLDS 6664e889921SJohn BaldwinOnly build worlds for each supported architecture. 6674e889921SJohn Baldwin.It Va UNIVERSE_TARGET 6684e889921SJohn BaldwinExecute the specified 6694e889921SJohn Baldwin.Xr make 1 6704e889921SJohn Baldwintarget for each supported architecture instead of the default action of 6714e889921SJohn Baldwinbuilding a world and one or more kernels. 6724e889921SJohn Baldwin.El 673786aa69aSBen Smithurst.Sh FILES 6740c0eb9beSRuslan Ermilov.Bl -tag -width ".Pa /usr/share/examples/etc/make.conf" -compact 675786aa69aSBen Smithurst.It Pa /usr/doc/Makefile 676786aa69aSBen Smithurst.It Pa /usr/doc/share/mk/doc.project.mk 677786aa69aSBen Smithurst.It Pa /usr/ports/Mk/bsd.port.mk 678786aa69aSBen Smithurst.It Pa /usr/ports/Mk/bsd.sites.mk 6791caae057SRuslan Ermilov.It Pa /usr/share/examples/etc/make.conf 6800c0eb9beSRuslan Ermilov.It Pa /usr/src/Makefile 6810c0eb9beSRuslan Ermilov.It Pa /usr/src/Makefile.inc1 6823136363fSRuslan Ermilov.El 6833faf5fc9SBen Smithurst.Sh EXAMPLES 684be6a4760SRuslan ErmilovFor an 6853faf5fc9SBen Smithurst.Dq approved 6867b710ab2SJoseph Koshymethod of updating your system from the latest sources, please see the 687be6a4760SRuslan Ermilov.Sx COMMON ITEMS 688be6a4760SRuslan Ermilovsection in 689be6a4760SRuslan Ermilov.Pa src/UPDATING . 690b82e53e2SMurray Stokely.Pp 691b82e53e2SMurray StokelyThe following sequence of commands can be used to cross-build the 69262d06538SMaxim Konovalovsystem for the sparc64 architecture on an i386 host: 693b82e53e2SMurray Stokely.Bd -literal -offset indent 694b82e53e2SMurray Stokelycd /usr/src 695531b260aSWarner Loshmake TARGET=sparc64 buildworld 696531b260aSWarner Loshmake TARGET=sparc64 DESTDIR=/clients/sparc64 installworld 697b82e53e2SMurray Stokely.Ed 698786aa69aSBen Smithurst.Sh SEE ALSO 6997c20a493SBen Smithurst.Xr cc 1 , 700786aa69aSBen Smithurst.Xr install 1 , 701786aa69aSBen Smithurst.Xr make 1 , 70250a994c9SWarren Block.Xr svn 1 , 703786aa69aSBen Smithurst.Xr make.conf 5 , 704157376baSJoseph Koshy.Xr src.conf 5 , 705a81996b6SBen Smithurst.Xr ports 7 , 706a54bda91SMurray Stokely.Xr release 7 , 70753837b18SEnji Cooper.Xr tests 7 , 70861001d75STom Rhodes.Xr config 8 , 70947f77d8cSBen Smithurst.Xr mergemaster 8 , 710d732418bSWarren Block.Xr portsnap 8 , 711a81996b6SBen Smithurst.Xr reboot 8 , 71253837b18SEnji Cooper.Xr shutdown 8 713786aa69aSBen Smithurst.Sh AUTHORS 714a63d6c94SBaptiste Daroussin.An Mike W. Meyer Aq Mt mwm@mired.org 715