BUILDING revision 1.101
11.101SwizBUILDING(8) NetBSD System Manager's Manual BUILDING(8) 21.1Stv 31.101SwizNAME 41.101Swiz BUILDING -- Procedure for building NetBSD from source code. 51.1Stv 61.101SwizREQUIREMENTS 71.1Stv NetBSD is designed to be buildable on most POSIX-compliant host systems. 81.101Swiz The basic build procedure is the same whether compiling natively (on the 91.101Swiz 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.101Swiz 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.101SwizFILES 201.101Swiz Source tree layout 211.101Swiz doc/BUILDING.mdoc 221.17Swiz This document (in -mdoc troff format; the original copy). 231.1Stv 241.101Swiz BUILDING This document (in plaintext). 251.1Stv 261.101Swiz tools/compat/README 271.48Sjmc Special notes for cross-hosting a NetBSD build on non- 281.48Sjmc NetBSD platforms. 291.48Sjmc 301.101Swiz 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.101Swiz on a non-native host, see the build.sh shell script.) 341.1Stv 351.101Swiz 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.101Swiz 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.101Swiz crypto/dist/, dist/, gnu/dist/ 461.101Swiz Sources imported verbatim from third parties, without man- 471.101Swiz gling the existing build structure. Other source trees in 481.101Swiz bin through usr.sbin use the NetBSD make(1) ``reachover'' 491.101Swiz Makefile semantics when building these programs for a 501.101Swiz native host. 511.101Swiz 521.101Swiz distrib/, etc/ 531.101Swiz Sources for items used when making a full release snap- 541.101Swiz shot, such as files installed in DESTDIR/etc on the desti- 551.101Swiz nation system, boot media, and release notes. 561.1Stv 571.101Swiz tests/, regress/ 581.70Sdholland Regression test harness. Can be cross-compiled, but only 591.101Swiz run natively. tests/ uses the atf(7) test framework; 601.101Swiz regress/ contains older tests that have not yet been 611.70Sdholland migrated to atf(7). 621.1Stv 631.101Swiz sys/ NetBSD kernel sources. 641.1Stv 651.101Swiz tools/ ``Reachover'' build structure for the host build tools. 661.101Swiz This has a special method of determining out-of-date sta- 671.101Swiz tus. 681.1Stv 691.101Swiz 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.101Swiz x11/ ``Reachover'' build structure for X11R6; the source is in 751.101Swiz X11SRCDIR. 761.49Slukem 771.101Swiz 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.101SwizCONFIGURATION 821.101Swiz Environment variables 831.8Slukem Several environment variables control the behaviour of NetBSD builds. 841.8Slukem 851.101Swiz 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.101Swiz functions (which is a widely-implemented but non-stan- 911.101Swiz dardised feature). 921.96Sapb 931.96Sapb Depending on the host system, a suitable shell may be 941.101Swiz /bin/sh, /usr/xpg4/bin/sh, /bin/ksh (provided it is a 951.96Sapb variant of ksh that supports the ``local'' keyword, 961.101Swiz such as ksh88, but not ksh93), or /usr/local/bin/bash. 971.96Sapb 981.101Swiz Most parts of the build require HOST_SH to be an abso- 991.101Swiz lute path; however, build.sh allows it to be a simple 1001.101Swiz command name, which will be converted to an absolute 1011.101Swiz path by searching the PATH. 1021.58Sapb 1031.101Swiz HOST_CC Path name to C compiler used to create the toolchain. 1041.53Sreed 1051.101Swiz HOST_CXX Path name to C++ compiler used to create the toolchain. 1061.53Sreed 1071.101Swiz MACHINE Machine type, e.g., ``macppc''. 1081.8Slukem 1091.101Swiz MACHINE_ARCH Machine architecture, e.g., ``powerpc''. 1101.8Slukem 1111.101Swiz MAKE Path name to invoke make(1) as. 1121.8Slukem 1131.101Swiz MAKEFLAGS Flags to invoke make(1) with. Note that build.sh 1141.101Swiz ignores the value of MAKEFLAGS passed in the environ- 1151.101Swiz ment, but allows MAKEFLAGS to be set via the -V option. 1161.8Slukem 1171.101Swiz MAKEOBJDIR Directory to use as the .OBJDIR for the current direc- 1181.101Swiz tory. The value is subjected to variable expansion by 1191.101Swiz make(1). Typical usage is to set this variable to a 1201.101Swiz value involving the use of `${.CURDIR:S...}' or 1211.101Swiz `${.CURDIR:C...}', to derive the value of .OBJDIR from 1221.101Swiz the value of .CURDIR. Used only if MAKEOBJDIRPREFIX is 1231.101Swiz not defined. MAKEOBJDIR can be provided only in the 1241.101Swiz environment or via the -O flag of build.sh; it cannot 1251.101Swiz usefully be set inside a Makefile, including mk.conf or 1261.101Swiz ${MAKECONF}. 1271.8Slukem 1281.101Swiz MAKEOBJDIRPREFIX Top level directory of the object directory tree. The 1291.88Sapb value is subjected to variable expansion by make(1). 1301.101Swiz build.sh will create the ${MAKEOBJDIRPREFIX} directory 1311.101Swiz 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.101Swiz value is defined and valid, then ${MAKEOBJDIRPRE- 1351.101Swiz FIX}/${.CURDIR} is used as the .OBJDIR for the current 1361.101Swiz directory. The current directory may be read only. 1371.101Swiz MAKEOBJDIRPREFIX can be provided only in the environ- 1381.101Swiz ment or via the -M flag of build.sh; it cannot usefully 1391.101Swiz be set inside a Makefile, including mk.conf or 1401.101Swiz ${MAKECONF}. 1411.101Swiz 1421.101Swiz "make" variables 1431.101Swiz Several variables control the behavior of NetBSD builds. Unless other- 1441.101Swiz wise specified, these variables may be set in either the process environ- 1451.101Swiz ment or the make(1) configuration file specified by MAKECONF. 1461.1Stv 1471.101Swiz 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.101Swiz configuration file in order to set additional build parame- 1501.101Swiz ters, such as compiler flags. 1511.9Sthorpej 1521.101Swiz BUILDSEED GCC uses random numbers when compiling C++ code. This vari- 1531.101Swiz able seeds the gcc random number generator using the -fran- 1541.101Swiz dom-seed flag with this value. By default, it is set to 1551.101Swiz NetBSD-(majorversion). Using a fixed value causes C++ bina- 1561.101Swiz ries to be the same when built from the same sources, result- 1571.101Swiz ing in identical (reproducible) builds. Additional informa- 1581.101Swiz tion is available in the GCC documentation of -frandom-seed. 1591.101Swiz 1601.101Swiz DESTDIR Directory to contain the built NetBSD system. If set, spe- 1611.101Swiz cial options are passed to the compilation tools to prevent 1621.101Swiz their default use of the host system's /usr/include, 1631.101Swiz /usr/lib, and so forth. This pathname must be an absolute 1641.101Swiz path, and should not end with a slash (/) character. (For 1651.101Swiz 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.101Swiz Default: Empty string if USETOOLS is ``yes''; unset other- 1701.101Swiz wise. 1711.1Stv 1721.101Swiz Note: build.sh will provide a default of destdir.MACHINE (in 1731.101Swiz the top-level .OBJDIR) unless run in `expert' mode. 1741.30Slukem 1751.101Swiz MAKECONF The name of the make(1) configuration file. Only settable in 1761.101Swiz the process environment. 1771.1Stv 1781.101Swiz Default: ``/etc/mk.conf'' 1791.1Stv 1801.101Swiz 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.101Swiz but the actual commands executed by make(1) are not dis- 1881.101Swiz 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.101Swiz are traced through use of the sh(1) ``-x'' flag. 2011.45Slukem 2021.101Swiz Default: 2 2031.45Slukem 2041.101Swiz MKCATPAGES Can be set to ``yes'' or ``no''. Indicates whether prefor- 2051.101Swiz matted plaintext manual pages will be created during a build. 2061.1Stv 2071.101Swiz Default: ``yes'' 2081.1Stv 2091.101Swiz MKCRYPTO Can be set to ``yes'' or ``no''. Indicates whether crypto- 2101.101Swiz graphic code will be included in a build; provided for the 2111.101Swiz benefit of countries that do not allow strong cryptography. 2121.101Swiz Will not affect use of the standard low-security password 2131.101Swiz encryption system, crypt(3). 2141.1Stv 2151.101Swiz Default: ``yes'' 2161.1Stv 2171.101Swiz MKDOC Can be set to ``yes'' or ``no''. Indicates whether system 2181.101Swiz documentation destined for DESTDIR/usr/share/doc will be 2191.44Slukem installed during a build. 2201.1Stv 2211.101Swiz Default: ``yes'' 2221.1Stv 2231.101Swiz MKHTML Can be set to ``yes'' or ``no''. Indicates whether prefor- 2241.101Swiz matted HTML manual pages will be built and installed 2251.77Slukem 2261.101Swiz Default: ``yes'' 2271.77Slukem 2281.101Swiz 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.101Swiz Default: ``no'' 2381.4Stv 2391.101Swiz 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.101Swiz Default: ``yes'' 2441.1Stv 2451.101Swiz MKKMOD Can be set to ``yes'' or ``no''. Indicates whether kernel 2461.95Sapb modules are built and installed. 2471.95Sapb 2481.101Swiz Default: ``yes'' 2491.95Sapb 2501.101Swiz 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.101Swiz DESTDIR/usr/libdata/lint. 2541.1Stv 2551.101Swiz Default: ``yes'' 2561.1Stv 2571.101Swiz MKMAN Can be set to ``yes'' or ``no''. Indicates whether manual 2581.1Stv pages will be installed during a build. 2591.1Stv 2601.101Swiz Default: ``yes'' 2611.1Stv 2621.101Swiz 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.101Swiz Default: ``yes'' 2671.1Stv 2681.101Swiz 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.101Swiz Default: ``yes'' 2741.1Stv 2751.101Swiz 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.101Swiz 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.101Swiz Default: Platform dependent. As of this writing, all plat- 2841.101Swiz forms except sh3 default to ``yes''. 2851.1Stv 2861.101Swiz MKPICINSTALL 2871.1Stv Can be set to ``yes'' or ``no''. Indicates whether the ar(1) 2881.101Swiz format libraries (lib*_pic.a), used to generate shared 2891.44Slukem libraries, are installed during a build. 2901.1Stv 2911.101Swiz Default: ``yes'' 2921.1Stv 2931.101Swiz MKPROFILE Can be set to ``yes'' or ``no''. Indicates whether profiled 2941.101Swiz libraries (lib*_p.a) will be built and installed during a 2951.1Stv build. 2961.1Stv 2971.101Swiz 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.101Swiz MKREPRO Can be set to ``yes'' or ``no''. Create reproducable builds. 3021.100Swiz This enables different switches to make two builds from the 3031.100Swiz same source tree result in the same build results. 3041.100Swiz 3051.101Swiz Default: ``no'' 3061.100Swiz 3071.101Swiz MKSHARE Can be set to ``yes'' or ``no''. Indicates whether files 3081.101Swiz destined to reside in DESTDIR/usr/share will be built and 3091.44Slukem installed during a build. If set to ``no'', then all of 3101.101Swiz MKCATPAGES, MKDOC, MKINFO, MKMAN, and MKNLS will be set to 3111.27Slukem ``no'' unconditionally. 3121.1Stv 3131.101Swiz Default: ``yes'' 3141.1Stv 3151.101Swiz MKSTRIPIDENT 3161.78Sapb Can be set to ``yes'' or ``no''. Indicates whether program 3171.78Sapb binaries and shared libraries should be built to include RCS 3181.78Sapb IDs for use with ident(1). 3191.78Sapb 3201.101Swiz Default: ``no'' 3211.78Sapb 3221.101Swiz MKUNPRIVED Can be set to ``yes'' or ``no''. Indicates whether an 3231.101Swiz unprivileged install will occur. The user, group, permis- 3241.101Swiz sions, and file flags, will not be set on the installed 3251.52Sjmc items; instead the information will be appended to a file 3261.101Swiz called METALOG in DESTDIR. The contents of METALOG are used 3271.52Sjmc during the generation of the distribution tar files to ensure 3281.52Sjmc that the appropriate file ownership is stored. 3291.38Slukem 3301.101Swiz Default: ``no'' 3311.38Slukem 3321.101Swiz MKUPDATE Can be set to ``yes'' or ``no''. Indicates whether all 3331.101Swiz install operations intended to write to DESTDIR will compare 3341.38Slukem file timestamps before installing, and skip the install phase 3351.44Slukem if the destination files are up-to-date. This also has 3361.44Slukem implications on full builds (see next subsection). 3371.38Slukem 3381.101Swiz Default: ``no'' 3391.38Slukem 3401.101Swiz MKX11 Can be set to ``yes'' or ``no''. Indicates whether X11 is 3411.101Swiz built from X11SRCDIR. 3421.49Slukem 3431.101Swiz Default: ``no'' 3441.49Slukem 3451.101Swiz TOOLDIR Directory to hold the host tools, once built. If specified, 3461.59Sapb must be an absolute path. This directory should be unique to 3471.101Swiz a given host system and NetBSD source tree. (However, multi- 3481.101Swiz ple targets may share the same TOOLDIR; the target-dependent 3491.101Swiz files have unique names.) If unset, a default based on the 3501.101Swiz uname(1) information of the host platform will be created in 3511.101Swiz the .OBJDIR of src. 3521.1Stv 3531.101Swiz Default: Unset. 3541.1Stv 3551.101Swiz USETOOLS Indicates whether the tools specified by TOOLDIR should be 3561.1Stv used as part of a build in progress. Must be set to ``yes'' 3571.1Stv if cross-compiling. 3581.1Stv 3591.101Swiz yes Use the tools from TOOLDIR. 3601.1Stv 3611.101Swiz no Do not use the tools from TOOLDIR, but refuse to build 3621.1Stv native compilation tool components that are version- 3631.1Stv specific for that tool. 3641.1Stv 3651.101Swiz never Do not use the tools from TOOLDIR, even when building 3661.101Swiz native tool components. This is similar to the tradi- 3671.101Swiz tional NetBSD build method, but does not verify that 3681.101Swiz the compilation tools in use are up-to-date enough in 3691.101Swiz order to build the tree successfully. This may cause 3701.101Swiz build or runtime problems when building the whole 3711.101Swiz NetBSD source tree. 3721.1Stv 3731.101Swiz Default: ``yes'', unless TOOLCHAIN_MISSING is set to ``yes''. 3741.71Sdholland 3751.101Swiz USETOOLS is also set to ``no'' when using <bsd.*.mk> outside 3761.71Sdholland the NetBSD source tree. 3771.1Stv 3781.101Swiz X11SRCDIR Directory containing the X11R6 source. If specified, must be 3791.59Sapb an absolute path. The main X11R6 source is found in 3801.101Swiz X11SRCDIR/xfree/xc. 3811.49Slukem 3821.101Swiz Default: NETBSDRCDIR/../xsrc, if that exists; otherwise 3831.101Swiz /usr/xsrc. 3841.49Slukem 3851.101Swiz X11FLAVOUR The style of X11 cross-built, set to either ``Xorg'' or 3861.79Smrg ``XFree86''. 3871.79Smrg 3881.101Swiz Default: ``Xorg'' on amd64, i386, macppc, shark and sparc64 3891.81Smrg platforms, ``XFree86'' on everything else. 3901.79Smrg 3911.101Swiz "make" variables for full builds 3921.7Slukem These variables only affect the top level ``Makefile'' and do not affect 3931.7Slukem manually building subtrees of the NetBSD source code. 3941.1Stv 3951.101Swiz INSTALLWORLDDIR Location for the ``make installworld'' target to install 3961.59Sapb to. If specified, must be an absolute path. 3971.1Stv 3981.101Swiz Default: ``/'' 3991.1Stv 4001.101Swiz MKOBJDIRS Can be set to ``yes'' or ``no''. Indicates whether 4011.44Slukem object directories will be created automatically (via a 4021.20Slukem ``make obj'' pass) at the start of a build. 4031.1Stv 4041.101Swiz Default: ``no'' 4051.1Stv 4061.101Swiz If using build.sh, the default is ``yes''. This may be 4071.101Swiz set back to ``no'' by giving build.sh the -o option. 4081.70Sdholland 4091.101Swiz MKUPDATE Can be set to ``yes'' or ``no''. If set, then in addi- 4101.101Swiz tion to the effects described for MKUPDATE=yes above, 4111.101Swiz this implies the effects of NOCLEANDIR (i.e., ``make 4121.101Swiz cleandir'' is avoided). 4131.38Slukem 4141.101Swiz Default: ``no'' 4151.38Slukem 4161.101Swiz If using build.sh, this may be set by giving the -u 4171.70Sdholland option. 4181.70Sdholland 4191.101Swiz NBUILDJOBS Now obsolete. Use the make(1) option -j, instead. See 4201.70Sdholland below. 4211.1Stv 4221.101Swiz Default: Unset. 4231.1Stv 4241.101Swiz NOCLEANDIR If set, avoids the ``make cleandir'' phase of a full 4251.20Slukem build. This has the effect of allowing only changed 4261.20Slukem files in a source tree to be recompiled. This can speed 4271.20Slukem up builds when updating only a few files in the tree. 4281.1Stv 4291.101Swiz Default: Unset. 4301.1Stv 4311.101Swiz See also MKUPDATE. 4321.70Sdholland 4331.101Swiz NODISTRIBDIRS If set, avoids the ``make distrib-dirs'' phase of a full 4341.101Swiz build. This skips running mtree(8) on DESTDIR, useful 4351.20Slukem on systems where building as an unprivileged user, or 4361.20Slukem where it is known that the system-wide mtree files have 4371.20Slukem not changed. 4381.1Stv 4391.101Swiz Default: Unset. 4401.1Stv 4411.101Swiz NOINCLUDES If set, avoids the ``make includes'' phase of a full 4421.20Slukem build. This has the effect of preventing make(1) from 4431.44Slukem thinking that some programs are out-of-date simply 4441.44Slukem because the system include files have changed. However, 4451.20Slukem this option should not be used when updating the entire 4461.20Slukem NetBSD source tree arbitrarily; it is suggested to use 4471.101Swiz MKUPDATE=yes instead in that case. 4481.1Stv 4491.101Swiz Default: Unset. 4501.1Stv 4511.101Swiz RELEASEDIR If set, specifies the directory to which a release(7) 4521.20Slukem layout will be written at the end of a ``make release''. 4531.59Sapb If specified, must be an absolute path. 4541.20Slukem 4551.101Swiz Default: Unset. 4561.20Slukem 4571.101Swiz Note: build.sh will provide a default of releasedir (in 4581.101Swiz the top-level .OBJDIR) unless run in `expert' mode. 4591.30Slukem 4601.101SwizBUILDING 4611.101Swiz "make" command line options 4621.52Sjmc This is not a summary of all the options available to make(1); only the 4631.52Sjmc options used most frequently with NetBSD builds are listed here. 4641.1Stv 4651.101Swiz -j njob Run up to njob make(1) subjobs in parallel. Makefiles should 4661.52Sjmc use .WAIT or have explicit dependencies as necessary to 4671.74Sapb enforce build ordering. 4681.10Ssommerfe 4691.101Swiz -m dir Specify the default directory for searching for system Make- 4701.101Swiz file segments, mainly the <bsd.*.mk> files. When building any 4711.101Swiz full NetBSD source tree, this should be set to the 4721.101Swiz ``share/mk'' directory in the source tree. This is set auto- 4731.101Swiz matically when building from the top level, or when using 4741.101Swiz build.sh. 4751.1Stv 4761.101Swiz -n Display the commands that would have been executed, but do not 4771.1Stv actually execute them. This will still cause recursion to 4781.1Stv take place. 4791.1Stv 4801.101Swiz -V var Print make(1)'s idea of the value of var. Does not build any 4811.1Stv targets. 4821.1Stv 4831.101Swiz var=value Set the variable var to value, overriding any setting speci- 4841.101Swiz fied by the process environment, the MAKECONF configuration 4851.101Swiz file, or the system Makefile segments. 4861.1Stv 4871.101Swiz "make" targets 4881.1Stv These default targets may be built by running make(1) in any subtree of 4891.1Stv the NetBSD source code. It is recommended that none of these be used 4901.1Stv from the top level Makefile; as a specific exception, ``make obj'' and 4911.1Stv ``make cleandir'' are useful in that context. 4921.1Stv 4931.101Swiz all Build programs, libraries, and preformatted documentation. 4941.1Stv 4951.101Swiz clean Remove program and library object code files. 4961.1Stv 4971.101Swiz cleandir Same as clean, but also remove preformatted documentation, 4981.44Slukem dependency files generated by ``make depend'', and any other 4991.49Slukem files known to be created at build time. 5001.1Stv 5011.101Swiz depend Create dependency files (.depend) containing more detailed 5021.44Slukem information about the dependencies of source code on header 5031.1Stv files. Allows programs to be recompiled automatically when a 5041.1Stv dependency changes. 5051.1Stv 5061.101Swiz dependall Does a ``make depend'' immediately followed by a ``make all''. 5071.10Ssommerfe This improves cache locality of the build since both passes 5081.10Ssommerfe read the source files in their entirety. 5091.1Stv 5101.101Swiz distclean Synonym for cleandir. 5111.49Slukem 5121.101Swiz includes Build and install system header files. Typically needed 5131.44Slukem before any system libraries or programs can be built. 5141.1Stv 5151.101Swiz install Install programs, libraries, and documentation into DESTDIR. 5161.101Swiz Few files will be installed to DESTDIR/dev, DESTDIR/etc, 5171.101Swiz DESTDIR/root or DESTDIR/var in order to prevent user supplied 5181.27Slukem configuration data from being overwritten. 5191.1Stv 5201.101Swiz lint Run lint(1) against the C source code, where appropriate, and 5211.1Stv generate system-installed lint libraries. 5221.1Stv 5231.101Swiz obj Create object directories to be used for built files, instead 5241.1Stv of building directly in the source tree. 5251.1Stv 5261.101Swiz tags Create ctags(1) searchable function lists usable by the ex(1) 5271.1Stv and vi(1) text editors. 5281.1Stv 5291.101Swiz "make" targets for the top level 5301.1Stv Additional make(1) targets are usable specifically from the top source 5311.1Stv level to facilitate building the entire NetBSD source tree. 5321.1Stv 5331.101Swiz build Build the entire NetBSD system (except the kernel). This 5341.68Sreed orders portions of the source tree such that prerequisites 5351.68Sreed will be built in the proper order. 5361.20Slukem 5371.101Swiz distribution Do a ``make build'', and then install a full distribution 5381.101Swiz (which does not include a kernel) into DESTDIR, including 5391.101Swiz files in DESTDIR/dev, DESTDIR/etc, DESTDIR/root and 5401.101Swiz DESTDIR/var. 5411.20Slukem 5421.101Swiz buildworld As per ``make distribution'', except that it ensures that 5431.101Swiz DESTDIR is not the root directory. 5441.20Slukem 5451.101Swiz installworld Install the distribution from DESTDIR to INSTALLWORLDDIR, 5461.70Sdholland which defaults to the root directory. Ensures that 5471.101Swiz INSTALLWORLDDIR is not the root directory if cross compil- 5481.101Swiz ing. 5491.20Slukem 5501.101Swiz The INSTALLSETS environment variable may be set to a space- 5511.95Sapb separated list of distribution sets to be installed. By 5521.95Sapb default, all sets except ``etc'' and ``xetc'' are 5531.101Swiz installed, so most files in INSTALLWORLDDIR/etc will not be 5541.95Sapb installed or modified. 5551.61Sapb 5561.101Swiz Note: Before performing this operation with 5571.101Swiz INSTALLWORLDDIR=/, it is highly recommended that you 5581.61Sapb upgrade your kernel and reboot. After performing this 5591.61Sapb operation, it is recommended that you use etcupdate(8) to 5601.101Swiz update files in INSTALLWORLDDIR/etc and that you use 5611.61Sapb postinstall(8) to check for inconsistencies (and possibly 5621.61Sapb to fix them). 5631.20Slukem 5641.101Swiz sets Create distribution sets from DESTDIR into 5651.101Swiz RELEASEDIR/RELEASEMACHINEDIR/binary/sets. Should be run 5661.70Sdholland after ``make distribution'', as ``make build'' alone does 5671.70Sdholland not install all of the required files. 5681.25Slukem 5691.101Swiz sourcesets Create source sets of the source tree into 5701.101Swiz RELEASEDIR/source/sets. 5711.31Slukem 5721.101Swiz syspkgs Create syspkgs from DESTDIR into 5731.101Swiz RELEASEDIR/RELEASEMACHINEDIR/binary/syspkgs. Should be run 5741.70Sdholland after ``make distribution'', as ``make build'' alone does 5751.70Sdholland not install all of the required files. 5761.54Sapb 5771.101Swiz release Do a ``make distribution'', build kernels, distribution 5781.44Slukem media, and install sets (this as per ``make sets''), and 5791.44Slukem then package the system into a standard release layout as 5801.101Swiz described by release(7). This requires that RELEASEDIR be 5811.25Slukem set (see above). 5821.1Stv 5831.101Swiz iso-image Create a NetBSD installation CD-ROM image in the 5841.101Swiz RELEASEDIR/iso directory. The CD-ROM file system will have 5851.62Sapb a layout as described in release(7). 5861.62Sapb 5871.62Sapb For most machine types, the CD-ROM will be bootable, and 5881.101Swiz will automatically run the sysinst(8) menu-based installa- 5891.101Swiz tion program, which can be used to install or upgrade a 5901.101Swiz NetBSD system. Bootable CD-ROMs also contain tools that 5911.101Swiz may be useful in repairing a damaged NetBSD installation. 5921.62Sapb 5931.62Sapb Before ``make iso-image'' is attempted, RELEASEDIR must be 5941.62Sapb populated by ``make release'' or equivalent. 5951.62Sapb 5961.62Sapb Note that other, smaller, CD-ROM images may be created in 5971.101Swiz the RELEASEDIR/RELEASEMACHINEDIR/installation/cdrom direc- 5981.101Swiz tory by ``make release''. These smaller images usually 5991.101Swiz contain the same tools as the larger images in 6001.101Swiz RELEASEDIR/iso, but do not contain additional content such 6011.69Slukem as the distribution sets. 6021.62Sapb 6031.62Sapb Note that the mac68k port still uses an older method of 6041.101Swiz creating CD-ROM images. This requires the mkisofs(1) util- 6051.101Swiz ity, which is not part of NetBSD, but which can be 6061.101Swiz installed from pkgsrc/sysutils/cdrtools. 6071.56Sapb 6081.101Swiz iso-image-source 6091.64Sjnemeth Create a NetBSD installation CD-ROM image in the 6101.101Swiz RELEASEDIR/iso directory. The CD-ROM file system will have 6111.64Sjnemeth a layout as described in release(7). It will have top 6121.64Sjnemeth level directories for the machine type and source. 6131.64Sjnemeth 6141.64Sjnemeth For most machine types, the CD-ROM will be bootable, and 6151.101Swiz will automatically run the sysinst(8) menu-based installa- 6161.101Swiz tion program, which can be used to install or upgrade a 6171.101Swiz NetBSD system. Bootable CD-ROMs also contain tools that 6181.101Swiz may be useful in repairing a damaged NetBSD installation. 6191.64Sjnemeth 6201.64Sjnemeth Before ``make iso-image-source'' is attempted, RELEASEDIR 6211.101Swiz must be populated by ``make sourcesets release'' or equiva- 6221.101Swiz lent. 6231.64Sjnemeth 6241.64Sjnemeth Note that other, smaller, CD-ROM images may be created in 6251.101Swiz the RELEASEDIR/RELEASEMACHINEDIR/installation/cdrom direc- 6261.101Swiz tory by ``make release''. These smaller images usually 6271.101Swiz contain the same tools as the larger images in 6281.101Swiz RELEASEDIR/iso, but do not contain additional content such 6291.69Slukem as the distribution sets. 6301.64Sjnemeth 6311.64Sjnemeth Note that the mac68k port still uses an older method of 6321.101Swiz creating CD-ROM images. This requires the mkisofs(1) util- 6331.101Swiz ity, which is not part of NetBSD, but which can be 6341.101Swiz installed from pkgsrc/sysutils/cdrtools. 6351.64Sjnemeth 6361.101Swiz install-image 6371.98Sapb Create a bootable NetBSD installation disk image in the 6381.101Swiz RELEASEDIR/RELEASEMACHINEDIR/installation/installimage 6391.98Sapb directory. The installation disk image is suitable for 6401.98Sapb copying to bootable USB flash memory sticks, etc., for 6411.98Sapb machines which are able to boot from such devices. The 6421.98Sapb file system in the bootable disk image will have a layout 6431.98Sapb as described in release(7). 6441.97Stsutsui 6451.97Stsutsui The installation image is bootable, and will automatically 6461.97Stsutsui run the sysinst(8) menu-based installation program, which 6471.98Sapb can be used to install or upgrade a NetBSD system. The 6481.98Sapb image also contains tools that may be useful in repairing a 6491.98Sapb damaged NetBSD installation. 6501.97Stsutsui 6511.101Swiz Before ``make install-image'' is attempted, RELEASEDIR must 6521.98Sapb be populated by ``make release'' or equivalent. The build 6531.101Swiz must have been performed with MKUNPRIVED=yes because ``make 6541.101Swiz install-image'' relies on information in DESTDIR/METALOG. 6551.97Stsutsui 6561.97Stsutsui live-image Create NetBSD live images in the 6571.101Swiz RELEASEDIR/RELEASEMACHINEDIR/installation/liveimage direc- 6581.101Swiz tory. The live image contains all necessary files to boot 6591.101Swiz NetBSD up to multi-user mode, including all files which 6601.101Swiz should be extracted during installation, NetBSD disklabel, 6611.101Swiz bootloaders, etc. 6621.101Swiz 6631.101Swiz The live image is suitable for use as a disk image in vir- 6641.101Swiz tual machine environments such as QEMU, and also useful to 6651.101Swiz boot NetBSD from a USB flash memory stick on a real 6661.98Sapb machine, without the need for installation. 6671.97Stsutsui 6681.97Stsutsui Before ``make live-image'' is attempted, RELEASEDIR must be 6691.99Stsutsui populated by ``make release'' or equivalent. The build 6701.101Swiz must have been performed with MKUNPRIVED=yes because ``make 6711.101Swiz install-image'' relies on information in DESTDIR/METALOG. 6721.97Stsutsui 6731.101Swiz regression-tests 6741.20Slukem Can only be run after building the regression tests in the 6751.70Sdholland directory ``regress''. Runs those compiled regression 6761.101Swiz tests on the local host. Note that most tests are now man- 6771.101Swiz aged instead using atf(7); this target should probably run 6781.101Swiz those as well but currently does not. 6791.1Stv 6801.101Swiz The "build.sh" script 6811.96Sapb This script file is a shell script designed to build the entire NetBSD 6821.101Swiz system on any host with a suitable modern shell and some common utili- 6831.101Swiz ties. The required shell features are described under the HOST_SH vari- 6841.101Swiz able. 6851.96Sapb 6861.96Sapb If a host system's default shell does support the required features, then 6871.96Sapb we suggest that you explicitly specify a suitable shell using a command 6881.96Sapb like 6891.96Sapb 6901.101Swiz /path/to/suitable/shell build.sh [options] 6911.96Sapb 6921.101Swiz The above command will usually enable build.sh to automatically set 6931.101Swiz HOST_SH=/path/to/suitable/shell, but if that fails, then the following 6941.96Sapb set of commands may be used instead: 6951.96Sapb 6961.101Swiz HOST_SH=/path/to/suitable/shell 6971.96Sapb export HOST_SH 6981.101Swiz ${HOST_SH} build.sh [options] 6991.96Sapb 7001.101Swiz If build.sh detects that it is being executed under an unsuitable shell, 7011.96Sapb it attempts to exec a suitable shell instead, or prints an error message. 7021.101Swiz If HOST_SH is not set explicitly, then build.sh sets a default using 7031.96Sapb heuristics dependent on the host platform, or from the shell under which 7041.101Swiz build.sh is executed (if that can be determined), or using the first copy 7051.101Swiz of sh found in PATH. 7061.1Stv 7071.1Stv All cross-compile builds, and most native builds, of the entire system 7081.101Swiz should make use of build.sh rather than just running ``make''. This way, 7091.101Swiz the make(1) program will be bootstrapped properly, in case the host sys- 7101.101Swiz tem has an older or incompatible ``make'' program. 7111.1Stv 7121.101Swiz When compiling the entire system via build.sh, many make(1) variables are 7131.1Stv set for you in order to help encapsulate the build process. In the list 7141.101Swiz of options below, variables that are automatically set by build.sh are 7151.1Stv noted where applicable. 7161.1Stv 7171.101Swiz The following operations are supported by build.sh: 7181.22Slukem 7191.101Swiz build Build the system as per ``make build''. Before the main 7201.101Swiz part of the build commences, this command runs the obj 7211.101Swiz operation (unless the -o option is given), ``make 7221.101Swiz cleandir'' (unless the -u option is given), and the tools 7231.70Sdholland operation. 7241.22Slukem 7251.101Swiz distribution Build a full distribution as per ``make distribution''. 7261.101Swiz This command first runs the build operation. 7271.22Slukem 7281.101Swiz release Build a full release as per ``make release''. This command 7291.101Swiz first runs the distribution operation. 7301.22Slukem 7311.101Swiz makewrapper Create the nbmake-MACHINE wrapper. This operation is auto- 7321.101Swiz matically performed for any of the other operations. 7331.23Slukem 7341.101Swiz cleandir Perform ``make cleandir''. 7351.75Slukem 7361.101Swiz obj Perform ``make obj''. 7371.22Slukem 7381.101Swiz tools Build and install the host tools from src/tools. This com- 7391.101Swiz mand will first run ``make obj'' and ``make cleandir'' in 7401.101Swiz the tools subdirectory unless the -o or -u options (respec- 7411.101Swiz tively) are given. 7421.22Slukem 7431.101Swiz install=idir Install the contents of DESTDIR to idir, using ``make 7441.61Sapb installworld''. Note that files that are part of the 7451.95Sapb ``etc'' or ``xetc'' sets will not be installed, unless 7461.95Sapb overridden by the INSTALLSETS environment variable. 7471.35Slukem 7481.101Swiz kernel=kconf Build a new kernel. The kconf argument is the name of a 7491.101Swiz configuration file suitable for use by config(1). If kconf 7501.22Slukem does not contain any `/' characters, the configuration file 7511.101Swiz is expected to be found in the KERNCONFDIR directory, which 7521.101Swiz is typically sys/arch/MACHINE/conf. The new kernel will be 7531.101Swiz built in a subdirectory of KERNOBJDIR, which is typically 7541.101Swiz sys/arch/MACHINE/compile or an associated object directory. 7551.70Sdholland 7561.101Swiz This command does not imply the tools command; run the 7571.101Swiz tools command first unless it is certain that the tools 7581.70Sdholland already exist and are up to date. 7591.70Sdholland 7601.70Sdholland This command will run ``make cleandir'' on the kernel in 7611.101Swiz question first unless the -u option is given. 7621.22Slukem 7631.101Swiz modules This command will build kernel modules and install them 7641.101Swiz into DESTDIR. 7651.86Sjnemeth 7661.101Swiz releasekernel=kconf 7671.70Sdholland Install a gzip(1)ed copy of the kernel previously built by 7681.101Swiz kernel=kconf into 7691.101Swiz RELEASEDIR/RELEASEMACHINEDIR/binary/kernel, usually as 7701.101Swiz netbsd-kconf.gz, although the ``netbsd'' prefix is deter- 7711.101Swiz mined from the ``config'' directives in kconf. 7721.24Slukem 7731.101Swiz sets Perform ``make sets''. 7741.31Slukem 7751.101Swiz sourcesets Perform ``make sourcesets''. 7761.22Slukem 7771.101Swiz syspkgs Perform ``make syspkgs''. 7781.54Sapb 7791.101Swiz iso-image Perform ``make iso-image''. 7801.56Sapb 7811.101Swiz iso-image-source 7821.65Sjnemeth Perform ``make iso-image-source''. 7831.65Sjnemeth 7841.101Swiz install-image 7851.98Sapb Perform ``make install-image''. 7861.97Stsutsui 7871.101Swiz live-image Perform ``make live-image''. 7881.97Stsutsui 7891.101Swiz The following command line options alter the behaviour of the build.sh 7901.51Swiz operations described above: 7911.1Stv 7921.101Swiz -a arch Set the value of MACHINE_ARCH to arch. 7931.9Sthorpej 7941.101Swiz -B buildid 7951.101Swiz Set the value of BUILDID to buildid. This will also append the 7961.67Ssborrill build identifier to the name of the ``make'' wrapper script so 7971.37Slukem that the resulting name is of the form 7981.101Swiz ``nbmake-MACHINE-BUILDID''. 7991.1Stv 8001.101Swiz -C cdextras 8011.101Swiz Append cdextras to the CDEXTRA variable, which is a space-sepa- 8021.101Swiz rated list of files or directories that will be added to the 8031.101Swiz CD-ROM image that may be create by the ``iso-image'' or 8041.87Sapb ``iso-image-source'' operations. Files will be added to the 8051.87Sapb root of the CD-ROM image, whereas directories will be copied 8061.87Sapb recursively. If relative paths are specified, they will be 8071.87Sapb converted to absolute paths before being used. Multiple paths 8081.101Swiz may be specified via multiple -C options, or via a single 8091.87Sapb option whose argument contains multiple space-separated paths. 8101.66Sjnemeth 8111.101Swiz -D dest Set the value of DESTDIR to dest. If a relative path is speci- 8121.101Swiz fied, it will be converted to an absolute path before being 8131.101Swiz used. 8141.101Swiz 8151.101Swiz -E Set `expert' mode. This overrides various sanity checks, and 8161.101Swiz allows: DESTDIR does not have to be set to a non-root path for 8171.101Swiz builds, and MKUNPRIVED=yes does not have to be set when build- 8181.101Swiz ing as a non-root user. 8191.23Slukem 8201.101Swiz Note: It is highly recommended that you know what you are doing 8211.23Slukem when you use this option. 8221.19Slukem 8231.101Swiz -h Print a help message. 8241.51Swiz 8251.101Swiz -j njob Run up to njob make(1) subjobs in parallel; passed through to 8261.74Sapb make(1). If you see failures for reasons other than running 8271.101Swiz out of memory while using build.sh with -j, please save com- 8281.101Swiz plete build logs so the failures can be analyzed. 8291.74Sapb 8301.101Swiz To achieve the fastest builds, -j values between (1 + the num- 8311.101Swiz ber of CPUs) and (2 * the number of CPUs) are recommended. Use 8321.101Swiz lower values on machines with limited memory or I/O bandwidth. 8331.101Swiz 8341.101Swiz -M obj Set MAKEOBJDIRPREFIX to obj. Unsets MAKEOBJDIR. See ``-O 8351.101Swiz -obj'' for more information. 8361.101Swiz 8371.101Swiz For instance, if the source directory is /usr/src, a setting of 8381.101Swiz ``-M /usr/obj'' will place build-time files under 8391.101Swiz /usr/obj/usr/src/bin, /usr/obj/usr/src/lib, 8401.101Swiz /usr/obj/usr/src/usr.bin, and so forth. 8411.88Sapb 8421.73Sapb If a relative path is specified, it will be converted to an 8431.101Swiz absolute path before being used. build.sh imposes the restric- 8441.101Swiz tion that the argument to the -M option must not begin with a 8451.101Swiz ``$'' (dollar sign) character; otherwise it would be too diffi- 8461.101Swiz cult to determine whether the value is an absolute or a rela- 8471.101Swiz tive path. If the directory does not already exist, build.sh 8481.101Swiz will create it. 8491.18Slukem 8501.101Swiz -m mach Set the value of MACHINE to mach, except in some special cases 8511.60Sapb listed below. This will also override any value of 8521.101Swiz MACHINE_ARCH in the process environment with a value deduced 8531.101Swiz from mach, unless -a is specified. All cross builds require 8541.101Swiz -m, but if unset on a NetBSD host, the host's value of MACHINE 8551.60Sapb will be detected and used automatically. 8561.60Sapb 8571.101Swiz Some machines support multiple values for MACHINE_ARCH. The 8581.101Swiz following special cases for the mach argument are defined to 8591.101Swiz set the listed values of MACHINE and MACHINE_ARCH: 8601.33Slukem 8611.101Swiz mach MACHINE MACHINE_ARCH 8621.60Sapb evbarm evbarm (not set) 8631.60Sapb evbarm-eb evbarm armeb 8641.60Sapb evbarm-el evbarm arm 8651.33Slukem evbmips evbmips (not set) 8661.33Slukem evbmips-eb evbmips mipseb 8671.33Slukem evbmips-el evbmips mipsel 8681.33Slukem evbsh3 evbsh3 (not set) 8691.33Slukem evbsh3-eb evbsh3 sh3eb 8701.33Slukem evbsh3-el evbsh3 sh3el 8711.33Slukem sbmips sbmips (not set) 8721.33Slukem sbmips-eb sbmips mipseb 8731.33Slukem sbmips-el sbmips mipsel 8741.1Stv 8751.101Swiz -N noiselevel 8761.46Slukem Set the ``noisyness'' level of the build, by setting 8771.101Swiz MAKEVERBOSE to noiselevel. 8781.45Slukem 8791.101Swiz -n Show the commands that would be executed by build.sh, but do 8801.1Stv not make any changes. This is similar in concept to ``make 8811.1Stv -n''. 8821.1Stv 8831.101Swiz -O obj Create an appropriate transform macro for MAKEOBJDIR that will 8841.101Swiz place the built object files under obj. Unsets 8851.101Swiz MAKEOBJDIRPREFIX. 8861.88Sapb 8871.101Swiz For instance, a setting of ``-O /usr/obj'' will place build- 8881.101Swiz time files under /usr/obj/bin, /usr/obj/lib, /usr/obj/usr.bin, 8891.88Sapb and so forth. 8901.88Sapb 8911.88Sapb If a relative path is specified, it will be converted to an 8921.101Swiz absolute path before being used. build.sh imposes the restric- 8931.101Swiz tion that the argument to the -O option must not contain a 8941.101Swiz ``$'' (dollar sign) character. If the directory does not 8951.101Swiz already exist, build.sh will create it. 8961.73Sapb 8971.101Swiz In normal use, exactly one of the -M or -O options should be 8981.101Swiz specified. If neither -M nor -O is specified, then a default 8991.78Sapb object directory will be chosen according to rules in 9001.78Sapb <bsd.obj.mk>. Relying on this default is not recommended 9011.78Sapb because it is determined by complex rules that are influenced 9021.78Sapb by the values of several variables and by the location of the 9031.78Sapb source directory. 9041.18Slukem 9051.101Swiz -o Set the value of MKOBJDIRS to ``no''. Otherwise, it will be 9061.70Sdholland automatically set to ``yes''. This default is opposite to the 9071.101Swiz behaviour when not using build.sh. 9081.1Stv 9091.101Swiz -R rel Set the value of RELEASEDIR to rel. If a relative path is 9101.59Sapb specified, it will be converted to an absolute path before 9111.59Sapb being used. 9121.18Slukem 9131.101Swiz -r Remove the contents of DESTDIR and TOOLDIR before building 9141.1Stv (provides a clean starting point). This will skip deleting 9151.101Swiz DESTDIR if building on a native system to the root directory. 9161.1Stv 9171.101Swiz -S seed Change the value of BUILDSEED to seed. This should rarely be 9181.72Sperry necessary. 9191.72Sperry 9201.101Swiz -T tools Set the value of TOOLDIR to tools. If a relative path is spec- 9211.101Swiz ified, it will be converted to an absolute path before being 9221.101Swiz used. If set, the bootstrap ``make'' will only be rebuilt if 9231.101Swiz the source files for make(1) have changed. 9241.101Swiz 9251.101Swiz -U Set MKUNPRIVED=yes. 9261.101Swiz 9271.101Swiz -u Set MKUPDATE=yes. 9281.101Swiz 9291.101Swiz -V var=[value] 9301.101Swiz Set the environment variable var to an optional value. This is 9311.101Swiz propagated to the nbmake wrapper. 9321.101Swiz 9331.101Swiz -w wrapper 9341.101Swiz Create the nbmake wrapper script (see below) in a custom loca- 9351.101Swiz tion, specified by wrapper. This allows, for instance, to 9361.101Swiz place the wrapper in PATH automatically. Note that wrapper is 9371.59Sapb the full name of the file, not just a directory name. If a 9381.59Sapb relative path is specified, it will be converted to an absolute 9391.59Sapb path before being used. 9401.1Stv 9411.101Swiz -X x11src 9421.101Swiz Set the value of X11SRCDIR to x11src. If a relative path is 9431.59Sapb specified, it will be converted to an absolute path before 9441.59Sapb being used. 9451.49Slukem 9461.101Swiz -x Set MKX11=yes. 9471.49Slukem 9481.101Swiz -Z var Unset ("zap") the environment variable var. This is propagated 9491.101Swiz to the nbmake wrapper. 9501.40Slukem 9511.101Swiz The "nbmake-MACHINE" wrapper script 9521.101Swiz If using the build.sh script to build NetBSD, a nbmake-MACHINE script 9531.101Swiz will be created in TOOLDIR/bin upon the first build to assist in building 9541.1Stv subtrees on a cross-compile host. 9551.1Stv 9561.101Swiz nbmake-MACHINE can be invoked in lieu of make(1), and will instead call 9571.101Swiz the up-to-date version of ``nbmake'' installed into TOOLDIR/bin with sev- 9581.101Swiz eral key variables pre-set, including MACHINE, MACHINE_ARCH, and TOOLDIR. 9591.101Swiz nbmake-MACHINE will also set variables specified with -V, and unset vari- 9601.101Swiz ables specified with -Z. 9611.40Slukem 9621.101Swiz This script can be symlinked into a directory listed in PATH, or called 9631.1Stv with an absolute path. 9641.1Stv 9651.101SwizEXAMPLES 9661.78Sapb 1. % ./build.sh [options] tools kernel=GENERIC 9671.28Slukem 9681.28Slukem Build a new toolchain, and use the new toolchain to configure and 9691.28Slukem build a new GENERIC kernel. 9701.28Slukem 9711.78Sapb 2. % ./build.sh [options] -U distribution 9721.28Slukem 9731.101Swiz Using unprivileged mode, build a complete distribution to a DESTDIR 9741.101Swiz directory that build.sh selects (and will display). 9751.28Slukem 9761.78Sapb 3. # ./build.sh [options] -U install=/ 9771.28Slukem 9781.101Swiz As root, install to / the distribution that was built by example 2. 9791.101Swiz Even though this is run as root, -U is required so that the permis- 9801.101Swiz sions stored in DESTDIR/METALOG are correctly applied to the files 9811.101Swiz as they're copied to /. 9821.28Slukem 9831.78Sapb 4. % ./build.sh [options] -U -u release 9841.28Slukem 9851.101Swiz Using unprivileged mode, build a complete release to DESTDIR and 9861.101Swiz RELEASEDIR directories that build.sh selects (and will display). 9871.101Swiz MKUPDATE=yes (-u) is set to prevent the ``make cleandir'', so that 9881.38Slukem if this is run after example 2, it doesn't need to redo that portion 9891.38Slukem of the release build. 9901.16Slukem 9911.101SwizOBSOLETE VARIABLES 9921.101Swiz NBUILDJOBS Use the make(1) option -j instead. 9931.15Slukem 9941.101Swiz USE_NEW_TOOLCHAIN 9951.15Slukem The new toolchain is now the default. To disable, use 9961.101Swiz TOOLCHAIN_MISSING=yes. 9971.10Ssommerfe 9981.101SwizSEE ALSO 9991.62Sapb make(1), hier(7), release(7), etcupdate(8), postinstall(8), sysinst(8), 10001.101Swiz pkgsrc/sysutils/cdrtools 10011.1Stv 10021.101SwizHISTORY 10031.101Swiz The build.sh based build scheme was introduced for NetBSD 1.6 as 10041.101Swiz USE_NEW_TOOLCHAIN, and re-worked to TOOLCHAIN_MISSING after that. 10051.1Stv 10061.100SwizNetBSD May 25, 2012 NetBSD 1007