.\" Copyright (c) 2000 .\" Mike W. Meyer .\" .\" Redistribution and use in source and binary forms, with or without .\" modification, are permitted provided that the following conditions .\" are met: .\" 1. Redistributions of source code must retain the above copyright .\" notice, this list of conditions and the following disclaimer. .\" 2. Redistributions in binary form must reproduce the above copyright .\" notice, this list of conditions and the following disclaimer in the .\" documentation and/or other materials provided with the distribution. .\" .\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND .\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE .\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE .\" ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE .\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL .\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS .\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) .\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT .\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY .\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF .\" SUCH DAMAGE. .\" .\" $FreeBSD: src/share/man/man7/build.7,v 1.19.2.1 2002/03/18 08:33:02 murray Exp $ .\" $DragonFly: src/share/man/man7/build.7,v 1.10 2006/03/16 18:32:12 swildner Exp $ .\" .Dd March 8, 2006 .Dt BUILD 7 .Os .Sh NAME .Nm build .Nd information on how to build the system .Sh DESCRIPTION The source for the .Dx system and applications is located in .Pa /usr/src . This directory contains the .Dq "base system" sources, which is loosely defined as the things required to rebuild the system to a useful state. It also contains the source for the system documentation, including manual pages. Third party applications have to be built using the .Em pkgsrc system. The file .Pa /usr/src/UPDATING gives specifics on how to obtain the tree for building packages while .Xr packages 7 describes the variables and targets that are available. .Pp The .Xr make 1 command is used in .Pa /usr/src to build and install the things in that directory. Issuing the .Xr make 1 command in any directory or subdirectory of those directories has the same effect as issuing the same command in all subdirectories of that directory. With no target specified, the things in that directory are just built. The following list provides the names and actions for other targets: .Bl -tag -width ".Cm install" .It Cm clean Removes any files created during the build process. .It Cm install Installs the results of the build for this directory. .It Cm update Gets updated sources as configured in .Pa /etc/make.conf . .El .Pp The other .Pa /usr/src make targets are: .Bl -tag -width ".Cm reinstallkernel" .It Cm buildworld Rebuild everything but the kernel. .It Cm quickworld Same as .Cm buildworld , but skip bootstrap, build and cross-build tool steps. This target can be used for incremental upgrades once a full build of the world has been done with .Cm buildworld . .It Cm realquickworld Same as .Cm quickworld , but also skip the depend step. .It Cm crossworld Just do the bootstrap, build and cross-build steps. .It Cm installworld Install everything built by .Cm buildworld . .It Cm world .Cm buildworld + .Cm installworld . .It Cm buildkernel Rebuild the kernel and the kernel-modules. .It Cm nativekernel Rebuild the kernel and the kernel-modules using native tools. .It Cm quickkernel Same as .Cm buildkernel , but skip the depend step and do not clean out the obj modules. This target can be used for incremental upgrades once a full build of the kernel has been done with .Cm buildkernel . .It Cm installkernel Install the kernel and the kernel-modules. .It Cm reinstallkernel Reinstall the kernel and the kernel-modules. .It Cm kernel .Cm buildkernel + .Cm installkernel . .It Cm preupgrade Perform certain upgrades that have to be done before .Cm installworld . .Cm installworld will complain if they have not been done. .It Cm upgrade Upgrade the files in /etc and also setup the rest of the system for the version of .Dx just installed. .It Cm most Build user commands, no libraries or include files. .It Cm installmost Install user commands, no libraries or include files. .El .Sh ENVIRONMENT .Bl -tag -width ".Va TARGET_ARCH" .It Va TARGET_ARCH The target machine processor architecture. This is analogous to the .Dq Nm uname Fl p output. .\"Set this to cross-build for a different architecture. .It Va TARGET The target hardware platform. This is analogous to the .Dq Nm uname Fl m output. .\"This is necessary to cross-build some target architectures. .It Va NO_WERROR If defined, warnings will not cause the build to halt, even if the makefile says otherwise. .It Va DESTDIR The directory hierarchy where the resulting binaries will be installed. .El .Sh FILES .Bl -tag -width ".Pa /usr/src/share/doc/Makefile" -compact .It Pa /etc/make.conf .It Pa /etc/defaults/make.conf .It Pa /usr/src/share/doc/Makefile .It Pa /usr/src/Makefile .It Pa /usr/src/Makefile.inc1 .El .Sh EXAMPLES The .Dq approved method of updating your system from the latest sources is: .Bd -literal -offset indent make buildworld make buildkernel KERNCONF=FOO make installkernel KERNCONF=FOO make installworld make upgrade .Ed .Pp .Dq FOO must be replaced with the name of the kernel configuration file from which the kernel should be built. Alternatively, the .Va KERNCONF variable in .Pa /etc/make.conf can be set to the name of the kernel to build; in this case the .Dq KERNCONF=FOO part of the .Cm buildkernel and .Cm installkernel commands can be omitted. .Pp After running these commands a system reboot is required, otherwise many programs which have been rebuilt (such as .Nm ps , .Nm top , etc) may not work with the old kernel which is still running. .Sh CAVEATS The build and install order in the .Sx EXAMPLES section enforces that the new kernel is installed before the new world. Sometimes it might be necessary to reboot the system between those two steps. In this case the .Cm installworld target will tell you so. .Pp Also note that you should .Em never run the .Cm upgrade target before having installed the new kernel and world because your system might (in the worst case) be rendered useless if you do so. This can happen because .Cm upgrade might remove something that the old system still needs for functioning correctly. .Sh SEE ALSO .Xr cc 1 , .Xr install 1 , .Xr make 1 , .Xr wmake 1 , .Xr make.conf 5 , .Xr packages 7 , .Xr release 7 , .Xr config 8 , .Xr reboot 8 , .Xr shutdown 8 .Sh AUTHORS .An -nosplit .An Mike W. Meyer Aq mwm@mired.org and .An Sascha Wildner Aq swildner@gmail.com .