Home | History | Annotate | Line # | Download | only in src
BUILDING revision 1.51
      1 BUILDING(8)             NetBSD System Manager's Manual             BUILDING(8)
      2 
      3 NAME
      4      BUILDING - Procedure for building NetBSD from source code.
      5 
      6 STATUS
      7      This document is a work-in-progress.  As such, the information described
      8      here may not match the reality of the build system as of this writing.
      9      Once this document is completely in sync with reality, this paragraph
     10      will be removed.
     11 
     12      Discrepancies between this documentation and the current reality of
     13      implementation are noted specially, as with the note below:
     14 
     15      Note: This document applies only to platforms which use the new toolchain
     16      as indicated by the default setting of TOOLCHAIN_MISSING in <bsd.own.mk>.
     17      Platforms which have not yet been switched to the new toolchain should
     18      continue building traditionally, using the notes specified in the file
     19      UPDATING.
     20 
     21 REQUIREMENTS
     22      NetBSD is designed to be buildable on most POSIX-compliant host systems.
     23      The basic build procedure is the same whether compiling natively (on the
     24      same NetBSD architecture) or cross compiling (on another architecture or
     25      OS).
     26 
     27      This source tree contains a special subtree, ``tools'', which uses the
     28      host system to create a build toolchain for the target architecture.  The
     29      host system must have at least C and C++ compilers in order to create the
     30      toolchain (make is not required); all other tools are created as part of
     31      the NetBSD build process.
     32 
     33 FILES
     34    Source tree layout
     35      doc/BUILDING.mdoc
     36                     This document (in -mdoc troff format; the original copy).
     37 
     38      BUILDING       This document (in plaintext).
     39 
     40      tools/compat/README
     41                     Special notes for cross-hosting a NetBSD build on non-
     42                     NetBSD platforms.
     43 
     44      Makefile       The main Makefile for NetBSD; should only be run for
     45                     native builds with an appropriately up-to-date version of
     46                     NetBSD make(1).  (For building from out-of-date systems or
     47                     on a non-native host, see the build.sh shell script.)
     48 
     49      UPDATING       Special notes for updating from an earlier revision of
     50                     NetBSD.  It is important to read this file before every
     51                     build of an updated source tree.
     52 
     53      build.sh       Bourne-compatible shell script used for building the host
     54                     build tools and the NetBSD system from scratch.  Can be
     55                     used for both native and cross builds, and should be used
     56                     instead of make(1) for any source tree that is updated and
     57                     recompiled regularly.
     58 
     59      crypto/dist/, dist/, gnu/dist/
     60                     Sources imported verbatim from third parties, without man-
     61                     gling the existing build structure.  Other source trees in
     62                     bin through usr.sbin use the NetBSD make(1) ``reachover''
     63                     Makefile semantics when building these programs for a
     64                     native host.
     65 
     66      distrib/, etc/
     67                     Sources for items used when making a full release snap-
     68                     shot, such as files installed in DESTDIR/etc on the desti-
     69                     nation system, boot media, and release notes.
     70 
     71      regress/       Regression test harness.  Can be cross-compiled, but only
     72                     run natively.
     73 
     74      sys/           NetBSD kernel sources.
     75 
     76      tools/         ``Reachover'' build structure for the host build tools.
     77                     This has a special method of determining out-of-date sta-
     78                     tus.
     79 
     80      bin/ ... usr.sbin/
     81                     Sources to the NetBSD userland (non-kernel) programs.  If
     82                     any of these directories are missing, they will be skipped
     83                     during the build.
     84 
     85      x11/           ``Reachover'' build structure for X11R6; the source is in
     86                     X11SRCDIR.
     87 
     88    Build tree layout
     89      The NetBSD build tree is described in hier(7), and the release layout is
     90      described in release(7).
     91 
     92 CONFIGURATION
     93    Environment variables
     94      Several environment variables control the behaviour of NetBSD builds.
     95 
     96      MACHINE           Machine type.
     97 
     98      MACHINE_ARCH      Machine architecture.
     99 
    100      MAKE              Path name to invoke make(1) as.
    101 
    102      MAKEFLAGS         Flags to invoke make(1) with.
    103 
    104      MAKEOBJDIR        Directory to use as the .OBJDIR for the current direc-
    105                        tory.  Used only if MAKEOBJDIRPREFIX is not defined.
    106                        MAKEOBJDIR can only be provided in the environment or
    107                        via the -O flag of build.sh.
    108 
    109      MAKEOBJDIRPREFIX  Top level directory of the object directory tree.  If
    110                        this is defined, ${MAKEOBJDIRPREFIX}/${.CURDIR} is used
    111                        as the .OBJDIR for the current directory.  The current
    112                        directory may be read only.  MAKEOBJDIRPREFIX can only
    113                        be provided in the environment or via the -M flag of
    114                        build.sh.
    115 
    116    "make" variables
    117      Several variables control the behavior of NetBSD builds.  Unless other-
    118      wise specified, these variables may be set in either the process environ-
    119      ment or the make(1) configuration file specified by MAKECONF.
    120 
    121      BUILDID     Identifier for the build.  The identifier will be appended to
    122                  object directory names, and can be consulted in the make(1)
    123                  configuration file in order to set additional build parame-
    124                  ters, such as compiler flags.
    125 
    126      DESTDIR     Directory to contain the built NetBSD system.  If set, spe-
    127                  cial options are passed to the compilation tools to prevent
    128                  their default use of the host system's /usr/include,
    129                  /usr/lib, and so forth.  This pathname should not end with a
    130                  slash (/) character (for installation into the system's root
    131                  directory, set DESTDIR to an empty string).  The directory
    132                  must reside on a file system which supports long file names
    133                  and hard links.
    134 
    135                  Default: Empty string if USETOOLS is ``yes''; unset other-
    136                  wise.
    137 
    138                  Note: build.sh will provide a default of destdir.MACHINE (in
    139                  the top-level .OBJDIR) unless run in `expert' mode
    140 
    141      MAKECONF    The name of the make(1) configuration file.  Only settable in
    142                  the process environment.
    143 
    144                  Default: ``/etc/mk.conf''
    145 
    146      MAKEVERBOSE
    147                  Level of verbosity of status messages.  Supported values:
    148 
    149                  0    No descriptive messages are shown.
    150 
    151                  1    Descriptive messages are shown.
    152 
    153                  2    Descriptive messages (prefixed with a `#') and command
    154                       output is not suppressed.
    155 
    156                  Default: 2
    157 
    158      MKCATPAGES  Can be set to ``yes'' or ``no''.  Indicates whether prefor-
    159                  matted plaintext manual pages will be created during a build.
    160 
    161                  Default: ``yes''
    162 
    163      MKCRYPTO    Can be set to ``yes'' or ``no''.  Indicates whether crypto-
    164                  graphic code will be included in a build; provided for the
    165                  benefit of countries that do not allow strong cryptography.
    166                  Will not affect use of the standard low-security password
    167                  encryption system, crypt(3).
    168 
    169                  Default: ``yes''
    170 
    171      MKDOC       Can be set to ``yes'' or ``no''.  Indicates whether system
    172                  documentation destined for DESTDIR/usr/share/doc will be
    173                  installed during a build.
    174 
    175                  Default: ``yes''
    176 
    177      MKHOSTOBJ   Can be set to ``yes'' or ``no''.  If set to ``yes'', then for
    178                  programs intended to be run on the compile host, the name,
    179                  release, and architecture of the host operating system will
    180                  be suffixed to the name of the object directory created by
    181                  ``make obj''.  (This allows multiple host systems to compile
    182                  NetBSD for a single target.)  If set to ``no'', then programs
    183                  built to be run on the compile host will use the same object
    184                  directory names as programs built to be run on the target.
    185 
    186                  Default: ``no''
    187 
    188      MKINFO      Can be set to ``yes'' or ``no''.  Indicates whether GNU Info
    189                  files, used for the documentation for most of the compilation
    190                  tools, will be created and installed during a build.
    191 
    192                  Default: ``yes''
    193 
    194      MKLINT      Can be set to ``yes'' or ``no''.  Indicates whether lint(1)
    195                  will be run against portions of the NetBSD source code during
    196                  the build, and whether lint libraries will be installed into
    197                  DESTDIR/usr/libdata/lint.
    198 
    199                  Default: ``yes''
    200 
    201      MKMAN       Can be set to ``yes'' or ``no''.  Indicates whether manual
    202                  pages will be installed during a build.
    203 
    204                  Default: ``yes''
    205 
    206      MKNLS       Can be set to ``yes'' or ``no''.  Indicates whether Native
    207                  Language System locale zone files will be compiled and
    208                  installed during a build.
    209 
    210                  Default: ``yes''
    211 
    212      MKOBJ       Can be set to ``yes'' or ``no''.  Indicates whether object
    213                  directories will be created when running ``make obj''.  If
    214                  set to ``no'', then all built files will be located inside
    215                  the regular source tree.
    216 
    217                  Default: ``yes''
    218 
    219      MKPIC       Can be set to ``yes'' or ``no''.  Indicates whether shared
    220                  objects and libraries will be created and installed during a
    221                  build.  If set to ``no'', the entire built system will be
    222                  statically linked.
    223 
    224                  Default: Platform dependent.  As of this writing, all plat-
    225                  forms except sh3 default to ``yes''.
    226 
    227      MKPICINSTALL
    228                  Can be set to ``yes'' or ``no''.  Indicates whether the ar(1)
    229                  format libraries (lib*_pic.a), used to generate shared
    230                  libraries, are installed during a build.
    231 
    232                  Default: ``yes''
    233 
    234      MKPROFILE   Can be set to ``yes'' or ``no''.  Indicates whether profiled
    235                  libraries (lib*_p.a) will be built and installed during a
    236                  build.
    237 
    238                  Default: ``yes''; however, some platforms turn off MKPROFILE
    239                  by default at times due to toolchain problems with profiled
    240                  code.
    241 
    242      MKSHARE     Can be set to ``yes'' or ``no''.  Indicates whether files
    243                  destined to reside in DESTDIR/usr/share will be built and
    244                  installed during a build.  If set to ``no'', then all of
    245                  MKCATPAGES, MKDOC, MKINFO, MKMAN, and MKNLS will be set to
    246                  ``no'' unconditionally.
    247 
    248                  Default: ``yes''
    249 
    250      MKTTINTERP  Can be set to ``yes'' or ``no''.  For X builds, decides if
    251                  the TrueType bytecode interpreter is turned on.  See
    252                  http://www.freetype.org/patents.html for details.
    253 
    254                  Default: ``no''
    255 
    256      MKUNPRIVED  Can be set to ``yes'' or ``no''.  Indicates whether an
    257                  unprivileged install will occur.  The user, group, permis-
    258                  sions, and file flags, will not be set on the installed item;
    259                  instead the information will be appended to a file called
    260                  METALOG in DESTDIR.  The contents of METALOG is used during
    261                  the generation of the distribution tar files to ensure that
    262                  the appropriate file ownership is stored.
    263 
    264                  Default: ``no''
    265 
    266      MKUPDATE    Can be set to ``yes'' or ``no''.  Indicates whether all
    267                  install operations intended to write to DESTDIR will compare
    268                  file timestamps before installing, and skip the install phase
    269                  if the destination files are up-to-date.  This also has
    270                  implications on full builds (see next subsection).
    271 
    272                  Default: ``no''
    273 
    274      MKX11       Can be set to ``yes'' or ``no''.  Indicates whether X11R6 is
    275                  built from X11SRCDIR.
    276 
    277                  Default: ``no''
    278 
    279      TOOLDIR     Directory to hold the host tools, once built.  This directory
    280                  should be unique to a given host system and NetBSD source
    281                  tree.  (However, multiple targets may share the same TOOLDIR;
    282                  the target-dependent files have unique names.)  If unset, a
    283                  default based on the uname(1) information of the host plat-
    284                  form will be created in the .OBJDIR of src.
    285 
    286                  Default: Unset.
    287 
    288      USETOOLS    Indicates whether the tools specified by TOOLDIR should be
    289                  used as part of a build in progress.  Must be set to ``yes''
    290                  if cross-compiling.
    291 
    292                  yes    Use the tools from TOOLDIR.
    293 
    294                  no     Do not use the tools from TOOLDIR, but refuse to build
    295                         native compilation tool components that are version-
    296                         specific for that tool.
    297 
    298                  never  Do not use the tools from TOOLDIR, even when building
    299                         native tool components.  This is similar to the tradi-
    300                         tional NetBSD build method, but does not verify that
    301                         the compilation tools in use are up-to-date enough in
    302                         order to build the tree successfully.  This may cause
    303                         build or runtime problems when building the whole
    304                         NetBSD source tree.
    305 
    306                  Default: ``yes'' if building all or part of a whole NetBSD
    307                  source tree (detected automatically); ``no'' otherwise (to
    308                  preserve traditional semantics of the <bsd.*.mk> make(1)
    309                  include files).
    310 
    311      X11SRCDIR   Directory containing the X11R6 source.  The main X11R6 source
    312                  is found in X11SRCDIR/xfree/xc.
    313 
    314                  Default: ``/usr/xsrc''
    315 
    316    "make" variables for full builds
    317      These variables only affect the top level ``Makefile'' and do not affect
    318      manually building subtrees of the NetBSD source code.
    319 
    320      INSTALLWORLDDIR  Location for the ``make installworld'' target to install
    321                       to.
    322 
    323                       Default: ``/''
    324 
    325      MKOBJDIRS        Can be set to ``yes'' or ``no''.  Indicates whether
    326                       object directories will be created automatically (via a
    327                       ``make obj'' pass) at the start of a build.
    328 
    329                       Default: ``no''
    330 
    331      MKUPDATE         Can be set to ``yes'' or ``no''.  If set, then in addi-
    332                       tion to the effects described for MKUPDATE=yes above,
    333                       this implies the effects of NOCLEANDIR (i.e., ``make
    334                       cleandir'' is avoided).
    335 
    336                       Default: ``no''
    337 
    338      NBUILDJOBS       Now obsolete.  Use the make(1) option -j, instead (see
    339                       below)
    340 
    341                       Default: Unset.
    342 
    343      NOCLEANDIR       If set, avoids the ``make cleandir'' phase of a full
    344                       build.  This has the effect of allowing only changed
    345                       files in a source tree to be recompiled.  This can speed
    346                       up builds when updating only a few files in the tree.
    347 
    348                       Default: Unset.
    349 
    350      NODISTRIBDIRS    If set, avoids the ``make distrib-dirs'' phase of a full
    351                       build.  This skips running mtree(8) on DESTDIR, useful
    352                       on systems where building as an unprivileged user, or
    353                       where it is known that the system-wide mtree files have
    354                       not changed.
    355 
    356                       Default: Unset.
    357 
    358      NOINCLUDES       If set, avoids the ``make includes'' phase of a full
    359                       build.  This has the effect of preventing make(1) from
    360                       thinking that some programs are out-of-date simply
    361                       because the system include files have changed.  However,
    362                       this option should not be used when updating the entire
    363                       NetBSD source tree arbitrarily; it is suggested to use
    364                       MKUPDATE=yes in that case.
    365 
    366                       Default: Unset.
    367 
    368      RELEASEDIR       If set, specifies the directory to which a release(7)
    369                       layout will be written at the end of a ``make release''.
    370 
    371                       Default: Unset.
    372 
    373                       Note: build.sh will provide a default of releasedir (in
    374                       the top-level .OBJDIR) unless run in `expert' mode
    375 
    376 BUILDING
    377    "make" command line options
    378      This is only a summary of options available to make(1); only the options
    379      used most frequently with NetBSD builds are listed here.
    380 
    381      -j njob    Run up to njob make(1) subjobs in parallel.  Makefiles should
    382                 use .WAIT or have explicit dependancies as necessary to
    383                 enforce build ordering.  If you see build failures with -j,
    384                 please save complete build logs so the failures can be ana-
    385                 lyzed.
    386 
    387      -m dir     Specify the default directory for searching for system Make-
    388                 file segments, mainly the <bsd.*.mk> files.  When building any
    389                 full NetBSD source tree, this should be set to the
    390                 ``share/mk'' directory in the source tree.  (This is set auto-
    391                 matically when building from the top level.)
    392 
    393      -n         Display the commands that would have been executed, but do not
    394                 actually execute them.  This will still cause recursion to
    395                 take place.
    396 
    397      -V var     Print make(1)'s idea of the value of var.  Does not build any
    398                 targets.
    399 
    400      var=value  Set the variable var to value, overriding any setting speci-
    401                 fied by the process environment, the MAKECONF configuration
    402                 file, or the system Makefile segments.
    403 
    404    "make" targets
    405      These default targets may be built by running make(1) in any subtree of
    406      the NetBSD source code.  It is recommended that none of these be used
    407      from the top level Makefile; as a specific exception, ``make obj'' and
    408      ``make cleandir'' are useful in that context.
    409 
    410      all        Build programs, libraries, and preformatted documentation.
    411 
    412      clean      Remove program and library object code files.
    413 
    414      cleandir   Same as clean, but also remove preformatted documentation,
    415                 dependency files generated by ``make depend'', and any other
    416                 files known to be created at build time.
    417 
    418      depend     Create dependency files (.depend) containing more detailed
    419                 information about the dependencies of source code on header
    420                 files.  Allows programs to be recompiled automatically when a
    421                 dependency changes.
    422 
    423      dependall  Does a ``make depend'' immediately followed by a ``make all''.
    424                 This improves cache locality of the build since both passes
    425                 read the source files in their entirety.
    426 
    427      distclean  Synonym for cleandir.
    428 
    429      includes   Build and install system header files.  Typically needed
    430                 before any system libraries or programs can be built.
    431 
    432      install    Install programs, libraries, and documentation into DESTDIR.
    433                 Few files will be installed to DESTDIR/dev, DESTDIR/etc,
    434                 DESTDIR/root or DESTDIR/var in order to prevent user supplied
    435                 configuration data from being overwritten.
    436 
    437      lint       Run lint(1) against the C source code, where appropriate, and
    438                 generate system-installed lint libraries.
    439 
    440      obj        Create object directories to be used for built files, instead
    441                 of building directly in the source tree.
    442 
    443      tags       Create ctags(1) searchable function lists usable by the ex(1)
    444                 and vi(1) text editors.
    445 
    446    "make" targets for the top level
    447      Additional make(1) targets are usable specifically from the top source
    448      level to facilitate building the entire NetBSD source tree.
    449 
    450      build         Build the entire NetBSD system.  This orders portions of
    451                    the source tree such that prerequisites will be built in
    452                    the proper order.
    453 
    454      distribution  Do a ``make build'', and then install a full distribution
    455                    into DESTDIR, including files in DESTDIR/dev, DESTDIR/etc,
    456                    DESTDIR/root and DESTDIR/var.
    457 
    458      buildworld    As per ``make distribution'', except that it ensures that
    459                    DESTDIR is not the root directory.
    460 
    461      installworld  Install the distribution from DESTDIR to INSTALLWORLDDIR
    462                    (which defaults to the root directory).  Ensures that
    463                    INSTALLWORLDDIR is the not root directory if cross compil-
    464                    ing.
    465 
    466                    Note: It is highly recommended that you upgrade your kernel
    467                    and reboot before performing this operation.
    468 
    469      sets          Create distribution sets from DESTDIR into
    470                    RELEASEDIR/MACHINE/binary/sets.  Should be run after ``make
    471                    distribution'' (as ``make build'' does not install all of
    472                    the required files).
    473 
    474      sourcesets    Create source sets of the source tree into
    475                    RELEASEDIR/source/sets.
    476 
    477      release       Do a ``make distribution'', build kernels, distribution
    478                    media, and install sets (this as per ``make sets''), and
    479                    then package the system into a standard release layout as
    480                    described by release(7).  This requires that RELEASEDIR be
    481                    set (see above).
    482 
    483      regression-tests
    484                    Can only be run after building the regression tests in the
    485                    directory ``regress''.  Runs the compiled regression tests
    486                    on the local host.
    487 
    488    The "build.sh" script
    489      This script file is a Bourne shell script designed to build the entire
    490      NetBSD system on any host with a Bourne shell in /bin/sh, including many
    491      that are not POSIX compliant.  Note that if a host system's /bin/sh is
    492      unusually old and broken, the Korn Shell (/bin/ksh), if available, may be
    493      a usable alternative.
    494 
    495      All cross-compile builds, and most native builds, of the entire system
    496      should make use of build.sh rather than just running ``make''.  This way,
    497      the make(1) program will be bootstrapped properly, in case the host sys-
    498      tem has an older or incompatible ``make'' program.
    499 
    500      When compiling the entire system via build.sh, many make(1) variables are
    501      set for you in order to help encapsulate the build process.  In the list
    502      of options below, variables that are automatically set by build.sh are
    503      noted where applicable.
    504 
    505      The following operations are supported by build.sh:
    506 
    507      build         Build the system as per ``make build''.  This option
    508                    implies the obj and tools operations.
    509 
    510      distribution  Build a full distribution as per ``make distribution''.
    511                    This option implies the build operation.
    512 
    513      release       Build a full release as per ``make release''.  This option
    514                    implies the distribution operation.
    515 
    516      makewrapper   Create the nbmake-MACHINE wrapper.  This operation is auto-
    517                    matically performed for any of the other operations.
    518 
    519      obj           Perform ``make obj''.
    520 
    521      tools         Build and install the host tools from src/tools.
    522 
    523      install=idir  Install the contents of DESTDIR to idir, using ``make
    524                    installworld''.
    525 
    526      kernel=kconf  Build a new kernel.  The kconf argument is the name of a
    527                    configuration file suitable for use by config(8).  If kconf
    528                    does not contain any `/' characters, the configuration file
    529                    is expected to be found in the KERNCONFDIR directory, which
    530                    is typically sys/arch/MACHINE/conf.  The new kernel will be
    531                    built in a subdirectory of KERNOBJDIR, which is typically
    532                    sys/arch/MACHINE/compile or an associated object directory.
    533                    In order to ensure that the kernel is built using up-to-
    534                    date tools, it is strongly recommended that the tools be
    535                    rebuilt (using the tools operation).
    536 
    537      releasekernel=kconf
    538                    Install a gzip(1)ed copy of the kernel built by
    539                    kernel=kconf into RELEASEDIR/MACHINE/binary/kernel, usually
    540                    as netbsd-kconf.gz, although the ``netbsd'' prefix is
    541                    determined from the ``config'' directives in kconf.
    542 
    543      sets          Perform ``make sets''.
    544 
    545      sourcesets    Perform ``make sourcesets''.
    546 
    547      The following command line options alter the behaviour of the build.sh
    548      operations described above:
    549 
    550      -a arch   Set the value of MACHINE_ARCH to arch.
    551 
    552      -B buildid
    553                Set the value of BUILDID to buildid.  This will also append the
    554                build idenfitier to the name of the ``make'' wrapper script so
    555                that the resulting name is of the form
    556                ``nbmake-MACHINE-BUILDID''.
    557 
    558      -D dest   Set the value of DESTDIR to dest.
    559 
    560      -E        Set `expert' mode.  This overrides various sanity checks, and
    561                allows: DESTDIR does not have to be set to a non-root path for
    562                builds, and MKUNPRIVED=yes does not have to be set when build-
    563                ing as a non-root user.
    564 
    565                Note: It is highly recommended that you know what you are doing
    566                when you use this option.
    567 
    568      -h        Print a help message.
    569 
    570      -j njob   Passed through to make(1).  Makefiles should use .WAIT or have
    571                explicit dependancies as necessary to enforce build ordering.
    572                If you see build failures with -j, please save complete build
    573                logs so the failures can be analyzed.
    574 
    575      -M obj    Set MAKEOBJDIRPREFIX to obj.  Unsets MAKEOBJDIR.
    576 
    577      -m mach   Set the value of MACHINE to mach.  This will also override any
    578                value of MACHINE_ARCH in the process environment with a value
    579                deduced from mach, unless -a is specified, or mach is a special
    580                case listed below.  All cross builds require -m, but if unset
    581                on a NetBSD host, the host's value of MACHINE will be detected
    582                and used automatically.
    583 
    584                Some machines support multiple values for MACHINE_ARCH.  For a
    585                given value of mach, the following MACHINE and MACHINE_ARCH
    586                values will result:
    587 
    588                      mach          MACHINE    MACHINE_ARCH
    589                      evbmips       evbmips    (not set)
    590                      evbmips-eb    evbmips    mipseb
    591                      evbmips-el    evbmips    mipsel
    592                      evbsh3        evbsh3     (not set)
    593                      evbsh3-eb     evbsh3     sh3eb
    594                      evbsh3-el     evbsh3     sh3el
    595                      sbmips        sbmips     (not set)
    596                      sbmips-eb     sbmips     mipseb
    597                      sbmips-el     sbmips     mipsel
    598 
    599      -N noiselevel
    600                Set the ``noisyness'' level of the build, by setting
    601                MAKEVERBOSE to noiselevel.
    602 
    603      -n        Show the commands that would be executed by build.sh, but do
    604                not make any changes.  This is similar in concept to ``make
    605                -n''.
    606 
    607      -O obj    Create an appropriate transform macro for MAKEOBJDIR that will
    608                place the built object files under obj.  For instance, a set-
    609                ting of /usr/obj will place build-time files under
    610                /usr/obj/bin, /usr/obj/lib, /usr/obj/usr.bin, and so forth.
    611                Unsets MAKEOBJDIRPREFIX.
    612 
    613      -o        Set the value of MKOBJDIRS to ``no''.  Otherwise, it will be
    614                automatically set to ``yes'' (which is opposite to the default
    615                behaviour).
    616 
    617      -R rel    Set the value of RELEASEDIR to rel.
    618 
    619      -r        Remove the contents of DESTDIR and TOOLDIR before building
    620                (provides a clean starting point).  This will skip deleting
    621                DESTDIR if building on a native system to the root directory.
    622 
    623      -T tools  Set the value of TOOLDIR to tools.  If set, the bootstrap
    624                ``make'' will only be rebuilt as needed (when the source files
    625                for make(1) change).
    626 
    627      -U        Set MKUNPRIVED=yes.
    628 
    629      -u        Set MKUPDATE=yes.
    630 
    631      -V var=[value]
    632                Set the environment variable var to an optional value.  This is
    633                propagated to the nbmake wrapper.
    634 
    635      -w wrapper
    636                Create the nbmake wrapper script (see below) in a custom loca-
    637                tion, specified by wrapper.  This allows, for instance, to
    638                place the wrapper in PATH automatically.  Note that wrapper is
    639                the full name of the file, not just a directory name.
    640 
    641      -X x11src
    642                Set the value of X11SRCDIR to x11src.
    643 
    644      -x        Set MKX11=yes.
    645 
    646      -Z var    Unset ("zap") the environment variable var.  This is propagated
    647                to the nbmake wrapper.
    648 
    649    The "nbmake-MACHINE" wrapper script
    650      If using the build.sh script to build NetBSD, a nbmake-MACHINE script
    651      will be created in TOOLDIR/bin upon the first build to assist in building
    652      subtrees on a cross-compile host.
    653 
    654      nbmake-MACHINE can be invoked in lieu of make(1), and will instead call
    655      the up-to-date version of ``nbmake'' installed into TOOLDIR/bin with sev-
    656      eral key variables pre-set, including MACHINE, MACHINE_ARCH, and TOOLDIR.
    657      build.sh will also set variables specified with -V, and unset variables
    658      specified with -Z.
    659 
    660      This script can be symlinked into a directory listed in PATH, or called
    661      with an absolute path.
    662 
    663 EXAMPLES
    664      1.   % ./build.sh tools kernel=GENERIC
    665 
    666           Build a new toolchain, and use the new toolchain to configure and
    667           build a new GENERIC kernel.
    668 
    669      2.   % ./build.sh -U distribution
    670 
    671           Using unprivileged mode, build a complete distribution to a DESTDIR
    672           directory that build.sh selects (and will display).
    673 
    674      3.   # ./build.sh -U install=/
    675 
    676           As root, install to / the distribution that was built by example 2.
    677           Even though this is run as root, -U is required so that the permis-
    678           sions stored in DESTDIR/METALOG are correctly applied to the files
    679           as they're copied to /.
    680 
    681      4.   % ./build.sh -U -u release
    682 
    683           Using unprivileged mode, build a complete release to DESTDIR and
    684           RELEASEDIR directories that build.sh selects (and will display).
    685           MKUPDATE=yes (-u) is set to prevent the ``make cleandir'', so that
    686           if this is run after example 2, it doesn't need to redo that portion
    687           of the release build.
    688 
    689 OBSOLETE VARIABLES
    690      NBUILDJOBS  Use the make(1) option -j, instead.
    691 
    692      USE_NEW_TOOLCHAIN
    693                  The new toolchain is now the default.  To disable, use
    694                  TOOLCHAIN_MISSING=yes.
    695 
    696 SEE ALSO
    697      make(1), hier(7), release(7)
    698 
    699 HISTORY
    700      The build.sh based build scheme was introduced for NetBSD 1.6 as
    701      USE_NEW_TOOLCHAIN, and re-worked to TOOLCHAIN_MISSING after that.
    702 
    703 BUGS
    704      A few platforms are not yet using this build system.
    705 
    706 NetBSD                         February 6, 2003                         NetBSD
    707