summaryrefslogtreecommitdiffstats
path: root/share/man/man7/build.7
blob: f256411fd5843b6ee3262d6cdf78474919763ba6 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
.\" 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$
.\"
.Dd August 9, 2004
.Dt BUILD 7
.Os
.Sh NAME
.Nm build
.Nd information on how to build the system
.Sh DESCRIPTION
The source for the
.Fx
system and applications are contained in three different directories,
normally
.Pa /usr/src ,
.Pa /usr/doc ,
and
.Pa /usr/ports .
.Pa /usr/src
contains the
.Dq "base system"
sources, which is loosely defined as the things required to rebuild
the system to a useful state.
.Pa /usr/doc
contains the source for the system documentation, excluding the manual
pages.
.Pa /usr/ports
is a tree that provides a consistent interface for building and
installing third party applications.
.Pp
The
.Xr make 1
command is used in each of these directories 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 indent-two
.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 indent-two
.It Cm buildworld
Rebuild everything but the kernel, configure files in
.Pa /etc ,
and release.
.It Cm installworld
Install everything built by
.Cm buildworld .
.It Cm buildkernel
Rebuild the kernel and the kernel modules.
.It Cm installkernel
Install the kernel and the kernel modules.
.It Cm reinstallkernel
Reinstall the kernel and the kernel modules.
.El
.Pp
For more information about the ports build process, see
.Xr ports 7 .
.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.
For example, cross-building for PC98 machines requires
.Va TARGET_ARCH Ns = Ns Li i386
and
.Va TARGET Ns = Ns Li pc98 .
.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/share/examples/etc/make.conf" -compact
.It Pa /etc/make.conf
.It Pa /usr/doc/Makefile
.It Pa /usr/doc/share/mk/doc.project.mk
.It Pa /usr/ports/Mk/bsd.port.mk
.It Pa /usr/ports/Mk/bsd.sites.mk
.It Pa /usr/share/examples/etc/make.conf
.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
<Reboot the new kernel in single user mode>
make installworld
mergemaster
.Ed
.Pp
.Dq Li 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
.Va KERNCONF Ns = Ns Li 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
.Xr ps 1 ,
.Xr top 1 ,
etc.\&)
may not work with the old kernel which is still running.
While not strictly necessary much of the time for upgrades from very
recent sources, the reboot into single user mode is critically
important for upgrading from older kernels, or when you know
.Dq weird things
have happened with the kernel.
.Pp
The following sequence of commands can be used to cross-build the
system for the Alpha architecture on an i386 host:
.Bd -literal -offset indent
cd /usr/src
make TARGET_ARCH=alpha buildworld
make TARGET_ARCH=alpha DESTDIR=/clients/axp installworld
.Ed
.Sh SEE ALSO
.Xr cc 1 ,
.Xr install 1 ,
.Xr make 1 ,
.Xr make.conf 5 ,
.Xr ports 7 ,
.Xr release 7 ,
.Xr mergemaster 8 ,
.Xr reboot 8 ,
.Xr shutdown 8
.Sh AUTHORS
.An Mike W. Meyer Aq mwm@mired.org .
OpenPOWER on IntegriCloud