[BACK]Return to BUILDING CVS log [TXT][DIR] Up to [cvs.NetBSD.org] / src

Annotation of src/BUILDING, Revision 1.34

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

CVSweb <webmaster@jp.NetBSD.org>