4 .\" Redistribution and use in source and binary forms, with or without
5 .\" modification, are permitted provided that the following conditions
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.
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
32 .Nd information on how to build the system
36 system and its applications are contained in three different directories,
46 sources, which is loosely defined as the things required to rebuild
47 the system to a useful state.
50 contains the source for the system documentation, excluding the manual
54 contains a tree that provides a consistent interface for building and
55 installing third party applications.
56 For more information about the ports build process, see
61 command is used in each of these directories to build and install the
62 things in that directory.
65 command in any directory or
66 subdirectory of those directories has the same effect as issuing the
67 same command in all subdirectories of that directory.
68 With no target specified, the things in that directory are just built.
70 A source tree is allowed to be read-only.
73 objects are usually built in a separate object directory hierarchy
74 specified by the environment variable
75 .Va MAKEOBJDIRPREFIX ,
81 For a given source directory, its canonical object directory
83 .Pa ${MAKEOBJDIRPREFIX}${.CURDIR}
89 .Pa /usr/obj${.CURDIR}
90 if this variable is not set.
91 Cross-builds set the object directory as described in the
96 The build may be controlled by defining
98 variables described in the
100 section below, and by the variables documented in
103 The following list provides the names and actions for the targets
104 supported by the build system:
105 .Bl -tag -width ".Cm cleandepend"
107 Remove any files created during the build process.
110 .Pa ${.OBJDIR}/${DEPENDFILE}
115 Remove the canonical object directory if it exists, or perform
116 actions equivalent to
117 .Dq Li "make clean cleandepend"
119 This target will also remove an
125 It is advisable to run
126 .Dq Li "make cleandir"
127 twice: the first invocation will remove the canonical object directory
128 and the second one will clean up
131 Generate a list of build dependencies in file
132 .Pa ${.OBJDIR}/${DEPENDFILE} .
134 Install the results of the build to the appropriate location in the
135 installation directory hierarchy specified in variable
138 Create the canonical object directory associated with the current
141 Create a symbolic link to the canonical object directory in
144 Generate a tags file using the program specified in the
148 The build system supports
154 The other supported targets under directory
157 .Bl -tag -width ".Cm distributeworld"
159 Spawn an interactive shell with environment variables set up for
160 cross-building the system.
161 The target architecture needs to be specified with
168 This target is only useful after a complete cross-toolchain including
169 the compiler, linker, assembler, headers and libraries has been
174 Build everything but the kernel, configure files in
178 The actual build location prefix used is
179 .Pa ${MAKEOBJDIRPREFIX}${.CURDIR}
180 for native builds, and
181 .Pa ${MAKEOBJDIRPREFIX}/${TARGET}${.CURDIR}
182 for cross builds and native builds with variable
183 .Va CROSS_BUILD_TESTING
186 Attempt to clean up targets built by a preceding
189 .It Cm distributeworld
190 Distribute everything compiled by a preceding
193 Files are placed in the directory hierarchy specified by
197 This target is used while building a release; see
200 Install everything built by a preceding
202 step into the directory hierarchy pointed to by
207 If installing onto an NFS file system, make sure that
209 is running on both client and server.
212 on how to make it start at boot time.
214 Create the build toolchain needed to build the rest of the system.
215 For cross-architecture builds, this step creates a cross-toolchain.
221 for all kernels including
223 for each architecture supported by the build system.
224 This command takes a long time.
226 Get updated sources as configured in
230 Kernel specific build targets in
233 .Bl -tag -width ".Cm reinstallkernel"
235 Rebuild the kernel and the kernel modules.
237 Install the kernel and the kernel modules to directory
238 .Pa ${DESTDIR}/boot/kernel ,
239 renaming any pre-existing directory with this name to
241 if it contained the currently running kernel.
242 The target directory under
244 may be modified using the
255 .It Cm kernel-toolchain
256 Rebuild the tools needed for kernel compilation.
257 Use this if you did not do a
260 .It Cm reinstallkernel
261 Reinstall the kernel and the kernel modules, overwriting the contents
262 of the target directory.
265 target, the target directory can be specified using the
271 Convenience targets for cleaning up the install destination directory
275 .Bl -tag -width ".Cm delete-old-libs"
277 Print a list of old files and directores in the system.
279 Delete obsolete base system files and directories interactively.
281 .Li -DBATCH_DELETE_OLD_FILES
282 is specified at the command line, the delete operation will be
289 should be set as with
290 .Dq Li "make installworld" .
291 .It Cm delete-old-libs
292 Delete obsolete base system libraries interactively.
293 This target should only be used if no 3rd party software uses these
296 .Li -DBATCH_DELETE_OLD_FILES
297 is specified at the command line, the delete operation will be
304 should be set as with
305 .Dq Li "make installworld" .
308 Variables that influence all builds include:
309 .Bl -tag -width ".Va MAKEOBJDIRPREFIX"
311 The directory hierarchy prefix where built objects will be installed.
314 defaults to the empty string.
315 .It Va MAKEOBJDIRPREFIX
316 Defines the prefix for directory names in the tree of built objects.
320 This variable should only be set in the environment and not via
324 If defined, compiler warnings will not cause the build to halt,
325 even if the makefile says otherwise.
328 Additionally, builds in
330 are influenced by the following
333 .Bl -tag -width ".Va SUBDIR_OVERRIDE"
335 If set, this variable supplies a list of additional directories to
336 build, relative to the root of the source tree.
337 .It Va SUBDIR_OVERRIDE
338 Override the default list of sub-directories and only build the
339 sub-directory named in this variable.
340 This variable is useful when debugging failed builds.
341 .Bd -literal -offset indent
342 make some-target SUBDIR_OVERRIDE=foo/bar
345 The target hardware platform.
346 This is analogous to the
349 This is necessary to cross-build some target architectures.
350 For example, cross-building for PC98 machines requires
351 .Va TARGET_ARCH Ns = Ns Li i386
353 .Va TARGET Ns = Ns Li pc98 .
356 defaults to the current hardware platform.
358 The target machine processor architecture.
359 This is analogous to the
362 Set this to cross-build for a different architecture.
365 defaults to the current machine architecture.
368 Builds under directory
370 are influenced by the following
373 .Bl -tag -width ".Va DOC_LANG"
375 If set, restricts the documentation build to the language subdirectories
376 specified as its content.
377 The default action is to build documentation for all languages.
380 .Bl -tag -width ".Pa /usr/share/examples/etc/make.conf" -compact
381 .It Pa /usr/doc/Makefile
382 .It Pa /usr/doc/share/mk/doc.project.mk
383 .It Pa /usr/ports/Mk/bsd.port.mk
384 .It Pa /usr/ports/Mk/bsd.sites.mk
385 .It Pa /usr/share/examples/etc/make.conf
386 .It Pa /usr/src/Makefile
387 .It Pa /usr/src/Makefile.inc1
392 method of updating your system from the latest sources, please see the
397 The following sequence of commands can be used to cross-build the
398 system for the sparc64 architecture on an i386 host:
399 .Bd -literal -offset indent
401 make TARGET_ARCH=sparc64 buildworld
402 make TARGET_ARCH=sparc64 DESTDIR=/clients/sparc64 installworld
417 .An Mike W. Meyer Aq mwm@mired.org .