(linenum→info "unix/slp.c:2238")

netbsdsrc/4.0/usr/src/BUILDING

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