BUILDING revision 1.99
11.1StvBUILDING(8) NetBSD System Manager's Manual BUILDING(8) 21.1Stv 31.1StvNAME 41.52Sjmc BUILDING -- Procedure for building NetBSD from source code. 51.1Stv 61.1StvREQUIREMENTS 71.1Stv NetBSD is designed to be buildable on most POSIX-compliant host systems. 81.1Stv The basic build procedure is the same whether compiling natively (on the 91.1Stv same NetBSD architecture) or cross compiling (on another architecture or 101.1Stv OS). 111.1Stv 121.1Stv This source tree contains a special subtree, ``tools'', which uses the 131.1Stv host system to create a build toolchain for the target architecture. The 141.1Stv host system must have at least C and C++ compilers in order to create the 151.1Stv toolchain (make is not required); all other tools are created as part of 161.53Sreed the NetBSD build process. (See the environment variables section below 171.53Sreed if you need to override or manually select your compilers.) 181.1Stv 191.1StvFILES 201.1Stv Source tree layout 211.17Swiz doc/BUILDING.mdoc 221.17Swiz This document (in -mdoc troff format; the original copy). 231.1Stv 241.2Swiz BUILDING This document (in plaintext). 251.1Stv 261.48Sjmc tools/compat/README 271.48Sjmc Special notes for cross-hosting a NetBSD build on non- 281.48Sjmc NetBSD platforms. 291.48Sjmc 301.44Slukem Makefile The main Makefile for NetBSD; should only be run for 311.44Slukem native builds with an appropriately up-to-date version of 321.1Stv NetBSD make(1). (For building from out-of-date systems or 331.1Stv on a non-native host, see the build.sh shell script.) 341.1Stv 351.1Stv UPDATING Special notes for updating from an earlier revision of 361.1Stv NetBSD. It is important to read this file before every 371.1Stv build of an updated source tree. 381.1Stv 391.1Stv build.sh Bourne-compatible shell script used for building the host 401.1Stv build tools and the NetBSD system from scratch. Can be 411.1Stv used for both native and cross builds, and should be used 421.1Stv instead of make(1) for any source tree that is updated and 431.1Stv recompiled regularly. 441.1Stv 451.1Stv crypto/dist/, dist/, gnu/dist/ 461.1Stv Sources imported verbatim from third parties, without man- 471.1Stv gling the existing build structure. Other source trees in 481.1Stv bin through usr.sbin use the NetBSD make(1) ``reachover'' 491.44Slukem Makefile semantics when building these programs for a 501.44Slukem native host. 511.1Stv 521.1Stv distrib/, etc/ 531.1Stv Sources for items used when making a full release snap- 541.27Slukem shot, such as files installed in DESTDIR/etc on the desti- 551.27Slukem nation system, boot media, and release notes. 561.1Stv 571.70Sdholland tests/, regress/ 581.70Sdholland Regression test harness. Can be cross-compiled, but only 591.70Sdholland run natively. tests/ uses the atf(7) test framework; 601.70Sdholland regress/ contains older tests that have not yet been 611.70Sdholland migrated to atf(7). 621.1Stv 631.1Stv sys/ NetBSD kernel sources. 641.1Stv 651.1Stv tools/ ``Reachover'' build structure for the host build tools. 661.1Stv This has a special method of determining out-of-date sta- 671.1Stv tus. 681.1Stv 691.1Stv bin/ ... usr.sbin/ 701.1Stv Sources to the NetBSD userland (non-kernel) programs. If 711.1Stv any of these directories are missing, they will be skipped 721.1Stv during the build. 731.1Stv 741.49Slukem x11/ ``Reachover'' build structure for X11R6; the source is in 751.49Slukem X11SRCDIR. 761.49Slukem 771.1Stv Build tree layout 781.1Stv The NetBSD build tree is described in hier(7), and the release layout is 791.1Stv described in release(7). 801.1Stv 811.1StvCONFIGURATION 821.8Slukem Environment variables 831.8Slukem Several environment variables control the behaviour of NetBSD builds. 841.8Slukem 851.96Sapb HOST_SH Path name to a shell available on the host system and 861.96Sapb suitable for use during the build. The NetBSD build 871.96Sapb system requires a modern Bourne-like shell with POSIX- 881.96Sapb compliant features, and also requires support for the 891.96Sapb ``local'' keyword to declare local variables in shell 901.96Sapb functions (which is a widely-implemented but non-stan- 911.96Sapb dardised feature). 921.96Sapb 931.96Sapb Depending on the host system, a suitable shell may be 941.96Sapb /bin/sh, /usr/xpg4/bin/sh, /bin/ksh (provided it is a 951.96Sapb variant of ksh that supports the ``local'' keyword, 961.96Sapb such as ksh88, but not ksh93), or /usr/local/bin/bash. 971.96Sapb 981.96Sapb Most parts of the build require HOST_SH to be an abso- 991.96Sapb lute path; however, build.sh allows it to be a simple 1001.96Sapb command name, which will be converted to an absolute 1011.96Sapb path by searching the PATH. 1021.58Sapb 1031.53Sreed HOST_CC Path name to C compiler used to create the toolchain. 1041.53Sreed 1051.53Sreed HOST_CXX Path name to C++ compiler used to create the toolchain. 1061.53Sreed 1071.70Sdholland MACHINE Machine type, e.g., ``macppc''. 1081.8Slukem 1091.70Sdholland MACHINE_ARCH Machine architecture, e.g., ``powerpc''. 1101.8Slukem 1111.8Slukem MAKE Path name to invoke make(1) as. 1121.8Slukem 1131.94Sapb MAKEFLAGS Flags to invoke make(1) with. Note that build.sh 1141.94Sapb ignores the value of MAKEFLAGS passed in the environ- 1151.94Sapb ment, but allows MAKEFLAGS to be set via the -V option. 1161.8Slukem 1171.8Slukem MAKEOBJDIR Directory to use as the .OBJDIR for the current direc- 1181.59Sapb tory. The value is subjected to variable expansion by 1191.73Sapb make(1). Typical usage is to set this variable to a 1201.73Sapb value involving the use of `${.CURDIR:S...}' or 1211.73Sapb `${.CURDIR:C...}', to derive the value of .OBJDIR from 1221.73Sapb the value of .CURDIR. Used only if MAKEOBJDIRPREFIX is 1231.73Sapb not defined. MAKEOBJDIR can be provided only in the 1241.73Sapb environment or via the -O flag of build.sh; it cannot 1251.82Smrg usefully be set inside a Makefile, including mk.conf or 1261.82Smrg ${MAKECONF}. 1271.8Slukem 1281.88Sapb MAKEOBJDIRPREFIX Top level directory of the object directory tree. The 1291.88Sapb value is subjected to variable expansion by make(1). 1301.88Sapb build.sh will create the ${MAKEOBJDIRPREFIX} directory 1311.88Sapb if necessary, but if make(1) is used without build.sh, 1321.88Sapb then rules in <bsd.obj.mk> will abort the build if the 1331.88Sapb ${MAKEOBJDIRPREFIX} directory does not exist. If the 1341.88Sapb value is defined and valid, then ${MAKEOBJDIRPRE- 1351.88Sapb FIX}/${.CURDIR} is used as the .OBJDIR for the current 1361.88Sapb directory. The current directory may be read only. 1371.88Sapb MAKEOBJDIRPREFIX can be provided only in the environ- 1381.88Sapb ment or via the -M flag of build.sh; it cannot usefully 1391.88Sapb be set inside a Makefile, including mk.conf or 1401.88Sapb ${MAKECONF}. 1411.8Slukem 1421.1Stv "make" variables 1431.1Stv Several variables control the behavior of NetBSD builds. Unless other- 1441.1Stv wise specified, these variables may be set in either the process environ- 1451.1Stv ment or the make(1) configuration file specified by MAKECONF. 1461.1Stv 1471.9Sthorpej BUILDID Identifier for the build. The identifier will be appended to 1481.9Sthorpej object directory names, and can be consulted in the make(1) 1491.9Sthorpej configuration file in order to set additional build parame- 1501.9Sthorpej ters, such as compiler flags. 1511.9Sthorpej 1521.72Sperry BUILDSEED GCC uses random numbers when compiling C++ code. This vari- 1531.72Sperry able seeds the gcc random number generator using the -fran- 1541.72Sperry dom-seed flag with this value. By default, it is set to 1551.72Sperry NetBSD-(majorversion). Using a fixed value causes C++ bina- 1561.84Shubertf ries to be the same when built from the same sources, result- 1571.85Shubertf ing in identical (reproducible) builds. Additional informa- 1581.84Shubertf tion is available in the GCC documentation of -frandom-seed. 1591.72Sperry 1601.1Stv DESTDIR Directory to contain the built NetBSD system. If set, spe- 1611.1Stv cial options are passed to the compilation tools to prevent 1621.1Stv their default use of the host system's /usr/include, 1631.59Sapb /usr/lib, and so forth. This pathname must be an absolute 1641.59Sapb path, and should not end with a slash (/) character. (For 1651.59Sapb installation into the system's root directory, set DESTDIR to 1661.59Sapb an empty string, not to ``/''). The directory must reside on 1671.59Sapb a file system which supports long file names and hard links. 1681.1Stv 1691.1Stv Default: Empty string if USETOOLS is ``yes''; unset other- 1701.1Stv wise. 1711.1Stv 1721.30Slukem Note: build.sh will provide a default of destdir.MACHINE (in 1731.70Sdholland the top-level .OBJDIR) unless run in `expert' mode. 1741.30Slukem 1751.1Stv MAKECONF The name of the make(1) configuration file. Only settable in 1761.1Stv the process environment. 1771.1Stv 1781.1Stv Default: ``/etc/mk.conf'' 1791.1Stv 1801.45Slukem MAKEVERBOSE 1811.45Slukem Level of verbosity of status messages. Supported values: 1821.45Slukem 1831.80Sapb 0 No descriptive messages or commands executed by make(1) 1841.80Sapb are shown. 1851.45Slukem 1861.80Sapb 1 Brief messages are shown describing what is being done, 1871.80Sapb but the actual commands executed by make(1) are not dis- 1881.80Sapb played. 1891.80Sapb 1901.80Sapb 2 Descriptive messages are shown as above (prefixed with a 1911.80Sapb `#'), and ordinary commands performed by make(1) are 1921.80Sapb displayed. 1931.80Sapb 1941.80Sapb 3 In addition to the above, all commands performed by 1951.80Sapb make(1) are displayed, even if they would ordinarily 1961.80Sapb have been hidden through use of the ``@'' prefix in the 1971.80Sapb relevant makefile. 1981.45Slukem 1991.80Sapb 4 In addition to the above, commands executed by make(1) 2001.80Sapb are traced through use of the sh(1) ``-x'' flag. 2011.45Slukem 2021.45Slukem Default: 2 2031.45Slukem 2041.1Stv MKCATPAGES Can be set to ``yes'' or ``no''. Indicates whether prefor- 2051.1Stv matted plaintext manual pages will be created during a build. 2061.1Stv 2071.1Stv Default: ``yes'' 2081.1Stv 2091.1Stv MKCRYPTO Can be set to ``yes'' or ``no''. Indicates whether crypto- 2101.1Stv graphic code will be included in a build; provided for the 2111.1Stv benefit of countries that do not allow strong cryptography. 2121.44Slukem Will not affect use of the standard low-security password 2131.44Slukem encryption system, crypt(3). 2141.1Stv 2151.1Stv Default: ``yes'' 2161.1Stv 2171.1Stv MKDOC Can be set to ``yes'' or ``no''. Indicates whether system 2181.44Slukem documentation destined for DESTDIR/usr/share/doc will be 2191.44Slukem installed during a build. 2201.1Stv 2211.1Stv Default: ``yes'' 2221.1Stv 2231.77Slukem MKHTML Can be set to ``yes'' or ``no''. Indicates whether prefor- 2241.77Slukem matted HTML manual pages will be built and installed 2251.77Slukem 2261.77Slukem Default: ``yes'' 2271.77Slukem 2281.4Stv MKHOSTOBJ Can be set to ``yes'' or ``no''. If set to ``yes'', then for 2291.4Stv programs intended to be run on the compile host, the name, 2301.4Stv release, and architecture of the host operating system will 2311.4Stv be suffixed to the name of the object directory created by 2321.4Stv ``make obj''. (This allows multiple host systems to compile 2331.4Stv NetBSD for a single target.) If set to ``no'', then programs 2341.4Stv built to be run on the compile host will use the same object 2351.4Stv directory names as programs built to be run on the target. 2361.4Stv 2371.4Stv Default: ``no'' 2381.4Stv 2391.1Stv MKINFO Can be set to ``yes'' or ``no''. Indicates whether GNU Info 2401.1Stv files, used for the documentation for most of the compilation 2411.1Stv tools, will be created and installed during a build. 2421.1Stv 2431.1Stv Default: ``yes'' 2441.1Stv 2451.95Sapb MKKMOD Can be set to ``yes'' or ``no''. Indicates whether kernel 2461.95Sapb modules are built and installed. 2471.95Sapb 2481.95Sapb Default: ``yes'' 2491.95Sapb 2501.1Stv MKLINT Can be set to ``yes'' or ``no''. Indicates whether lint(1) 2511.1Stv will be run against portions of the NetBSD source code during 2521.1Stv the build, and whether lint libraries will be installed into 2531.27Slukem DESTDIR/usr/libdata/lint. 2541.1Stv 2551.1Stv Default: ``yes'' 2561.1Stv 2571.1Stv MKMAN Can be set to ``yes'' or ``no''. Indicates whether manual 2581.1Stv pages will be installed during a build. 2591.1Stv 2601.1Stv Default: ``yes'' 2611.1Stv 2621.1Stv MKNLS Can be set to ``yes'' or ``no''. Indicates whether Native 2631.44Slukem Language System locale zone files will be compiled and 2641.44Slukem installed during a build. 2651.1Stv 2661.1Stv Default: ``yes'' 2671.1Stv 2681.1Stv MKOBJ Can be set to ``yes'' or ``no''. Indicates whether object 2691.1Stv directories will be created when running ``make obj''. If 2701.1Stv set to ``no'', then all built files will be located inside 2711.1Stv the regular source tree. 2721.1Stv 2731.1Stv Default: ``yes'' 2741.1Stv 2751.70Sdholland Note that setting MKOBJ to ``no'' is not recommended and may 2761.70Sdholland cause problems when updating the tree with cvs(1). 2771.70Sdholland 2781.1Stv MKPIC Can be set to ``yes'' or ``no''. Indicates whether shared 2791.1Stv objects and libraries will be created and installed during a 2801.1Stv build. If set to ``no'', the entire built system will be 2811.1Stv statically linked. 2821.1Stv 2831.1Stv Default: Platform dependent. As of this writing, all plat- 2841.1Stv forms except sh3 default to ``yes''. 2851.1Stv 2861.1Stv MKPICINSTALL 2871.1Stv Can be set to ``yes'' or ``no''. Indicates whether the ar(1) 2881.44Slukem format libraries (lib*_pic.a), used to generate shared 2891.44Slukem libraries, are installed during a build. 2901.1Stv 2911.1Stv Default: ``yes'' 2921.1Stv 2931.1Stv MKPROFILE Can be set to ``yes'' or ``no''. Indicates whether profiled 2941.1Stv libraries (lib*_p.a) will be built and installed during a 2951.1Stv build. 2961.1Stv 2971.1Stv Default: ``yes''; however, some platforms turn off MKPROFILE 2981.1Stv by default at times due to toolchain problems with profiled 2991.1Stv code. 3001.1Stv 3011.1Stv MKSHARE Can be set to ``yes'' or ``no''. Indicates whether files 3021.44Slukem destined to reside in DESTDIR/usr/share will be built and 3031.44Slukem installed during a build. If set to ``no'', then all of 3041.27Slukem MKCATPAGES, MKDOC, MKINFO, MKMAN, and MKNLS will be set to 3051.27Slukem ``no'' unconditionally. 3061.1Stv 3071.1Stv Default: ``yes'' 3081.1Stv 3091.78Sapb MKSTRIPIDENT 3101.78Sapb Can be set to ``yes'' or ``no''. Indicates whether program 3111.78Sapb binaries and shared libraries should be built to include RCS 3121.78Sapb IDs for use with ident(1). 3131.78Sapb 3141.78Sapb Default: ``no'' 3151.78Sapb 3161.44Slukem MKUNPRIVED Can be set to ``yes'' or ``no''. Indicates whether an 3171.44Slukem unprivileged install will occur. The user, group, permis- 3181.52Sjmc sions, and file flags, will not be set on the installed 3191.52Sjmc items; instead the information will be appended to a file 3201.52Sjmc called METALOG in DESTDIR. The contents of METALOG are used 3211.52Sjmc during the generation of the distribution tar files to ensure 3221.52Sjmc that the appropriate file ownership is stored. 3231.38Slukem 3241.38Slukem Default: ``no'' 3251.38Slukem 3261.44Slukem MKUPDATE Can be set to ``yes'' or ``no''. Indicates whether all 3271.44Slukem install operations intended to write to DESTDIR will compare 3281.38Slukem file timestamps before installing, and skip the install phase 3291.44Slukem if the destination files are up-to-date. This also has 3301.44Slukem implications on full builds (see next subsection). 3311.38Slukem 3321.38Slukem Default: ``no'' 3331.38Slukem 3341.79Smrg MKX11 Can be set to ``yes'' or ``no''. Indicates whether X11 is 3351.49Slukem built from X11SRCDIR. 3361.49Slukem 3371.49Slukem Default: ``no'' 3381.49Slukem 3391.59Sapb TOOLDIR Directory to hold the host tools, once built. If specified, 3401.59Sapb must be an absolute path. This directory should be unique to 3411.59Sapb a given host system and NetBSD source tree. (However, multi- 3421.59Sapb ple targets may share the same TOOLDIR; the target-dependent 3431.59Sapb files have unique names.) If unset, a default based on the 3441.59Sapb uname(1) information of the host platform will be created in 3451.59Sapb the .OBJDIR of src. 3461.1Stv 3471.1Stv Default: Unset. 3481.1Stv 3491.1Stv USETOOLS Indicates whether the tools specified by TOOLDIR should be 3501.1Stv used as part of a build in progress. Must be set to ``yes'' 3511.1Stv if cross-compiling. 3521.1Stv 3531.1Stv yes Use the tools from TOOLDIR. 3541.1Stv 3551.1Stv no Do not use the tools from TOOLDIR, but refuse to build 3561.1Stv native compilation tool components that are version- 3571.1Stv specific for that tool. 3581.1Stv 3591.1Stv never Do not use the tools from TOOLDIR, even when building 3601.1Stv native tool components. This is similar to the tradi- 3611.1Stv tional NetBSD build method, but does not verify that 3621.1Stv the compilation tools in use are up-to-date enough in 3631.1Stv order to build the tree successfully. This may cause 3641.1Stv build or runtime problems when building the whole 3651.1Stv NetBSD source tree. 3661.1Stv 3671.71Sdholland Default: ``yes'', unless TOOLCHAIN_MISSING is set to ``yes''. 3681.71Sdholland 3691.71Sdholland USETOOLS is also set to ``no'' when using <bsd.*.mk> outside 3701.71Sdholland the NetBSD source tree. 3711.1Stv 3721.59Sapb X11SRCDIR Directory containing the X11R6 source. If specified, must be 3731.59Sapb an absolute path. The main X11R6 source is found in 3741.59Sapb X11SRCDIR/xfree/xc. 3751.49Slukem 3761.89Sapb Default: NETBSDRCDIR/../xsrc, if that exists; otherwise 3771.89Sapb /usr/xsrc. 3781.49Slukem 3791.79Smrg X11FLAVOUR The style of X11 cross-built, set to either ``Xorg'' or 3801.79Smrg ``XFree86''. 3811.79Smrg 3821.81Smrg Default: ``Xorg'' on amd64, i386, macppc, shark and sparc64 3831.81Smrg platforms, ``XFree86'' on everything else. 3841.79Smrg 3851.1Stv "make" variables for full builds 3861.7Slukem These variables only affect the top level ``Makefile'' and do not affect 3871.7Slukem manually building subtrees of the NetBSD source code. 3881.1Stv 3891.20Slukem INSTALLWORLDDIR Location for the ``make installworld'' target to install 3901.59Sapb to. If specified, must be an absolute path. 3911.1Stv 3921.20Slukem Default: ``/'' 3931.1Stv 3941.44Slukem MKOBJDIRS Can be set to ``yes'' or ``no''. Indicates whether 3951.44Slukem object directories will be created automatically (via a 3961.20Slukem ``make obj'' pass) at the start of a build. 3971.1Stv 3981.34Slukem Default: ``no'' 3991.1Stv 4001.70Sdholland If using build.sh, the default is ``yes''. This may be 4011.70Sdholland set back to ``no'' by giving build.sh the -o option. 4021.70Sdholland 4031.38Slukem MKUPDATE Can be set to ``yes'' or ``no''. If set, then in addi- 4041.38Slukem tion to the effects described for MKUPDATE=yes above, 4051.38Slukem this implies the effects of NOCLEANDIR (i.e., ``make 4061.38Slukem cleandir'' is avoided). 4071.38Slukem 4081.38Slukem Default: ``no'' 4091.38Slukem 4101.70Sdholland If using build.sh, this may be set by giving the -u 4111.70Sdholland option. 4121.70Sdholland 4131.70Sdholland NBUILDJOBS Now obsolete. Use the make(1) option -j, instead. See 4141.70Sdholland below. 4151.1Stv 4161.20Slukem Default: Unset. 4171.1Stv 4181.20Slukem NOCLEANDIR If set, avoids the ``make cleandir'' phase of a full 4191.20Slukem build. This has the effect of allowing only changed 4201.20Slukem files in a source tree to be recompiled. This can speed 4211.20Slukem up builds when updating only a few files in the tree. 4221.1Stv 4231.20Slukem Default: Unset. 4241.1Stv 4251.70Sdholland See also MKUPDATE. 4261.70Sdholland 4271.20Slukem NODISTRIBDIRS If set, avoids the ``make distrib-dirs'' phase of a full 4281.20Slukem build. This skips running mtree(8) on DESTDIR, useful 4291.20Slukem on systems where building as an unprivileged user, or 4301.20Slukem where it is known that the system-wide mtree files have 4311.20Slukem not changed. 4321.1Stv 4331.20Slukem Default: Unset. 4341.1Stv 4351.20Slukem NOINCLUDES If set, avoids the ``make includes'' phase of a full 4361.20Slukem build. This has the effect of preventing make(1) from 4371.44Slukem thinking that some programs are out-of-date simply 4381.44Slukem because the system include files have changed. However, 4391.20Slukem this option should not be used when updating the entire 4401.20Slukem NetBSD source tree arbitrarily; it is suggested to use 4411.70Sdholland MKUPDATE=yes instead in that case. 4421.1Stv 4431.20Slukem Default: Unset. 4441.1Stv 4451.20Slukem RELEASEDIR If set, specifies the directory to which a release(7) 4461.20Slukem layout will be written at the end of a ``make release''. 4471.59Sapb If specified, must be an absolute path. 4481.20Slukem 4491.20Slukem Default: Unset. 4501.20Slukem 4511.30Slukem Note: build.sh will provide a default of releasedir (in 4521.70Sdholland the top-level .OBJDIR) unless run in `expert' mode. 4531.30Slukem 4541.1StvBUILDING 4551.1Stv "make" command line options 4561.52Sjmc This is not a summary of all the options available to make(1); only the 4571.52Sjmc options used most frequently with NetBSD builds are listed here. 4581.1Stv 4591.10Ssommerfe -j njob Run up to njob make(1) subjobs in parallel. Makefiles should 4601.52Sjmc use .WAIT or have explicit dependencies as necessary to 4611.74Sapb enforce build ordering. 4621.10Ssommerfe 4631.1Stv -m dir Specify the default directory for searching for system Make- 4641.1Stv file segments, mainly the <bsd.*.mk> files. When building any 4651.1Stv full NetBSD source tree, this should be set to the 4661.70Sdholland ``share/mk'' directory in the source tree. This is set auto- 4671.70Sdholland matically when building from the top level, or when using 4681.70Sdholland build.sh. 4691.1Stv 4701.1Stv -n Display the commands that would have been executed, but do not 4711.1Stv actually execute them. This will still cause recursion to 4721.1Stv take place. 4731.1Stv 4741.47Szuntum -V var Print make(1)'s idea of the value of var. Does not build any 4751.1Stv targets. 4761.1Stv 4771.1Stv var=value Set the variable var to value, overriding any setting speci- 4781.1Stv fied by the process environment, the MAKECONF configuration 4791.1Stv file, or the system Makefile segments. 4801.1Stv 4811.1Stv "make" targets 4821.1Stv These default targets may be built by running make(1) in any subtree of 4831.1Stv the NetBSD source code. It is recommended that none of these be used 4841.1Stv from the top level Makefile; as a specific exception, ``make obj'' and 4851.1Stv ``make cleandir'' are useful in that context. 4861.1Stv 4871.1Stv all Build programs, libraries, and preformatted documentation. 4881.1Stv 4891.1Stv clean Remove program and library object code files. 4901.1Stv 4911.44Slukem cleandir Same as clean, but also remove preformatted documentation, 4921.44Slukem dependency files generated by ``make depend'', and any other 4931.49Slukem files known to be created at build time. 4941.1Stv 4951.44Slukem depend Create dependency files (.depend) containing more detailed 4961.44Slukem information about the dependencies of source code on header 4971.1Stv files. Allows programs to be recompiled automatically when a 4981.1Stv dependency changes. 4991.1Stv 5001.1Stv dependall Does a ``make depend'' immediately followed by a ``make all''. 5011.10Ssommerfe This improves cache locality of the build since both passes 5021.10Ssommerfe read the source files in their entirety. 5031.1Stv 5041.49Slukem distclean Synonym for cleandir. 5051.49Slukem 5061.44Slukem includes Build and install system header files. Typically needed 5071.44Slukem before any system libraries or programs can be built. 5081.1Stv 5091.1Stv install Install programs, libraries, and documentation into DESTDIR. 5101.27Slukem Few files will be installed to DESTDIR/dev, DESTDIR/etc, 5111.27Slukem DESTDIR/root or DESTDIR/var in order to prevent user supplied 5121.27Slukem configuration data from being overwritten. 5131.1Stv 5141.1Stv lint Run lint(1) against the C source code, where appropriate, and 5151.1Stv generate system-installed lint libraries. 5161.1Stv 5171.1Stv obj Create object directories to be used for built files, instead 5181.1Stv of building directly in the source tree. 5191.1Stv 5201.1Stv tags Create ctags(1) searchable function lists usable by the ex(1) 5211.1Stv and vi(1) text editors. 5221.1Stv 5231.1Stv "make" targets for the top level 5241.1Stv Additional make(1) targets are usable specifically from the top source 5251.1Stv level to facilitate building the entire NetBSD source tree. 5261.1Stv 5271.68Sreed build Build the entire NetBSD system (except the kernel). This 5281.68Sreed orders portions of the source tree such that prerequisites 5291.68Sreed will be built in the proper order. 5301.20Slukem 5311.20Slukem distribution Do a ``make build'', and then install a full distribution 5321.68Sreed (which does not include a kernel) into DESTDIR, including 5331.68Sreed files in DESTDIR/dev, DESTDIR/etc, DESTDIR/root and 5341.68Sreed DESTDIR/var. 5351.20Slukem 5361.20Slukem buildworld As per ``make distribution'', except that it ensures that 5371.20Slukem DESTDIR is not the root directory. 5381.20Slukem 5391.70Sdholland installworld Install the distribution from DESTDIR to INSTALLWORLDDIR, 5401.70Sdholland which defaults to the root directory. Ensures that 5411.52Sjmc INSTALLWORLDDIR is not the root directory if cross compil- 5421.20Slukem ing. 5431.20Slukem 5441.95Sapb The INSTALLSETS environment variable may be set to a space- 5451.95Sapb separated list of distribution sets to be installed. By 5461.95Sapb default, all sets except ``etc'' and ``xetc'' are 5471.95Sapb installed, so most files in INSTALLWORLDDIR/etc will not be 5481.95Sapb installed or modified. 5491.61Sapb 5501.61Sapb Note: Before performing this operation with 5511.61Sapb INSTALLWORLDDIR=/, it is highly recommended that you 5521.61Sapb upgrade your kernel and reboot. After performing this 5531.61Sapb operation, it is recommended that you use etcupdate(8) to 5541.61Sapb update files in INSTALLWORLDDIR/etc and that you use 5551.61Sapb postinstall(8) to check for inconsistencies (and possibly 5561.61Sapb to fix them). 5571.20Slukem 5581.25Slukem sets Create distribution sets from DESTDIR into 5591.69Slukem RELEASEDIR/RELEASEMACHINEDIR/binary/sets. Should be run 5601.70Sdholland after ``make distribution'', as ``make build'' alone does 5611.70Sdholland not install all of the required files. 5621.25Slukem 5631.31Slukem sourcesets Create source sets of the source tree into 5641.31Slukem RELEASEDIR/source/sets. 5651.31Slukem 5661.54Sapb syspkgs Create syspkgs from DESTDIR into 5671.69Slukem RELEASEDIR/RELEASEMACHINEDIR/binary/syspkgs. Should be run 5681.70Sdholland after ``make distribution'', as ``make build'' alone does 5691.70Sdholland not install all of the required files. 5701.54Sapb 5711.44Slukem release Do a ``make distribution'', build kernels, distribution 5721.44Slukem media, and install sets (this as per ``make sets''), and 5731.44Slukem then package the system into a standard release layout as 5741.44Slukem described by release(7). This requires that RELEASEDIR be 5751.25Slukem set (see above). 5761.1Stv 5771.62Sapb iso-image Create a NetBSD installation CD-ROM image in the 5781.62Sapb RELEASEDIR/iso directory. The CD-ROM file system will have 5791.62Sapb a layout as described in release(7). 5801.62Sapb 5811.62Sapb For most machine types, the CD-ROM will be bootable, and 5821.62Sapb will automatically run the sysinst(8) menu-based installa- 5831.62Sapb tion program, which can be used to install or upgrade a 5841.62Sapb NetBSD system. Bootable CD-ROMs also contain tools that 5851.62Sapb may be useful in repairing a damaged NetBSD installation. 5861.62Sapb 5871.62Sapb Before ``make iso-image'' is attempted, RELEASEDIR must be 5881.62Sapb populated by ``make release'' or equivalent. 5891.62Sapb 5901.62Sapb Note that other, smaller, CD-ROM images may be created in 5911.69Slukem the RELEASEDIR/RELEASEMACHINEDIR/installation/cdrom direc- 5921.69Slukem tory by ``make release''. These smaller images usually 5931.69Slukem contain the same tools as the larger images in 5941.69Slukem RELEASEDIR/iso, but do not contain additional content such 5951.69Slukem as the distribution sets. 5961.62Sapb 5971.62Sapb Note that the mac68k port still uses an older method of 5981.62Sapb creating CD-ROM images. This requires the mkisofs(1) util- 5991.62Sapb ity, which is not part of NetBSD, but which can be 6001.62Sapb installed from pkgsrc/sysutils/cdrtools. 6011.56Sapb 6021.64Sjnemeth iso-image-source 6031.64Sjnemeth Create a NetBSD installation CD-ROM image in the 6041.64Sjnemeth RELEASEDIR/iso directory. The CD-ROM file system will have 6051.64Sjnemeth a layout as described in release(7). It will have top 6061.64Sjnemeth level directories for the machine type and source. 6071.64Sjnemeth 6081.64Sjnemeth For most machine types, the CD-ROM will be bootable, and 6091.64Sjnemeth will automatically run the sysinst(8) menu-based installa- 6101.64Sjnemeth tion program, which can be used to install or upgrade a 6111.64Sjnemeth NetBSD system. Bootable CD-ROMs also contain tools that 6121.64Sjnemeth may be useful in repairing a damaged NetBSD installation. 6131.64Sjnemeth 6141.64Sjnemeth Before ``make iso-image-source'' is attempted, RELEASEDIR 6151.64Sjnemeth must be populated by ``make sourcesets release'' or equiva- 6161.64Sjnemeth lent. 6171.64Sjnemeth 6181.64Sjnemeth Note that other, smaller, CD-ROM images may be created in 6191.69Slukem the RELEASEDIR/RELEASEMACHINEDIR/installation/cdrom direc- 6201.69Slukem tory by ``make release''. These smaller images usually 6211.69Slukem contain the same tools as the larger images in 6221.69Slukem RELEASEDIR/iso, but do not contain additional content such 6231.69Slukem as the distribution sets. 6241.64Sjnemeth 6251.64Sjnemeth Note that the mac68k port still uses an older method of 6261.64Sjnemeth creating CD-ROM images. This requires the mkisofs(1) util- 6271.64Sjnemeth ity, which is not part of NetBSD, but which can be 6281.64Sjnemeth installed from pkgsrc/sysutils/cdrtools. 6291.64Sjnemeth 6301.98Sapb install-image 6311.98Sapb Create a bootable NetBSD installation disk image in the 6321.97Stsutsui RELEASEDIR/RELEASEMACHINEDIR/installation/installimage 6331.98Sapb directory. The installation disk image is suitable for 6341.98Sapb copying to bootable USB flash memory sticks, etc., for 6351.98Sapb machines which are able to boot from such devices. The 6361.98Sapb file system in the bootable disk image will have a layout 6371.98Sapb as described in release(7). 6381.97Stsutsui 6391.97Stsutsui The installation image is bootable, and will automatically 6401.97Stsutsui run the sysinst(8) menu-based installation program, which 6411.98Sapb can be used to install or upgrade a NetBSD system. The 6421.98Sapb image also contains tools that may be useful in repairing a 6431.98Sapb damaged NetBSD installation. 6441.97Stsutsui 6451.97Stsutsui Before ``make install-image'' is attempted, RELEASEDIR must 6461.98Sapb be populated by ``make release'' or equivalent. The build 6471.98Sapb must have been performed with MKUNPRIVED=yes because ``make 6481.98Sapb install-image'' relies on information in DESTDIR/METALOG. 6491.97Stsutsui 6501.97Stsutsui live-image Create NetBSD live images in the 6511.98Sapb RELEASEDIR/RELEASEMACHINEDIR/installation/liveimage direc- 6521.98Sapb tory. The live image contains all necessary files to boot 6531.98Sapb NetBSD up to multi-user mode, including all files which 6541.98Sapb should be extracted during installation, NetBSD disklabel, 6551.98Sapb bootloaders, etc. 6561.98Sapb 6571.98Sapb The live image is suitable for use as a disk image in vir- 6581.98Sapb tual machine environments such as QEMU, and also useful to 6591.98Sapb boot NetBSD from a USB flash memory stick on a real 6601.98Sapb machine, without the need for installation. 6611.97Stsutsui 6621.97Stsutsui Before ``make live-image'' is attempted, RELEASEDIR must be 6631.99Stsutsui populated by ``make release'' or equivalent. The build 6641.99Stsutsui must have been performed with MKUNPRIVED=yes because ``make 6651.98Sapb install-image'' relies on information in DESTDIR/METALOG. 6661.97Stsutsui 6671.1Stv regression-tests 6681.20Slukem Can only be run after building the regression tests in the 6691.70Sdholland directory ``regress''. Runs those compiled regression 6701.70Sdholland tests on the local host. Note that most tests are now man- 6711.70Sdholland aged instead using atf(7); this target should probably run 6721.70Sdholland those as well but currently does not. 6731.1Stv 6741.1Stv The "build.sh" script 6751.96Sapb This script file is a shell script designed to build the entire NetBSD 6761.96Sapb system on any host with a suitable modern shell and some common utili- 6771.96Sapb ties. The required shell features are described under the HOST_SH vari- 6781.96Sapb able. 6791.96Sapb 6801.96Sapb If a host system's default shell does support the required features, then 6811.96Sapb we suggest that you explicitly specify a suitable shell using a command 6821.96Sapb like 6831.96Sapb 6841.96Sapb /path/to/suitable/shell build.sh [options] 6851.96Sapb 6861.96Sapb The above command will usually enable build.sh to automatically set 6871.96Sapb HOST_SH=/path/to/suitable/shell, but if that fails, then the following 6881.96Sapb set of commands may be used instead: 6891.96Sapb 6901.96Sapb HOST_SH=/path/to/suitable/shell 6911.96Sapb export HOST_SH 6921.96Sapb ${HOST_SH} build.sh [options] 6931.96Sapb 6941.96Sapb If build.sh detects that it is being executed under an unsuitable shell, 6951.96Sapb it attempts to exec a suitable shell instead, or prints an error message. 6961.96Sapb If HOST_SH is not set explicitly, then build.sh sets a default using 6971.96Sapb heuristics dependent on the host platform, or from the shell under which 6981.96Sapb build.sh is executed (if that can be determined), or using the first copy 6991.96Sapb of sh found in PATH. 7001.1Stv 7011.1Stv All cross-compile builds, and most native builds, of the entire system 7021.1Stv should make use of build.sh rather than just running ``make''. This way, 7031.1Stv the make(1) program will be bootstrapped properly, in case the host sys- 7041.1Stv tem has an older or incompatible ``make'' program. 7051.1Stv 7061.1Stv When compiling the entire system via build.sh, many make(1) variables are 7071.1Stv set for you in order to help encapsulate the build process. In the list 7081.1Stv of options below, variables that are automatically set by build.sh are 7091.1Stv noted where applicable. 7101.1Stv 7111.22Slukem The following operations are supported by build.sh: 7121.22Slukem 7131.70Sdholland build Build the system as per ``make build''. Before the main 7141.70Sdholland part of the build commences, this command runs the obj 7151.70Sdholland operation (unless the -o option is given), ``make 7161.70Sdholland cleandir'' (unless the -u option is given), and the tools 7171.70Sdholland operation. 7181.22Slukem 7191.22Slukem distribution Build a full distribution as per ``make distribution''. 7201.70Sdholland This command first runs the build operation. 7211.22Slukem 7221.70Sdholland release Build a full release as per ``make release''. This command 7231.70Sdholland first runs the distribution operation. 7241.22Slukem 7251.23Slukem makewrapper Create the nbmake-MACHINE wrapper. This operation is auto- 7261.23Slukem matically performed for any of the other operations. 7271.23Slukem 7281.75Slukem cleandir Perform ``make cleandir''. 7291.75Slukem 7301.22Slukem obj Perform ``make obj''. 7311.22Slukem 7321.70Sdholland tools Build and install the host tools from src/tools. This com- 7331.70Sdholland mand will first run ``make obj'' and ``make cleandir'' in 7341.70Sdholland the tools subdirectory unless the -o or -u options (respec- 7351.70Sdholland tively) are given. 7361.22Slukem 7371.35Slukem install=idir Install the contents of DESTDIR to idir, using ``make 7381.61Sapb installworld''. Note that files that are part of the 7391.95Sapb ``etc'' or ``xetc'' sets will not be installed, unless 7401.95Sapb overridden by the INSTALLSETS environment variable. 7411.35Slukem 7421.22Slukem kernel=kconf Build a new kernel. The kconf argument is the name of a 7431.54Sapb configuration file suitable for use by config(1). If kconf 7441.22Slukem does not contain any `/' characters, the configuration file 7451.22Slukem is expected to be found in the KERNCONFDIR directory, which 7461.22Slukem is typically sys/arch/MACHINE/conf. The new kernel will be 7471.22Slukem built in a subdirectory of KERNOBJDIR, which is typically 7481.22Slukem sys/arch/MACHINE/compile or an associated object directory. 7491.70Sdholland 7501.70Sdholland This command does not imply the tools command; run the 7511.70Sdholland tools command first unless it is certain that the tools 7521.70Sdholland already exist and are up to date. 7531.70Sdholland 7541.70Sdholland This command will run ``make cleandir'' on the kernel in 7551.70Sdholland question first unless the -u option is given. 7561.22Slukem 7571.86Sjnemeth modules This command will build kernel modules and install them 7581.86Sjnemeth into DESTDIR. 7591.86Sjnemeth 7601.35Slukem releasekernel=kconf 7611.70Sdholland Install a gzip(1)ed copy of the kernel previously built by 7621.69Slukem kernel=kconf into 7631.69Slukem RELEASEDIR/RELEASEMACHINEDIR/binary/kernel, usually as 7641.69Slukem netbsd-kconf.gz, although the ``netbsd'' prefix is deter- 7651.69Slukem mined from the ``config'' directives in kconf. 7661.24Slukem 7671.24Slukem sets Perform ``make sets''. 7681.31Slukem 7691.31Slukem sourcesets Perform ``make sourcesets''. 7701.22Slukem 7711.54Sapb syspkgs Perform ``make syspkgs''. 7721.54Sapb 7731.56Sapb iso-image Perform ``make iso-image''. 7741.56Sapb 7751.65Sjnemeth iso-image-source 7761.65Sjnemeth Perform ``make iso-image-source''. 7771.65Sjnemeth 7781.98Sapb install-image 7791.98Sapb Perform ``make install-image''. 7801.97Stsutsui 7811.97Stsutsui live-image Perform ``make live-image''. 7821.97Stsutsui 7831.51Swiz The following command line options alter the behaviour of the build.sh 7841.51Swiz operations described above: 7851.1Stv 7861.1Stv -a arch Set the value of MACHINE_ARCH to arch. 7871.9Sthorpej 7881.9Sthorpej -B buildid 7891.9Sthorpej Set the value of BUILDID to buildid. This will also append the 7901.67Ssborrill build identifier to the name of the ``make'' wrapper script so 7911.37Slukem that the resulting name is of the form 7921.37Slukem ``nbmake-MACHINE-BUILDID''. 7931.1Stv 7941.67Ssborrill -C cdextras 7951.87Sapb Append cdextras to the CDEXTRA variable, which is a space-sepa- 7961.87Sapb rated list of files or directories that will be added to the 7971.87Sapb CD-ROM image that may be create by the ``iso-image'' or 7981.87Sapb ``iso-image-source'' operations. Files will be added to the 7991.87Sapb root of the CD-ROM image, whereas directories will be copied 8001.87Sapb recursively. If relative paths are specified, they will be 8011.87Sapb converted to absolute paths before being used. Multiple paths 8021.87Sapb may be specified via multiple -C options, or via a single 8031.87Sapb option whose argument contains multiple space-separated paths. 8041.66Sjnemeth 8051.59Sapb -D dest Set the value of DESTDIR to dest. If a relative path is speci- 8061.59Sapb fied, it will be converted to an absolute path before being 8071.59Sapb used. 8081.18Slukem 8091.23Slukem -E Set `expert' mode. This overrides various sanity checks, and 8101.23Slukem allows: DESTDIR does not have to be set to a non-root path for 8111.38Slukem builds, and MKUNPRIVED=yes does not have to be set when build- 8121.38Slukem ing as a non-root user. 8131.23Slukem 8141.23Slukem Note: It is highly recommended that you know what you are doing 8151.23Slukem when you use this option. 8161.19Slukem 8171.51Swiz -h Print a help message. 8181.51Swiz 8191.70Sdholland -j njob Run up to njob make(1) subjobs in parallel; passed through to 8201.74Sapb make(1). If you see failures for reasons other than running 8211.74Sapb out of memory while using build.sh with -j, please save com- 8221.74Sapb plete build logs so the failures can be analyzed. 8231.74Sapb 8241.74Sapb To achieve the fastest builds, -j values between (1 + the num- 8251.74Sapb ber of CPUs) and (2 * the number of CPUs) are recommended. Use 8261.74Sapb lower values on machines with limited memory or I/O bandwidth. 8271.1Stv 8281.88Sapb -M obj Set MAKEOBJDIRPREFIX to obj. Unsets MAKEOBJDIR. See ``-O 8291.88Sapb -obj'' for more information. 8301.88Sapb 8311.88Sapb For instance, if the source directory is /usr/src, a setting of 8321.88Sapb ``-M /usr/obj'' will place build-time files under 8331.88Sapb /usr/obj/usr/src/bin, /usr/obj/usr/src/lib, 8341.88Sapb /usr/obj/usr/src/usr.bin, and so forth. 8351.88Sapb 8361.73Sapb If a relative path is specified, it will be converted to an 8371.88Sapb absolute path before being used. build.sh imposes the restric- 8381.88Sapb tion that the argument to the -M option must not begin with a 8391.88Sapb ``$'' (dollar sign) character; otherwise it would be too diffi- 8401.88Sapb cult to determine whether the value is an absolute or a rela- 8411.88Sapb tive path. If the directory does not already exist, build.sh 8421.88Sapb will create it. 8431.18Slukem 8441.60Sapb -m mach Set the value of MACHINE to mach, except in some special cases 8451.60Sapb listed below. This will also override any value of 8461.60Sapb MACHINE_ARCH in the process environment with a value deduced 8471.60Sapb from mach, unless -a is specified. All cross builds require 8481.60Sapb -m, but if unset on a NetBSD host, the host's value of MACHINE 8491.60Sapb will be detected and used automatically. 8501.60Sapb 8511.60Sapb Some machines support multiple values for MACHINE_ARCH. The 8521.60Sapb following special cases for the mach argument are defined to 8531.60Sapb set the listed values of MACHINE and MACHINE_ARCH: 8541.33Slukem 8551.33Slukem mach MACHINE MACHINE_ARCH 8561.60Sapb evbarm evbarm (not set) 8571.60Sapb evbarm-eb evbarm armeb 8581.60Sapb evbarm-el evbarm arm 8591.33Slukem evbmips evbmips (not set) 8601.33Slukem evbmips-eb evbmips mipseb 8611.33Slukem evbmips-el evbmips mipsel 8621.33Slukem evbsh3 evbsh3 (not set) 8631.33Slukem evbsh3-eb evbsh3 sh3eb 8641.33Slukem evbsh3-el evbsh3 sh3el 8651.33Slukem sbmips sbmips (not set) 8661.33Slukem sbmips-eb sbmips mipseb 8671.33Slukem sbmips-el sbmips mipsel 8681.1Stv 8691.45Slukem -N noiselevel 8701.46Slukem Set the ``noisyness'' level of the build, by setting 8711.46Slukem MAKEVERBOSE to noiselevel. 8721.45Slukem 8731.1Stv -n Show the commands that would be executed by build.sh, but do 8741.1Stv not make any changes. This is similar in concept to ``make 8751.1Stv -n''. 8761.1Stv 8771.18Slukem -O obj Create an appropriate transform macro for MAKEOBJDIR that will 8781.88Sapb place the built object files under obj. Unsets 8791.88Sapb MAKEOBJDIRPREFIX. 8801.88Sapb 8811.88Sapb For instance, a setting of ``-O /usr/obj'' will place build- 8821.88Sapb time files under /usr/obj/bin, /usr/obj/lib, /usr/obj/usr.bin, 8831.88Sapb and so forth. 8841.88Sapb 8851.88Sapb If a relative path is specified, it will be converted to an 8861.88Sapb absolute path before being used. build.sh imposes the restric- 8871.88Sapb tion that the argument to the -O option must not contain a 8881.88Sapb ``$'' (dollar sign) character. If the directory does not 8891.88Sapb already exist, build.sh will create it. 8901.73Sapb 8911.73Sapb In normal use, exactly one of the -M or -O options should be 8921.78Sapb specified. If neither -M nor -O is specified, then a default 8931.78Sapb object directory will be chosen according to rules in 8941.78Sapb <bsd.obj.mk>. Relying on this default is not recommended 8951.78Sapb because it is determined by complex rules that are influenced 8961.78Sapb by the values of several variables and by the location of the 8971.78Sapb source directory. 8981.18Slukem 8991.34Slukem -o Set the value of MKOBJDIRS to ``no''. Otherwise, it will be 9001.70Sdholland automatically set to ``yes''. This default is opposite to the 9011.70Sdholland behaviour when not using build.sh. 9021.1Stv 9031.59Sapb -R rel Set the value of RELEASEDIR to rel. If a relative path is 9041.59Sapb specified, it will be converted to an absolute path before 9051.59Sapb being used. 9061.18Slukem 9071.1Stv -r Remove the contents of DESTDIR and TOOLDIR before building 9081.1Stv (provides a clean starting point). This will skip deleting 9091.1Stv DESTDIR if building on a native system to the root directory. 9101.1Stv 9111.72Sperry -S seed Change the value of BUILDSEED to seed. This should rarely be 9121.72Sperry necessary. 9131.72Sperry 9141.59Sapb -T tools Set the value of TOOLDIR to tools. If a relative path is spec- 9151.59Sapb ified, it will be converted to an absolute path before being 9161.70Sdholland used. If set, the bootstrap ``make'' will only be rebuilt if 9171.70Sdholland the source files for make(1) have changed. 9181.18Slukem 9191.38Slukem -U Set MKUNPRIVED=yes. 9201.18Slukem 9211.38Slukem -u Set MKUPDATE=yes. 9221.1Stv 9231.21Slukem -V var=[value] 9241.40Slukem Set the environment variable var to an optional value. This is 9251.40Slukem propagated to the nbmake wrapper. 9261.21Slukem 9271.1Stv -w wrapper 9281.1Stv Create the nbmake wrapper script (see below) in a custom loca- 9291.1Stv tion, specified by wrapper. This allows, for instance, to 9301.1Stv place the wrapper in PATH automatically. Note that wrapper is 9311.59Sapb the full name of the file, not just a directory name. If a 9321.59Sapb relative path is specified, it will be converted to an absolute 9331.59Sapb path before being used. 9341.1Stv 9351.49Slukem -X x11src 9361.59Sapb Set the value of X11SRCDIR to x11src. If a relative path is 9371.59Sapb specified, it will be converted to an absolute path before 9381.59Sapb being used. 9391.49Slukem 9401.49Slukem -x Set MKX11=yes. 9411.49Slukem 9421.40Slukem -Z var Unset ("zap") the environment variable var. This is propagated 9431.40Slukem to the nbmake wrapper. 9441.40Slukem 9451.1Stv The "nbmake-MACHINE" wrapper script 9461.1Stv If using the build.sh script to build NetBSD, a nbmake-MACHINE script 9471.1Stv will be created in TOOLDIR/bin upon the first build to assist in building 9481.1Stv subtrees on a cross-compile host. 9491.1Stv 9501.1Stv nbmake-MACHINE can be invoked in lieu of make(1), and will instead call 9511.1Stv the up-to-date version of ``nbmake'' installed into TOOLDIR/bin with sev- 9521.1Stv eral key variables pre-set, including MACHINE, MACHINE_ARCH, and TOOLDIR. 9531.70Sdholland nbmake-MACHINE will also set variables specified with -V, and unset vari- 9541.70Sdholland ables specified with -Z. 9551.40Slukem 9561.1Stv This script can be symlinked into a directory listed in PATH, or called 9571.1Stv with an absolute path. 9581.1Stv 9591.16SlukemEXAMPLES 9601.78Sapb 1. % ./build.sh [options] tools kernel=GENERIC 9611.28Slukem 9621.28Slukem Build a new toolchain, and use the new toolchain to configure and 9631.28Slukem build a new GENERIC kernel. 9641.28Slukem 9651.78Sapb 2. % ./build.sh [options] -U distribution 9661.28Slukem 9671.30Slukem Using unprivileged mode, build a complete distribution to a DESTDIR 9681.30Slukem directory that build.sh selects (and will display). 9691.28Slukem 9701.78Sapb 3. # ./build.sh [options] -U install=/ 9711.28Slukem 9721.29Slukem As root, install to / the distribution that was built by example 2. 9731.29Slukem Even though this is run as root, -U is required so that the permis- 9741.30Slukem sions stored in DESTDIR/METALOG are correctly applied to the files 9751.30Slukem as they're copied to /. 9761.28Slukem 9771.78Sapb 4. % ./build.sh [options] -U -u release 9781.28Slukem 9791.30Slukem Using unprivileged mode, build a complete release to DESTDIR and 9801.30Slukem RELEASEDIR directories that build.sh selects (and will display). 9811.38Slukem MKUPDATE=yes (-u) is set to prevent the ``make cleandir'', so that 9821.38Slukem if this is run after example 2, it doesn't need to redo that portion 9831.38Slukem of the release build. 9841.16Slukem 9851.10SsommerfeOBSOLETE VARIABLES 9861.70Sdholland NBUILDJOBS Use the make(1) option -j instead. 9871.15Slukem 9881.15Slukem USE_NEW_TOOLCHAIN 9891.15Slukem The new toolchain is now the default. To disable, use 9901.15Slukem TOOLCHAIN_MISSING=yes. 9911.10Ssommerfe 9921.1StvSEE ALSO 9931.62Sapb make(1), hier(7), release(7), etcupdate(8), postinstall(8), sysinst(8), 9941.61Sapb pkgsrc/sysutils/cdrtools 9951.1Stv 9961.1StvHISTORY 9971.15Slukem The build.sh based build scheme was introduced for NetBSD 1.6 as 9981.15Slukem USE_NEW_TOOLCHAIN, and re-worked to TOOLCHAIN_MISSING after that. 9991.1Stv 10001.94SapbNetBSD September 9, 2011 NetBSD 1001