2003-01-04 15:55:32 +03:00
|
|
|
.\" $NetBSD: BUILDING.mdoc,v 1.8 2003/01/04 12:55:33 lukem Exp $
|
2001-10-29 22:46:47 +03:00
|
|
|
.\"
|
2002-09-21 09:17:52 +04:00
|
|
|
.\" Copyright (c) 2001, 2002 The NetBSD Foundation, Inc.
|
2001-10-29 22:46:47 +03:00
|
|
|
.\" All rights reserved.
|
|
|
|
.\"
|
|
|
|
.\" This code is derived from software contributed to The NetBSD Foundation
|
|
|
|
.\" by Todd Vierling.
|
|
|
|
.\"
|
|
|
|
.\" 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.
|
|
|
|
.\" 3. All advertising materials mentioning features or use of this software
|
|
|
|
.\" must display the following acknowledgement:
|
|
|
|
.\" This product includes software developed by the NetBSD
|
|
|
|
.\" Foundation, Inc. and its contributors.
|
|
|
|
.\" 4. Neither the name of The NetBSD Foundation nor the names of its
|
|
|
|
.\" contributors may be used to endorse or promote products derived
|
|
|
|
.\" from this software without specific prior written permission.
|
|
|
|
.\"
|
|
|
|
.\" THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
|
|
|
|
.\" ``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 FOUNDATION OR CONTRIBUTORS
|
|
|
|
.\" 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.
|
|
|
|
.\"
|
2001-10-29 23:02:01 +03:00
|
|
|
.\" =====
|
|
|
|
.\" NOTE: After changing this file, run "make build-docs" to generate the
|
|
|
|
.\" proper plaintext versions, and check in all BUILDING.* files!
|
|
|
|
.\"
|
2003-01-04 15:55:32 +03:00
|
|
|
.Dd January 4, 2003
|
2001-10-29 22:46:47 +03:00
|
|
|
.Dt BUILDING 8
|
|
|
|
.Os NetBSD
|
|
|
|
.
|
|
|
|
.Sh NAME
|
|
|
|
.
|
|
|
|
.Nm BUILDING
|
|
|
|
.Nd Procedure for building
|
|
|
|
.Nx
|
|
|
|
from source code.
|
|
|
|
.
|
|
|
|
.Sh STATUS
|
|
|
|
.
|
2002-12-18 22:46:48 +03:00
|
|
|
This document is a work-in-progress.
|
|
|
|
As such, the information described
|
2001-10-29 22:46:47 +03:00
|
|
|
here may not match the reality of the build system as of this writing.
|
|
|
|
Once this document is completely in sync with reality, this paragraph
|
|
|
|
will be removed.
|
|
|
|
.Pp
|
|
|
|
Discrepancies between this documentation and the current reality of
|
|
|
|
implementation are noted specially, as with the note below:
|
|
|
|
.Pp
|
|
|
|
.Em Note :
|
2001-10-30 19:22:40 +03:00
|
|
|
This document applies only to platforms which use the new toolchain as
|
2001-11-15 19:20:37 +03:00
|
|
|
indicated by the default setting of
|
2002-09-21 09:17:52 +04:00
|
|
|
.Sy TOOLCHAIN_MISSING
|
2001-10-29 22:46:47 +03:00
|
|
|
in
|
|
|
|
.Aq bsd.own.mk .
|
|
|
|
Platforms which have not yet been switched to the new toolchain should
|
|
|
|
continue building traditionally, using the notes specified in the file
|
|
|
|
.Sy UPDATING .
|
|
|
|
.
|
|
|
|
.Sh REQUIREMENTS
|
|
|
|
.
|
|
|
|
.Nx
|
2001-10-30 19:22:40 +03:00
|
|
|
is designed to be buildable on most POSIX-compliant host systems.
|
2001-10-29 22:46:47 +03:00
|
|
|
The basic build procedure is the same whether compiling
|
|
|
|
.Em natively
|
|
|
|
(on the same
|
|
|
|
.Nx
|
|
|
|
architecture) or
|
|
|
|
.Em cross compiling
|
|
|
|
(on another architecture or OS).
|
|
|
|
.Pp
|
|
|
|
This source tree contains a special subtree,
|
|
|
|
.Dq tools ,
|
|
|
|
which uses the host system to create a build toolchain for the target
|
2002-12-18 22:46:48 +03:00
|
|
|
architecture.
|
|
|
|
The host system must have at least C and C++
|
2001-10-29 22:46:47 +03:00
|
|
|
compilers in order to create the toolchain
|
|
|
|
.Nm ( make
|
|
|
|
is not required); all other tools are created as part of the
|
|
|
|
.Nx
|
|
|
|
build process.
|
|
|
|
.Pp
|
|
|
|
.Bd -ragged -offset indent
|
2001-10-30 19:22:40 +03:00
|
|
|
.Em Note :
|
2001-10-29 22:46:47 +03:00
|
|
|
A couple host toolchain components are not yet available in the tools
|
2002-12-18 22:46:48 +03:00
|
|
|
directory.
|
|
|
|
Also, some tools use non-POSIX, non-ANSI C extensions
|
|
|
|
and need to be standardized.
|
|
|
|
As a result, cross-compiling from systems other than
|
2001-10-29 22:46:47 +03:00
|
|
|
.Nx
|
|
|
|
is not currently supported.
|
|
|
|
.Ed
|
|
|
|
.
|
|
|
|
.Sh FILES
|
|
|
|
.
|
|
|
|
.Ss Source tree layout
|
|
|
|
.
|
|
|
|
.Bl -tag -width "BUILDING.mdoc"
|
2002-11-25 22:18:44 +03:00
|
|
|
.It Sy doc/BUILDING.mdoc
|
2001-10-29 23:02:01 +03:00
|
|
|
This document (in -mdoc troff format; the original copy).
|
2001-11-09 00:29:06 +03:00
|
|
|
.It Sy BUILDING
|
2001-10-29 23:02:01 +03:00
|
|
|
This document (in plaintext).
|
2001-10-29 22:46:47 +03:00
|
|
|
.It Sy Makefile
|
|
|
|
The main Makefile for
|
|
|
|
.Nx ;
|
2001-10-30 19:22:40 +03:00
|
|
|
should only be run for native builds with an appropriately up-to-date
|
2001-10-29 22:46:47 +03:00
|
|
|
version of
|
|
|
|
.Nx
|
|
|
|
.Xr make 1 .
|
|
|
|
(For building from out-of-date systems or on a non-native host, see the
|
|
|
|
.Nm build.sh
|
|
|
|
shell script.)
|
|
|
|
.It Sy UPDATING
|
|
|
|
Special notes for updating from an earlier revision of
|
|
|
|
.Nx .
|
|
|
|
It is important to read this file before every build of an updated
|
|
|
|
source tree.
|
|
|
|
.It Sy build.sh
|
|
|
|
Bourne-compatible shell script used for building the host build tools
|
|
|
|
and the
|
|
|
|
.Nx
|
2002-12-18 22:46:48 +03:00
|
|
|
system from scratch.
|
|
|
|
Can be used for both native and cross builds, and should be used instead of
|
2001-10-29 22:46:47 +03:00
|
|
|
.Xr make 1
|
|
|
|
for any source tree that is updated and recompiled regularly.
|
|
|
|
.It Sy crypto/dist/ , dist/ , gnu/dist/
|
|
|
|
Sources imported verbatim from third parties, without mangling the
|
2002-12-18 22:46:48 +03:00
|
|
|
existing build structure.
|
|
|
|
Other source trees in
|
2001-10-29 22:46:47 +03:00
|
|
|
.Sy bin
|
|
|
|
through
|
|
|
|
.Sy usr.sbin
|
|
|
|
use the
|
|
|
|
.Nx
|
|
|
|
.Xr make 1
|
|
|
|
.Dq reachover
|
|
|
|
Makefile semantics when building these programs for a native host.
|
|
|
|
.It Sy distrib/ , etc/
|
|
|
|
Sources for items used when making a full release snapshot, such as
|
|
|
|
files installed in
|
|
|
|
.Sy /etc
|
|
|
|
on the destination system, boot media, and release notes.
|
|
|
|
.It Sy regress/
|
2002-12-18 22:46:48 +03:00
|
|
|
Regression test harness.
|
|
|
|
Can be cross-compiled, but only run natively.
|
2001-10-29 22:46:47 +03:00
|
|
|
.It Sy sys/
|
|
|
|
.Nx
|
|
|
|
kernel sources.
|
|
|
|
.It Sy tools/
|
|
|
|
.Dq Reachover
|
2002-12-18 22:46:48 +03:00
|
|
|
build structure for the host build tools.
|
|
|
|
This has a special method of determining out-of-date status.
|
2001-10-29 22:46:47 +03:00
|
|
|
.It Sy bin/ ... usr.sbin/
|
|
|
|
Sources to the
|
|
|
|
.Nx
|
2002-12-18 22:46:48 +03:00
|
|
|
userland (non-kernel) programs.
|
|
|
|
If any of these directories are missing, they will be skipped during the build.
|
2001-10-29 22:46:47 +03:00
|
|
|
.El
|
|
|
|
.
|
|
|
|
.Ss Build tree layout
|
|
|
|
.
|
|
|
|
The
|
|
|
|
.Nx
|
|
|
|
build tree is described in
|
|
|
|
.Xr hier 7 ,
|
|
|
|
and the release layout is described in
|
|
|
|
.Xr release 7 .
|
|
|
|
.Pp
|
|
|
|
.
|
|
|
|
.Sh CONFIGURATION
|
|
|
|
.
|
2002-03-05 04:15:51 +03:00
|
|
|
.Ss Environment variables
|
|
|
|
..
|
|
|
|
Several environment variables control the behaviour of
|
|
|
|
.Nx
|
|
|
|
builds.
|
|
|
|
.
|
|
|
|
.Bl -tag -width "MAKEOBJDIRPREFIX"
|
|
|
|
.
|
|
|
|
.It Sy MACHINE
|
|
|
|
Machine type.
|
|
|
|
.
|
|
|
|
.It Sy MACHINE_ARCH
|
|
|
|
Machine architecture.
|
|
|
|
.
|
|
|
|
.It Sy MAKE
|
|
|
|
Path name to invoke
|
|
|
|
.Xr make 1
|
|
|
|
as.
|
|
|
|
.
|
|
|
|
.It Sy MAKEFLAGS
|
|
|
|
Flags to invoke
|
|
|
|
.Xr make 1
|
|
|
|
with.
|
|
|
|
.
|
|
|
|
.It Sy MAKEOBJDIR
|
|
|
|
Directory to use as the
|
|
|
|
.Sy .OBJDIR
|
|
|
|
for the current directory.
|
|
|
|
Used only if
|
|
|
|
.Sy MAKEOBJDIRPREFIX
|
|
|
|
is not defined.
|
|
|
|
.Sy MAKEOBJDIR
|
|
|
|
can only be provided in the environment.
|
|
|
|
.
|
|
|
|
.It Sy MAKEOBJDIRPREFIX
|
|
|
|
Top level directory of the object directory tree.
|
|
|
|
If this is defined,
|
|
|
|
${MAKEOBJDIRPREFIX}/${.CURDIR}
|
|
|
|
is used as the
|
|
|
|
.Sy .OBJDIR
|
|
|
|
for the current directory.
|
|
|
|
The current directory may be read only.
|
|
|
|
.Sy MAKEOBJDIRPREFIX
|
|
|
|
can only be provided in the environment.
|
|
|
|
.
|
|
|
|
.El
|
|
|
|
.
|
2001-10-30 17:40:24 +03:00
|
|
|
.Ss \*qmake\*q variables
|
2001-10-29 22:46:47 +03:00
|
|
|
.
|
|
|
|
.de YorN
|
|
|
|
Can be set to
|
|
|
|
.Dq yes
|
|
|
|
or
|
|
|
|
.Dq no .
|
|
|
|
..
|
|
|
|
.de DFLT
|
|
|
|
.Pp
|
|
|
|
.Em Default :
|
|
|
|
..
|
|
|
|
.de DFLTu
|
|
|
|
.DFLT
|
|
|
|
Unset.
|
|
|
|
..
|
|
|
|
.de DFLTy
|
|
|
|
.DFLT
|
|
|
|
.Dq yes
|
|
|
|
..
|
|
|
|
.de DFLTn
|
|
|
|
.DFLT
|
|
|
|
.Dq no
|
|
|
|
..
|
|
|
|
Several variables control the behavior of
|
|
|
|
.Nx
|
2002-12-18 22:46:48 +03:00
|
|
|
builds.
|
|
|
|
Unless otherwise specified, these variables may be set in
|
2001-10-29 22:46:47 +03:00
|
|
|
either the process environment or the
|
|
|
|
.Xr make 1
|
|
|
|
configuration file specified by
|
|
|
|
.Sy MAKECONF .
|
|
|
|
.
|
|
|
|
.Bl -tag -width "MKCATPAGES"
|
|
|
|
.
|
2002-03-14 21:33:04 +03:00
|
|
|
.It Sy BUILDID
|
2002-12-18 22:46:48 +03:00
|
|
|
Identifier for the build.
|
|
|
|
The identifier will be appended to
|
2002-03-14 21:33:04 +03:00
|
|
|
object directory names, and can be consulted in the
|
|
|
|
.Xr make 1
|
|
|
|
configuration file in order to set additional build parameters,
|
|
|
|
such as compiler flags.
|
|
|
|
.
|
2001-10-29 22:46:47 +03:00
|
|
|
.It Sy DESTDIR
|
|
|
|
Directory to contain the built
|
|
|
|
.Nx
|
2002-12-18 22:46:48 +03:00
|
|
|
system.
|
|
|
|
If set, special options are passed to the compilation tools to
|
2001-10-29 22:46:47 +03:00
|
|
|
prevent their default use of the host system's
|
|
|
|
.Sy /usr/include , /usr/lib ,
|
2002-12-18 22:46:48 +03:00
|
|
|
and so forth.
|
|
|
|
This pathname should
|
2001-10-29 22:46:47 +03:00
|
|
|
.Em not
|
|
|
|
end with a slash
|
|
|
|
.Pq /
|
|
|
|
character (for installation into the system's root directory, set
|
|
|
|
.Sy DESTDIR
|
|
|
|
to an empty string).
|
2002-03-04 05:10:02 +03:00
|
|
|
The directory must reside on a file system which supports long file
|
|
|
|
names and hard links.
|
2001-10-29 22:46:47 +03:00
|
|
|
.DFLT
|
|
|
|
Empty string if
|
|
|
|
.Sy USETOOLS
|
|
|
|
is
|
|
|
|
.Dq yes ;
|
|
|
|
unset otherwise.
|
|
|
|
.
|
|
|
|
.It Sy MAKECONF
|
|
|
|
The name of the
|
|
|
|
.Xr make 1
|
|
|
|
configuration file.
|
|
|
|
.Em Only settable in the process environment.
|
|
|
|
.DFLT
|
|
|
|
.Dq /etc/mk.conf
|
|
|
|
.
|
|
|
|
.It Sy MKCATPAGES
|
|
|
|
.YorN
|
2001-10-30 19:22:40 +03:00
|
|
|
Indicates whether preformatted plaintext manual pages will be created
|
2001-10-29 22:46:47 +03:00
|
|
|
during a build.
|
|
|
|
.DFLTy
|
|
|
|
.
|
|
|
|
.It Sy MKCRYPTO
|
|
|
|
.YorN
|
2001-10-30 19:22:40 +03:00
|
|
|
Indicates whether cryptographic code will be included in a build;
|
|
|
|
provided for the benefit of countries that do not allow strong
|
2002-12-18 22:46:48 +03:00
|
|
|
cryptography.
|
|
|
|
Will not affect use of the standard low-security password encryption system,
|
2001-10-29 22:46:47 +03:00
|
|
|
.Xr crypt 3 .
|
|
|
|
.DFLTy
|
|
|
|
.
|
|
|
|
.It Sy MKDOC
|
|
|
|
.YorN
|
|
|
|
Indicates whether system documentation destined for
|
|
|
|
.Sy /usr/share/doc
|
|
|
|
will be installed during a build.
|
|
|
|
.DFLTy
|
|
|
|
.
|
2001-11-15 01:29:23 +03:00
|
|
|
.It Sy MKHOSTOBJ
|
|
|
|
.YorN
|
|
|
|
If set to
|
|
|
|
.Dq yes ,
|
|
|
|
then for programs intended to be run on the compile host,
|
|
|
|
the name, release, and architecture of the host operating system
|
|
|
|
will be suffixed to the name of the object directory created by
|
|
|
|
.Dq make obj .
|
|
|
|
(This allows multiple host systems to compile NetBSD for a single target.)
|
|
|
|
If set to
|
|
|
|
.Dq no ,
|
|
|
|
then programs built to be run on the compile host will use the same
|
|
|
|
object directory names as programs built to be run on the target.
|
|
|
|
.DFLTn
|
|
|
|
.
|
2001-10-29 22:46:47 +03:00
|
|
|
.It Sy MKINFO
|
|
|
|
.YorN
|
|
|
|
Indicates whether GNU Info files, used for the documentation for
|
2001-10-30 19:22:40 +03:00
|
|
|
most of the compilation tools, will be created and installed during a
|
2001-10-29 22:46:47 +03:00
|
|
|
build.
|
|
|
|
.DFLTy
|
|
|
|
.
|
|
|
|
.It Sy MKLINT
|
|
|
|
.YorN
|
|
|
|
Indicates whether
|
|
|
|
.Xr lint 1
|
|
|
|
will be run against portions of the
|
|
|
|
.Nx
|
2001-10-30 19:22:40 +03:00
|
|
|
source code during the build, and whether lint libraries will be
|
2001-10-29 22:46:47 +03:00
|
|
|
installed into
|
|
|
|
.Sy /usr/libdata/lint .
|
|
|
|
.DFLTy
|
|
|
|
.
|
|
|
|
.It Sy MKMAN
|
|
|
|
.YorN
|
|
|
|
Indicates whether manual pages will be installed during a build.
|
|
|
|
.DFLTy
|
|
|
|
.
|
|
|
|
.It Sy MKNLS
|
|
|
|
.YorN
|
|
|
|
Indicates whether Native Language System locale zone files will be
|
|
|
|
compiled and installed during a build.
|
|
|
|
.DFLTy
|
|
|
|
.
|
|
|
|
.It Sy MKOBJ
|
|
|
|
.YorN
|
|
|
|
Indicates whether object directories will be created when running
|
|
|
|
.Dq make obj .
|
|
|
|
If set to
|
|
|
|
.Dq no ,
|
|
|
|
then all built files will be located inside the regular source tree.
|
|
|
|
.DFLTy
|
|
|
|
.
|
|
|
|
.It Sy MKPIC
|
|
|
|
.YorN
|
|
|
|
Indicates whether shared objects and libraries will be created and
|
2002-12-18 22:46:48 +03:00
|
|
|
installed during a build.
|
|
|
|
If set to
|
2001-10-29 22:46:47 +03:00
|
|
|
.Dq no ,
|
|
|
|
the entire built system will be statically linked.
|
|
|
|
.DFLT
|
2002-12-18 22:46:48 +03:00
|
|
|
Platform dependent.
|
|
|
|
As of this writing, all platforms except
|
2001-10-29 22:46:47 +03:00
|
|
|
.Sy sh3
|
|
|
|
default to
|
|
|
|
.Dq yes .
|
|
|
|
.
|
|
|
|
.It Sy MKPICINSTALL
|
|
|
|
.YorN
|
|
|
|
Indicates whether the
|
|
|
|
.Xr ar 1
|
|
|
|
format libraries
|
|
|
|
.Sy ( lib*_pic.a ) ,
|
|
|
|
used to generate shared libraries, are installed during a build.
|
|
|
|
.DFLTy
|
|
|
|
.
|
|
|
|
.It Sy MKPROFILE
|
|
|
|
.YorN
|
|
|
|
Indicates whether profiled libraries
|
|
|
|
.Sy ( lib*_p.a )
|
|
|
|
will be built and installed during a build.
|
|
|
|
.DFLT
|
|
|
|
.Dq yes ;
|
|
|
|
however, some platforms turn off
|
|
|
|
.Sy MKPROFILE
|
|
|
|
by default at times due to toolchain problems with profiled code.
|
|
|
|
.
|
|
|
|
.It Sy MKSHARE
|
|
|
|
.YorN
|
|
|
|
Indicates whether files destined to reside in
|
|
|
|
.Sy /usr/share
|
2002-12-18 22:46:48 +03:00
|
|
|
will be built and installed during a build.
|
|
|
|
If set to
|
2001-10-29 22:46:47 +03:00
|
|
|
.Dq no ,
|
|
|
|
then all of
|
|
|
|
.Sy MKCATPAGES , MKDOC , MKINFO , MKMAN ,
|
|
|
|
and
|
|
|
|
.Sy MKNLS
|
|
|
|
will be set to
|
|
|
|
.Dq no
|
|
|
|
unconditionally.
|
|
|
|
.DFLTy
|
|
|
|
.
|
|
|
|
.It Sy TOOLDIR
|
2002-12-18 22:46:48 +03:00
|
|
|
Directory to hold the host tools, once built.
|
|
|
|
This directory should be unique to a given host system and
|
2001-10-29 22:46:47 +03:00
|
|
|
.Nx
|
2002-12-18 22:46:48 +03:00
|
|
|
source tree.
|
|
|
|
(However, multiple targets may share the same
|
2001-10-29 22:46:47 +03:00
|
|
|
.Sy TOOLDIR ;
|
2001-11-01 02:20:34 +03:00
|
|
|
the target-dependent files have unique names.) If unset, a default based
|
|
|
|
on the
|
|
|
|
.Xr uname 1
|
|
|
|
information of the host platform will be created in the
|
|
|
|
.Sy .OBJDIR
|
|
|
|
of
|
2002-12-18 22:46:48 +03:00
|
|
|
.Pa src/tools .
|
2001-10-29 22:46:47 +03:00
|
|
|
.DFLTu
|
|
|
|
.
|
2002-03-04 05:10:02 +03:00
|
|
|
.It Sy UNPRIVED
|
|
|
|
If set, then an unprivileged install will occur.
|
|
|
|
The user, group, permissions, and file flags, will not be set on
|
|
|
|
the installed item; instead the information will be appended to
|
|
|
|
a file called
|
|
|
|
.Pa METALOG
|
2002-05-03 12:58:45 +04:00
|
|
|
in
|
|
|
|
.Sy DESTDIR .
|
2002-03-04 05:10:02 +03:00
|
|
|
The contents of
|
|
|
|
.Pa METALOG
|
|
|
|
is used during the generation of the distribution tar files to ensure
|
|
|
|
that the appropriate file ownership is stored.
|
|
|
|
.DFLTu
|
|
|
|
.
|
2001-10-29 22:46:47 +03:00
|
|
|
.It Sy UPDATE
|
|
|
|
If set, then all install operations intended to write to
|
|
|
|
.Sy DESTDIR
|
2001-10-30 19:22:40 +03:00
|
|
|
will compare file timestamps before installing, and skip the install
|
2002-12-18 22:46:48 +03:00
|
|
|
phase if the destination files are up-to-date.
|
|
|
|
This also has implications on full builds (see next subsection).
|
2001-10-29 22:46:47 +03:00
|
|
|
.DFLTu
|
|
|
|
.
|
|
|
|
.It Sy USETOOLS
|
|
|
|
Indicates whether the tools specified by
|
|
|
|
.Sy TOOLDIR
|
2002-12-18 22:46:48 +03:00
|
|
|
should be used as part of a build in progress.
|
|
|
|
Must be set to
|
2001-10-29 22:46:47 +03:00
|
|
|
.Dq yes
|
|
|
|
if cross-compiling.
|
|
|
|
.Bl -tag -width "never"
|
|
|
|
.It Sy yes
|
|
|
|
Use the tools from
|
|
|
|
.Sy TOOLDIR .
|
|
|
|
.It Sy no
|
|
|
|
Do not use the tools from
|
|
|
|
.Sy TOOLDIR ,
|
|
|
|
but refuse to build native compilation tool components that are
|
|
|
|
version-specific for that tool.
|
|
|
|
.It Sy never
|
|
|
|
Do not use the tools from
|
|
|
|
.Sy TOOLDIR ,
|
2002-12-18 22:46:48 +03:00
|
|
|
even when building native tool components.
|
|
|
|
This is similar to the traditional
|
2001-10-29 22:46:47 +03:00
|
|
|
.Nx
|
|
|
|
build method, but does
|
|
|
|
.Em not
|
2001-10-30 19:22:40 +03:00
|
|
|
verify that the compilation tools in use are up-to-date enough in order
|
2002-12-18 22:46:48 +03:00
|
|
|
to build the tree successfully.
|
|
|
|
This may cause build or runtime problems when building the whole
|
2001-10-29 22:46:47 +03:00
|
|
|
.Nx
|
|
|
|
source tree.
|
|
|
|
.El
|
|
|
|
.DFLT
|
|
|
|
.Dq yes
|
|
|
|
if building all or part of a whole
|
|
|
|
.Nx
|
|
|
|
source tree (detected automatically);
|
|
|
|
.Dq no
|
|
|
|
otherwise (to preserve traditional semantics of the
|
|
|
|
.Aq bsd.*.mk
|
|
|
|
.Xr make 1
|
|
|
|
include files).
|
|
|
|
.
|
|
|
|
.El
|
|
|
|
.
|
2001-10-30 17:40:24 +03:00
|
|
|
.Ss \*qmake\*q variables for full builds
|
2001-10-29 22:46:47 +03:00
|
|
|
These variables only affect the top level
|
|
|
|
.Dq Makefile
|
2002-03-04 05:10:02 +03:00
|
|
|
and do not affect manually building subtrees of the
|
2001-10-29 22:46:47 +03:00
|
|
|
.Nx
|
|
|
|
source code.
|
|
|
|
.
|
2002-12-25 03:58:00 +03:00
|
|
|
.Bl -tag -width "INSTALLWORLDDIR"
|
|
|
|
.
|
|
|
|
.It Sy INSTALLWORLDDIR
|
|
|
|
Location for the
|
|
|
|
.Dq make installworld
|
|
|
|
target to install to.
|
|
|
|
.DFLT
|
|
|
|
.Dq /
|
2001-10-29 22:46:47 +03:00
|
|
|
.
|
|
|
|
.It Sy MKOBJDIRS
|
|
|
|
.YorN
|
|
|
|
Indicates whether object directories will be created automatically
|
|
|
|
(via a
|
|
|
|
.Dq make obj
|
|
|
|
pass) at the start of a build.
|
|
|
|
.DFLTy
|
|
|
|
.
|
|
|
|
.It Sy NBUILDJOBS
|
2002-12-18 22:46:48 +03:00
|
|
|
Now obsolete.
|
|
|
|
Use the
|
2001-10-29 22:46:47 +03:00
|
|
|
.Xr make 1
|
|
|
|
option
|
2002-12-08 11:42:51 +03:00
|
|
|
.Fl j ,
|
2002-05-03 02:13:30 +04:00
|
|
|
instead (see below)
|
2001-10-29 22:46:47 +03:00
|
|
|
.DFLTu
|
|
|
|
.
|
|
|
|
.It Sy NOCLEANDIR
|
|
|
|
If set, avoids the
|
|
|
|
.Dq make cleandir
|
2002-12-18 22:46:48 +03:00
|
|
|
phase of a full build.
|
|
|
|
This has the effect of allowing only changed
|
|
|
|
files in a source tree to be recompiled.
|
|
|
|
This can speed up builds when updating only a few files in the tree.
|
2001-10-29 22:46:47 +03:00
|
|
|
.DFLTu
|
|
|
|
.
|
|
|
|
.It Sy NODISTRIBDIRS
|
|
|
|
If set, avoids the
|
|
|
|
.Dq make distrib-dirs
|
2002-12-18 22:46:48 +03:00
|
|
|
phase of a full build.
|
|
|
|
This skips running
|
2001-10-30 19:22:40 +03:00
|
|
|
.Xr mtree 8
|
2001-10-29 22:46:47 +03:00
|
|
|
on
|
|
|
|
.Sy DESTDIR ,
|
2001-10-30 19:22:40 +03:00
|
|
|
useful on systems where building as an unprivileged user, or where it is
|
2001-10-29 22:46:47 +03:00
|
|
|
known that the system-wide mtree files have not changed.
|
|
|
|
.DFLTu
|
|
|
|
.
|
|
|
|
.It Sy NOINCLUDES
|
|
|
|
If set, avoids the
|
|
|
|
.Dq make includes
|
2002-12-18 22:46:48 +03:00
|
|
|
phase of a full build.
|
|
|
|
This has the effect of preventing
|
2001-10-29 22:46:47 +03:00
|
|
|
.Xr make 1
|
2001-10-30 19:22:40 +03:00
|
|
|
from thinking that some programs are out-of-date simply because the
|
2002-12-18 22:46:48 +03:00
|
|
|
system include files have changed.
|
|
|
|
However, this option should not be used when updating the entire
|
2001-10-29 22:46:47 +03:00
|
|
|
.Nx
|
|
|
|
source tree arbitrarily; it is suggested to use
|
|
|
|
.Sy UPDATE
|
|
|
|
in that case.
|
|
|
|
.DFLTu
|
|
|
|
.
|
|
|
|
.It Sy RELEASEDIR
|
|
|
|
If set, specifies the directory to which a
|
|
|
|
.Xr release 7
|
|
|
|
layout will be written at the end of a
|
|
|
|
.Dq make release .
|
|
|
|
.DFLTu
|
|
|
|
.
|
|
|
|
.It Sy UPDATE
|
|
|
|
If set, then in addition to the effects described for UPDATE above, this
|
|
|
|
implies the effects of
|
|
|
|
.Sy NOCLEANDIR .
|
|
|
|
.
|
|
|
|
.El
|
|
|
|
.
|
|
|
|
.Sh BUILDING
|
|
|
|
.
|
2001-10-30 17:40:24 +03:00
|
|
|
.Ss \*qmake\*q command line options
|
2001-10-29 22:46:47 +03:00
|
|
|
This is only a summary of options available to
|
|
|
|
.Xr make 1 ;
|
|
|
|
only the options used most frequently with
|
|
|
|
.Nx
|
|
|
|
builds are listed here.
|
|
|
|
.
|
|
|
|
.Bl -tag -width "var=value"
|
|
|
|
.
|
2002-12-08 11:42:51 +03:00
|
|
|
.It Fl j Ar njob
|
2002-05-03 02:13:30 +04:00
|
|
|
Run up to
|
2002-12-08 11:42:51 +03:00
|
|
|
.Ar njob
|
2002-05-03 02:13:30 +04:00
|
|
|
.Xr make 1
|
|
|
|
subjobs in parallel.
|
|
|
|
Makefiles should use .WAIT or have explicit dependancies
|
|
|
|
as necessary to enforce build ordering.
|
|
|
|
If you see build failures with -j, please save complete build logs
|
|
|
|
so the failures can be analyzed.
|
|
|
|
.
|
2002-12-08 11:42:51 +03:00
|
|
|
.It Fl m Ar dir
|
2001-10-30 19:22:40 +03:00
|
|
|
Specify the default directory for searching for system Makefile
|
2001-10-29 22:46:47 +03:00
|
|
|
segments, mainly the
|
|
|
|
.Aq bsd.*.mk
|
2002-12-18 22:46:48 +03:00
|
|
|
files.
|
|
|
|
When building any full
|
2001-10-29 22:46:47 +03:00
|
|
|
.Nx
|
|
|
|
source tree, this should be set to the
|
|
|
|
.Dq share/mk
|
2002-12-18 22:46:48 +03:00
|
|
|
directory in the source tree.
|
|
|
|
(This is set automatically when building from the top level.)
|
2001-10-29 22:46:47 +03:00
|
|
|
.
|
2002-12-08 11:42:51 +03:00
|
|
|
.It Fl n
|
2001-10-29 22:46:47 +03:00
|
|
|
Display the commands that would have been executed, but do not
|
2002-12-18 22:46:48 +03:00
|
|
|
actually execute them.
|
|
|
|
This will still cause recursion to take place.
|
2001-10-29 22:46:47 +03:00
|
|
|
.
|
2002-12-08 11:42:51 +03:00
|
|
|
.It Fl v Ar var
|
2001-10-29 22:46:47 +03:00
|
|
|
Print
|
2001-10-30 19:22:40 +03:00
|
|
|
.Xr make 1 Ns 's
|
2001-10-29 22:46:47 +03:00
|
|
|
idea of the value of
|
2002-12-08 11:42:51 +03:00
|
|
|
.Ar var .
|
2001-10-29 22:46:47 +03:00
|
|
|
Does not build any targets.
|
|
|
|
.
|
|
|
|
.It Em var=value
|
|
|
|
Set the variable
|
|
|
|
.Em var
|
|
|
|
to
|
|
|
|
.Em value ,
|
|
|
|
overriding any setting specified by the process environment, the
|
|
|
|
.Sy MAKECONF
|
|
|
|
configuration file, or the system Makefile segments.
|
|
|
|
.
|
|
|
|
.El
|
|
|
|
.
|
2001-10-30 17:40:24 +03:00
|
|
|
.Ss \*qmake\*q targets
|
2001-10-29 22:46:47 +03:00
|
|
|
.
|
|
|
|
These default targets may be built by running
|
|
|
|
.Xr make 1
|
|
|
|
in any subtree of the
|
|
|
|
.Nx
|
2002-12-18 22:46:48 +03:00
|
|
|
source code.
|
|
|
|
It is recommended that none of these be used from the top
|
2001-10-29 22:46:47 +03:00
|
|
|
level Makefile; as a specific exception,
|
|
|
|
.Dq make obj
|
|
|
|
and
|
|
|
|
.Dq make cleandir
|
|
|
|
are useful in that context.
|
|
|
|
.
|
|
|
|
.Bl -tag -width "dependall"
|
|
|
|
.
|
|
|
|
.It Sy all
|
|
|
|
Build programs, libraries, and preformatted documentation.
|
|
|
|
.
|
|
|
|
.It Sy clean
|
|
|
|
Remove program and library object code files.
|
|
|
|
.
|
|
|
|
.It Sy cleandir
|
|
|
|
Same as
|
|
|
|
.Sy clean ,
|
2001-10-30 19:22:40 +03:00
|
|
|
but also remove preformatted documentation, dependency files generated
|
2001-10-29 22:46:47 +03:00
|
|
|
by
|
|
|
|
.Dq make depend ,
|
2001-10-30 19:22:40 +03:00
|
|
|
and any other files known to be created at build time.
|
2001-10-29 22:46:47 +03:00
|
|
|
.Dq make distclean
|
|
|
|
may be used as a synonym, for familiarity with a similar well-known
|
|
|
|
convention.
|
|
|
|
.
|
|
|
|
.It Sy depend
|
|
|
|
Create dependency files
|
|
|
|
.Sy ( .depend )
|
2001-10-30 19:22:40 +03:00
|
|
|
containing more detailed information about the dependencies of source
|
2002-12-18 22:46:48 +03:00
|
|
|
code on header files.
|
|
|
|
Allows programs to be recompiled automatically when a dependency changes.
|
2001-10-29 22:46:47 +03:00
|
|
|
.
|
|
|
|
.It Sy dependall
|
|
|
|
Does a
|
|
|
|
.Dq make depend
|
|
|
|
immediately followed by a
|
|
|
|
.Dq make all .
|
2002-05-03 02:13:30 +04:00
|
|
|
This improves cache locality of the build since both passes read the source
|
|
|
|
files in their entirety.
|
2001-10-29 22:46:47 +03:00
|
|
|
.
|
|
|
|
.It Sy includes
|
2002-12-18 22:46:48 +03:00
|
|
|
Build and install system header files.
|
|
|
|
Typically needed before any system libraries or programs can be built.
|
2001-10-29 22:46:47 +03:00
|
|
|
.
|
|
|
|
.It Sy install
|
|
|
|
Install programs, libraries, and documentation into
|
|
|
|
.Sy DESTDIR .
|
2002-09-17 20:35:39 +04:00
|
|
|
Few files will be installed to
|
|
|
|
.Pa /dev ,
|
|
|
|
.Pa /etc ,
|
|
|
|
.Pa /root
|
|
|
|
or
|
|
|
|
.Pa /var
|
|
|
|
in order to prevent user supplied configuration data from being overwritten.
|
2001-10-29 22:46:47 +03:00
|
|
|
.It Sy lint
|
|
|
|
Run
|
|
|
|
.Xr lint 1
|
2001-10-30 19:22:40 +03:00
|
|
|
against the C source code, where appropriate, and generate
|
2001-10-29 22:46:47 +03:00
|
|
|
system-installed lint libraries.
|
|
|
|
.
|
|
|
|
.It Sy obj
|
2001-10-30 19:22:40 +03:00
|
|
|
Create object directories to be used for built files, instead of
|
2001-10-29 22:46:47 +03:00
|
|
|
building directly in the source tree.
|
|
|
|
.
|
|
|
|
.It Sy tags
|
|
|
|
Create
|
|
|
|
.Xr ctags 1
|
|
|
|
searchable function lists usable by the
|
|
|
|
.Xr ex 1
|
|
|
|
and
|
|
|
|
.Xr vi 1
|
|
|
|
text editors.
|
|
|
|
.
|
|
|
|
.El
|
|
|
|
.
|
2001-10-30 17:40:24 +03:00
|
|
|
.Ss \*qmake\*q targets for the top level
|
2001-10-29 22:46:47 +03:00
|
|
|
.
|
|
|
|
Additional
|
|
|
|
.Xr make 1
|
|
|
|
targets are usable specifically from the top source level to facilitate
|
|
|
|
building the entire
|
|
|
|
.Nx
|
|
|
|
source tree.
|
|
|
|
.
|
2002-12-25 03:58:00 +03:00
|
|
|
.Bl -tag -width "distribution"
|
2001-10-29 22:46:47 +03:00
|
|
|
.
|
|
|
|
.It Sy build
|
|
|
|
Build the entire
|
|
|
|
.Nx
|
2002-12-18 22:46:48 +03:00
|
|
|
system.
|
|
|
|
This orders portions of the source tree such that prerequisites
|
2001-10-29 22:46:47 +03:00
|
|
|
will be built in the proper order.
|
|
|
|
.
|
2002-12-25 03:58:00 +03:00
|
|
|
.It Sy distribution
|
|
|
|
Do a
|
|
|
|
.Dq make build ,
|
|
|
|
and then install a full distribution into
|
|
|
|
.Sy DESTDIR .
|
|
|
|
.
|
|
|
|
.It Sy buildworld
|
|
|
|
As per
|
|
|
|
.Dq make distribution ,
|
|
|
|
except that it ensures that
|
|
|
|
.Sy DESTDIR
|
|
|
|
is not the root directory.
|
|
|
|
.
|
|
|
|
.
|
|
|
|
.It Sy installworld
|
|
|
|
Install the distribution from
|
|
|
|
.Sy DESTDIR
|
|
|
|
to
|
|
|
|
.Sy INSTALLWORLDDIR
|
|
|
|
(which defaults to the root directory).
|
|
|
|
Ensures that
|
|
|
|
.Sy INSTALLWORLDDIR
|
|
|
|
is the not root directory if cross compiling.
|
|
|
|
.Pp
|
|
|
|
.Em Note :
|
|
|
|
It is highly recommended that you upgrade your kernel and reboot
|
|
|
|
before performing this operation.
|
|
|
|
.
|
2001-10-29 22:46:47 +03:00
|
|
|
.It Sy release
|
|
|
|
Do a
|
|
|
|
.Dq make build ,
|
|
|
|
then package the system into a standard release layout as described by
|
|
|
|
.Xr release 7 .
|
|
|
|
This requires that
|
|
|
|
.Sy RELEASEDIR
|
|
|
|
be set (see above).
|
|
|
|
.
|
|
|
|
.It Sy regression-tests
|
|
|
|
Can only be run after building the regression tests in the directory
|
|
|
|
.Dq regress .
|
|
|
|
Runs the compiled regression tests on the local host.
|
|
|
|
.
|
|
|
|
.El
|
|
|
|
.
|
2001-10-30 17:40:24 +03:00
|
|
|
.Ss The \*qbuild.sh\*q script
|
2001-10-29 22:46:47 +03:00
|
|
|
.
|
2001-10-30 19:22:40 +03:00
|
|
|
This script file is a Bourne shell script designed to build the
|
2001-10-29 22:46:47 +03:00
|
|
|
entire
|
|
|
|
.Nx
|
|
|
|
system on any host with a Bourne shell in
|
|
|
|
.Sy /bin/sh ,
|
2002-12-18 22:46:48 +03:00
|
|
|
including many that are not POSIX compliant.
|
|
|
|
Note that if a host system's
|
2001-10-29 22:46:47 +03:00
|
|
|
.Sy /bin/sh
|
|
|
|
is unusually old and broken, the Korn Shell
|
|
|
|
.Sy ( /bin/ksh ) ,
|
|
|
|
if available, may be a usable alternative.
|
|
|
|
.Pp
|
2001-10-30 19:22:40 +03:00
|
|
|
All cross-compile builds, and most native builds, of the entire system
|
2001-10-29 22:46:47 +03:00
|
|
|
should make use of
|
|
|
|
.Sy build.sh
|
|
|
|
rather than just running
|
|
|
|
.Dq make .
|
|
|
|
This way, the
|
|
|
|
.Xr make 1
|
2001-10-30 19:22:40 +03:00
|
|
|
program will be bootstrapped properly, in case the host system has an
|
2001-10-29 22:46:47 +03:00
|
|
|
older or incompatible
|
|
|
|
.Dq make
|
|
|
|
program.
|
|
|
|
.Pp
|
|
|
|
When compiling the entire system via
|
|
|
|
.Sy build.sh ,
|
|
|
|
many
|
|
|
|
.Xr make 1
|
2001-10-30 19:22:40 +03:00
|
|
|
variables are set for you in order to help encapsulate the build
|
2002-12-18 22:46:48 +03:00
|
|
|
process.
|
|
|
|
In the list of options below, variables that are automatically set by
|
2001-10-29 22:46:47 +03:00
|
|
|
.Sy build.sh
|
2001-11-01 02:20:34 +03:00
|
|
|
are noted where applicable.
|
2001-10-29 22:46:47 +03:00
|
|
|
.Pp
|
|
|
|
The following are available command line options that may be supplied to
|
|
|
|
.Sy build.sh :
|
|
|
|
.
|
|
|
|
.Bl -tag -width "-T tools"
|
|
|
|
.
|
2002-12-08 11:42:51 +03:00
|
|
|
.It Fl a Ar arch
|
2001-10-29 22:46:47 +03:00
|
|
|
Set the value of
|
|
|
|
.Sy MACHINE_ARCH
|
|
|
|
to
|
2002-12-08 11:42:51 +03:00
|
|
|
.Ar arch .
|
2001-10-29 22:46:47 +03:00
|
|
|
.
|
2002-12-08 11:42:51 +03:00
|
|
|
.It Fl B Ar buildid
|
2002-03-14 21:33:04 +03:00
|
|
|
Set the value of
|
|
|
|
.Sy BUILDID
|
|
|
|
to
|
2002-12-08 11:42:51 +03:00
|
|
|
.Ar buildid .
|
2002-03-14 21:33:04 +03:00
|
|
|
This will also append the build idenfitier to the name of the
|
|
|
|
.Dq make
|
|
|
|
wrapper script so that the resulting name is of the form
|
|
|
|
.Dq Sy nbmake-MACHINE-BUILDID .
|
|
|
|
.
|
2002-12-08 11:42:51 +03:00
|
|
|
.It Fl b
|
2001-11-01 02:20:34 +03:00
|
|
|
Bootstrap
|
|
|
|
.Dq make
|
|
|
|
and create a
|
|
|
|
.Sy nbmake-MACHINE
|
|
|
|
script (see below).
|
2001-10-29 22:46:47 +03:00
|
|
|
.
|
2002-12-08 11:42:51 +03:00
|
|
|
.It Fl D Ar dest
|
|
|
|
Set the value of
|
|
|
|
.Sy DESTDIR
|
|
|
|
to
|
|
|
|
.Ar dest .
|
|
|
|
.
|
|
|
|
.It Fl d
|
2002-09-17 20:35:39 +04:00
|
|
|
Build a full distribution.
|
|
|
|
This differs from a default build in that files will also be installed to
|
|
|
|
.Pa /dev ,
|
|
|
|
.Pa /etc ,
|
|
|
|
.Pa /root
|
|
|
|
and
|
|
|
|
.Pa /var .
|
|
|
|
Note this does not build a
|
2001-11-25 21:40:34 +03:00
|
|
|
.Dq release ;
|
|
|
|
no release sets are placed in ${RELEASEDIR}.
|
2002-12-08 11:42:51 +03:00
|
|
|
.Fl d
|
2002-09-17 20:35:39 +04:00
|
|
|
is implied by
|
2002-12-08 11:42:51 +03:00
|
|
|
.Fl R .
|
2001-11-25 21:40:34 +03:00
|
|
|
.
|
2002-12-09 01:14:00 +03:00
|
|
|
.It Fl E
|
|
|
|
Set
|
|
|
|
.Sq expert
|
|
|
|
mode;
|
|
|
|
.Sy DESTDIR
|
|
|
|
does not have to be set to a non-root path for builds when this is set.
|
|
|
|
.
|
2002-12-25 03:58:00 +03:00
|
|
|
.It Fl i Ar installworlddir
|
|
|
|
Install the contents of
|
|
|
|
.Dv DESTDIR
|
|
|
|
to
|
|
|
|
.Ar installworlddir
|
|
|
|
after all other operations have completed, using the top level
|
|
|
|
.Dq installworld
|
|
|
|
target.
|
|
|
|
.
|
2002-12-08 11:42:51 +03:00
|
|
|
.It Fl j Ar njob
|
2002-05-03 02:13:30 +04:00
|
|
|
Passed through to
|
|
|
|
.Xr make 1 .
|
|
|
|
Makefiles should use .WAIT or have explicit dependancies
|
|
|
|
as necessary to enforce build ordering.
|
|
|
|
If you see build failures with -j, please save complete build logs
|
|
|
|
so the failures can be analyzed.
|
2001-10-29 22:46:47 +03:00
|
|
|
.
|
2002-12-08 11:42:51 +03:00
|
|
|
.It Fl k Em kernel
|
2002-10-20 19:48:01 +04:00
|
|
|
Build a new kernel.
|
|
|
|
The
|
2002-12-08 11:42:51 +03:00
|
|
|
.Ar kernel
|
2002-10-20 19:48:01 +04:00
|
|
|
argument is the name of a configuration file suitable
|
|
|
|
for use by
|
|
|
|
.Xr config 8 .
|
|
|
|
If
|
2002-12-08 11:42:51 +03:00
|
|
|
.Ar kernel
|
2002-10-20 19:48:01 +04:00
|
|
|
does not contain any
|
|
|
|
.Sq /
|
|
|
|
characters, the configuration file is expected to be found in the
|
|
|
|
.Sy KERNCONFDIR
|
|
|
|
directory, which is typically
|
|
|
|
.Sy sys/arch/MACHINE/conf .
|
|
|
|
The new kernel will be built in a subdirectory of
|
|
|
|
.Sy KERNOBJDIR ,
|
|
|
|
which is typically
|
|
|
|
.Sy sys/arch/MACHINE/compile
|
|
|
|
or an associated object directory.
|
|
|
|
In order to ensure that the kernel is built using up-to-date tools,
|
|
|
|
it is strongly recommended that the tools be rebuilt (using the
|
2002-12-08 11:42:51 +03:00
|
|
|
.Fl t
|
2002-10-20 19:48:01 +04:00
|
|
|
option) in a separate invocation of
|
|
|
|
.Nm build.sh
|
|
|
|
prior to using the
|
2002-12-08 11:42:51 +03:00
|
|
|
.Fl k
|
2002-10-20 19:48:01 +04:00
|
|
|
option, or that the
|
2002-12-08 11:42:51 +03:00
|
|
|
.Fl t
|
2002-10-20 19:48:01 +04:00
|
|
|
and
|
2002-12-08 11:42:51 +03:00
|
|
|
.Fl k
|
2002-10-20 19:48:01 +04:00
|
|
|
options be used together in a single invocation of
|
|
|
|
.Nm build.sh .
|
|
|
|
.
|
2002-12-08 11:42:51 +03:00
|
|
|
.It Fl M Ar obj
|
|
|
|
Set
|
|
|
|
.Sy MAKEOBJDIRPREFIX
|
|
|
|
to
|
|
|
|
.Ar obj .
|
|
|
|
.
|
|
|
|
.It Fl m Ar mach
|
2001-10-29 22:46:47 +03:00
|
|
|
Set the value of
|
|
|
|
.Sy MACHINE
|
|
|
|
to
|
2002-12-08 11:42:51 +03:00
|
|
|
.Ar mach .
|
2001-10-29 22:46:47 +03:00
|
|
|
This will also override any value of
|
|
|
|
.Sy MACHINE_ARCH
|
|
|
|
in the process environment with a value deduced from
|
2002-12-08 11:42:51 +03:00
|
|
|
.Ar mach ,
|
2001-10-29 22:46:47 +03:00
|
|
|
unless
|
2002-12-08 11:42:51 +03:00
|
|
|
.Fl a
|
2002-12-18 22:46:48 +03:00
|
|
|
is specified.
|
|
|
|
All cross builds require
|
2002-12-08 11:42:51 +03:00
|
|
|
.Fl m ,
|
2001-11-01 02:20:34 +03:00
|
|
|
but if unset on a NetBSD host, the host's value of MACHINE will be
|
|
|
|
detected and used automatically.
|
|
|
|
.
|
2002-12-08 11:42:51 +03:00
|
|
|
.It Fl n
|
2001-11-01 02:20:34 +03:00
|
|
|
Show the commands that would be executed by
|
|
|
|
.Sy build.sh ,
|
2002-12-18 22:46:48 +03:00
|
|
|
but do not make any changes.
|
|
|
|
This is similar in concept to
|
2001-11-01 02:20:34 +03:00
|
|
|
.Dq make -n .
|
|
|
|
.
|
2002-12-08 11:42:51 +03:00
|
|
|
.It Fl O Ar obj
|
2001-11-01 02:20:34 +03:00
|
|
|
Create an appropriate transform macro for
|
|
|
|
.Sy MAKEOBJDIR
|
|
|
|
that will place the built object files under
|
2002-12-08 11:42:51 +03:00
|
|
|
.Ar obj .
|
2001-11-01 02:20:34 +03:00
|
|
|
For instance, a setting of
|
|
|
|
.Sy /usr/obj
|
2002-07-22 13:49:05 +04:00
|
|
|
will place build-time files under
|
2001-11-01 02:20:34 +03:00
|
|
|
.Sy /usr/obj/bin , /usr/obj/lib ,
|
|
|
|
and so forth.
|
2001-10-29 22:46:47 +03:00
|
|
|
.
|
2002-12-08 11:42:51 +03:00
|
|
|
.It Fl o
|
|
|
|
Set the value of
|
|
|
|
.Sy MKOBJDIRS
|
|
|
|
to
|
|
|
|
.Dq no .
|
|
|
|
.
|
|
|
|
.It Fl R Ar rel
|
2001-10-29 22:46:47 +03:00
|
|
|
Set the value of
|
|
|
|
.Sy RELEASEDIR
|
|
|
|
to
|
2002-12-08 11:42:51 +03:00
|
|
|
.Ar rel .
|
2001-11-01 02:20:34 +03:00
|
|
|
Setting this option will cause
|
2001-10-29 22:46:47 +03:00
|
|
|
.Sy build.sh
|
2001-11-01 02:20:34 +03:00
|
|
|
to run
|
2001-10-29 22:46:47 +03:00
|
|
|
.Dq make release
|
|
|
|
instead of
|
|
|
|
.Dq make build .
|
|
|
|
.
|
2002-12-08 11:42:51 +03:00
|
|
|
.It Fl r
|
|
|
|
Remove the contents of
|
|
|
|
.Sy DESTDIR
|
|
|
|
and
|
|
|
|
.Sy TOOLDIR
|
2002-12-18 22:46:48 +03:00
|
|
|
before building (provides a clean starting point).
|
|
|
|
This will skip deleting
|
2002-12-08 11:42:51 +03:00
|
|
|
.Sy DESTDIR
|
|
|
|
if building on a native system to the root directory.
|
|
|
|
.
|
|
|
|
.It Fl T Ar tools
|
2001-10-29 22:46:47 +03:00
|
|
|
Set the value of
|
|
|
|
.Sy TOOLDIR
|
|
|
|
to
|
2002-12-08 11:42:51 +03:00
|
|
|
.Ar tools .
|
2001-11-01 02:20:34 +03:00
|
|
|
If set, the bootstrap
|
|
|
|
.Dq make
|
|
|
|
will only be rebuilt as needed (when the source files for
|
|
|
|
.Xr make 1
|
|
|
|
change).
|
2001-10-29 22:46:47 +03:00
|
|
|
.
|
2002-12-08 11:42:51 +03:00
|
|
|
.It Fl t
|
|
|
|
Build and install the host tools from
|
2002-12-18 22:46:48 +03:00
|
|
|
.Pa src/tools
|
|
|
|
only.
|
|
|
|
This option implies
|
2002-12-08 11:42:51 +03:00
|
|
|
.Fl b .
|
|
|
|
.
|
|
|
|
.It Fl U
|
2002-03-04 05:10:02 +03:00
|
|
|
Set the
|
|
|
|
.Sy UNPRIVED
|
|
|
|
variable.
|
|
|
|
.
|
2002-12-08 11:42:51 +03:00
|
|
|
.It Fl u
|
|
|
|
Set the
|
|
|
|
.Sy UPDATE
|
|
|
|
variable.
|
|
|
|
.
|
2003-01-04 15:55:32 +03:00
|
|
|
.It Xo
|
|
|
|
.Fl V
|
|
|
|
.Sm off
|
|
|
|
.Ar var
|
|
|
|
.Li =
|
|
|
|
.Op Ar value
|
|
|
|
.Sm on
|
|
|
|
.Xc
|
|
|
|
Set the variable
|
|
|
|
.Ar var
|
|
|
|
to
|
|
|
|
.Ar value
|
|
|
|
(which is optional).
|
|
|
|
This is useful for setting
|
|
|
|
.Sy RELEASEDIR
|
|
|
|
without actually building a release.
|
|
|
|
.
|
2002-12-08 11:42:51 +03:00
|
|
|
.It Fl w Ar wrapper
|
|
|
|
Create the nbmake wrapper script (see below) in a custom location,
|
|
|
|
specified by
|
|
|
|
.Ar wrapper .
|
|
|
|
This allows, for instance, to place the wrapper in
|
|
|
|
.Sy PATH
|
2002-12-18 22:46:48 +03:00
|
|
|
automatically.
|
|
|
|
Note that
|
2002-12-08 11:42:51 +03:00
|
|
|
.Ar wrapper
|
|
|
|
is the full name of the file, not just a directory name.
|
|
|
|
.
|
2001-10-29 22:46:47 +03:00
|
|
|
.El
|
|
|
|
.
|
2001-10-30 17:40:24 +03:00
|
|
|
.Ss The \*qnbmake-MACHINE\*q wrapper script
|
2001-10-29 22:46:47 +03:00
|
|
|
.
|
|
|
|
If using the
|
|
|
|
.Sy build.sh
|
|
|
|
script to build
|
|
|
|
.Nx ,
|
|
|
|
a
|
|
|
|
.Sy nbmake-MACHINE
|
|
|
|
script will be created in
|
|
|
|
.Sy TOOLDIR/bin
|
2001-10-30 19:22:40 +03:00
|
|
|
upon the first build to assist in building subtrees on a cross-compile
|
2001-10-29 22:46:47 +03:00
|
|
|
host.
|
|
|
|
.Pp
|
|
|
|
.Sy nbmake-MACHINE
|
|
|
|
can be invoked in lieu of
|
|
|
|
.Xr make 1 ,
|
|
|
|
and will instead call the up-to-date version of
|
|
|
|
.Dq nbmake
|
|
|
|
installed into
|
|
|
|
.Sy TOOLDIR/bin
|
|
|
|
with several key variables pre-set, including
|
|
|
|
.Sy MACHINE , MACHINE_ARCH ,
|
|
|
|
and
|
|
|
|
.Sy TOOLDIR .
|
|
|
|
This script can be symlinked into a directory listed in
|
|
|
|
.Sy PATH ,
|
|
|
|
or called with an absolute path.
|
|
|
|
.
|
2002-10-20 19:48:01 +04:00
|
|
|
.Sh EXAMPLES
|
|
|
|
.Bl -tag -width "build.sh"
|
|
|
|
.It Li "./build.sh -t"
|
|
|
|
Build a new toolchain.
|
|
|
|
.It Li "cd ${KERNCONFDIR} ; ${TOOLDIR}/bin/nbconfig GENERIC"
|
|
|
|
Use the new version of
|
|
|
|
.Xr config 8
|
|
|
|
to prepare to build a new GENERIC kernel.
|
|
|
|
.It Li "cd ${KERNOBJDIR}/GENERIC ; ${TOOLDIR}/bin/nbmake-${MACHINE} dependall"
|
|
|
|
Use the new toolchain to build a new GENERIC kernel.
|
|
|
|
.It Li "./build.sh -t -k GENERIC"
|
|
|
|
Build a new toolchain, and use the new toolchain to
|
|
|
|
configure and build a new GENERIC kernel.
|
|
|
|
.It Li "./build.sh -U -d"
|
|
|
|
Using unprivileged mode,
|
|
|
|
build a complete distribution in
|
|
|
|
.Sy DESTDIR .
|
|
|
|
.It Li "./build.sh -U -R /some/dir/RELEASE"
|
|
|
|
Using unprivileged mode,
|
|
|
|
build a complete release in the specified release directory.
|
|
|
|
.El
|
|
|
|
.
|
2002-05-03 02:13:30 +04:00
|
|
|
.Sh OBSOLETE VARIABLES
|
|
|
|
.
|
|
|
|
.Bl -tag -width "NBUILDJOBS"
|
|
|
|
.
|
|
|
|
.It Sy NBUILDJOBS
|
2002-09-21 09:17:52 +04:00
|
|
|
Use the
|
2002-05-03 02:13:30 +04:00
|
|
|
.Xr make 1
|
|
|
|
option
|
2002-12-08 11:42:51 +03:00
|
|
|
.Fl j ,
|
2002-05-03 02:13:30 +04:00
|
|
|
instead.
|
2002-09-21 09:17:52 +04:00
|
|
|
.
|
|
|
|
.It Sy USE_NEW_TOOLCHAIN
|
|
|
|
The new toolchain is now the default.
|
|
|
|
To disable, use
|
|
|
|
.Sy TOOLCHAIN_MISSING=yes .
|
2002-05-03 02:13:30 +04:00
|
|
|
.El
|
2001-10-29 22:46:47 +03:00
|
|
|
.Sh SEE ALSO
|
|
|
|
.Xr make 1 ,
|
|
|
|
.Xr hier 7 ,
|
|
|
|
.Xr release 7
|
|
|
|
.
|
|
|
|
.Sh HISTORY
|
|
|
|
.
|
|
|
|
The
|
2002-09-21 09:17:52 +04:00
|
|
|
.Nm build.sh
|
|
|
|
based build scheme was introduced for
|
|
|
|
.Nx 1.6
|
|
|
|
as
|
|
|
|
.Sy USE_NEW_TOOLCHAIN ,
|
|
|
|
and re-worked to
|
|
|
|
.Sy TOOLCHAIN_MISSING
|
|
|
|
after that.
|
2001-10-30 19:22:40 +03:00
|
|
|
.
|
|
|
|
.Sh BUGS
|
|
|
|
.
|
2002-09-21 09:17:52 +04:00
|
|
|
A few platforms are not yet using this build system.
|