1.\" Copyright (c) 2000 2.\" Mike W. Meyer 3.\" 4.\" Redistribution and use in source and binary forms, with or without 5.\" modification, are permitted provided that the following conditions 6.\" are met: 7.\" 1. Redistributions of source code must retain the above copyright 8.\" notice, this list of conditions and the following disclaimer. 9.\" 2. Redistributions in binary form must reproduce the above copyright 10.\" notice, this list of conditions and the following disclaimer in the 11.\" documentation and/or other materials provided with the distribution. 12.\" 13.\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND 14.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 15.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 16.\" ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE 17.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 18.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 19.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 20.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 21.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 22.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 23.\" SUCH DAMAGE. 24.\" 25.\" $FreeBSD: src/share/man/man7/build.7,v 1.19.2.1 2002/03/18 08:33:02 murray Exp $ 26.\" $DragonFly: src/share/man/man7/build.7,v 1.4 2004/07/08 00:14:49 hmp Exp $ 27.\" 28.Dd November 4, 2000 29.Dt BUILD 7 30.Os 31.Sh NAME 32.Nm build 33.Nd information on how to build the system 34.Sh DESCRIPTION 35The source for the 36.Dx 37system and applications is contained in two different directories, 38normally 39.Pa /usr/src 40and 41.Pa /usr/ports . 42The 43.Pa /usr/src 44directory contains the 45.Dq "base system" 46sources, which is loosely defined as the things required to rebuild 47the system to a useful state. 48It also contains the source for the system documentation, including 49manual pages. 50The 51.Pa /usr/ports 52directory 53is a tree that provides a consistent interface for building and 54installing third party applications. 55.Pp 56The 57.Xr make 1 58command is used in each of these directories to build and install the 59things in that directory. Issuing the make command in any directory or 60subdirectory of those directories has the same effect as issuing the 61same command in all subdirectories of that directory. With no target 62specified, the things in that directory are just built. The following 63list provides the names and actions for other targets: 64.Bl -tag -width Ar 65.It Ar clean 66Removes any files created during the build process. 67.It Ar install 68Installs the results of the build for this directory. 69.It Ar update 70Gets updated sources as configured in 71.Pa /etc/make.conf . 72.El 73.Pp 74The other 75.Pa /usr/src 76make targets are: 77.Bl -tag -width Ar 78.It Ar buildworld 79Rebuild everything but the kernel, configure files in 80.Pa /etc , 81and release. 82.It Ar installworld 83Install everything built by 84.Dq buildworld . 85.It Ar world 86buildworld + installworld. 87.It Ar buildkernel 88Rebuild the kernel and the kernel-modules. 89.It Ar installkernel 90Install the kernel and the kernel-modules. 91.It Ar reinstallkernel 92Reinstall the kernel and the kernel-modules. 93.It Ar upgrade 94Upgrade a.out (2.2.x/3.0) system to the new ELF way 95.It Ar most 96Build user commands, no libraries or include files. 97.It Ar installmost 98Install user commands, no libraries or include files. 99.It Ar aout-to-elf 100Upgrade an system from a.out to elf format. 101.It Ar aout-to-elf-build 102Build everything required to upgrade a system from a.out to elf format. 103.It Ar aout-to-elf-install 104Install everything built by aout-to-elf-build. 105.It Ar move-aout-libs 106Move the a.out libraries into an aout sub-directory of each elf 107library sub-directory. 108.El 109.Pp 110For more information about the ports build process, see 111.Xr ports 7 . 112.Sh ENVIRONMENT 113.Bl -tag -width ".Va TARGET_ARCH" 114.It Va TARGET_ARCH 115The target machine processor architecture. 116This is analogous to the 117.Dq "uname -p" 118output. 119Set this to cross-build for a different architecture. 120.It Va TARGET 121The target hardware platform. 122This is analogous to the 123.Dq "uname -m" 124output. 125This is necessary to cross-build some target architectures. 126For example, cross-building for PC98 machines requires 127.Va "TARGET_ARCH=i386" 128and 129.Va "TARGET=pc98" . 130.It Va NO_WERROR 131If defined, warnings will not cause the build to halt, even if the 132makefile says otherwise. 133.It Va DESTDIR 134The directory hierarchy where the resulting binaries will be 135installed. 136.El 137.Sh FILES 138.Bl -tag -width ".Pa /usr/share/examples/etc/make.conf" -compact 139.It Pa /etc/make.conf 140.It Pa /usr/src/share/doc/Makefile 141.It Pa /usr/ports/Mk/bsd.port.mk 142.It Pa /usr/ports/Mk/bsd.sites.mk 143.It Pa /usr/share/examples/etc/defaults/make.conf 144.It Pa /usr/src/Makefile 145.It Pa /usr/src/Makefile.inc1 146.El 147.Sh EXAMPLES 148The 149.Dq approved 150method of updating your system from the latest sources is: 151.Bd -literal -offset indent 152make buildworld 153make buildkernel KERNCONF=FOO 154make installkernel KERNCONF=FOO 155make installworld 156mergemaster 157.Ed 158.Pp 159.Dq FOO 160must be replaced with the name of the kernel configuration file from which 161the kernel should be built. 162Alternatively, the 163.Va KERNCONF 164variable in 165.Pa /etc/make.conf 166can be set to the name of the kernel to build; 167in this case the 168.Dq KERNCONF=FOO 169part of the 170.Dq buildkernel 171and 172.Dq installkernel 173commands can be omitted. 174.Pp 175After running these commands a system reboot is required, 176otherwise many programs which have been rebuilt 177(such as 178.Nm ps , 179.Nm top , 180etc) 181may not work with the old kernel which is still running. 182.Pp 183The following sequence of commands can be used to cross-build the 184system for the Alpha architecture on an i386 host: 185.Bd -literal -offset indent 186cd /usr/src 187make TARGET_ARCH=alpha buildworld 188make TARGET_ARCH=alpha DESTDIR=/clients/axp installworld 189.Ed 190.Sh SEE ALSO 191.Xr cc 1 , 192.Xr install 1 , 193.Xr make 1 , 194.Xr make.conf 5 , 195.Xr ports 7 , 196.Xr release 7 , 197.Xr mergemaster 8 , 198.Xr reboot 8 , 199.Xr shutdown 8 200.Sh AUTHORS 201.An Mike W. Meyer Aq mwm@mired.org . 202