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

Annotation of src/BUILDING, Revision 1.56

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

CVSweb <webmaster@jp.NetBSD.org>