Home | History | Annotate | Line # | Download | only in src
BUILDING revision 1.152
      1  1.104       wiz BUILDING(8)                 System Manager's Manual                BUILDING(8)
      2    1.1        tv 
      3  1.105       wiz NAME
      4  1.150     lukem      BUILDING - Procedure for building NetBSD from source code
      5    1.1        tv 
      6  1.105       wiz REQUIREMENTS
      7    1.1        tv      NetBSD is designed to be buildable on most POSIX-compliant host systems.
      8  1.105       wiz      The basic build procedure is the same whether compiling natively (on the
      9  1.105       wiz      same NetBSD architecture) or cross compiling (on another architecture or
     10    1.1        tv      OS).
     11    1.1        tv 
     12  1.126       wiz      This source tree contains a special subtree, "tools", which uses the host
     13  1.126       wiz      system to create a build toolchain for the target architecture.  The host
     14  1.126       wiz      system must have at least C and C++ compilers in order to create the
     15  1.105       wiz      toolchain (make is not required); all other tools are created as part of
     16  1.147     lukem      the NetBSD build process.  (See the Environment variables section below
     17   1.53      reed      if you need to override or manually select your compilers.)
     18    1.1        tv 
     19  1.105       wiz FILES
     20  1.105       wiz    Source tree layout
     21  1.151     lukem      BUILDING       This document (in plaintext).  Generated from
     22  1.151     lukem                     doc/BUILDING.mdoc.
     23   1.48       jmc 
     24  1.105       wiz      Makefile       The main Makefile for NetBSD; should only be run for
     25   1.44     lukem                     native builds with an appropriately up-to-date version of
     26  1.142    andvar                     NetBSD make(1).  Intended for expert use with knowledge of
     27  1.129     sevan                     its shortcomings, it has been superseded by the build.sh
     28  1.129     sevan                     shell script as the recommended means for building NetBSD.
     29    1.1        tv 
     30  1.105       wiz      UPDATING       Special notes for updating from an earlier revision of
     31    1.1        tv                     NetBSD.  It is important to read this file before every
     32    1.1        tv                     build of an updated source tree.
     33    1.1        tv 
     34  1.105       wiz      build.sh       Bourne-compatible shell script used for building the host
     35    1.1        tv                     build tools and the NetBSD system from scratch.  Can be
     36    1.1        tv                     used for both native and cross builds, and should be used
     37  1.129     sevan                     instead of make(1) as it performs additional checks to
     38  1.129     sevan                     prevent common issues going undetected, such as building
     39  1.129     sevan                     with an outdated version of make(1).
     40    1.1        tv 
     41  1.105       wiz      crypto/dist/, dist/, gnu/dist/
     42  1.104       wiz                     Sources imported verbatim from third parties, without
     43  1.104       wiz                     mangling the existing build structure.  Other source trees
     44  1.126       wiz                     in bin through usr.sbin use the NetBSD make(1) "reachover"
     45  1.126       wiz                     Makefile semantics when building these programs for a
     46  1.126       wiz                     native host.
     47  1.104       wiz 
     48  1.151     lukem      distrib/, etc/
     49  1.151     lukem                     Sources for items used when making a full release
     50  1.151     lukem                     snapshot, such as files installed in DESTDIR/etc on the
     51  1.151     lukem                     destination system, boot media, and release notes.
     52  1.151     lukem 
     53  1.151     lukem      doc/BUILDING.mdoc
     54  1.151     lukem                     This document, in -mdoc troff format; the original copy.
     55  1.151     lukem                     Used to generate BUILDING.
     56  1.151     lukem 
     57  1.106       wiz      external, sys/external
     58  1.106       wiz                     Sources and build infrastructure for components imported
     59  1.106       wiz                     (mostly) unchanged from upstream maintainers, sorted by
     60  1.106       wiz                     applicable license.  This is (slowly) replacing the
     61  1.106       wiz                     crypto/dist, dist, and gnu/dist directories.
     62  1.106       wiz 
     63  1.151     lukem      external/mit/xorg/
     64  1.151     lukem                     "Reachover" build structure for modular Xorg; the source
     65  1.151     lukem                     is in X11SRCDIR.
     66    1.1        tv 
     67  1.151     lukem      regress/, tests/
     68   1.70  dholland                     Regression test harness.  Can be cross-compiled, but only
     69  1.105       wiz                     run natively.  tests/ uses the atf(7) test framework;
     70  1.105       wiz                     regress/ contains older tests that have not yet been
     71   1.70  dholland                     migrated to atf(7).
     72    1.1        tv 
     73  1.105       wiz      sys/           NetBSD kernel sources.
     74    1.1        tv 
     75  1.126       wiz      tools/         "Reachover" build structure for the host build tools.
     76  1.104       wiz                     This has a special method of determining out-of-date
     77  1.104       wiz                     status.
     78    1.1        tv 
     79  1.151     lukem      tools/compat/README
     80  1.151     lukem                     Special notes for cross-hosting a NetBSD build on non-
     81  1.151     lukem                     NetBSD platforms.
     82  1.151     lukem 
     83  1.151     lukem      Other directories including bin/ ... usr.sbin/
     84    1.1        tv                     Sources to the NetBSD userland (non-kernel) programs.  If
     85    1.1        tv                     any of these directories are missing, they will be skipped
     86    1.1        tv                     during the build.
     87    1.1        tv 
     88  1.105       wiz    Build tree layout
     89    1.1        tv      The NetBSD build tree is described in hier(7), and the release layout is
     90    1.1        tv      described in release(7).
     91    1.1        tv 
     92  1.105       wiz CONFIGURATION
     93  1.105       wiz    Environment variables
     94    1.8     lukem      Several environment variables control the behaviour of NetBSD builds.
     95    1.8     lukem 
     96  1.152     lukem      HOST_CC         Path name to C compiler used to create the toolchain.
     97   1.58       apb 
     98  1.152     lukem      HOST_CFLAGS     Flags passed to the host C compiler.
     99   1.53      reed 
    100  1.152     lukem      HOST_CXX        Path name to C++ compiler used to create the toolchain.
    101  1.137       uwe 
    102  1.152     lukem      HOST_CXXFLAGS   Flags passed to the host C++ compiler.
    103   1.53      reed 
    104  1.152     lukem      HOST_SH         Path name to a shell available on the host system and
    105  1.152     lukem                      suitable for use during the build.  The NetBSD build
    106  1.152     lukem                      system requires a modern Bourne-like shell with POSIX-
    107  1.152     lukem                      compliant features, and also requires support for the
    108  1.152     lukem                      "local" keyword to declare local variables in shell
    109  1.152     lukem                      functions (which is a widely-implemented but non-
    110  1.152     lukem                      standardised feature).
    111  1.152     lukem 
    112  1.152     lukem                      Depending on the host system, a suitable shell may be
    113  1.152     lukem                      /bin/sh, /usr/xpg4/bin/sh, /bin/ksh (provided it is a
    114  1.152     lukem                      variant of ksh that supports the "local" keyword, such as
    115  1.152     lukem                      ksh88, but not ksh93), or /usr/local/bin/bash.
    116  1.152     lukem 
    117  1.152     lukem                      Most parts of the build require HOST_SH to be an absolute
    118  1.152     lukem                      path; however, build.sh allows it to be a simple command
    119  1.152     lukem                      name, which will be converted to an absolute path by
    120  1.152     lukem                      searching the PATH.
    121  1.137       uwe 
    122  1.147     lukem      INSTALLBOOT_UBOOT_PATHS
    123  1.152     lukem                      A colon-separated list of search paths used by
    124  1.152     lukem                      installboot(8) to find U-Boot packages.
    125  1.147     lukem 
    126  1.152     lukem      MACHINE         Machine type, e.g., "macppc".
    127    1.8     lukem 
    128  1.152     lukem      MACHINE_ARCH    Machine architecture, e.g., "powerpc".
    129    1.8     lukem 
    130  1.152     lukem      MAKE            Path name to invoke make(1) as.
    131    1.8     lukem 
    132  1.152     lukem      MAKECONF        The name of the make(1) configuration file.  See "make"
    133  1.152     lukem                      variables and mk.conf(5).
    134  1.151     lukem 
    135  1.152     lukem                      Note: Only settable in the process environment.
    136  1.151     lukem 
    137  1.152     lukem                      Default: "/etc/mk.conf"
    138  1.151     lukem 
    139  1.152     lukem      MAKEFLAGS       Flags to invoke make(1) with.
    140  1.151     lukem 
    141  1.152     lukem                      Note: build.sh ignores the value of MAKEFLAGS passed in
    142  1.152     lukem                      the environment, but allows MAKEFLAGS to be set via the
    143  1.152     lukem                      -V option.
    144  1.151     lukem 
    145  1.152     lukem      MAKEOBJDIR      Directory to use as the .OBJDIR for the current
    146  1.152     lukem                      directory.  The value is subjected to variable expansion
    147  1.152     lukem                      by make(1).  Typical usage is to set this variable to a
    148  1.152     lukem                      value involving the use of `${.CURDIR:S...}' or
    149  1.152     lukem                      `${.CURDIR:C...}', to derive the value of .OBJDIR from
    150  1.152     lukem                      the value of .CURDIR.  Used only if MAKEOBJDIRPREFIX is
    151  1.152     lukem                      not defined.
    152  1.151     lukem 
    153  1.152     lukem                      Note: MAKEOBJDIR can be provided only in the environment
    154  1.152     lukem                      or via the -O flag of build.sh; it cannot usefully be set
    155  1.152     lukem                      inside a Makefile, including in mk.conf(5) or MAKECONF.
    156  1.151     lukem 
    157  1.151     lukem      MAKEOBJDIRPREFIX
    158  1.152     lukem                      Top level directory of the object directory tree.  The
    159  1.152     lukem                      value is subjected to variable expansion by make(1).
    160  1.152     lukem                      build.sh will create the ${MAKEOBJDIRPREFIX} directory if
    161  1.152     lukem                      necessary, but if make(1) is used without build.sh, then
    162  1.152     lukem                      rules in <bsd.obj.mk> will abort the build if the
    163  1.152     lukem                      ${MAKEOBJDIRPREFIX} directory does not exist.  If the
    164  1.152     lukem                      value is defined and valid, then
    165  1.152     lukem                      ${MAKEOBJDIRPREFIX}/${.CURDIR} is used as the .OBJDIR for
    166  1.152     lukem                      the current directory.  The current directory may be read
    167  1.152     lukem                      only.
    168  1.152     lukem 
    169  1.152     lukem                      Note: MAKEOBJDIRPREFIX can be provided only in the
    170  1.152     lukem                      environment or via the -M flag of build.sh; it cannot
    171  1.152     lukem                      usefully be set inside a Makefile, including in
    172  1.152     lukem                      mk.conf(5) or MAKECONF.
    173  1.152     lukem 
    174  1.152     lukem      TMPDIR          Top-level directory to store temporary directories used
    175  1.152     lukem                      by build.sh before paths to other directories such as
    176  1.152     lukem                      .OBJDIR can be determined.
    177  1.149     lukem 
    178  1.152     lukem                      Note: Must support execution of binaries.  I.e., without
    179  1.152     lukem                      mount(8)'s -o noexec option.
    180  1.149     lukem 
    181  1.152     lukem                      Default: "/tmp".
    182  1.149     lukem 
    183  1.105       wiz    "make" variables
    184  1.104       wiz      Several variables control the behavior of NetBSD builds.  Unless
    185  1.104       wiz      otherwise specified, these variables may be set in either the process
    186  1.150     lukem      environment or the make(1) configuration file mk.conf(5) specified by
    187  1.151     lukem      MAKECONF.
    188  1.151     lukem 
    189  1.151     lukem      This list is not comprehensive; all supported variables and their
    190  1.151     lukem      defaults are documented in mk.conf(5).
    191  1.151     lukem 
    192  1.152     lukem      BSDOBJDIR       The real path to the object directory tree for the NetBSD
    193  1.152     lukem                      source tree.
    194  1.151     lukem 
    195  1.152     lukem                      Default: "/usr/obj"
    196  1.151     lukem 
    197  1.152     lukem      BSDSRCDIR       The real path to the NetBSD source tree, if NETBSDSRCDIR
    198  1.152     lukem                      isn't defined.
    199  1.151     lukem 
    200  1.152     lukem                      Default: "/usr/src"
    201  1.152     lukem 
    202  1.152     lukem      BUILDID         Identifier for the build.  If set, this should be a short
    203  1.152     lukem                      string that is suitable for use as part of a file or
    204  1.152     lukem                      directory name.  The identifier will be appended to
    205  1.152     lukem                      object directory names, and can be consulted in the
    206  1.152     lukem                      make(1) configuration file in order to set additional
    207  1.152     lukem                      build parameters, such as compiler flags.  It will also
    208  1.152     lukem                      be used as part of the kernel version string, which can
    209  1.152     lukem                      be shown by "uname -v".
    210  1.152     lukem 
    211  1.152     lukem                      Default: Unset.
    212  1.152     lukem 
    213  1.152     lukem      BUILDINFO       Optional multi-line string containing information about
    214  1.152     lukem                      the build.  This will appear in DESTDIR/etc/release, and
    215  1.152     lukem                      it will be stored in the buildinfo variable in any
    216  1.152     lukem                      kernels that are built.  When such kernels are booted,
    217  1.152     lukem                      the sysctl(7) kern.buildinfo variable will report this
    218  1.152     lukem                      value.  The string may contain backslash escape
    219  1.152     lukem                      sequences, such as "\\" (representing a backslash
    220  1.152     lukem                      character) and "\n" (representing a newline).
    221  1.152     lukem 
    222  1.152     lukem                      Default: Unset.
    223  1.152     lukem 
    224  1.152     lukem      BUILDSEED       g++(1) uses random numbers when compiling C++ code.  This
    225  1.152     lukem                      variable seeds the g++(1) random number generator using
    226  1.152     lukem                      -frandom-seed with this value.  By default, it is set to
    227  1.152     lukem                      "NetBSD-(majorversion)".  Using a fixed value causes C++
    228  1.152     lukem                      binaries to be the same when built from the same sources,
    229  1.152     lukem                      resulting in identical (reproducible) builds.  Additional
    230  1.152     lukem                      information is available in the g++(1) documentation of
    231  1.152     lukem                      -frandom-seed.
    232  1.152     lukem 
    233  1.152     lukem                      Default: Unset.
    234  1.152     lukem 
    235  1.152     lukem      CPUFLAGS        Additional flags to the compiler/assembler to select CPU
    236  1.152     lukem                      instruction set options, CPU tuning options, etc.
    237  1.152     lukem 
    238  1.152     lukem                      Default: Unset.
    239  1.152     lukem 
    240  1.152     lukem      DESTDIR         Directory to contain the built NetBSD system.  If set,
    241  1.152     lukem                      special options are passed to the compilation tools to
    242  1.152     lukem                      prevent their default use of the host system's
    243  1.152     lukem                      /usr/include, /usr/lib, and so forth.  This pathname must
    244  1.152     lukem                      be an absolute path, and should not end with a slash (/)
    245  1.152     lukem                      character.  (For installation into the system's root
    246  1.152     lukem                      directory, set DESTDIR to an empty string, not to "/").
    247  1.152     lukem                      The directory must reside on a file system which supports
    248  1.152     lukem                      long file names and hard links.
    249  1.151     lukem 
    250  1.152     lukem                      Note: build.sh will provide a default of destdir.MACHINE
    251  1.152     lukem                      (in the top-level .OBJDIR) unless run in `expert' mode.
    252  1.151     lukem 
    253  1.152     lukem                      Default: Empty string if USETOOLS is "yes"; unset
    254  1.152     lukem                      otherwise.
    255  1.151     lukem 
    256  1.151     lukem      EXTERNAL_TOOLCHAIN
    257  1.152     lukem                      If defined, this variable indicates the root directory of
    258  1.152     lukem                      an external toolchain which will be used to build the
    259  1.152     lukem                      tree.  For example, if a platform is a TOOLCHAIN_MISSING
    260  1.152     lukem                      platform, EXTERNAL_TOOLCHAIN can be used to re-enable the
    261  1.152     lukem                      cross-compile framework.
    262  1.151     lukem 
    263  1.152     lukem                      If EXTERNAL_TOOLCHAIN is defined, act as MKGCC=no, since
    264  1.152     lukem                      the external version of the compiler may not be able to
    265  1.152     lukem                      build the library components of the in-tree compiler.
    266  1.151     lukem 
    267  1.152     lukem                      This variable should be used in conjunction with an
    268  1.152     lukem                      appropriate HAVE_GCC or HAVE_LLVM setting to control the
    269  1.152     lukem                      compiler flags.
    270  1.151     lukem 
    271  1.152     lukem                      Note: This variable is not yet used in as many places as
    272  1.152     lukem                      it should be.  Expect the exact semantics of this
    273  1.152     lukem                      variable to change in the short term as parts of the
    274  1.152     lukem                      cross-compile framework continue to be cleaned up.
    275  1.151     lukem 
    276  1.152     lukem                      Default: Unset.
    277  1.151     lukem 
    278  1.152     lukem      MAKEVERBOSE     Level of verbosity of status messages.  Supported values:
    279  1.151     lukem 
    280  1.152     lukem                      0   No descriptive messages or commands executed by
    281  1.152     lukem                          make(1) are shown.
    282  1.151     lukem 
    283  1.152     lukem                      1   Brief messages are shown describing what is being
    284  1.152     lukem                          done, but the actual commands executed by make(1) are
    285  1.152     lukem                          not shown.
    286  1.151     lukem 
    287  1.152     lukem                      2   Descriptive messages are shown as above (prefixed
    288  1.152     lukem                          with a `#'), and ordinary commands performed by
    289  1.152     lukem                          make(1) are shown.
    290  1.151     lukem 
    291  1.152     lukem                      3   In addition to the above, all commands performed by
    292  1.152     lukem                          make(1) are shown, even if they would ordinarily have
    293  1.152     lukem                          been hidden through use of the "@" prefix in the
    294  1.152     lukem                          relevant makefile.
    295  1.151     lukem 
    296  1.152     lukem                      4   In addition to the above, commands executed by
    297  1.152     lukem                          make(1) are traced through use of the sh(1) "-x"
    298  1.152     lukem                          flag.
    299  1.151     lukem 
    300  1.152     lukem                      Default: 2
    301  1.151     lukem 
    302  1.152     lukem      MKCATPAGES      Can be set to "yes" or "no".  Indicates whether
    303  1.152     lukem                      preformatted plaintext manual pages will be created and
    304  1.152     lukem                      installed.
    305  1.151     lukem 
    306  1.152     lukem                      Forced to "no" if MKMAN=no or MKSHARE=no.
    307  1.151     lukem 
    308  1.152     lukem                      Default: "no"
    309  1.151     lukem 
    310  1.152     lukem      MKCROSSGDB      Can be set to "yes" or "no".  Create a cross-gdb as a
    311  1.152     lukem                      host tool.
    312    1.1        tv 
    313  1.152     lukem                      Default: "no"
    314  1.151     lukem 
    315  1.152     lukem      MKDEBUG         Can be set to "yes" or "no".  Indicates whether debug
    316  1.152     lukem                      information should be generated for all userland
    317  1.152     lukem                      binaries.  The result is collected as an additional
    318  1.152     lukem                      debug.tgz and xdebug.tgz set and installed in
    319  1.152     lukem                      DESTDIR/usr/libdata/debug.
    320  1.151     lukem 
    321  1.152     lukem                      Forced to "no" if NODEBUG is defined, usually in the
    322  1.152     lukem                      Makefile before any make(1) .include directives.
    323  1.151     lukem 
    324  1.152     lukem                      Default: "no"
    325  1.151     lukem 
    326  1.152     lukem      MKDEBUGKERNEL   Can be set to "yes" or "no".  Indicates whether debugging
    327  1.152     lukem                      symbols will be built for kernels by default; pretend as
    328  1.152     lukem                      if makeoptions DEBUG="-g" is specified in kernel
    329  1.152     lukem                      configuration files.  This will also put the debug kernel
    330  1.152     lukem                      netbsd.gdb in the kernel sets.  See options(4) for
    331  1.152     lukem                      details.  This is useful if a cross-gdb is built as well
    332  1.152     lukem                      (see MKCROSSGDB).
    333  1.151     lukem 
    334  1.152     lukem                      Default: "no"
    335  1.151     lukem 
    336  1.152     lukem      MKDEBUGLIB      Can be set to "yes" or "no".  Indicates whether debug
    337  1.152     lukem                      libraries (lib*_g.a) will be built and installed.  Debug
    338  1.152     lukem                      libraries are compiled with "-g -DDEBUG".
    339  1.151     lukem 
    340  1.152     lukem                      Forced to "no" if NODEBUGLIB is defined, usually in the
    341  1.152     lukem                      Makefile before any make(1) .include directives.
    342  1.151     lukem 
    343  1.152     lukem                      Default: "no"
    344  1.151     lukem 
    345  1.152     lukem      MKDEBUGTOOLS    Can be set to "yes" or "no".  Indicates whether debug
    346  1.152     lukem                      information (lib*_g.a) will be included in the build
    347  1.152     lukem                      toolchain.
    348  1.151     lukem 
    349  1.152     lukem                      Default: "no"
    350  1.107       apb 
    351  1.152     lukem      MKDOC           Can be set to "yes" or "no".  Indicates whether system
    352  1.152     lukem                      documentation destined for DESTDIR/usr/share/doc will be
    353  1.152     lukem                      installed.
    354  1.151     lukem 
    355  1.152     lukem                      Forced to "no" if NODOC is defined, usually in the
    356  1.152     lukem                      Makefile before any make(1) .include directives.
    357  1.151     lukem 
    358  1.152     lukem                      Forced to "no" if MKSHARE=no.
    359  1.151     lukem 
    360  1.152     lukem                      Default: "yes"
    361  1.151     lukem 
    362  1.152     lukem      MKHOSTOBJ       Can be set to "yes" or "no".  If set to "yes", then for
    363  1.152     lukem                      programs intended to be run on the compile host, the
    364  1.152     lukem                      name, release, and architecture of the host operating
    365  1.152     lukem                      system will be suffixed to the name of the object
    366  1.152     lukem                      directory created by "make obj".  (This allows multiple
    367  1.152     lukem                      host systems to compile NetBSD for a single target.)  If
    368  1.152     lukem                      set to "no", then programs built to be run on the compile
    369  1.152     lukem                      host will use the same object directory names as programs
    370  1.152     lukem                      built to be run on the target.
    371    1.9   thorpej 
    372  1.152     lukem                      Default: "no"
    373  1.108       apb 
    374  1.152     lukem      MKHTML          Can be set to "yes" or "no".  Indicates whether the HTML
    375  1.152     lukem                      manual pages are created and installed.  and installed
    376  1.108       apb 
    377  1.152     lukem                      Forced to "no" if NOHTML is defined, usually in the
    378  1.152     lukem                      Makefile before any make(1) .include directives.
    379  1.104       wiz 
    380  1.152     lukem                      Forced to "no" if MKMAN=no or MKSHARE=no.
    381  1.138   thorpej 
    382  1.152     lukem                      Default: "yes"
    383  1.138   thorpej 
    384  1.152     lukem      MKINFO          Can be set to "yes" or "no".  Indicates whether GNU Info
    385  1.152     lukem                      files, used for the documentation for most of the
    386  1.152     lukem                      compilation tools, will be built and installed.
    387    1.1        tv 
    388  1.152     lukem                      Forced to "no" if NOINFO is defined, usually in the
    389  1.152     lukem                      Makefile before any make(1) .include directives.
    390    1.1        tv 
    391  1.152     lukem                      Forced to "no" if MKSHARE=no.
    392   1.30     lukem 
    393  1.152     lukem                      Default: "yes"
    394   1.45     lukem 
    395  1.152     lukem      MKKDEBUG        Deprecated, use MKDEBUGKERNEL.
    396   1.45     lukem 
    397  1.152     lukem      MKKMOD          Can be set to "yes" or "no".  Indicates whether kernel
    398  1.152     lukem                      modules are built and installed.
    399   1.80       apb 
    400  1.152     lukem                      Default: "no" on or1k; "yes" on other platforms.
    401   1.80       apb 
    402  1.152     lukem      MKLINKLIB       Can be set to "yes" or "no".  Indicates whether all of
    403  1.152     lukem                      the shared library infrastructure will be built and
    404  1.152     lukem                      installed.  If "no", prevents: installation of the *.a
    405  1.152     lukem                      libraries, installation of the *_pic.a libraries on PIC
    406  1.152     lukem                      systems, building of *.a libraries on PIC systems, or
    407  1.152     lukem                      installation of .so symlinks on ELF systems.
    408   1.45     lukem 
    409  1.152     lukem                      Forced to "no" if NOLINKLIB is defined, usually in the
    410  1.152     lukem                      Makefile before any make(1) .include directives.
    411   1.45     lukem 
    412  1.152     lukem                      If "no", acts as MKLINT=no MKPICINSTALL=no MKPROFILE=no.
    413   1.45     lukem 
    414  1.152     lukem                      Default: "yes"
    415  1.140     kamil 
    416  1.152     lukem      MKLINT          Can be set to "yes" or "no".  Indicates whether lint(1)
    417  1.152     lukem                      will be run against portions of the NetBSD source code
    418  1.152     lukem                      during the build, and whether lint libraries will be
    419  1.152     lukem                      installed into DESTDIR/usr/libdata/lint.
    420  1.140     kamil 
    421  1.152     lukem                      Forced to "no" if NOLINT is defined, usually in the
    422  1.152     lukem                      Makefile before any make(1) .include directives.
    423  1.106       wiz 
    424  1.152     lukem                      Forced to "no" if MKLINKLIB=no.
    425  1.106       wiz 
    426  1.152     lukem                      Default: "no"
    427  1.106       wiz 
    428  1.152     lukem      MKMAN           Can be set to "yes" or "no".  Indicates whether manual
    429  1.152     lukem                      pages will be installed.
    430  1.106       wiz 
    431  1.152     lukem                      Forced to "no" if NOMAN is defined, usually in the
    432  1.152     lukem                      Makefile before any make(1) .include directives.
    433  1.106       wiz 
    434  1.152     lukem                      Forced to "no" if MKSHARE=no.
    435  1.106       wiz 
    436  1.152     lukem                      If "no", acts as MKCATPAGES=no MKHTML=no.
    437    1.1        tv 
    438  1.152     lukem                      Default: "yes"
    439    1.1        tv 
    440  1.152     lukem      MKNLS           Can be set to "yes" or "no".  Indicates whether Native
    441  1.152     lukem                      Language System (NLS) locale zone files will be built and
    442  1.152     lukem                      installed.
    443   1.77     lukem 
    444  1.152     lukem                      Forced to "no" if NONLS is defined, usually in the
    445  1.152     lukem                      Makefile before any make(1) .include directives.
    446   1.77     lukem 
    447  1.152     lukem                      Forced to "no" if MKSHARE=no.
    448    1.4        tv 
    449  1.152     lukem                      Default: "yes"
    450    1.4        tv 
    451  1.152     lukem      MKOBJ           Can be set to "yes" or "no".  Indicates whether object
    452  1.152     lukem                      directories will be created when running "make obj".  If
    453  1.152     lukem                      set to "no", then all built files will be located inside
    454  1.152     lukem                      the regular source tree.
    455    1.1        tv 
    456  1.152     lukem                      Forced to "no" if NOOBJ is defined, usually in the
    457  1.152     lukem                      Makefile before any make(1) .include directives.
    458    1.1        tv 
    459  1.152     lukem                      If "no", acts as MKOBJDIRS=no.
    460  1.143     lukem 
    461  1.152     lukem                      Note: Setting MKOBJ to "no" is not recommended and may
    462  1.152     lukem                      cause problems when updating the tree with cvs(1).
    463  1.143     lukem 
    464  1.152     lukem                      Default: "yes"
    465   1.95       apb 
    466  1.152     lukem      MKOBJDIRS       Can be set to "yes" or "no".  Indicates whether object
    467  1.152     lukem                      directories will be created automatically (via a "make
    468  1.152     lukem                      obj" pass) at the start of a build.
    469   1.95       apb 
    470  1.152     lukem                      Forced to "no" if MKOBJ=no.
    471    1.1        tv 
    472  1.152     lukem                      Default: "no"
    473    1.1        tv 
    474  1.152     lukem      MKPIC           Can be set to "yes" or "no".  Indicates whether shared
    475  1.152     lukem                      objects and libraries will be created and installed.  If
    476  1.152     lukem                      "no", the entire built system will be statically linked.
    477    1.1        tv 
    478  1.152     lukem                      Forced to "no" if NOPIC is defined, usually in the
    479  1.152     lukem                      Makefile before any make(1) .include directives.
    480    1.1        tv 
    481  1.152     lukem                      If "no", acts as MKPICLIB=no.
    482    1.1        tv 
    483  1.152     lukem                      Default: "no" on m68000; "yes" on other platforms.
    484    1.1        tv 
    485  1.152     lukem      MKPICINSTALL    Can be set to "yes" or "no".  Indicates whether the ar(1)
    486  1.152     lukem                      format libraries (lib*_pic.a), used to generate shared
    487  1.152     lukem                      libraries, are installed.
    488    1.1        tv 
    489  1.152     lukem                      Forced to "no" if NOPICINSTALL is defined, usually in the
    490  1.152     lukem                      Makefile before any make(1) .include directives.
    491    1.1        tv 
    492  1.152     lukem                      Forced to "no" if MKLINKLIB=no.
    493   1.70  dholland 
    494  1.152     lukem                      Default: "no"
    495    1.1        tv 
    496  1.152     lukem      MKPROFILE       Can be set to "yes" or "no".  Indicates whether profiled
    497  1.152     lukem                      libraries (lib*_p.a) will be built and installed.
    498    1.1        tv 
    499  1.152     lukem                      Forced to "no" if NOPROFILE is defined, usually in the
    500  1.152     lukem                      Makefile before any make(1) .include directives.
    501    1.1        tv 
    502  1.152     lukem                      Forced to "no" if MKLINKLIB=no.
    503    1.1        tv 
    504  1.152     lukem                      Default: "no" on or1k, riscv32, and riscv64 (due to
    505  1.152     lukem                      toolchain problems with profiled code); "yes" on other
    506  1.152     lukem                      platforms.
    507    1.1        tv 
    508  1.152     lukem      MKREPRO         Can be set to "yes" or "no".  Indicates whether builds
    509  1.152     lukem                      are to be reproducible.  If "yes", two builds from the
    510  1.152     lukem                      same source tree will produce the same build results.
    511    1.1        tv 
    512  1.152     lukem                      Used as the default for MKARZERO.
    513  1.100       wiz 
    514  1.152     lukem                      This may be set to "yes" by giving build.sh the -P
    515  1.152     lukem                      option.
    516  1.151     lukem 
    517  1.152     lukem                      Default: "no" Can be set to "yes" or "no".
    518  1.100       wiz 
    519  1.122       wiz      MKREPRO_TIMESTAMP
    520  1.152     lukem                      Unix timestamp.  When MKREPRO is set, the timestamp of
    521  1.152     lukem                      all files in the sets will be set to this value.
    522  1.151     lukem 
    523  1.152     lukem                      This may be set automatically to the latest source tree
    524  1.152     lukem                      timestamp using cvslatest(1) by giving build.sh the -P
    525  1.152     lukem                      option.
    526  1.151     lukem 
    527  1.152     lukem                      Default: Unset.
    528  1.151     lukem 
    529  1.152     lukem      MKSHARE         Can be set to "yes" or "no".  Indicates whether files
    530  1.152     lukem                      destined to reside in DESTDIR/usr/share will be built and
    531  1.152     lukem                      installed.
    532  1.151     lukem 
    533  1.152     lukem                      Forced to "no" if NOSHARE is defined, usually in the
    534  1.152     lukem                      Makefile before any make(1) .include directives.
    535  1.122       wiz 
    536  1.152     lukem                      If "no", acts as MKCATPAGES=no MKDOC=no MKINFO=no
    537  1.152     lukem                      MKHTML=no MKMAN=no MKNLS=no.
    538   1.49     lukem 
    539  1.152     lukem                      Default: "yes"
    540  1.151     lukem 
    541  1.152     lukem      MKSTRIPIDENT    Can be set to "yes" or "no".  Indicates whether RCS IDs,
    542  1.152     lukem                      for use with ident(1), should be stripped from program
    543  1.152     lukem                      binaries and shared libraries.
    544  1.151     lukem 
    545  1.152     lukem                      Default: "no"
    546  1.151     lukem 
    547  1.152     lukem      MKSTRIPSYM      Can be set to "yes" or "no".  Indicates whether all local
    548  1.152     lukem                      symbols should be stripped from shared libraries.  If
    549  1.152     lukem                      "yes", strip all local symbols from shared libraries; the
    550  1.152     lukem                      affect is equivalent to the -x option of ld(1).  If "no",
    551  1.152     lukem                      strip only temporary local symbols; the affect is
    552  1.152     lukem                      equivalent to the -X option of ld(1).  Keeping non-
    553  1.152     lukem                      temporary local symbols such as static function names is
    554  1.152     lukem                      useful on using DTrace for userland libraries and getting
    555  1.152     lukem                      a backtrace from a rump kernel loading shared libraries.
    556  1.151     lukem 
    557  1.152     lukem                      Default: "yes"
    558  1.151     lukem 
    559  1.152     lukem      MKUNPRIVED      Can be set to "yes" or "no".  Indicates whether an
    560  1.152     lukem                      unprivileged install will occur.  The user, group,
    561  1.152     lukem                      permissions, and file flags, will not be set on the
    562  1.152     lukem                      installed items; instead the information will be appended
    563  1.152     lukem                      to a file called METALOG in DESTDIR.  The contents of
    564  1.152     lukem                      METALOG are used during the generation of the
    565  1.152     lukem                      distribution tar files to ensure that the appropriate
    566  1.152     lukem                      file ownership is stored.
    567  1.151     lukem 
    568  1.152     lukem                      Default: "no"
    569  1.151     lukem 
    570  1.152     lukem      MKUPDATE        Can be set to "yes" or "no".  Indicates whether all
    571  1.152     lukem                      install operations intended to write to DESTDIR will
    572  1.152     lukem                      compare file timestamps before installing, and skip the
    573  1.152     lukem                      install phase if the destination files are up-to-date.
    574  1.151     lukem 
    575  1.152     lukem                      Note: This also has implications on full builds (see next
    576  1.152     lukem                      subsection).
    577  1.151     lukem 
    578  1.152     lukem                      Default: "no"
    579  1.151     lukem 
    580  1.152     lukem      MKX11           Can be set to "yes" or "no".  Indicates whether X11 is
    581  1.152     lukem                      built and installed from X11SRCDIR, and whether the X
    582  1.152     lukem                      sets will be created.
    583  1.151     lukem 
    584  1.152     lukem                      Note: If "yes", requires MKINET6=yes.
    585  1.151     lukem 
    586  1.152     lukem                      Default: "no"
    587  1.151     lukem 
    588  1.152     lukem      NETBSDSRCDIR    The path to the top level of the NetBSD sources.
    589  1.152     lukem 
    590  1.152     lukem                      Default: Top level of the NetBSD source tree (as
    591  1.152     lukem                      determined by the presence of build.sh and tools/) if
    592  1.152     lukem                      make(1) is run from within that tree; otherwise BSDSRCDIR
    593  1.152     lukem                      will be used.
    594  1.151     lukem 
    595  1.151     lukem      TOOLCHAIN_MISSING
    596  1.152     lukem                      Can be set to "yes" or "no".  If not "no", this indicates
    597  1.152     lukem                      that the platform "MACHINE_ARCH" being built does not
    598  1.152     lukem                      have a working in-tree toolchain.
    599  1.152     lukem 
    600  1.152     lukem                      If not "no", acts as MKBINUTILS=no MKGCC=no MKGDB=no.
    601  1.152     lukem 
    602  1.152     lukem                      Default: "no"
    603  1.152     lukem 
    604  1.152     lukem      TOOLDIR         Directory to hold the host tools, once built.  If
    605  1.152     lukem                      specified, must be an absolute path.  This directory
    606  1.152     lukem                      should be unique to a given host system and NetBSD source
    607  1.152     lukem                      tree.  (However, multiple targets may share the same
    608  1.152     lukem                      TOOLDIR; the target-dependent files have unique names.)
    609  1.152     lukem                      If unset, a default based on the uname(1) information of
    610  1.152     lukem                      the host platform will be created in the .OBJDIR of src.
    611  1.152     lukem 
    612  1.152     lukem                      Default: Unset.
    613  1.152     lukem 
    614  1.152     lukem      USETOOLS        Can be set to "yes" or "no".  Indicates whether the tools
    615  1.152     lukem                      specified by TOOLDIR should be used as part of a build in
    616  1.152     lukem                      progress.  Must be set to "yes" if cross-compiling.
    617  1.152     lukem 
    618  1.152     lukem                      yes    Use the tools from TOOLDIR.
    619  1.152     lukem 
    620  1.152     lukem                      no     Do not use the tools from TOOLDIR, but refuse to
    621  1.152     lukem                             build native compilation tool components that are
    622  1.152     lukem                             version-specific for that tool.
    623  1.152     lukem 
    624  1.152     lukem                      never  Do not use the tools from TOOLDIR, even when
    625  1.152     lukem                             building native tool components.  This is similar
    626  1.152     lukem                             to the traditional NetBSD build method, but does
    627  1.152     lukem                             not verify that the compilation tools in use are
    628  1.152     lukem                             up-to-date enough in order to build the tree
    629  1.152     lukem                             successfully.  This may cause build or runtime
    630  1.152     lukem                             problems when building the whole NetBSD source
    631  1.152     lukem                             tree.
    632  1.152     lukem 
    633  1.152     lukem                      Default: "no" when using <bsd.*.mk> outside the NetBSD
    634  1.152     lukem                      source tree (detected automatically) or if
    635  1.152     lukem                      TOOLCHAIN_MISSING=yes; "yes" otherwise.
    636  1.152     lukem 
    637  1.152     lukem      X11SRCDIR       Directory containing the modular Xorg source.  If
    638  1.152     lukem                      specified, must be an absolute path.  The main modular
    639  1.152     lukem                      Xorg source is found in X11SRCDIR/external/mit.
    640  1.151     lukem 
    641  1.152     lukem                      Default: NETBSDSRCDIR/../xsrc, if that exists; otherwise
    642  1.152     lukem                      /usr/xsrc.
    643   1.49     lukem 
    644  1.105       wiz    "make" variables for full builds
    645  1.126       wiz      These variables only affect the top level "Makefile" and do not affect
    646    1.7     lukem      manually building subtrees of the NetBSD source code.
    647    1.1        tv 
    648  1.147     lukem      INSTALLBOOT_BOARDS
    649  1.152     lukem                      A list of boards to create bootable images for.  If
    650  1.152     lukem                      corresponding U-Boot packages are installed, bootable
    651  1.152     lukem                      images are created as part of a release.  See the
    652  1.152     lukem                      -o board=name option of installboot(8).
    653  1.147     lukem 
    654  1.152     lukem      INSTALLWORLDDIR
    655  1.152     lukem                      Location for the "make installworld" target to install
    656  1.152     lukem                      to.  If specified, must be an absolute path.
    657    1.1        tv 
    658  1.152     lukem                      Default: "/"
    659    1.1        tv 
    660  1.152     lukem      MKOBJDIRS       Can be set to "yes" or "no".  Indicates whether object
    661  1.152     lukem                      directories will be created automatically (via a "make
    662  1.152     lukem                      obj" pass) at the start of a build.
    663    1.1        tv 
    664  1.152     lukem                      Default: "no"
    665    1.1        tv 
    666  1.152     lukem                      If using build.sh, the default is "yes".  This may be set
    667  1.152     lukem                      back to "no" by giving build.sh the -o option.
    668   1.70  dholland 
    669  1.152     lukem      MKUPDATE        Can be set to "yes" or "no".  If set, then in addition to
    670  1.152     lukem                      the effects described for MKUPDATE=yes above, this
    671  1.152     lukem                      implies the effects of NOCLEANDIR (i.e., "make cleandir"
    672  1.152     lukem                      is avoided).
    673   1.38     lukem 
    674  1.152     lukem                      Default: "no"
    675   1.38     lukem 
    676  1.152     lukem                      If using build.sh, this may be set by giving the -u
    677  1.152     lukem                      option.
    678   1.70  dholland 
    679  1.152     lukem      NBUILDJOBS      Now obsolete.  Use the make(1) option -j, instead.  See
    680  1.152     lukem                      below.
    681    1.1        tv 
    682  1.152     lukem                      Default: Unset.
    683    1.1        tv 
    684  1.152     lukem      NOCLEANDIR      If set, avoids the "make cleandir" phase of a full build.
    685  1.152     lukem                      This has the effect of allowing only changed files in a
    686  1.152     lukem                      source tree to be recompiled.  This can speed up builds
    687  1.152     lukem                      when updating only a few files in the tree.
    688    1.1        tv 
    689  1.152     lukem                      Default: Unset.
    690    1.1        tv 
    691  1.152     lukem                      See also MKUPDATE.
    692   1.70  dholland 
    693  1.152     lukem      NODISTRIBDIRS   If set, avoids the "make distrib-dirs" phase of a full
    694  1.152     lukem                      build.  This skips running mtree(8) on DESTDIR, useful on
    695  1.152     lukem                      systems where building as an unprivileged user, or where
    696  1.152     lukem                      it is known that the system-wide mtree files have not
    697  1.152     lukem                      changed.
    698    1.1        tv 
    699  1.152     lukem                      Default: Unset.
    700    1.1        tv 
    701  1.152     lukem      NOINCLUDES      If set, avoids the "make includes" phase of a full build.
    702  1.152     lukem                      This has the effect of preventing make(1) from thinking
    703  1.152     lukem                      that some programs are out-of-date simply because the
    704  1.152     lukem                      system include files have changed.  However, this option
    705  1.152     lukem                      should not be used when updating the entire NetBSD source
    706  1.152     lukem                      tree arbitrarily; it is suggested to use MKUPDATE=yes
    707  1.152     lukem                      instead in that case.
    708    1.1        tv 
    709  1.152     lukem                      Default: Unset.
    710    1.1        tv 
    711  1.152     lukem      RELEASEDIR      If set, specifies the directory to which a release(7)
    712  1.152     lukem                      layout will be written at the end of a "make release".
    713  1.152     lukem                      If specified, must be an absolute path.
    714   1.20     lukem 
    715  1.152     lukem                      Note: build.sh will provide a default of releasedir (in
    716  1.152     lukem                      the top-level .OBJDIR) unless run in `expert' mode.
    717   1.30     lukem 
    718  1.152     lukem                      Default: Unset.
    719  1.151     lukem 
    720  1.105       wiz BUILDING
    721  1.105       wiz    "make" command line options
    722   1.52       jmc      This is not a summary of all the options available to make(1); only the
    723   1.52       jmc      options used most frequently with NetBSD builds are listed here.
    724    1.1        tv 
    725  1.105       wiz      -j njob    Run up to njob make(1) subjobs in parallel.  Makefiles should
    726   1.52       jmc                 use .WAIT or have explicit dependencies as necessary to
    727   1.74       apb                 enforce build ordering.
    728   1.10  sommerfe 
    729  1.105       wiz      -m dir     Specify the default directory for searching for system
    730  1.104       wiz                 Makefile segments, mainly the <bsd.*.mk> files.  When building
    731  1.104       wiz                 any full NetBSD source tree, this should be set to the
    732  1.126       wiz                 "share/mk" directory in the source tree.  This is set
    733  1.104       wiz                 automatically when building from the top level, or when using
    734  1.105       wiz                 build.sh.
    735    1.1        tv 
    736  1.148     lukem      -n         Show the commands that would have been executed, but do not
    737    1.1        tv                 actually execute them.  This will still cause recursion to
    738    1.1        tv                 take place.
    739    1.1        tv 
    740  1.148     lukem      -V var     Show make(1)'s idea of the value of var.  Does not build any
    741    1.1        tv                 targets.
    742    1.1        tv 
    743  1.105       wiz      var=value  Set the variable var to value, overriding any setting
    744  1.105       wiz                 specified by the process environment, the MAKECONF
    745  1.104       wiz                 configuration file, or the system Makefile segments.
    746    1.1        tv 
    747  1.105       wiz    "make" targets
    748    1.1        tv      These default targets may be built by running make(1) in any subtree of
    749    1.1        tv      the NetBSD source code.  It is recommended that none of these be used
    750  1.126       wiz      from the top level Makefile; as a specific exception, "make obj" and
    751  1.126       wiz      "make cleandir" are useful in that context.
    752    1.1        tv 
    753  1.105       wiz      all        Build programs, libraries, and preformatted documentation.
    754    1.1        tv 
    755  1.105       wiz      clean      Remove program and library object code files.
    756    1.1        tv 
    757  1.105       wiz      cleandir   Same as clean, but also remove preformatted documentation,
    758  1.126       wiz                 dependency files generated by "make depend", and any other
    759   1.49     lukem                 files known to be created at build time.
    760    1.1        tv 
    761  1.105       wiz      depend     Create dependency files (.depend) containing more detailed
    762   1.44     lukem                 information about the dependencies of source code on header
    763    1.1        tv                 files.  Allows programs to be recompiled automatically when a
    764    1.1        tv                 dependency changes.
    765    1.1        tv 
    766  1.126       wiz      dependall  Does a "make depend" immediately followed by a "make all".
    767   1.10  sommerfe                 This improves cache locality of the build since both passes
    768   1.10  sommerfe                 read the source files in their entirety.
    769    1.1        tv 
    770  1.105       wiz      distclean  Synonym for cleandir.
    771   1.49     lukem 
    772  1.105       wiz      includes   Build and install system header files.  Typically needed
    773   1.44     lukem                 before any system libraries or programs can be built.
    774    1.1        tv 
    775  1.105       wiz      install    Install programs, libraries, and documentation into DESTDIR.
    776  1.105       wiz                 Few files will be installed to DESTDIR/dev, DESTDIR/etc,
    777  1.105       wiz                 DESTDIR/root or DESTDIR/var in order to prevent user supplied
    778   1.27     lukem                 configuration data from being overwritten.
    779    1.1        tv 
    780  1.105       wiz      lint       Run lint(1) against the C source code, where appropriate, and
    781    1.1        tv                 generate system-installed lint libraries.
    782    1.1        tv 
    783  1.105       wiz      obj        Create object directories to be used for built files, instead
    784    1.1        tv                 of building directly in the source tree.
    785    1.1        tv 
    786  1.105       wiz      tags       Create ctags(1) searchable function lists usable by the ex(1)
    787    1.1        tv                 and vi(1) text editors.
    788    1.1        tv 
    789  1.105       wiz    "make" targets for the top level
    790    1.1        tv      Additional make(1) targets are usable specifically from the top source
    791    1.1        tv      level to facilitate building the entire NetBSD source tree.
    792    1.1        tv 
    793  1.105       wiz      build         Build the entire NetBSD system (except the kernel).  This
    794   1.68      reed                    orders portions of the source tree such that prerequisites
    795   1.68      reed                    will be built in the proper order.
    796   1.20     lukem 
    797  1.126       wiz      distribution  Do a "make build", and then install a full distribution
    798  1.105       wiz                    (which does not include a kernel) into DESTDIR, including
    799  1.105       wiz                    files in DESTDIR/dev, DESTDIR/etc, DESTDIR/root and
    800  1.105       wiz                    DESTDIR/var.
    801   1.20     lukem 
    802  1.126       wiz      buildworld    As per "make distribution", except that it ensures that
    803  1.105       wiz                    DESTDIR is not the root directory.
    804   1.20     lukem 
    805  1.105       wiz      installworld  Install the distribution from DESTDIR to INSTALLWORLDDIR,
    806   1.70  dholland                    which defaults to the root directory.  Ensures that
    807  1.105       wiz                    INSTALLWORLDDIR is not the root directory if cross
    808  1.104       wiz                    compiling.
    809   1.20     lukem 
    810  1.105       wiz                    The INSTALLSETS environment variable may be set to a space-
    811   1.95       apb                    separated list of distribution sets to be installed.  By
    812  1.126       wiz                    default, all sets except "etc" and "xetc" are installed, so
    813  1.126       wiz                    most files in INSTALLWORLDDIR/etc will not be installed or
    814  1.126       wiz                    modified.
    815   1.61       apb 
    816  1.105       wiz                    Note: Before performing this operation with
    817  1.105       wiz                    INSTALLWORLDDIR=/, it is highly recommended that you
    818   1.61       apb                    upgrade your kernel and reboot.  After performing this
    819   1.61       apb                    operation, it is recommended that you use etcupdate(8) to
    820  1.105       wiz                    update files in INSTALLWORLDDIR/etc, and postinstall(8) to
    821  1.102       abs                    check for or fix inconsistencies.
    822   1.20     lukem 
    823  1.105       wiz      sets          Create distribution sets from DESTDIR into
    824  1.105       wiz                    RELEASEDIR/RELEASEMACHINEDIR/binary/sets.  Should be run
    825  1.126       wiz                    after "make distribution", as "make build" alone does not
    826  1.126       wiz                    install all of the required files.
    827   1.25     lukem 
    828  1.105       wiz      sourcesets    Create source sets of the source tree into
    829  1.105       wiz                    RELEASEDIR/source/sets.
    830   1.31     lukem 
    831  1.105       wiz      syspkgs       Create syspkgs from DESTDIR into
    832  1.105       wiz                    RELEASEDIR/RELEASEMACHINEDIR/binary/syspkgs.  Should be run
    833  1.126       wiz                    after "make distribution", as "make build" alone does not
    834  1.126       wiz                    install all of the required files.
    835   1.54       apb 
    836  1.126       wiz      release       Do a "make distribution", build kernels, distribution
    837  1.126       wiz                    media, and install sets (this as per "make sets"), and then
    838  1.126       wiz                    package the system into a standard release layout as
    839  1.105       wiz                    described by release(7).  This requires that RELEASEDIR be
    840   1.25     lukem                    set (see above).
    841    1.1        tv 
    842  1.105       wiz      iso-image     Create a NetBSD installation CD-ROM image in the
    843  1.114       snj                    RELEASEDIR/images directory.  The CD-ROM file system will
    844  1.114       snj                    have a layout as described in release(7).
    845   1.62       apb 
    846   1.62       apb                    For most machine types, the CD-ROM will be bootable, and
    847  1.104       wiz                    will automatically run the sysinst(8) menu-based
    848  1.104       wiz                    installation program, which can be used to install or
    849  1.104       wiz                    upgrade a NetBSD system.  Bootable CD-ROMs also contain
    850  1.104       wiz                    tools that may be useful in repairing a damaged NetBSD
    851  1.104       wiz                    installation.
    852   1.62       apb 
    853  1.126       wiz                    Before "make iso-image" is attempted, RELEASEDIR must be
    854  1.126       wiz                    populated by "make release" or equivalent.
    855   1.62       apb 
    856  1.151     lukem                    Note: Other, smaller, CD-ROM images may be created in the
    857  1.151     lukem                    RELEASEDIR/RELEASEMACHINEDIR/installation/cdrom directory
    858  1.151     lukem                    by "make release".  These smaller images usually contain
    859  1.151     lukem                    the same tools as the larger images in RELEASEDIR/images,
    860  1.151     lukem                    but do not contain additional content such as the
    861  1.151     lukem                    distribution sets.
    862   1.62       apb 
    863  1.151     lukem                    Note: The mac68k port still uses an older method of
    864  1.104       wiz                    creating CD-ROM images.  This requires the mkisofs(1)
    865  1.104       wiz                    utility, which is not part of NetBSD, but which can be
    866  1.105       wiz                    installed from pkgsrc/sysutils/cdrtools.
    867   1.56       apb 
    868  1.105       wiz      iso-image-source
    869   1.64   jnemeth                    Create a NetBSD installation CD-ROM image in the
    870  1.114       snj                    RELEASEDIR/images directory.  The CD-ROM file system will
    871  1.114       snj                    have a layout as described in release(7).  It will have top
    872   1.64   jnemeth                    level directories for the machine type and source.
    873   1.64   jnemeth 
    874   1.64   jnemeth                    For most machine types, the CD-ROM will be bootable, and
    875  1.104       wiz                    will automatically run the sysinst(8) menu-based
    876  1.104       wiz                    installation program, which can be used to install or
    877  1.104       wiz                    upgrade a NetBSD system.  Bootable CD-ROMs also contain
    878  1.104       wiz                    tools that may be useful in repairing a damaged NetBSD
    879  1.104       wiz                    installation.
    880   1.64   jnemeth 
    881  1.126       wiz                    Before "make iso-image-source" is attempted, RELEASEDIR
    882  1.126       wiz                    must be populated by "make sourcesets release" or
    883  1.104       wiz                    equivalent.
    884   1.64   jnemeth 
    885  1.151     lukem                    Note: Other, smaller, CD-ROM images may be created in the
    886  1.151     lukem                    RELEASEDIR/RELEASEMACHINEDIR/installation/cdrom directory
    887  1.151     lukem                    by "make release".  These smaller images usually contain
    888  1.151     lukem                    the same tools as the larger images in RELEASEDIR/images,
    889  1.151     lukem                    but do not contain additional content such as the
    890  1.151     lukem                    distribution sets.
    891   1.64   jnemeth 
    892  1.151     lukem                    Note: The mac68k port still uses an older method of
    893  1.104       wiz                    creating CD-ROM images.  This requires the mkisofs(1)
    894  1.104       wiz                    utility, which is not part of NetBSD, but which can be
    895  1.105       wiz                    installed from pkgsrc/sysutils/cdrtools.
    896   1.64   jnemeth 
    897  1.105       wiz      install-image
    898   1.98       apb                    Create a bootable NetBSD installation disk image in the
    899  1.127    plunky                    RELEASEDIR/images directory.  The installation disk image
    900  1.127    plunky                    is suitable for copying to bootable USB flash memory
    901  1.127    plunky                    sticks, etc., for machines which are able to boot from such
    902  1.127    plunky                    devices.  The file system in the bootable disk image will
    903  1.127    plunky                    have a layout as described in release(7).
    904   1.97   tsutsui 
    905   1.97   tsutsui                    The installation image is bootable, and will automatically
    906   1.97   tsutsui                    run the sysinst(8) menu-based installation program, which
    907   1.98       apb                    can be used to install or upgrade a NetBSD system.  The
    908   1.98       apb                    image also contains tools that may be useful in repairing a
    909   1.98       apb                    damaged NetBSD installation.
    910   1.97   tsutsui 
    911  1.126       wiz                    Before "make install-image" is attempted, RELEASEDIR must
    912  1.126       wiz                    be populated by "make release" or equivalent.  The build
    913  1.126       wiz                    must have been performed with MKUNPRIVED=yes because "make
    914  1.126       wiz                    install-image" relies on information in DESTDIR/METALOG.
    915   1.97   tsutsui 
    916  1.120  pgoyette      live-image    Create NetBSD live images in the RELEASEDIR/images
    917  1.104       wiz                    directory.  The live image contains all necessary files to
    918  1.104       wiz                    boot NetBSD up to multi-user mode, including all files
    919  1.104       wiz                    which should be extracted during installation, NetBSD
    920  1.104       wiz                    disklabel, bootloaders, etc.
    921  1.104       wiz 
    922  1.104       wiz                    The live image is suitable for use as a disk image in
    923  1.104       wiz                    virtual machine environments such as QEMU, and also useful
    924  1.104       wiz                    to boot NetBSD from a USB flash memory stick on a real
    925   1.98       apb                    machine, without the need for installation.
    926   1.97   tsutsui 
    927  1.126       wiz                    Before "make live-image" is attempted, RELEASEDIR must be
    928  1.126       wiz                    populated by "make release" or equivalent.  The build must
    929  1.126       wiz                    have been performed with MKUNPRIVED=yes because "make
    930  1.126       wiz                    install-image" relies on information in DESTDIR/METALOG.
    931   1.97   tsutsui 
    932  1.105       wiz      regression-tests
    933   1.20     lukem                    Can only be run after building the regression tests in the
    934  1.126       wiz                    directory "regress".  Runs those compiled regression tests
    935  1.151     lukem                    on the local host.
    936  1.151     lukem 
    937  1.151     lukem                    Note: Most tests are now managed instead using atf(7); this
    938  1.151     lukem                    target should probably run those as well but currently does
    939  1.151     lukem                    not.
    940    1.1        tv 
    941  1.105       wiz    The "build.sh" script
    942   1.96       apb      This script file is a shell script designed to build the entire NetBSD
    943  1.104       wiz      system on any host with a suitable modern shell and some common
    944  1.105       wiz      utilities.  The required shell features are described under the HOST_SH
    945  1.104       wiz      variable.
    946   1.96       apb 
    947   1.96       apb      If a host system's default shell does support the required features, then
    948   1.96       apb      we suggest that you explicitly specify a suitable shell using a command
    949   1.96       apb      like
    950   1.96       apb 
    951  1.105       wiz            /path/to/suitable/shell build.sh [options]
    952   1.96       apb 
    953  1.105       wiz      The above command will usually enable build.sh to automatically set
    954  1.105       wiz      HOST_SH=/path/to/suitable/shell, but if that fails, then the following
    955   1.96       apb      set of commands may be used instead:
    956   1.96       apb 
    957  1.105       wiz            HOST_SH=/path/to/suitable/shell
    958   1.96       apb            export HOST_SH
    959  1.105       wiz            ${HOST_SH} build.sh [options]
    960   1.96       apb 
    961  1.105       wiz      If build.sh detects that it is being executed under an unsuitable shell,
    962  1.148     lukem      it attempts to exec a suitable shell instead, or shows an error message.
    963  1.105       wiz      If HOST_SH is not set explicitly, then build.sh sets a default using
    964   1.96       apb      heuristics dependent on the host platform, or from the shell under which
    965  1.105       wiz      build.sh is executed (if that can be determined), or using the first copy
    966  1.105       wiz      of sh found in PATH.
    967    1.1        tv 
    968    1.1        tv      All cross-compile builds, and most native builds, of the entire system
    969  1.126       wiz      should make use of build.sh rather than just running "make".  This way,
    970  1.104       wiz      the make(1) program will be bootstrapped properly, in case the host
    971  1.126       wiz      system has an older or incompatible "make" program.
    972    1.1        tv 
    973  1.105       wiz      When compiling the entire system via build.sh, many make(1) variables are
    974    1.1        tv      set for you in order to help encapsulate the build process.  In the list
    975  1.105       wiz      of options below, variables that are automatically set by build.sh are
    976    1.1        tv      noted where applicable.
    977    1.1        tv 
    978  1.105       wiz      The following operations are supported by build.sh:
    979   1.22     lukem 
    980  1.126       wiz      build         Build the system as per "make build".  Before the main part
    981  1.126       wiz                    of the build commences, this command runs the obj operation
    982  1.126       wiz                    (unless the -o option is given), "make cleandir" (unless
    983  1.126       wiz                    the -u option is given), and the tools operation.
    984   1.22     lukem 
    985  1.126       wiz      distribution  Build a full distribution as per "make distribution".  This
    986  1.126       wiz                    command first runs the build operation.
    987   1.22     lukem 
    988  1.126       wiz      release       Build a full release as per "make release".  This command
    989  1.105       wiz                    first runs the distribution operation.
    990   1.22     lukem 
    991  1.148     lukem      help          Show a help message, and exit.
    992  1.148     lukem 
    993  1.105       wiz      makewrapper   Create the nbmake-MACHINE wrapper.  This operation is
    994  1.104       wiz                    automatically performed for any of the other operations.
    995   1.23     lukem 
    996  1.126       wiz      cleandir      Perform "make cleandir".
    997   1.75     lukem 
    998  1.126       wiz      obj           Perform "make obj".
    999   1.22     lukem 
   1000  1.105       wiz      tools         Build and install the host tools from src/tools.  This
   1001  1.126       wiz                    command will first run "make obj" and "make cleandir" in
   1002  1.126       wiz                    the tools subdirectory unless the -o or -u options
   1003  1.104       wiz                    (respectively) are given.
   1004   1.22     lukem 
   1005  1.126       wiz      install=idir  Install the contents of DESTDIR to idir, using "make
   1006  1.151     lukem                    installworld".
   1007  1.151     lukem 
   1008  1.151     lukem                    Note: Files that are part of the "etc" or "xetc" sets will
   1009  1.151     lukem                    not be installed, unless overridden by the INSTALLSETS
   1010  1.151     lukem                    environment variable.
   1011   1.35     lukem 
   1012  1.105       wiz      kernel=kconf  Build a new kernel.  The kconf argument is the name of a
   1013  1.105       wiz                    configuration file suitable for use by config(1).  If kconf
   1014   1.22     lukem                    does not contain any `/' characters, the configuration file
   1015  1.105       wiz                    is expected to be found in the KERNCONFDIR directory, which
   1016  1.105       wiz                    is typically sys/arch/MACHINE/conf.  The new kernel will be
   1017  1.105       wiz                    built in a subdirectory of KERNOBJDIR, which is typically
   1018  1.105       wiz                    sys/arch/MACHINE/compile or an associated object directory.
   1019   1.70  dholland 
   1020  1.105       wiz                    This command does not imply the tools command; run the
   1021  1.105       wiz                    tools command first unless it is certain that the tools
   1022   1.70  dholland                    already exist and are up to date.
   1023   1.70  dholland 
   1024  1.126       wiz                    This command will run "make cleandir" on the kernel in
   1025  1.105       wiz                    question first unless the -u option is given.
   1026   1.22     lukem 
   1027  1.106       wiz      kernel.gdb=kconf
   1028  1.106       wiz                    Build a new kernel with debug information.  Similar to the
   1029  1.106       wiz                    above kernel=kconf operation, but creates a netbsd.gdb file
   1030  1.106       wiz                    alongside of the kernel netbsd, which contains a full
   1031  1.106       wiz                    symbol table and can be used for debugging (for example
   1032  1.106       wiz                    with a cross-gdb built by MKCROSSGDB).
   1033  1.106       wiz 
   1034  1.113  uebayasi      kernels       This command will build all kernels defined in port
   1035  1.113  uebayasi                    specific release build procedure.
   1036  1.111  uebayasi 
   1037  1.112  uebayasi                    This command internally calls the kernel=kconf operation
   1038  1.112  uebayasi                    for each found kernel configuration file.
   1039  1.111  uebayasi 
   1040  1.105       wiz      modules       This command will build kernel modules and install them
   1041  1.105       wiz                    into DESTDIR.
   1042   1.86   jnemeth 
   1043  1.105       wiz      releasekernel=kconf
   1044   1.70  dholland                    Install a gzip(1)ed copy of the kernel previously built by
   1045  1.105       wiz                    kernel=kconf into
   1046  1.105       wiz                    RELEASEDIR/RELEASEMACHINEDIR/binary/kernel, usually as
   1047  1.126       wiz                    netbsd-kconf.gz, although the "netbsd" prefix is determined
   1048  1.126       wiz                    from the "config" directives in kconf.
   1049   1.24     lukem 
   1050  1.126       wiz      sets          Perform "make sets".
   1051   1.31     lukem 
   1052  1.126       wiz      sourcesets    Perform "make sourcesets".
   1053   1.22     lukem 
   1054  1.126       wiz      syspkgs       Perform "make syspkgs".
   1055   1.54       apb 
   1056  1.126       wiz      iso-image     Perform "make iso-image".
   1057   1.56       apb 
   1058  1.105       wiz      iso-image-source
   1059  1.126       wiz                    Perform "make iso-image-source".
   1060   1.65   jnemeth 
   1061  1.105       wiz      install-image
   1062  1.126       wiz                    Perform "make install-image".
   1063   1.97   tsutsui 
   1064  1.126       wiz      live-image    Perform "make live-image".
   1065   1.97   tsutsui 
   1066  1.148     lukem      list-arch     Show a list of valid MACHINE and MACHINE_ARCH settings, the
   1067  1.148     lukem                    default MACHINE_ARCH for each MACHINE, and aliases for
   1068  1.109       apb                    MACHINE/MACHINE_ARCH pairs, and then exits.  The -m or -a
   1069  1.109       apb                    options (or both) may be used to specify glob patterns that
   1070  1.109       apb                    will be used to narrow the list of results; for example,
   1071  1.131      leot                    "build.sh -m 'evb*' -a '*arm*' list-arch" will list all
   1072  1.109       apb                    known MACHINE/MACHINE_ARCH values in which either MACHINE
   1073  1.109       apb                    or ALIAS matches the pattern `evb*', and MACHINE_ARCH
   1074  1.109       apb                    matches the pattern `*arm*'.
   1075  1.109       apb 
   1076  1.105       wiz      The following command line options alter the behaviour of the build.sh
   1077   1.51       wiz      operations described above:
   1078    1.1        tv 
   1079  1.109       apb      -a arch   Set the value of MACHINE_ARCH to arch.  See the -m option for
   1080  1.109       apb                more information.
   1081    1.9   thorpej 
   1082  1.105       wiz      -B buildid
   1083  1.105       wiz                Set the value of BUILDID to buildid.  This will also append the
   1084  1.126       wiz                build identifier to the name of the "make" wrapper script so
   1085   1.37     lukem                that the resulting name is of the form
   1086  1.126       wiz                "nbmake-MACHINE-BUILDID".
   1087    1.1        tv 
   1088  1.105       wiz      -C cdextras
   1089  1.105       wiz                Append cdextras to the CDEXTRA variable, which is a space-
   1090  1.104       wiz                separated list of files or directories that will be added to
   1091  1.126       wiz                the CD-ROM image that may be create by the "iso-image" or
   1092  1.126       wiz                "iso-image-source" operations.  Files will be added to the root
   1093  1.126       wiz                of the CD-ROM image, whereas directories will be copied
   1094   1.87       apb                recursively.  If relative paths are specified, they will be
   1095   1.87       apb                converted to absolute paths before being used.  Multiple paths
   1096  1.105       wiz                may be specified via multiple -C options, or via a single
   1097   1.87       apb                option whose argument contains multiple space-separated paths.
   1098   1.66   jnemeth 
   1099  1.136       uwe      -c compiler
   1100  1.136       uwe                Select the compiler for the toolchain to build NetBSD and for
   1101  1.136       uwe                inclusion in the NetBSD distribution.  Supported choices:
   1102  1.136       uwe 
   1103  1.136       uwe                      clang
   1104  1.136       uwe 
   1105  1.136       uwe                      gcc [default]
   1106  1.136       uwe 
   1107  1.136       uwe                The compiler used to build the toolchain can be different; see
   1108  1.136       uwe                HOST_CC and HOST_CXX.
   1109  1.136       uwe 
   1110  1.105       wiz      -D dest   Set the value of DESTDIR to dest.  If a relative path is
   1111  1.104       wiz                specified, it will be converted to an absolute path before
   1112  1.104       wiz                being used.
   1113  1.104       wiz 
   1114  1.105       wiz      -E        Set `expert' mode.  This overrides various sanity checks, and
   1115  1.105       wiz                allows: DESTDIR does not have to be set to a non-root path for
   1116  1.105       wiz                builds, and MKUNPRIVED=yes does not have to be set when
   1117  1.104       wiz                building as a non-root user.
   1118   1.23     lukem 
   1119  1.105       wiz                Note: It is highly recommended that you know what you are doing
   1120   1.23     lukem                when you use this option.
   1121   1.19     lukem 
   1122  1.148     lukem      -h        Show a help message, and exit.
   1123   1.51       wiz 
   1124  1.105       wiz      -j njob   Run up to njob make(1) subjobs in parallel; passed through to
   1125   1.74       apb                make(1).  If you see failures for reasons other than running
   1126  1.105       wiz                out of memory while using build.sh with -j, please save
   1127  1.104       wiz                complete build logs so the failures can be analyzed.
   1128   1.74       apb 
   1129  1.105       wiz                To achieve the fastest builds, -j values between (1 + the
   1130  1.104       wiz                number of CPUs) and (2 * the number of CPUs) are recommended.
   1131  1.104       wiz                Use lower values on machines with limited memory or I/O
   1132  1.104       wiz                bandwidth.
   1133  1.104       wiz 
   1134  1.126       wiz      -M obj    Set MAKEOBJDIRPREFIX to obj.  Unsets MAKEOBJDIR.  See "-O obj"
   1135  1.126       wiz                for more information.
   1136  1.104       wiz 
   1137  1.105       wiz                For instance, if the source directory is /usr/src, a setting of
   1138  1.126       wiz                "-M /usr/obj" will place build-time files under
   1139  1.105       wiz                /usr/obj/usr/src/bin, /usr/obj/usr/src/lib,
   1140  1.105       wiz                /usr/obj/usr/src/usr.bin, and so forth.
   1141   1.88       apb 
   1142   1.73       apb                If a relative path is specified, it will be converted to an
   1143  1.105       wiz                absolute path before being used.  build.sh imposes the
   1144  1.105       wiz                restriction that the argument to the -M option must not begin
   1145  1.126       wiz                with a "$" (dollar sign) character; otherwise it would be too
   1146  1.104       wiz                difficult to determine whether the value is an absolute or a
   1147  1.104       wiz                relative path.  If the directory does not already exist,
   1148  1.105       wiz                build.sh will create it.
   1149   1.18     lukem 
   1150  1.109       apb      -m mach   Set the value of MACHINE to mach, unless the mach argument is
   1151  1.109       apb                an alias that refers to a MACHINE/MACHINE_ARCH pair, in which
   1152  1.109       apb                case both MACHINE and MACHINE_ARCH are set from the alias.
   1153  1.109       apb                Such aliases are interpreted entirely by build.sh; they are not
   1154  1.109       apb                used by any other part of the build system.  The MACHINE_ARCH
   1155  1.109       apb                setting implied by mach will override any value of MACHINE_ARCH
   1156  1.109       apb                in the process environment, but will not override a value set
   1157  1.109       apb                by the -a option.  All cross builds require -m, but if unset on
   1158  1.109       apb                a NetBSD host, the host's value of MACHINE will be detected and
   1159  1.109       apb                used automatically.
   1160  1.109       apb 
   1161  1.109       apb                See the list-arch operation for a way to get a list of valid
   1162  1.109       apb                MACHINE and MACHINE_ARCH settings.
   1163    1.1        tv 
   1164  1.105       wiz      -N noiselevel
   1165  1.126       wiz                Set the "noisyness" level of the build, by setting MAKEVERBOSE
   1166  1.126       wiz                to noiselevel.
   1167   1.45     lukem 
   1168  1.105       wiz      -n        Show the commands that would be executed by build.sh, but do
   1169  1.126       wiz                not make any changes.  This is similar in concept to "make -n".
   1170    1.1        tv 
   1171  1.105       wiz      -O obj    Create an appropriate transform macro for MAKEOBJDIR that will
   1172  1.105       wiz                place the built object files under obj.  Unsets
   1173  1.105       wiz                MAKEOBJDIRPREFIX.
   1174   1.88       apb 
   1175  1.126       wiz                For instance, a setting of "-O /usr/obj" will place build-time
   1176  1.126       wiz                files under /usr/obj/bin, /usr/obj/lib, /usr/obj/usr.bin, and
   1177  1.126       wiz                so forth.
   1178   1.88       apb 
   1179   1.88       apb                If a relative path is specified, it will be converted to an
   1180  1.105       wiz                absolute path before being used.  build.sh imposes the
   1181  1.105       wiz                restriction that the argument to the -O option must not contain
   1182  1.126       wiz                a "$" (dollar sign) character.  If the directory does not
   1183  1.105       wiz                already exist, build.sh will create it.
   1184   1.73       apb 
   1185  1.105       wiz                In normal use, exactly one of the -M or -O options should be
   1186  1.105       wiz                specified.  If neither -M nor -O is specified, then a default
   1187   1.78       apb                object directory will be chosen according to rules in
   1188   1.78       apb                <bsd.obj.mk>.  Relying on this default is not recommended
   1189   1.78       apb                because it is determined by complex rules that are influenced
   1190   1.78       apb                by the values of several variables and by the location of the
   1191   1.78       apb                source directory.
   1192   1.18     lukem 
   1193  1.151     lukem                Note: Placing the obj directory location outside of the default
   1194  1.151     lukem                source tree hierarchy makes it easier to manually clear out old
   1195  1.151     lukem                files in the event the "make cleandir" operation is unable to
   1196  1.151     lukem                do so.  (See CAVEATS below.)
   1197  1.151     lukem 
   1198  1.151     lukem                Note: The use of one of -M or -O is the only means of building
   1199  1.151     lukem                multiple machine architecture userlands from the same source
   1200  1.151     lukem                tree without cleaning between builds (in which case, one would
   1201  1.151     lukem                specify distinct obj locations for each).
   1202  1.109       apb 
   1203  1.126       wiz      -o        Set the value of MKOBJDIRS to "no".  Otherwise, it will be
   1204  1.126       wiz                automatically set to "yes".  This default is opposite to the
   1205  1.105       wiz                behaviour when not using build.sh.
   1206    1.1        tv 
   1207  1.148     lukem      -P        Set the value of MKREPRO and MKREPRO_TIMESTAMP to the latest
   1208  1.148     lukem                source CVS timestamp for reproducible builds.
   1209  1.148     lukem 
   1210  1.105       wiz      -R rel    Set the value of RELEASEDIR to rel.  If a relative path is
   1211   1.59       apb                specified, it will be converted to an absolute path before
   1212   1.59       apb                being used.
   1213   1.18     lukem 
   1214  1.105       wiz      -r        Remove the contents of DESTDIR and TOOLDIR before building
   1215    1.1        tv                (provides a clean starting point).  This will skip deleting
   1216  1.105       wiz                DESTDIR if building on a native system to the root directory.
   1217    1.1        tv 
   1218  1.105       wiz      -S seed   Change the value of BUILDSEED to seed.  This should rarely be
   1219   1.72     perry                necessary.
   1220   1.72     perry 
   1221  1.105       wiz      -T tools  Set the value of TOOLDIR to tools.  If a relative path is
   1222  1.104       wiz                specified, it will be converted to an absolute path before
   1223  1.126       wiz                being used.  If set, the bootstrap "make" will only be rebuilt
   1224  1.126       wiz                if the source files for make(1) have changed.
   1225  1.104       wiz 
   1226  1.105       wiz      -U        Set MKUNPRIVED=yes.
   1227  1.104       wiz 
   1228  1.105       wiz      -u        Set MKUPDATE=yes.
   1229  1.104       wiz 
   1230  1.105       wiz      -V var=[value]
   1231  1.105       wiz                Set the environment variable var to an optional value.  This is
   1232  1.105       wiz                propagated to the nbmake wrapper.
   1233  1.105       wiz 
   1234  1.105       wiz      -w wrapper
   1235  1.105       wiz                Create the nbmake wrapper script (see below) in a custom
   1236  1.105       wiz                location, specified by wrapper.  This allows, for instance, to
   1237  1.151     lukem                place the wrapper in PATH automatically.
   1238  1.151     lukem 
   1239  1.151     lukem                Note: wrapper is the full name of the file, not just a
   1240  1.151     lukem                directory name.  If a relative path is specified, it will be
   1241  1.151     lukem                converted to an absolute path before being used.
   1242    1.1        tv 
   1243  1.105       wiz      -X x11src
   1244  1.105       wiz                Set the value of X11SRCDIR to x11src.  If a relative path is
   1245   1.59       apb                specified, it will be converted to an absolute path before
   1246   1.59       apb                being used.
   1247   1.49     lukem 
   1248  1.105       wiz      -x        Set MKX11=yes.
   1249   1.49     lukem 
   1250  1.105       wiz      -Z var    Unset ("zap") the environment variable var.  This is propagated
   1251  1.105       wiz                to the nbmake wrapper.
   1252   1.40     lukem 
   1253  1.148     lukem      -?        Show a help message, and exit.
   1254  1.148     lukem 
   1255  1.105       wiz    The "nbmake-MACHINE" wrapper script
   1256  1.105       wiz      If using the build.sh script to build NetBSD, a nbmake-MACHINE script
   1257  1.105       wiz      will be created in TOOLDIR/bin upon the first build to assist in building
   1258    1.1        tv      subtrees on a cross-compile host.
   1259    1.1        tv 
   1260  1.105       wiz      nbmake-MACHINE can be invoked in lieu of make(1), and will instead call
   1261  1.126       wiz      the up-to-date version of "nbmake" installed into TOOLDIR/bin with
   1262  1.105       wiz      several key variables pre-set, including MACHINE, MACHINE_ARCH, and
   1263  1.105       wiz      TOOLDIR.  nbmake-MACHINE will also set variables specified with -V, and
   1264  1.105       wiz      unset variables specified with -Z.
   1265   1.40     lukem 
   1266  1.105       wiz      This script can be symlinked into a directory listed in PATH, or called
   1267    1.1        tv      with an absolute path.
   1268    1.1        tv 
   1269  1.105       wiz EXAMPLES
   1270  1.151     lukem      1.   % ./build.sh [OPTIONS] tools kernel=GENERIC
   1271   1.28     lukem 
   1272   1.28     lukem           Build a new toolchain, and use the new toolchain to configure and
   1273   1.28     lukem           build a new GENERIC kernel.
   1274   1.28     lukem 
   1275  1.151     lukem      2.   % ./build.sh [OPTIONS] -U distribution
   1276   1.28     lukem 
   1277  1.105       wiz           Using unprivileged mode, build a complete distribution to a DESTDIR
   1278  1.148     lukem           directory that build.sh selects (and will show).
   1279   1.28     lukem 
   1280  1.151     lukem      3.   # ./build.sh [OPTIONS] -U install=/
   1281   1.28     lukem 
   1282  1.105       wiz           As root, install to / the distribution that was built by example 2.
   1283  1.105       wiz           Even though this is run as root, -U is required so that the
   1284  1.105       wiz           permissions stored in DESTDIR/METALOG are correctly applied to the
   1285  1.105       wiz           files as they're copied to /.
   1286   1.28     lukem 
   1287  1.151     lukem      4.   % ./build.sh [OPTIONS] -U -u release
   1288   1.28     lukem 
   1289  1.105       wiz           Using unprivileged mode, build a complete release to DESTDIR and
   1290  1.148     lukem           RELEASEDIR directories that build.sh selects (and will show).
   1291  1.126       wiz           MKUPDATE=yes (-u) is set to prevent the "make cleandir", so that if
   1292  1.126       wiz           this is run after example 2, it doesn't need to redo that portion of
   1293  1.126       wiz           the release build.
   1294   1.16     lukem 
   1295  1.105       wiz OBSOLETE VARIABLES
   1296  1.105       wiz      NBUILDJOBS  Use the make(1) option -j instead.
   1297   1.15     lukem 
   1298  1.105       wiz      USE_NEW_TOOLCHAIN
   1299   1.15     lukem                  The new toolchain is now the default.  To disable, use
   1300  1.105       wiz                  TOOLCHAIN_MISSING=yes.
   1301   1.10  sommerfe 
   1302  1.105       wiz SEE ALSO
   1303  1.151     lukem      ar(1), config(1), ctags(1), cvs(1), cvslatest(1), ex(1), g++(1), gzip(1),
   1304  1.151     lukem      ident(1), ld(1), lint(1), make(1), mkisofs(1), sh(1), uname(1), vi(1),
   1305  1.151     lukem      options(4), mk.conf(5), atf(7), hier(7), release(7), sysctl(7),
   1306  1.151     lukem      etcupdate(8), installboot(8), mount(8), mtree(8), postinstall(8),
   1307  1.151     lukem      sysinst(8), pkgsrc/sysutils/cdrtools
   1308    1.1        tv 
   1309  1.105       wiz HISTORY
   1310  1.105       wiz      The build.sh based build scheme was introduced for NetBSD 1.6 as
   1311  1.105       wiz      USE_NEW_TOOLCHAIN, and re-worked to TOOLCHAIN_MISSING after that.
   1312    1.1        tv 
   1313  1.109       apb CAVEATS
   1314  1.109       apb      After significant updates to third-party components in the source tree,
   1315  1.126       wiz      the "make cleandir" operation may be insufficient to clean out old files
   1316  1.126       wiz      in object directories.  Instead, one may have to manually remove the
   1317  1.126       wiz      files.  Consult the UPDATING file for notices concerning this.
   1318  1.109       apb 
   1319  1.152     lukem NetBSD                           June 5, 2023                           NetBSD
   1320