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