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

Annotation of src/BUILDING, Revision 1.48

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

CVSweb <webmaster@jp.NetBSD.org>