xref: /freebsd/share/man/man7/build.7 (revision ae83180158c4c937f170e31eff311b18c0286a93)
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$
26.\"
27.Dd March 15, 2002
28.Dt BUILD 7
29.Os
30.Sh NAME
31.Nm build
32.Nd information on how to build the system
33.Sh DESCRIPTION
34The source for the
35.Fx
36system and applications are contained in three different directories,
37normally
38.Pa /usr/src ,
39.Pa /usr/doc ,
40and
41.Pa /usr/ports .
42.Pa /usr/src
43contains the
44.Dq "base system"
45sources, which is loosely defined as the things required to rebuild
46the system to a useful state.
47.Pa /usr/doc
48contains the source for the system documentation, excluding the manual
49pages.
50.Pa /usr/ports
51is a tree that provides a consistent interface for building and
52installing third party applications.
53.Pp
54The
55.Xr make 1
56command is used in each of these directories to build and install the
57things in that directory.
58Issuing the
59.Xr make 1
60command in any directory or
61subdirectory of those directories has the same effect as issuing the
62same command in all subdirectories of that directory.
63With no target specified, the things in that directory are just built.
64The following
65list provides the names and actions for other targets:
66.Bl -tag -width indent-two
67.It Cm clean
68Removes any files created during the build process.
69.It Cm install
70Installs the results of the build for this directory.
71.It Cm update
72Gets updated sources as configured in
73.Pa /etc/make.conf .
74.El
75.Pp
76The other
77.Pa /usr/src
78make targets are:
79.Bl -tag -width indent-two
80.It Cm buildworld
81Rebuild everything but the kernel, configure files in
82.Pa /etc ,
83and release.
84.It Cm installworld
85Install everything built by
86.Cm buildworld .
87.It Cm world
88.Cm buildworld
89+
90.Cm installworld .
91.It Cm buildkernel
92Rebuild the kernel and the kernel modules.
93.It Cm installkernel
94Install the kernel and the kernel modules.
95.It Cm reinstallkernel
96Reinstall the kernel and the kernel modules.
97.It Cm upgrade
98Upgrade
99.Xr a.out 5
100(2.2.x/3.0) system to the new
101.Xr elf 5
102way.
103.It Cm most
104Build user commands, no libraries or include files.
105.It Cm installmost
106Install user commands, no libraries or include files.
107.It Cm aout-to-elf
108Upgrade a system from
109.Xr a.out 5
110to
111.Xr elf 5
112format.
113.It Cm aout-to-elf-build
114Build everything required to upgrade a system from
115.Xr a.out 5
116to
117.Xr elf 5
118format.
119.It Cm aout-to-elf-install
120Install everything built by
121.Cm aout-to-elf-build .
122.It Cm move-aout-libs
123Move the
124.Xr a.out 5
125libraries into an
126.Pa aout
127subdirectory of each
128.Xr elf 5
129library subdirectory.
130.El
131.Pp
132For more information about the ports build process, see
133.Xr ports 7 .
134.Sh ENVIRONMENT
135.Bl -tag -width ".Va TARGET_ARCH"
136.It Va TARGET_ARCH
137The target machine processor architecture.
138This is analogous to the
139.Dq Nm uname Fl p
140output.
141Set this to cross-build for a different architecture.
142.It Va TARGET
143The target hardware platform.
144This is analogous to the
145.Dq Nm uname Fl m
146output.
147This is necessary to cross-build some target architectures.
148For example, cross-building for PC98 machines requires
149.Va TARGET_ARCH Ns = Ns Li i386
150and
151.Va TARGET Ns = Ns Li pc98 .
152.It Va NO_WERROR
153If defined, warnings will not cause the build to halt, even if the
154makefile says otherwise.
155.It Va DESTDIR
156The directory hierarchy where the resulting binaries will be
157installed.
158.El
159.Sh FILES
160.Bl -tag -width ".Pa /usr/share/examples/etc/make.conf" -compact
161.It Pa /etc/make.conf
162.It Pa /usr/doc/Makefile
163.It Pa /usr/doc/share/mk/doc.project.mk
164.It Pa /usr/ports/Mk/bsd.port.mk
165.It Pa /usr/ports/Mk/bsd.sites.mk
166.It Pa /usr/share/examples/etc/make.conf
167.It Pa /usr/src/Makefile
168.It Pa /usr/src/Makefile.inc1
169.El
170.Sh EXAMPLES
171The
172.Dq approved
173method of updating your system from the latest sources is:
174.Bd -literal -offset indent
175make buildworld
176make buildkernel KERNCONF=FOO
177make installkernel KERNCONF=FOO
178make installworld
179mergemaster
180.Ed
181.Pp
182.Dq Li FOO
183must be replaced with the name of the kernel configuration file from which
184the kernel should be built.
185Alternatively, the
186.Va KERNCONF
187variable in
188.Pa /etc/make.conf
189can be set to the name of the kernel to build;
190in this case the
191.Va KERNCONF Ns = Ns Li FOO
192part of the
193.Cm buildkernel
194and
195.Cm installkernel
196commands can be omitted.
197.Pp
198After running these commands a system reboot is required,
199otherwise many programs which have been rebuilt
200(such as
201.Xr ps 1 ,
202.Xr top 1 ,
203etc.\&)
204may not work with the old kernel which is still running.
205.Pp
206The following sequence of commands can be used to cross-build the
207system for the Alpha architecture on an i386 host:
208.Bd -literal -offset indent
209cd /usr/src
210make TARGET_ARCH=alpha buildworld
211make TARGET_ARCH=alpha DESTDIR=/clients/axp installworld
212.Ed
213.Sh SEE ALSO
214.Xr cc 1 ,
215.Xr install 1 ,
216.Xr make 1 ,
217.Xr make.conf 5 ,
218.Xr ports 7 ,
219.Xr release 7 ,
220.Xr mergemaster 8 ,
221.Xr reboot 8 ,
222.Xr shutdown 8
223.Sh AUTHORS
224.An Mike W. Meyer Aq mwm@mired.org .
225