Add plaintext and HTML generated versions of the BUILDING document.
This commit is contained in:
parent
83805cdad7
commit
6238f9244e
|
@ -0,0 +1,846 @@
|
||||||
|
<html>
|
||||||
|
<head>
|
||||||
|
<title>
|
||||||
|
October 29, 2001 BUILDING 8 NetBSD
|
||||||
|
|
||||||
|
</title>
|
||||||
|
<style type="text/css">
|
||||||
|
<!--
|
||||||
|
body { margin-left:4%; }
|
||||||
|
H1 { color: maroon; padding: 4pt; margin-left: -4% }
|
||||||
|
H2 { color: maroon; padding: 4pt; margin-left: -4% }
|
||||||
|
H3 { color: maroon; padding: 4pt; margin-left: -4% }
|
||||||
|
H4 { color: maroon; padding: 4pt; margin-left: -4% }
|
||||||
|
H5 { color: maroon; padding: 4pt; margin-left: -4% }
|
||||||
|
-->
|
||||||
|
</style>
|
||||||
|
</head>
|
||||||
|
<body bgcolor="#FFFFFF" text="#000000">
|
||||||
|
<h3>
|
||||||
|
NAME
|
||||||
|
</h3>
|
||||||
|
<b>BUILDING</b>
|
||||||
|
- Procedure for building
|
||||||
|
NetBSD
|
||||||
|
from source code.
|
||||||
|
<h3>
|
||||||
|
STATUS
|
||||||
|
</h3>
|
||||||
|
This document is a work-in-progress. As such, the information described
|
||||||
|
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.
|
||||||
|
<p>
|
||||||
|
Discrepancies between this documentation and the current reality of
|
||||||
|
implementation are noted specially, as with the note below:
|
||||||
|
<p>
|
||||||
|
<em></em><em>Note</em>:
|
||||||
|
This document applies only to platforms which use the new toolchain as
|
||||||
|
indicated by the setting of
|
||||||
|
<b></b><b>USE_NEW_TOOLCHAIN</b>
|
||||||
|
in
|
||||||
|
<b></b><b>/etc/mk.conf</b>
|
||||||
|
or
|
||||||
|
<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
|
||||||
|
<b></b><b>UPDATING</b>.
|
||||||
|
<h3>
|
||||||
|
REQUIREMENTS
|
||||||
|
</h3>
|
||||||
|
NetBSD
|
||||||
|
is designed to be buildable on most POSIX-compliant host systems.
|
||||||
|
The basic build procedure is the same whether compiling
|
||||||
|
<em></em><em>natively</em>
|
||||||
|
(on the same
|
||||||
|
NetBSD
|
||||||
|
architecture) or
|
||||||
|
<em></em><em>cross</em><em> compiling</em>
|
||||||
|
(on another architecture or OS).
|
||||||
|
<p>
|
||||||
|
This source tree contains a special subtree,
|
||||||
|
``tools'',
|
||||||
|
which uses the host system to create a build toolchain for the target
|
||||||
|
architecture. The host system must have at least C and C++
|
||||||
|
compilers in order to create the toolchain
|
||||||
|
<b>(</b><b>make</b>
|
||||||
|
is not required); all other tools are created as part of the
|
||||||
|
NetBSD
|
||||||
|
build process.
|
||||||
|
<p>
|
||||||
|
<dl compact><dt><dd>
|
||||||
|
<pre>
|
||||||
|
<em></em><em>Note</em>:
|
||||||
|
A couple host toolchain components are not yet available in the tools
|
||||||
|
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
|
||||||
|
NetBSD
|
||||||
|
is not currently supported.
|
||||||
|
</pre>
|
||||||
|
</dl>
|
||||||
|
<h3>
|
||||||
|
FILES
|
||||||
|
</h3>
|
||||||
|
<h4>
|
||||||
|
<a name="Source tree layout">
|
||||||
|
Source tree layout
|
||||||
|
</a>
|
||||||
|
</h4>
|
||||||
|
<dl compact>
|
||||||
|
<p><dt><b></b><b>BUILDING</b><dd>
|
||||||
|
This document (in formatted plaintext).
|
||||||
|
<p><dt><b></b><b>BUILDING.mdoc</b><dd>
|
||||||
|
This document (in -mdoc troff format).
|
||||||
|
<p><dt><b></b><b>Makefile</b><dd>
|
||||||
|
The main Makefile for
|
||||||
|
NetBSD;
|
||||||
|
should only be run for native builds with an appropriately up-to-date
|
||||||
|
version of
|
||||||
|
NetBSD
|
||||||
|
<code>make(1)</code>.
|
||||||
|
(For building from out-of-date systems or on a non-native host, see the
|
||||||
|
<b>build.sh</b>
|
||||||
|
shell script.)
|
||||||
|
<p><dt><b></b><b>UPDATING</b><dd>
|
||||||
|
Special notes for updating from an earlier revision of
|
||||||
|
NetBSD.
|
||||||
|
It is important to read this file before every build of an updated
|
||||||
|
source tree.
|
||||||
|
<p><dt><b></b><b>build.sh</b><dd>
|
||||||
|
Bourne-compatible shell script used for building the host build tools
|
||||||
|
and the
|
||||||
|
NetBSD
|
||||||
|
system from scratch. Can be used for both native and cross builds, and
|
||||||
|
should be used instead of
|
||||||
|
<code>make(1)</code>
|
||||||
|
for any source tree that is updated and recompiled regularly.
|
||||||
|
<p><dt><b></b><b>crypto/dist/</b>,<b> dist/</b>,<b> gnu/dist/</b><dd>
|
||||||
|
Sources imported verbatim from third parties, without mangling the
|
||||||
|
existing build structure. Other source trees in
|
||||||
|
<b></b><b>bin</b>
|
||||||
|
through
|
||||||
|
<b></b><b>usr.sbin</b>
|
||||||
|
use the
|
||||||
|
NetBSD
|
||||||
|
<code>make(1)</code>
|
||||||
|
``reachover''
|
||||||
|
Makefile semantics when building these programs for a native host.
|
||||||
|
<p><dt><b></b><b>distrib/</b>,<b> etc/</b><dd>
|
||||||
|
Sources for items used when making a full release snapshot, such as
|
||||||
|
files installed in
|
||||||
|
<b></b><b>/etc</b>
|
||||||
|
on the destination system, boot media, and release notes.
|
||||||
|
<p><dt><b></b><b>regress/</b><dd>
|
||||||
|
Regression test harness. Can be cross-compiled, but only run natively.
|
||||||
|
<p><dt><b></b><b>sys/</b><dd>
|
||||||
|
NetBSD
|
||||||
|
kernel sources.
|
||||||
|
<p><dt><b></b><b>tools/</b><dd>
|
||||||
|
``Reachover''
|
||||||
|
build structure for the host build tools. This has a special method of
|
||||||
|
determining out-of-date status.
|
||||||
|
<p><dt><b></b><b>bin/</b><b> ...</b><b> usr.sbin/</b><dd>
|
||||||
|
Sources to the
|
||||||
|
NetBSD
|
||||||
|
userland (non-kernel) programs. If any of these directories are
|
||||||
|
missing, they will be skipped during the build.
|
||||||
|
</dl>
|
||||||
|
<h4>
|
||||||
|
<a name="Build tree layout">
|
||||||
|
Build tree layout
|
||||||
|
</a>
|
||||||
|
</h4>
|
||||||
|
The
|
||||||
|
NetBSD
|
||||||
|
build tree is described in
|
||||||
|
<code>hier(7)</code>,
|
||||||
|
and the release layout is described in
|
||||||
|
<code>release(7)</code>.
|
||||||
|
<p>
|
||||||
|
<h3>
|
||||||
|
CONFIGURATION
|
||||||
|
</h3>
|
||||||
|
<h4>
|
||||||
|
<a name="make variables">
|
||||||
|
make variables
|
||||||
|
</a>
|
||||||
|
</h4>
|
||||||
|
Several variables control the behavior of
|
||||||
|
NetBSD
|
||||||
|
builds. Unless otherwise specified, these variables may be set in
|
||||||
|
either the process environment or the
|
||||||
|
<code>make(1)</code>
|
||||||
|
configuration file specified by
|
||||||
|
<b></b><b>MAKECONF</b>.
|
||||||
|
<dl compact>
|
||||||
|
<p><dt><b></b><b>DESTDIR</b><dd>
|
||||||
|
Directory to contain the built
|
||||||
|
NetBSD
|
||||||
|
system. If set, special options are passed to the compilation tools to
|
||||||
|
prevent their default use of the host system's
|
||||||
|
<b></b><b>/usr/include</b>,<b> /usr/lib</b>,
|
||||||
|
and so forth. This pathname should
|
||||||
|
<em></em><em>not</em>
|
||||||
|
end with a slash
|
||||||
|
(/)
|
||||||
|
character (for installation into the system's root directory, set
|
||||||
|
<b></b><b>DESTDIR</b>
|
||||||
|
to an empty string).
|
||||||
|
<p>
|
||||||
|
<em></em><em>Default</em>:
|
||||||
|
Empty string if
|
||||||
|
<b></b><b>USETOOLS</b>
|
||||||
|
is
|
||||||
|
``yes'';
|
||||||
|
unset otherwise.
|
||||||
|
<p><dt><b></b><b>MAKECONF</b><dd>
|
||||||
|
The name of the
|
||||||
|
<code>make(1)</code>
|
||||||
|
configuration file.
|
||||||
|
<em></em><em>Only</em><em> settable</em><em> in</em><em> the</em><em> process</em><em> environment.</em>
|
||||||
|
<p>
|
||||||
|
<em></em><em>Default</em>:
|
||||||
|
``/etc/mk.conf''
|
||||||
|
<p><dt><b></b><b>MKCATPAGES</b><dd>
|
||||||
|
Can be set to
|
||||||
|
``yes''
|
||||||
|
or
|
||||||
|
``no''.
|
||||||
|
Indicates whether preformatted plaintext manual pages will be created
|
||||||
|
during a build.
|
||||||
|
<p>
|
||||||
|
<em></em><em>Default</em>:
|
||||||
|
``yes''
|
||||||
|
<p><dt><b></b><b>MKCRYPTO</b><dd>
|
||||||
|
Can be set to
|
||||||
|
``yes''
|
||||||
|
or
|
||||||
|
``no''.
|
||||||
|
Indicates whether cryptographic code will be included in a build;
|
||||||
|
provided for the benefit of countries that do not allow strong
|
||||||
|
cryptography. Will not affect use of the standard low-security password
|
||||||
|
encryption system,
|
||||||
|
<code>crypt(3)</code>.
|
||||||
|
<p>
|
||||||
|
<em></em><em>Default</em>:
|
||||||
|
``yes''
|
||||||
|
<p><dt><b></b><b>MKDOC</b><dd>
|
||||||
|
Can be set to
|
||||||
|
``yes''
|
||||||
|
or
|
||||||
|
``no''.
|
||||||
|
Indicates whether system documentation destined for
|
||||||
|
<b></b><b>/usr/share/doc</b>
|
||||||
|
will be installed during a build.
|
||||||
|
<p>
|
||||||
|
<em></em><em>Default</em>:
|
||||||
|
``yes''
|
||||||
|
<p><dt><b></b><b>MKINFO</b><dd>
|
||||||
|
Can be set to
|
||||||
|
``yes''
|
||||||
|
or
|
||||||
|
``no''.
|
||||||
|
Indicates whether GNU Info files, used for the documentation for
|
||||||
|
most of the compilation tools, will be created and installed during a
|
||||||
|
build.
|
||||||
|
<p>
|
||||||
|
<em></em><em>Default</em>:
|
||||||
|
``yes''
|
||||||
|
<p><dt><b></b><b>MKLINT</b><dd>
|
||||||
|
Can be set to
|
||||||
|
``yes''
|
||||||
|
or
|
||||||
|
``no''.
|
||||||
|
Indicates whether
|
||||||
|
<code>lint(1)</code>
|
||||||
|
will be run against portions of the
|
||||||
|
NetBSD
|
||||||
|
source code during the build, and whether lint libraries will be
|
||||||
|
installed into
|
||||||
|
<b></b><b>/usr/libdata/lint</b>.
|
||||||
|
<p>
|
||||||
|
<em></em><em>Default</em>:
|
||||||
|
``yes''
|
||||||
|
<p><dt><b></b><b>MKMAN</b><dd>
|
||||||
|
Can be set to
|
||||||
|
``yes''
|
||||||
|
or
|
||||||
|
``no''.
|
||||||
|
Indicates whether manual pages will be installed during a build.
|
||||||
|
<p>
|
||||||
|
<em></em><em>Default</em>:
|
||||||
|
``yes''
|
||||||
|
<p><dt><b></b><b>MKNLS</b><dd>
|
||||||
|
Can be set to
|
||||||
|
``yes''
|
||||||
|
or
|
||||||
|
``no''.
|
||||||
|
Indicates whether Native Language System locale zone files will be
|
||||||
|
compiled and installed during a build.
|
||||||
|
<p>
|
||||||
|
<em></em><em>Default</em>:
|
||||||
|
``yes''
|
||||||
|
<p><dt><b></b><b>MKOBJ</b><dd>
|
||||||
|
Can be set to
|
||||||
|
``yes''
|
||||||
|
or
|
||||||
|
``no''.
|
||||||
|
Indicates whether object directories will be created when running
|
||||||
|
``make obj''.
|
||||||
|
If set to
|
||||||
|
``no'',
|
||||||
|
then all built files will be located inside the regular source tree.
|
||||||
|
<p>
|
||||||
|
<em></em><em>Default</em>:
|
||||||
|
``yes''
|
||||||
|
<p><dt><b></b><b>MKPIC</b><dd>
|
||||||
|
Can be set to
|
||||||
|
``yes''
|
||||||
|
or
|
||||||
|
``no''.
|
||||||
|
Indicates whether shared objects and libraries will be created and
|
||||||
|
installed during a build. If set to
|
||||||
|
``no'',
|
||||||
|
the entire built system will be statically linked.
|
||||||
|
<p>
|
||||||
|
<em></em><em>Default</em>:
|
||||||
|
Platform dependent. As of this writing, all platforms except
|
||||||
|
<b></b><b>sh3</b>
|
||||||
|
default to
|
||||||
|
``yes''.
|
||||||
|
<p><dt><b></b><b>MKPICINSTALL</b><dd>
|
||||||
|
Can be set to
|
||||||
|
``yes''
|
||||||
|
or
|
||||||
|
``no''.
|
||||||
|
Indicates whether the
|
||||||
|
<code>ar(1)</code>
|
||||||
|
format libraries
|
||||||
|
<b></b>(<b>lib*_pic.a</b>),
|
||||||
|
used to generate shared libraries, are installed during a build.
|
||||||
|
<p>
|
||||||
|
<em></em><em>Default</em>:
|
||||||
|
``yes''
|
||||||
|
<p><dt><b></b><b>MKPROFILE</b><dd>
|
||||||
|
Can be set to
|
||||||
|
``yes''
|
||||||
|
or
|
||||||
|
``no''.
|
||||||
|
Indicates whether profiled libraries
|
||||||
|
<b></b>(<b>lib*_p.a</b>)
|
||||||
|
will be built and installed during a build.
|
||||||
|
<p>
|
||||||
|
<em></em><em>Default</em>:
|
||||||
|
``yes'';
|
||||||
|
however, some platforms turn off
|
||||||
|
<b></b><b>MKPROFILE</b>
|
||||||
|
by default at times due to toolchain problems with profiled code.
|
||||||
|
<p><dt><b></b><b>MKSHARE</b><dd>
|
||||||
|
Can be set to
|
||||||
|
``yes''
|
||||||
|
or
|
||||||
|
``no''.
|
||||||
|
Indicates whether files destined to reside in
|
||||||
|
<b></b><b>/usr/share</b>
|
||||||
|
will be built and installed during a build. If set to
|
||||||
|
``no'',
|
||||||
|
then all of
|
||||||
|
<b></b><b>MKCATPAGES</b>,<b> MKDOC</b>,<b> MKINFO</b>,<b> MKMAN</b>,
|
||||||
|
and
|
||||||
|
<b></b><b>MKNLS</b>
|
||||||
|
will be set to
|
||||||
|
``no''
|
||||||
|
unconditionally.
|
||||||
|
<p>
|
||||||
|
<em></em><em>Default</em>:
|
||||||
|
``yes''
|
||||||
|
<p><dt><b></b><b>TOOLDIR</b><dd>
|
||||||
|
Directory to hold the host tools, once built. This directory should be
|
||||||
|
unique to a given host system and
|
||||||
|
NetBSD
|
||||||
|
source tree. (However, multiple targets may share the same
|
||||||
|
<b></b><b>TOOLDIR</b>;
|
||||||
|
the target-dependent files have unique names.) Must be set if USETOOLS
|
||||||
|
is
|
||||||
|
``yes''.
|
||||||
|
<p>
|
||||||
|
<em></em><em>Default</em>:
|
||||||
|
Unset.
|
||||||
|
<p><dt><b></b><b>UPDATE</b><dd>
|
||||||
|
If set, then all install operations intended to write to
|
||||||
|
<b></b><b>DESTDIR</b>
|
||||||
|
will compare file timestamps before installing, and skip the install
|
||||||
|
phase if the destination files are up-to-date. This also has
|
||||||
|
implications on full builds (see next subsection).
|
||||||
|
<p>
|
||||||
|
<em></em><em>Default</em>:
|
||||||
|
Unset.
|
||||||
|
<p><dt><b></b><b>USETOOLS</b><dd>
|
||||||
|
Indicates whether the tools specified by
|
||||||
|
<b></b><b>TOOLDIR</b>
|
||||||
|
should be used as part of a build in progress. Must be set to
|
||||||
|
``yes''
|
||||||
|
if cross-compiling.
|
||||||
|
<dl compact>
|
||||||
|
<p><dt><b></b><b>yes</b><dd>
|
||||||
|
Use the tools from
|
||||||
|
<b></b><b>TOOLDIR</b>.
|
||||||
|
<p><dt><b></b><b>no</b><dd>
|
||||||
|
Do not use the tools from
|
||||||
|
<b></b><b>TOOLDIR</b>,
|
||||||
|
but refuse to build native compilation tool components that are
|
||||||
|
version-specific for that tool.
|
||||||
|
<p><dt><b></b><b>never</b><dd>
|
||||||
|
Do not use the tools from
|
||||||
|
<b></b><b>TOOLDIR</b>,
|
||||||
|
even when building native tool components. This is similar to the
|
||||||
|
traditional
|
||||||
|
NetBSD
|
||||||
|
build method, but does
|
||||||
|
<em></em><em>not</em>
|
||||||
|
verify that the compilation tools in use are up-to-date enough in order
|
||||||
|
to build the tree successfully. This may cause build or runtime
|
||||||
|
problems when building the whole
|
||||||
|
NetBSD
|
||||||
|
source tree.
|
||||||
|
</dl>
|
||||||
|
<p>
|
||||||
|
<em></em><em>Default</em>:
|
||||||
|
``yes''
|
||||||
|
if building all or part of a whole
|
||||||
|
NetBSD
|
||||||
|
source tree (detected automatically);
|
||||||
|
``no''
|
||||||
|
otherwise (to preserve traditional semantics of the
|
||||||
|
<bsd.*.mk>
|
||||||
|
<code>make(1)</code>
|
||||||
|
include files).
|
||||||
|
<p>
|
||||||
|
<em></em><em>Note</em>:
|
||||||
|
Currently, the
|
||||||
|
``no''
|
||||||
|
option functions similarly to the
|
||||||
|
``never''
|
||||||
|
option. Proper checks will be added in the near future to add the
|
||||||
|
described functionality for version-specific tool components.
|
||||||
|
</dl>
|
||||||
|
<h4>
|
||||||
|
<a name="make variables for full builds">
|
||||||
|
make variables for full builds
|
||||||
|
</a>
|
||||||
|
</h4>
|
||||||
|
These variables only affect the top level
|
||||||
|
``Makefile''
|
||||||
|
and do not manually building subtrees of the
|
||||||
|
NetBSD
|
||||||
|
source code.
|
||||||
|
<dl compact>
|
||||||
|
<p><dt><b></b><b>MKOBJDIRS</b><dd>
|
||||||
|
Can be set to
|
||||||
|
``yes''
|
||||||
|
or
|
||||||
|
``no''.
|
||||||
|
Indicates whether object directories will be created automatically
|
||||||
|
(via a
|
||||||
|
``make obj''
|
||||||
|
pass) at the start of a build.
|
||||||
|
<p>
|
||||||
|
<em></em><em>Default</em>:
|
||||||
|
``yes''
|
||||||
|
<p><dt><b></b><b>MKTOOLS</b><dd>
|
||||||
|
Indicates whether the host tools will be built and installed
|
||||||
|
automatically if they are out-of-date.
|
||||||
|
<dl compact>
|
||||||
|
<p><dt><b></b><b>yes</b><dd>
|
||||||
|
Build tools as needed into
|
||||||
|
<b></b><b>TOOLDIR</b>,
|
||||||
|
but only if the tools in question are out-of-date.
|
||||||
|
<p><dt><b></b><b>no</b><dd>
|
||||||
|
Do not update the tools in
|
||||||
|
<b></b><b>TOOLDIR</b>;
|
||||||
|
halt the build as a safety precaution if tools are out-of-date.
|
||||||
|
<p><dt><b></b><b>always</b><dd>
|
||||||
|
Always rebuild the tools in
|
||||||
|
<b></b><b>TOOLDIR</b>
|
||||||
|
from scratch during a build. This is similar to the standard
|
||||||
|
NetBSD
|
||||||
|
source tree build method, but is not typically required for host tools.
|
||||||
|
</dl>
|
||||||
|
<p>
|
||||||
|
<em></em><em>Default</em>:
|
||||||
|
``no''
|
||||||
|
<p><dt><b></b><b>NBUILDJOBS</b><dd>
|
||||||
|
If set, specifies the number of parallel
|
||||||
|
<code>make(1)</code>
|
||||||
|
processes that should be run simultaneously. This can speed up builds
|
||||||
|
on SMP machines, or machines with much more CPU power than I/O
|
||||||
|
availability. This should be used
|
||||||
|
<em></em><em>instead</em>
|
||||||
|
of the
|
||||||
|
<code>make(1)</code>
|
||||||
|
option
|
||||||
|
<b></b><b>-j</b>,
|
||||||
|
in order to ensure proper ordering of build components.
|
||||||
|
<p>
|
||||||
|
<em></em><em>Default</em>:
|
||||||
|
Unset.
|
||||||
|
<p><dt><b></b><b>NOCLEANDIR</b><dd>
|
||||||
|
If set, avoids the
|
||||||
|
``make cleandir''
|
||||||
|
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.
|
||||||
|
<p>
|
||||||
|
<em></em><em>Default</em>:
|
||||||
|
Unset.
|
||||||
|
<p><dt><b></b><b>NODISTRIBDIRS</b><dd>
|
||||||
|
If set, avoids the
|
||||||
|
``make distrib-dirs''
|
||||||
|
phase of a full build. This skips running
|
||||||
|
<code>mtree(1)</code>
|
||||||
|
on
|
||||||
|
<b></b><b>DESTDIR</b>,
|
||||||
|
useful on systems where building as an unprivileged user, or where it is
|
||||||
|
known that the system-wide mtree files have not changed.
|
||||||
|
<p>
|
||||||
|
<em></em><em>Default</em>:
|
||||||
|
Unset.
|
||||||
|
<p><dt><b></b><b>NOINCLUDES</b><dd>
|
||||||
|
If set, avoids the
|
||||||
|
``make includes''
|
||||||
|
phase of a full build. This has the effect of preventing
|
||||||
|
<code>make(1)</code>
|
||||||
|
from thinking that some programs are out-of-date simply because the
|
||||||
|
system include files have changed. However, this option should not be
|
||||||
|
used when updating the entire
|
||||||
|
NetBSD
|
||||||
|
source tree arbitrarily; it is suggested to use
|
||||||
|
<b></b><b>UPDATE</b>
|
||||||
|
in that case.
|
||||||
|
<p>
|
||||||
|
<em></em><em>Default</em>:
|
||||||
|
Unset.
|
||||||
|
<p><dt><b></b><b>RELEASEDIR</b><dd>
|
||||||
|
If set, specifies the directory to which a
|
||||||
|
<code>release(7)</code>
|
||||||
|
layout will be written at the end of a
|
||||||
|
``make release''.
|
||||||
|
<p>
|
||||||
|
<em></em><em>Default</em>:
|
||||||
|
Unset.
|
||||||
|
<p><dt><b></b><b>UPDATE</b><dd>
|
||||||
|
If set, then in addition to the effects described for UPDATE above, this
|
||||||
|
implies the effects of
|
||||||
|
<b></b><b>NOCLEANDIR</b>.
|
||||||
|
</dl>
|
||||||
|
<h3>
|
||||||
|
BUILDING
|
||||||
|
</h3>
|
||||||
|
<h4>
|
||||||
|
<a name="make command line options">
|
||||||
|
make command line options
|
||||||
|
</a>
|
||||||
|
</h4>
|
||||||
|
This is only a summary of options available to
|
||||||
|
<code>make(1)</code>;
|
||||||
|
only the options used most frequently with
|
||||||
|
NetBSD
|
||||||
|
builds are listed here.
|
||||||
|
<dl compact>
|
||||||
|
<p><dt><b></b><b>-m</b><em></em><em> dir</em><dd>
|
||||||
|
Specify the default directory for searching for system Makefile
|
||||||
|
segments, mainly the
|
||||||
|
<bsd.*.mk>
|
||||||
|
files. When building any full
|
||||||
|
NetBSD
|
||||||
|
source tree, this should be set to the
|
||||||
|
``share/mk''
|
||||||
|
directory in the source tree. (This is set automatically when building
|
||||||
|
from the top level.)
|
||||||
|
<p><dt><b></b><b>-n</b><dd>
|
||||||
|
Display the commands that would have been executed, but do not
|
||||||
|
actually execute them. This will still cause recursion to take place.
|
||||||
|
<p><dt><b></b><b>-v</b><em></em><em> var</em><dd>
|
||||||
|
Print
|
||||||
|
<code>make(1)</code>'s
|
||||||
|
idea of the value of
|
||||||
|
<em></em><em>var</em>.
|
||||||
|
Does not build any targets.
|
||||||
|
<p><dt><em></em><em>var=value</em><dd>
|
||||||
|
Set the variable
|
||||||
|
<em></em><em>var</em>
|
||||||
|
to
|
||||||
|
<em></em><em>value</em>,
|
||||||
|
overriding any setting specified by the process environment, the
|
||||||
|
<b></b><b>MAKECONF</b>
|
||||||
|
configuration file, or the system Makefile segments.
|
||||||
|
</dl>
|
||||||
|
<h4>
|
||||||
|
<a name="make targets">
|
||||||
|
make targets
|
||||||
|
</a>
|
||||||
|
</h4>
|
||||||
|
These default targets may be built by running
|
||||||
|
<code>make(1)</code>
|
||||||
|
in any subtree of the
|
||||||
|
NetBSD
|
||||||
|
source code. It is recommended that none of these be used from the top
|
||||||
|
level Makefile; as a specific exception,
|
||||||
|
``make obj''
|
||||||
|
and
|
||||||
|
``make cleandir''
|
||||||
|
are useful in that context.
|
||||||
|
<dl compact>
|
||||||
|
<p><dt><b></b><b>all</b><dd>
|
||||||
|
Build programs, libraries, and preformatted documentation.
|
||||||
|
<p><dt><b></b><b>clean</b><dd>
|
||||||
|
Remove program and library object code files.
|
||||||
|
<p><dt><b></b><b>cleandir</b><dd>
|
||||||
|
Same as
|
||||||
|
<b></b><b>clean</b>,
|
||||||
|
but also remove preformatted documentation, dependency files generated
|
||||||
|
by
|
||||||
|
``make depend'',
|
||||||
|
and any other files known to be created at build time.
|
||||||
|
``make distclean''
|
||||||
|
may be used as a synonym, for familiarity with a similar well-known
|
||||||
|
convention.
|
||||||
|
<p><dt><b></b><b>depend</b><dd>
|
||||||
|
Create dependency files
|
||||||
|
<b></b>(<b>.depend</b>)
|
||||||
|
containing more detailed information about the dependencies of source
|
||||||
|
code on header files. Allows programs to be recompiled automatically
|
||||||
|
when a dependency changes.
|
||||||
|
<p><dt><b></b><b>dependall</b><dd>
|
||||||
|
Does a
|
||||||
|
``make depend''
|
||||||
|
immediately followed by a
|
||||||
|
``make all''.
|
||||||
|
This combined target recurses as an atomic unit, so that the
|
||||||
|
``make depend''
|
||||||
|
phase can participate in
|
||||||
|
<b></b><b>make</b><b> -j</b>
|
||||||
|
parallelism.
|
||||||
|
<p><dt><b></b><b>includes</b><dd>
|
||||||
|
Build and install system header files. Typically needed before any
|
||||||
|
system libraries or programs can be built.
|
||||||
|
<p><dt><b></b><b>install</b><dd>
|
||||||
|
Install programs, libraries, and documentation into
|
||||||
|
<b></b><b>DESTDIR</b>.
|
||||||
|
<p><dt><b></b><b>lint</b><dd>
|
||||||
|
Run
|
||||||
|
<code>lint(1)</code>
|
||||||
|
against the C source code, where appropriate, and generate
|
||||||
|
system-installed lint libraries.
|
||||||
|
<p><dt><b></b><b>obj</b><dd>
|
||||||
|
Create object directories to be used for built files, instead of
|
||||||
|
building directly in the source tree.
|
||||||
|
<p><dt><b></b><b>tags</b><dd>
|
||||||
|
Create
|
||||||
|
<code>ctags(1)</code>
|
||||||
|
searchable function lists usable by the
|
||||||
|
<code>ex(1)</code>
|
||||||
|
and
|
||||||
|
<code>vi(1)</code>
|
||||||
|
text editors.
|
||||||
|
</dl>
|
||||||
|
<h4>
|
||||||
|
<a name="make targets for the top level">
|
||||||
|
make targets for the top level
|
||||||
|
</a>
|
||||||
|
</h4>
|
||||||
|
Additional
|
||||||
|
<code>make(1)</code>
|
||||||
|
targets are usable specifically from the top source level to facilitate
|
||||||
|
building the entire
|
||||||
|
NetBSD
|
||||||
|
source tree.
|
||||||
|
<dl compact>
|
||||||
|
<p><dt><b></b><b>build</b><dd>
|
||||||
|
Build the entire
|
||||||
|
NetBSD
|
||||||
|
system. This orders portions of the source tree such that prerequisites
|
||||||
|
will be built in the proper order.
|
||||||
|
<p><dt><b></b><b>release</b><dd>
|
||||||
|
Do a
|
||||||
|
``make build'',
|
||||||
|
then package the system into a standard release layout as described by
|
||||||
|
<code>release(7)</code>.
|
||||||
|
This requires that
|
||||||
|
<b></b><b>RELEASEDIR</b>
|
||||||
|
be set (see above).
|
||||||
|
<p><dt><b></b><b>regression-tests</b><dd>
|
||||||
|
Can only be run after building the regression tests in the directory
|
||||||
|
``regress''.
|
||||||
|
Runs the compiled regression tests on the local host.
|
||||||
|
</dl>
|
||||||
|
<h4>
|
||||||
|
<a name="The build.sh script">
|
||||||
|
The build.sh script
|
||||||
|
</a>
|
||||||
|
</h4>
|
||||||
|
This script file is a Bourne shell script designed to build the
|
||||||
|
entire
|
||||||
|
NetBSD
|
||||||
|
system on any host with a Bourne shell in
|
||||||
|
<b></b><b>/bin/sh</b>,
|
||||||
|
including many that are not POSIX compliant. Note that if a host
|
||||||
|
system's
|
||||||
|
<b></b><b>/bin/sh</b>
|
||||||
|
is unusually old and broken, the Korn Shell
|
||||||
|
<b></b>(<b>/bin/ksh</b>),
|
||||||
|
if available, may be a usable alternative.
|
||||||
|
<p>
|
||||||
|
All cross-compile builds, and most native builds, of the entire system
|
||||||
|
should make use of
|
||||||
|
<b></b><b>build.sh</b>
|
||||||
|
rather than just running
|
||||||
|
``make''.
|
||||||
|
This way, the
|
||||||
|
<code>make(1)</code>
|
||||||
|
program will be bootstrapped properly, in case the host system has an
|
||||||
|
older or incompatible
|
||||||
|
``make''
|
||||||
|
program.
|
||||||
|
<p>
|
||||||
|
When compiling the entire system via
|
||||||
|
<b></b><b>build.sh</b>,
|
||||||
|
many
|
||||||
|
<code>make(1)</code>
|
||||||
|
variables are set for you in order to help encapsulate the build
|
||||||
|
process. In particular, both
|
||||||
|
<b></b><b>USETOOLS</b>
|
||||||
|
and
|
||||||
|
<b></b><b>MKTOOLS</b>
|
||||||
|
are set to
|
||||||
|
``yes'',
|
||||||
|
and
|
||||||
|
<b></b><b>MACHINE_ARCH</b>
|
||||||
|
(if unset) is deduced from the value of
|
||||||
|
<b></b><b>MACHINE</b>.
|
||||||
|
<p>
|
||||||
|
The variables
|
||||||
|
<b></b><b>DESTDIR</b>,<b> MACHINE</b>,<b> MACHINE_ARCH</b>,
|
||||||
|
and
|
||||||
|
<b></b><b>TOOLDIR</b>
|
||||||
|
are required in order for
|
||||||
|
<b></b><b>build.sh</b>
|
||||||
|
to function, and thus they cannot be set in the configuration file
|
||||||
|
specified by
|
||||||
|
<b></b><b>MAKECONF</b>.
|
||||||
|
They may be set either in the process environment, or via command line
|
||||||
|
options to
|
||||||
|
<b></b><b>build.sh</b>.
|
||||||
|
<p>
|
||||||
|
The following are available command line options that may be supplied to
|
||||||
|
<b></b><b>build.sh</b>:
|
||||||
|
<dl compact>
|
||||||
|
<p><dt><b></b><b>-a</b><em></em><em> arch</em><dd>
|
||||||
|
Set the value of
|
||||||
|
<b></b><b>MACHINE_ARCH</b>
|
||||||
|
to
|
||||||
|
<em></em><em>arch</em>.
|
||||||
|
<p><dt><b></b><b>-D</b><em></em><em> dest</em><dd>
|
||||||
|
Set the value of
|
||||||
|
<b></b><b>DESTDIR</b>
|
||||||
|
to
|
||||||
|
<em></em><em>dest</em>.
|
||||||
|
<p><dt><b></b><b>-j</b><em></em><em> njob</em><dd>
|
||||||
|
Set the value of
|
||||||
|
<b></b><b>NBUILDJOBS</b>
|
||||||
|
to
|
||||||
|
<em></em><em>njob</em>.
|
||||||
|
This provides similar functionality to the familiar
|
||||||
|
``make -j'',
|
||||||
|
but preserves the ordering of the top level
|
||||||
|
``make build''.
|
||||||
|
<p><dt><b></b><b>-m</b><em></em><em> mach</em><dd>
|
||||||
|
Set the value of
|
||||||
|
<b></b><b>MACHINE</b>
|
||||||
|
to
|
||||||
|
<em></em><em>mach</em>.
|
||||||
|
This will also override any value of
|
||||||
|
<b></b><b>MACHINE_ARCH</b>
|
||||||
|
in the process environment with a value deduced from
|
||||||
|
<em></em><em>mach</em>,
|
||||||
|
unless
|
||||||
|
<b></b><b>-a</b>
|
||||||
|
is specified.
|
||||||
|
<p><dt><b></b><b>-R</b><em></em><em> rel</em><dd>
|
||||||
|
Set the value of
|
||||||
|
<b></b><b>RELEASEDIR</b>
|
||||||
|
to
|
||||||
|
<em></em><em>rel</em>.
|
||||||
|
Setting this option will make
|
||||||
|
<b></b><b>build.sh</b>
|
||||||
|
run
|
||||||
|
``make release''
|
||||||
|
instead of
|
||||||
|
``make build''.
|
||||||
|
<p><dt><b></b><b>-r</b><dd>
|
||||||
|
Remove the contents of
|
||||||
|
<b></b><b>DESTDIR</b>
|
||||||
|
and
|
||||||
|
<b></b><b>TOOLDIR</b>
|
||||||
|
before building (provides a clean starting point).
|
||||||
|
<p><dt><b></b><b>-T</b><em></em><em> tools</em><dd>
|
||||||
|
Set the value of
|
||||||
|
<b></b><b>TOOLDIR</b>
|
||||||
|
to
|
||||||
|
<em></em><em>tools</em>.
|
||||||
|
</dl>
|
||||||
|
<h3>
|
||||||
|
The nbmake-MACHINE wrapper script
|
||||||
|
</h3>
|
||||||
|
If using the
|
||||||
|
<b></b><b>build.sh</b>
|
||||||
|
script to build
|
||||||
|
NetBSD,
|
||||||
|
a
|
||||||
|
<b></b><b>nbmake-MACHINE</b>
|
||||||
|
script will be created in
|
||||||
|
<b></b><b>TOOLDIR/bin</b>
|
||||||
|
upon the first build to assist in building subtrees on a cross-compile
|
||||||
|
host.
|
||||||
|
<p>
|
||||||
|
<b></b><b>nbmake-MACHINE</b>
|
||||||
|
can be invoked in lieu of
|
||||||
|
<code>make(1)</code>,
|
||||||
|
and will instead call the up-to-date version of
|
||||||
|
``nbmake''
|
||||||
|
installed into
|
||||||
|
<b></b><b>TOOLDIR/bin</b>
|
||||||
|
with several key variables pre-set, including
|
||||||
|
<b></b><b>MACHINE</b>,<b> MACHINE_ARCH</b>,
|
||||||
|
and
|
||||||
|
<b></b><b>TOOLDIR</b>.
|
||||||
|
This script can be symlinked into a directory listed in
|
||||||
|
<b></b><b>PATH</b>,
|
||||||
|
or called with an absolute path.
|
||||||
|
<h3>
|
||||||
|
SEE ALSO
|
||||||
|
</h3>
|
||||||
|
<code>make(1)</code>,
|
||||||
|
<code>hier(7)</code>,
|
||||||
|
<code>release(7)</code>
|
||||||
|
<h3>
|
||||||
|
BUGS
|
||||||
|
</h3>
|
||||||
|
Many platforms are not yet using the
|
||||||
|
<b></b><b>USE_NEW_TOOLCHAIN</b>
|
||||||
|
system.
|
||||||
|
<h3>
|
||||||
|
HISTORY
|
||||||
|
</h3>
|
||||||
|
The
|
||||||
|
<b></b><b>USE_NEW_TOOLCHAIN</b>
|
||||||
|
based build scheme was introduced in the
|
||||||
|
``NetBSD-current''
|
||||||
|
development sources between
|
||||||
|
NetBSD1.5
|
||||||
|
and
|
||||||
|
NetBSD1.6.
|
||||||
|
</font></body>
|
||||||
|
</html>
|
||||||
|
|
|
@ -0,0 +1,449 @@
|
||||||
|
BUILDING(8) NetBSD System Manager's Manual BUILDING(8)
|
||||||
|
|
||||||
|
NAME
|
||||||
|
BUILDING - Procedure for building NetBSD from source code.
|
||||||
|
|
||||||
|
STATUS
|
||||||
|
This document is a work-in-progress. As such, the information described
|
||||||
|
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.
|
||||||
|
|
||||||
|
Discrepancies between this documentation and the current reality of im-
|
||||||
|
plementation are noted specially, as with the note below:
|
||||||
|
|
||||||
|
Note: This document applies only to platforms which use the new toolchain
|
||||||
|
as indicated by the setting of USE_NEW_TOOLCHAIN in /etc/mk.conf or
|
||||||
|
<bsd.own.mk>. Platforms which have not yet been switched to the new
|
||||||
|
toolchain should continue building traditionally, using the notes speci-
|
||||||
|
fied in the file UPDATING.
|
||||||
|
|
||||||
|
REQUIREMENTS
|
||||||
|
NetBSD is designed to be buildable on most POSIX-compliant host systems.
|
||||||
|
The basic build procedure is the same whether compiling natively (on the
|
||||||
|
same NetBSD architecture) or cross compiling (on another architecture or
|
||||||
|
OS).
|
||||||
|
|
||||||
|
This source tree contains a special subtree, ``tools'', which uses the
|
||||||
|
host system to create a build toolchain for the target architecture. The
|
||||||
|
host system must have at least C and C++ compilers in order to create the
|
||||||
|
toolchain (make is not required); all other tools are created as part of
|
||||||
|
the NetBSD build process.
|
||||||
|
|
||||||
|
Note: A couple host toolchain components are not yet available in
|
||||||
|
the tools directory. Also, some tools use non-POSIX, non-ANSI C
|
||||||
|
extensions and need to be standardized. As a result, cross-compil-
|
||||||
|
ing from systems other than NetBSD is not currently supported.
|
||||||
|
|
||||||
|
FILES
|
||||||
|
Source tree layout
|
||||||
|
|
||||||
|
BUILDING This document (in formatted plaintext).
|
||||||
|
|
||||||
|
BUILDING.mdoc This document (in -mdoc troff format).
|
||||||
|
|
||||||
|
Makefile The main Makefile for NetBSD; should only be run for na-
|
||||||
|
tive builds with an appropriately up-to-date version of
|
||||||
|
NetBSD make(1). (For building from out-of-date systems or
|
||||||
|
on a non-native host, see the build.sh shell script.)
|
||||||
|
|
||||||
|
UPDATING Special notes for updating from an earlier revision of
|
||||||
|
NetBSD. It is important to read this file before every
|
||||||
|
build of an updated source tree.
|
||||||
|
|
||||||
|
build.sh Bourne-compatible shell script used for building the host
|
||||||
|
build tools and the NetBSD system from scratch. Can be
|
||||||
|
used for both native and cross builds, and should be used
|
||||||
|
instead of make(1) for any source tree that is updated and
|
||||||
|
recompiled regularly.
|
||||||
|
|
||||||
|
crypto/dist/, dist/, gnu/dist/
|
||||||
|
Sources imported verbatim from third parties, without man-
|
||||||
|
gling the existing build structure. Other source trees in
|
||||||
|
bin through usr.sbin use the NetBSD make(1) ``reachover''
|
||||||
|
Makefile semantics when building these programs for a na-
|
||||||
|
tive host.
|
||||||
|
|
||||||
|
distrib/, etc/
|
||||||
|
Sources for items used when making a full release snap-
|
||||||
|
shot, such as files installed in /etc on the destination
|
||||||
|
system, boot media, and release notes.
|
||||||
|
|
||||||
|
regress/ Regression test harness. Can be cross-compiled, but only
|
||||||
|
run natively.
|
||||||
|
|
||||||
|
sys/ NetBSD kernel sources.
|
||||||
|
|
||||||
|
tools/ ``Reachover'' build structure for the host build tools.
|
||||||
|
This has a special method of determining out-of-date sta-
|
||||||
|
tus.
|
||||||
|
|
||||||
|
bin/ ... usr.sbin/
|
||||||
|
Sources to the NetBSD userland (non-kernel) programs. If
|
||||||
|
any of these directories are missing, they will be skipped
|
||||||
|
during the build.
|
||||||
|
|
||||||
|
Build tree layout
|
||||||
|
The NetBSD build tree is described in hier(7), and the release layout is
|
||||||
|
described in release(7).
|
||||||
|
|
||||||
|
CONFIGURATION
|
||||||
|
make variables
|
||||||
|
Several variables control the behavior of NetBSD builds. Unless other-
|
||||||
|
wise specified, these variables may be set in either the process environ-
|
||||||
|
ment or the make(1) configuration file specified by MAKECONF.
|
||||||
|
|
||||||
|
DESTDIR Directory to contain the built NetBSD system. If set, spe-
|
||||||
|
cial options are passed to the compilation tools to prevent
|
||||||
|
their default use of the host system's /usr/include,
|
||||||
|
/usr/lib, and so forth. This pathname should not end with a
|
||||||
|
slash (/) character (for installation into the system's root
|
||||||
|
directory, set DESTDIR to an empty string).
|
||||||
|
|
||||||
|
Default: Empty string if USETOOLS is ``yes''; unset other-
|
||||||
|
wise.
|
||||||
|
|
||||||
|
MAKECONF The name of the make(1) configuration file. Only settable in
|
||||||
|
the process environment.
|
||||||
|
|
||||||
|
Default: ``/etc/mk.conf''
|
||||||
|
|
||||||
|
MKCATPAGES Can be set to ``yes'' or ``no''. Indicates whether prefor-
|
||||||
|
matted plaintext manual pages will be created during a build.
|
||||||
|
|
||||||
|
Default: ``yes''
|
||||||
|
|
||||||
|
MKCRYPTO Can be set to ``yes'' or ``no''. Indicates whether crypto-
|
||||||
|
graphic code will be included in a build; provided for the
|
||||||
|
benefit of countries that do not allow strong cryptography.
|
||||||
|
Will not affect use of the standard low-security password en-
|
||||||
|
cryption system, crypt(3).
|
||||||
|
|
||||||
|
Default: ``yes''
|
||||||
|
|
||||||
|
MKDOC Can be set to ``yes'' or ``no''. Indicates whether system
|
||||||
|
documentation destined for /usr/share/doc will be installed
|
||||||
|
during a build.
|
||||||
|
|
||||||
|
Default: ``yes''
|
||||||
|
|
||||||
|
MKINFO Can be set to ``yes'' or ``no''. Indicates whether GNU Info
|
||||||
|
files, used for the documentation for most of the compilation
|
||||||
|
tools, will be created and installed during a build.
|
||||||
|
|
||||||
|
Default: ``yes''
|
||||||
|
|
||||||
|
MKLINT Can be set to ``yes'' or ``no''. Indicates whether lint(1)
|
||||||
|
will be run against portions of the NetBSD source code during
|
||||||
|
the build, and whether lint libraries will be installed into
|
||||||
|
/usr/libdata/lint.
|
||||||
|
|
||||||
|
Default: ``yes''
|
||||||
|
|
||||||
|
MKMAN Can be set to ``yes'' or ``no''. Indicates whether manual
|
||||||
|
pages will be installed during a build.
|
||||||
|
|
||||||
|
Default: ``yes''
|
||||||
|
|
||||||
|
MKNLS Can be set to ``yes'' or ``no''. Indicates whether Native
|
||||||
|
Language System locale zone files will be compiled and in-
|
||||||
|
stalled during a build.
|
||||||
|
|
||||||
|
Default: ``yes''
|
||||||
|
|
||||||
|
MKOBJ Can be set to ``yes'' or ``no''. Indicates whether object
|
||||||
|
directories will be created when running ``make obj''. If
|
||||||
|
set to ``no'', then all built files will be located inside
|
||||||
|
the regular source tree.
|
||||||
|
|
||||||
|
Default: ``yes''
|
||||||
|
|
||||||
|
MKPIC Can be set to ``yes'' or ``no''. Indicates whether shared
|
||||||
|
objects and libraries will be created and installed during a
|
||||||
|
build. If set to ``no'', the entire built system will be
|
||||||
|
statically linked.
|
||||||
|
|
||||||
|
Default: Platform dependent. As of this writing, all plat-
|
||||||
|
forms except sh3 default to ``yes''.
|
||||||
|
|
||||||
|
MKPICINSTALL
|
||||||
|
Can be set to ``yes'' or ``no''. Indicates whether the ar(1)
|
||||||
|
format libraries (lib*_pic.a), used to generate shared li-
|
||||||
|
braries, are installed during a build.
|
||||||
|
|
||||||
|
Default: ``yes''
|
||||||
|
|
||||||
|
MKPROFILE Can be set to ``yes'' or ``no''. Indicates whether profiled
|
||||||
|
libraries (lib*_p.a) will be built and installed during a
|
||||||
|
build.
|
||||||
|
|
||||||
|
Default: ``yes''; however, some platforms turn off MKPROFILE
|
||||||
|
by default at times due to toolchain problems with profiled
|
||||||
|
code.
|
||||||
|
|
||||||
|
MKSHARE Can be set to ``yes'' or ``no''. Indicates whether files
|
||||||
|
destined to reside in /usr/share will be built and installed
|
||||||
|
during a build. If set to ``no'', then all of MKCATPAGES,
|
||||||
|
MKDOC, MKINFO, MKMAN, and MKNLS will be set to ``no'' uncon-
|
||||||
|
ditionally.
|
||||||
|
|
||||||
|
Default: ``yes''
|
||||||
|
|
||||||
|
TOOLDIR Directory to hold the host tools, once built. This directory
|
||||||
|
should be unique to a given host system and NetBSD source
|
||||||
|
tree. (However, multiple targets may share the same TOOLDIR;
|
||||||
|
the target-dependent files have unique names.) Must be set
|
||||||
|
if USETOOLS is ``yes''.
|
||||||
|
|
||||||
|
Default: Unset.
|
||||||
|
|
||||||
|
UPDATE If set, then all install operations intended to write to
|
||||||
|
DESTDIR will compare file timestamps before installing, and
|
||||||
|
skip the install phase if the destination files are up-to-
|
||||||
|
date. This also has implications on full builds (see next
|
||||||
|
subsection).
|
||||||
|
|
||||||
|
Default: Unset.
|
||||||
|
|
||||||
|
USETOOLS Indicates whether the tools specified by TOOLDIR should be
|
||||||
|
used as part of a build in progress. Must be set to ``yes''
|
||||||
|
if cross-compiling.
|
||||||
|
|
||||||
|
yes Use the tools from TOOLDIR.
|
||||||
|
|
||||||
|
no Do not use the tools from TOOLDIR, but refuse to build
|
||||||
|
native compilation tool components that are version-
|
||||||
|
specific for that tool.
|
||||||
|
|
||||||
|
never Do not use the tools from TOOLDIR, even when building
|
||||||
|
native tool components. This is similar to the tradi-
|
||||||
|
tional NetBSD build method, but does not verify that
|
||||||
|
the compilation tools in use are up-to-date enough in
|
||||||
|
order to build the tree successfully. This may cause
|
||||||
|
build or runtime problems when building the whole
|
||||||
|
NetBSD source tree.
|
||||||
|
|
||||||
|
Default: ``yes'' if building all or part of a whole NetBSD
|
||||||
|
source tree (detected automatically); ``no'' otherwise (to
|
||||||
|
preserve traditional semantics of the <bsd.*.mk> make(1) in-
|
||||||
|
clude files).
|
||||||
|
|
||||||
|
Note: Currently, the ``no'' option functions similarly to the
|
||||||
|
``never'' option. Proper checks will be added in the near
|
||||||
|
future to add the described functionality for version-specif-
|
||||||
|
ic tool components.
|
||||||
|
|
||||||
|
make variables for full builds
|
||||||
|
These variables only affect the top level ``Makefile'' and do not manual-
|
||||||
|
ly building subtrees of the NetBSD source code.
|
||||||
|
|
||||||
|
MKOBJDIRS Can be set to ``yes'' or ``no''. Indicates whether object
|
||||||
|
directories will be created automatically (via a ``make
|
||||||
|
obj'' pass) at the start of a build.
|
||||||
|
|
||||||
|
Default: ``yes''
|
||||||
|
|
||||||
|
MKTOOLS Indicates whether the host tools will be built and in-
|
||||||
|
stalled automatically if they are out-of-date.
|
||||||
|
|
||||||
|
yes Build tools as needed into TOOLDIR, but only if the
|
||||||
|
tools in question are out-of-date.
|
||||||
|
|
||||||
|
no Do not update the tools in TOOLDIR; halt the build
|
||||||
|
as a safety precaution if tools are out-of-date.
|
||||||
|
|
||||||
|
always
|
||||||
|
Always rebuild the tools in TOOLDIR from scratch
|
||||||
|
during a build. This is similar to the standard
|
||||||
|
NetBSD source tree build method, but is not typi-
|
||||||
|
cally required for host tools.
|
||||||
|
|
||||||
|
Default: ``no''
|
||||||
|
|
||||||
|
NBUILDJOBS If set, specifies the number of parallel make(1) processes
|
||||||
|
that should be run simultaneously. This can speed up
|
||||||
|
builds on SMP machines, or machines with much more CPU
|
||||||
|
power than I/O availability. This should be used instead
|
||||||
|
of the make(1) option -j, in order to ensure proper order-
|
||||||
|
ing of build components.
|
||||||
|
|
||||||
|
Default: Unset.
|
||||||
|
|
||||||
|
NOCLEANDIR If set, avoids the ``make cleandir'' 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.
|
||||||
|
|
||||||
|
Default: Unset.
|
||||||
|
|
||||||
|
NODISTRIBDIRS If set, avoids the ``make distrib-dirs'' phase of a full
|
||||||
|
build. This skips running mtree(1) on DESTDIR, useful on
|
||||||
|
systems where building as an unprivileged user, or where
|
||||||
|
it is known that the system-wide mtree files have not
|
||||||
|
changed.
|
||||||
|
|
||||||
|
Default: Unset.
|
||||||
|
|
||||||
|
NOINCLUDES If set, avoids the ``make includes'' phase of a full
|
||||||
|
build. This has the effect of preventing make(1) from
|
||||||
|
thinking that some programs are out-of-date simply because
|
||||||
|
the system include files have changed. However, this op-
|
||||||
|
tion should not be used when updating the entire NetBSD
|
||||||
|
source tree arbitrarily; it is suggested to use UPDATE in
|
||||||
|
that case.
|
||||||
|
|
||||||
|
Default: Unset.
|
||||||
|
|
||||||
|
RELEASEDIR If set, specifies the directory to which a release(7) lay-
|
||||||
|
out will be written at the end of a ``make release''.
|
||||||
|
|
||||||
|
Default: Unset.
|
||||||
|
|
||||||
|
UPDATE If set, then in addition to the effects described for UP-
|
||||||
|
DATE above, this implies the effects of NOCLEANDIR.
|
||||||
|
|
||||||
|
BUILDING
|
||||||
|
make command line options
|
||||||
|
This is only a summary of options available to make(1); only the options
|
||||||
|
used most frequently with NetBSD builds are listed here.
|
||||||
|
|
||||||
|
-m dir Specify the default directory for searching for system Make-
|
||||||
|
file segments, mainly the <bsd.*.mk> files. When building any
|
||||||
|
full NetBSD source tree, this should be set to the
|
||||||
|
``share/mk'' directory in the source tree. (This is set auto-
|
||||||
|
matically when building from the top level.)
|
||||||
|
|
||||||
|
-n Display the commands that would have been executed, but do not
|
||||||
|
actually execute them. This will still cause recursion to
|
||||||
|
take place.
|
||||||
|
|
||||||
|
-v var Print make(1)'s idea of the value of var. Does not build any
|
||||||
|
targets.
|
||||||
|
|
||||||
|
var=value Set the variable var to value, overriding any setting speci-
|
||||||
|
fied by the process environment, the MAKECONF configuration
|
||||||
|
file, or the system Makefile segments.
|
||||||
|
|
||||||
|
make targets
|
||||||
|
These default targets may be built by running make(1) in any subtree of
|
||||||
|
the NetBSD source code. It is recommended that none of these be used
|
||||||
|
from the top level Makefile; as a specific exception, ``make obj'' and
|
||||||
|
``make cleandir'' are useful in that context.
|
||||||
|
|
||||||
|
all Build programs, libraries, and preformatted documentation.
|
||||||
|
|
||||||
|
clean Remove program and library object code files.
|
||||||
|
|
||||||
|
cleandir Same as clean, but also remove preformatted documentation, de-
|
||||||
|
pendency files generated by ``make depend'', and any other
|
||||||
|
files known to be created at build time. ``make distclean''
|
||||||
|
may be used as a synonym, for familiarity with a similar well-
|
||||||
|
known convention.
|
||||||
|
|
||||||
|
depend Create dependency files (.depend) containing more detailed in-
|
||||||
|
formation about the dependencies of source code on header
|
||||||
|
files. Allows programs to be recompiled automatically when a
|
||||||
|
dependency changes.
|
||||||
|
|
||||||
|
dependall Does a ``make depend'' immediately followed by a ``make all''.
|
||||||
|
This combined target recurses as an atomic unit, so that the
|
||||||
|
``make depend'' phase can participate in make -j parallelism.
|
||||||
|
|
||||||
|
includes Build and install system header files. Typically needed be-
|
||||||
|
fore any system libraries or programs can be built.
|
||||||
|
|
||||||
|
install Install programs, libraries, and documentation into DESTDIR.
|
||||||
|
|
||||||
|
lint Run lint(1) against the C source code, where appropriate, and
|
||||||
|
generate system-installed lint libraries.
|
||||||
|
|
||||||
|
obj Create object directories to be used for built files, instead
|
||||||
|
of building directly in the source tree.
|
||||||
|
|
||||||
|
tags Create ctags(1) searchable function lists usable by the ex(1)
|
||||||
|
and vi(1) text editors.
|
||||||
|
|
||||||
|
make targets for the top level
|
||||||
|
Additional make(1) targets are usable specifically from the top source
|
||||||
|
level to facilitate building the entire NetBSD source tree.
|
||||||
|
|
||||||
|
build Build the entire NetBSD system. This orders portions of the
|
||||||
|
source tree such that prerequisites will be built in the prop-
|
||||||
|
er order.
|
||||||
|
|
||||||
|
release Do a ``make build'', then package the system into a standard
|
||||||
|
release layout as described by release(7). This requires that
|
||||||
|
RELEASEDIR be set (see above).
|
||||||
|
|
||||||
|
regression-tests
|
||||||
|
Can only be run after building the regression tests in the di-
|
||||||
|
rectory ``regress''. Runs the compiled regression tests on
|
||||||
|
the local host.
|
||||||
|
|
||||||
|
The build.sh script
|
||||||
|
This script file is a Bourne shell script designed to build the entire
|
||||||
|
NetBSD system on any host with a Bourne shell in /bin/sh, including many
|
||||||
|
that are not POSIX compliant. Note that if a host system's /bin/sh is
|
||||||
|
unusually old and broken, the Korn Shell (/bin/ksh), if available, may be
|
||||||
|
a usable alternative.
|
||||||
|
|
||||||
|
All cross-compile builds, and most native builds, of the entire system
|
||||||
|
should make use of build.sh rather than just running ``make''. This way,
|
||||||
|
the make(1) program will be bootstrapped properly, in case the host sys-
|
||||||
|
tem has an older or incompatible ``make'' program.
|
||||||
|
|
||||||
|
When compiling the entire system via build.sh, many make(1) variables are
|
||||||
|
set for you in order to help encapsulate the build process. In particu-
|
||||||
|
lar, both USETOOLS and MKTOOLS are set to ``yes'', and MACHINE_ARCH (if
|
||||||
|
unset) is deduced from the value of MACHINE.
|
||||||
|
|
||||||
|
The variables DESTDIR, MACHINE, MACHINE_ARCH, and TOOLDIR are required in
|
||||||
|
order for build.sh to function, and thus they cannot be set in the con-
|
||||||
|
figuration file specified by MAKECONF. They may be set either in the
|
||||||
|
process environment, or via command line options to build.sh.
|
||||||
|
|
||||||
|
The following are available command line options that may be supplied to
|
||||||
|
build.sh:
|
||||||
|
|
||||||
|
-a arch Set the value of MACHINE_ARCH to arch.
|
||||||
|
|
||||||
|
-D dest Set the value of DESTDIR to dest.
|
||||||
|
|
||||||
|
-j njob Set the value of NBUILDJOBS to njob. This provides similar
|
||||||
|
functionality to the familiar ``make -j'', but preserves the
|
||||||
|
ordering of the top level ``make build''.
|
||||||
|
|
||||||
|
-m mach Set the value of MACHINE to mach. This will also override any
|
||||||
|
value of MACHINE_ARCH in the process environment with a value
|
||||||
|
deduced from mach, unless -a is specified.
|
||||||
|
|
||||||
|
-R rel Set the value of RELEASEDIR to rel. Setting this option will
|
||||||
|
make build.sh run ``make release'' instead of ``make build''.
|
||||||
|
|
||||||
|
-r Remove the contents of DESTDIR and TOOLDIR before building
|
||||||
|
(provides a clean starting point).
|
||||||
|
|
||||||
|
-T tools Set the value of TOOLDIR to tools.
|
||||||
|
|
||||||
|
The nbmake-MACHINE wrapper script
|
||||||
|
If using the build.sh script to build NetBSD, a nbmake-MACHINE script
|
||||||
|
will be created in TOOLDIR/bin upon the first build to assist in building
|
||||||
|
subtrees on a cross-compile host.
|
||||||
|
|
||||||
|
nbmake-MACHINE can be invoked in lieu of make(1), and will instead call
|
||||||
|
the up-to-date version of ``nbmake'' installed into TOOLDIR/bin with sev-
|
||||||
|
eral key variables pre-set, including MACHINE, MACHINE_ARCH, and TOOLDIR.
|
||||||
|
This script can be symlinked into a directory listed in PATH, or called
|
||||||
|
with an absolute path.
|
||||||
|
|
||||||
|
SEE ALSO
|
||||||
|
make(1), hier(7), release(7)
|
||||||
|
|
||||||
|
BUGS
|
||||||
|
Many platforms are not yet using the USE_NEW_TOOLCHAIN system.
|
||||||
|
|
||||||
|
HISTORY
|
||||||
|
The USE_NEW_TOOLCHAIN based build scheme was introduced in the ``NetBSD-
|
||||||
|
current'' development sources between NetBSD 1.5 and NetBSD 1.6.
|
||||||
|
|
||||||
|
NetBSD October 29, 2001 7
|
Loading…
Reference in New Issue