BUILDING revision 1.105
11.104SwizBUILDING(8) System Manager's Manual BUILDING(8) 21.1Stv 31.105SwizNAME 41.105Swiz BUILDING -- Procedure for building NetBSD from source code. 51.1Stv 61.105SwizREQUIREMENTS 71.1Stv NetBSD is designed to be buildable on most POSIX-compliant host systems. 81.105Swiz The basic build procedure is the same whether compiling natively (on the 91.105Swiz 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.105Swiz 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.105SwizFILES 201.105Swiz Source tree layout 211.105Swiz doc/BUILDING.mdoc 221.17Swiz This document (in -mdoc troff format; the original copy). 231.1Stv 241.105Swiz BUILDING This document (in plaintext). 251.1Stv 261.105Swiz tools/compat/README 271.48Sjmc Special notes for cross-hosting a NetBSD build on non- 281.48Sjmc NetBSD platforms. 291.48Sjmc 301.105Swiz 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.105Swiz on a non-native host, see the build.sh shell script.) 341.1Stv 351.105Swiz 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.105Swiz 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.105Swiz crypto/dist/, dist/, gnu/dist/ 461.104Swiz Sources imported verbatim from third parties, without 471.104Swiz mangling the existing build structure. Other source trees 481.105Swiz in bin through usr.sbin use the NetBSD make(1) 491.104Swiz ``reachover'' Makefile semantics when building these 501.104Swiz programs for a native host. 511.104Swiz 521.105Swiz distrib/, etc/ 531.104Swiz Sources for items used when making a full release 541.105Swiz snapshot, such as files installed in DESTDIR/etc on the 551.104Swiz destination system, boot media, and release notes. 561.1Stv 571.105Swiz tests/, regress/ 581.70Sdholland Regression test harness. Can be cross-compiled, but only 591.105Swiz run natively. tests/ uses the atf(7) test framework; 601.105Swiz regress/ contains older tests that have not yet been 611.70Sdholland migrated to atf(7). 621.1Stv 631.105Swiz sys/ NetBSD kernel sources. 641.1Stv 651.105Swiz tools/ ``Reachover'' build structure for the host build tools. 661.104Swiz This has a special method of determining out-of-date 671.104Swiz status. 681.1Stv 691.105Swiz 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.105Swiz x11/ ``Reachover'' build structure for X11R6; the source is in 751.105Swiz X11SRCDIR. 761.49Slukem 771.105Swiz 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.105SwizCONFIGURATION 821.105Swiz Environment variables 831.8Slukem Several environment variables control the behaviour of NetBSD builds. 841.8Slukem 851.105Swiz 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.104Swiz functions (which is a widely-implemented but non- 911.104Swiz standardised feature). 921.96Sapb 931.96Sapb Depending on the host system, a suitable shell may be 941.105Swiz /bin/sh, /usr/xpg4/bin/sh, /bin/ksh (provided it is a 951.96Sapb variant of ksh that supports the ``local'' keyword, 961.105Swiz such as ksh88, but not ksh93), or /usr/local/bin/bash. 971.96Sapb 981.105Swiz Most parts of the build require HOST_SH to be an 991.105Swiz absolute path; however, build.sh allows it to be a 1001.104Swiz simple command name, which will be converted to an 1011.105Swiz absolute path by searching the PATH. 1021.58Sapb 1031.105Swiz HOST_CC Path name to C compiler used to create the toolchain. 1041.53Sreed 1051.105Swiz HOST_CXX Path name to C++ compiler used to create the toolchain. 1061.53Sreed 1071.105Swiz MACHINE Machine type, e.g., ``macppc''. 1081.8Slukem 1091.105Swiz MACHINE_ARCH Machine architecture, e.g., ``powerpc''. 1101.8Slukem 1111.105Swiz MAKE Path name to invoke make(1) as. 1121.8Slukem 1131.105Swiz MAKEFLAGS Flags to invoke make(1) with. Note that build.sh 1141.105Swiz ignores the value of MAKEFLAGS passed in the 1151.105Swiz environment, but allows MAKEFLAGS to be set via the -V 1161.104Swiz option. 1171.8Slukem 1181.105Swiz MAKEOBJDIR Directory to use as the .OBJDIR for the current 1191.104Swiz directory. The value is subjected to variable 1201.104Swiz expansion by make(1). Typical usage is to set this 1211.104Swiz variable to a value involving the use of 1221.104Swiz `${.CURDIR:S...}' or `${.CURDIR:C...}', to derive the 1231.105Swiz value of .OBJDIR from the value of .CURDIR. Used only 1241.105Swiz if MAKEOBJDIRPREFIX is not defined. MAKEOBJDIR can be 1251.105Swiz provided only in the environment or via the -O flag of 1261.105Swiz build.sh; it cannot usefully be set inside a Makefile, 1271.105Swiz including mk.conf or ${MAKECONF}. 1281.8Slukem 1291.105Swiz MAKEOBJDIRPREFIX Top level directory of the object directory tree. The 1301.88Sapb value is subjected to variable expansion by make(1). 1311.105Swiz build.sh will create the ${MAKEOBJDIRPREFIX} directory 1321.105Swiz if necessary, but if make(1) is used without build.sh, 1331.88Sapb then rules in <bsd.obj.mk> will abort the build if the 1341.88Sapb ${MAKEOBJDIRPREFIX} directory does not exist. If the 1351.104Swiz value is defined and valid, then 1361.105Swiz ${MAKEOBJDIRPREFIX}/${.CURDIR} is used as the .OBJDIR 1371.104Swiz for the current directory. The current directory may 1381.105Swiz be read only. MAKEOBJDIRPREFIX can be provided only in 1391.105Swiz the environment or via the -M flag of build.sh; it 1401.104Swiz cannot usefully be set inside a Makefile, including 1411.105Swiz mk.conf or ${MAKECONF}. 1421.104Swiz 1431.105Swiz "make" variables 1441.104Swiz Several variables control the behavior of NetBSD builds. Unless 1451.104Swiz otherwise specified, these variables may be set in either the process 1461.105Swiz environment or the make(1) configuration file specified by MAKECONF. 1471.1Stv 1481.105Swiz BUILDID Identifier for the build. The identifier will be appended to 1491.9Sthorpej object directory names, and can be consulted in the make(1) 1501.104Swiz configuration file in order to set additional build 1511.104Swiz parameters, such as compiler flags. 1521.9Sthorpej 1531.105Swiz BUILDSEED GCC uses random numbers when compiling C++ code. This 1541.104Swiz variable seeds the gcc random number generator using the 1551.104Swiz -frandom-seed flag with this value. By default, it is set to 1561.104Swiz NetBSD-(majorversion). Using a fixed value causes C++ 1571.104Swiz binaries to be the same when built from the same sources, 1581.104Swiz resulting in identical (reproducible) builds. Additional 1591.104Swiz information is available in the GCC documentation of 1601.104Swiz -frandom-seed. 1611.104Swiz 1621.105Swiz DESTDIR Directory to contain the built NetBSD system. If set, 1631.104Swiz special options are passed to the compilation tools to 1641.105Swiz prevent their default use of the host system's /usr/include, 1651.105Swiz /usr/lib, and so forth. This pathname must be an absolute 1661.105Swiz path, and should not end with a slash (/) character. (For 1671.105Swiz installation into the system's root directory, set DESTDIR to 1681.59Sapb an empty string, not to ``/''). The directory must reside on 1691.59Sapb a file system which supports long file names and hard links. 1701.1Stv 1711.105Swiz Default: Empty string if USETOOLS is ``yes''; unset 1721.104Swiz otherwise. 1731.1Stv 1741.105Swiz Note: build.sh will provide a default of destdir.MACHINE (in 1751.105Swiz the top-level .OBJDIR) unless run in `expert' mode. 1761.30Slukem 1771.105Swiz MAKECONF The name of the make(1) configuration file. Only settable in 1781.105Swiz the process environment. 1791.1Stv 1801.105Swiz Default: ``/etc/mk.conf'' 1811.1Stv 1821.105Swiz MAKEVERBOSE 1831.45Slukem Level of verbosity of status messages. Supported values: 1841.45Slukem 1851.80Sapb 0 No descriptive messages or commands executed by make(1) 1861.80Sapb are shown. 1871.45Slukem 1881.80Sapb 1 Brief messages are shown describing what is being done, 1891.104Swiz but the actual commands executed by make(1) are not 1901.104Swiz displayed. 1911.80Sapb 1921.80Sapb 2 Descriptive messages are shown as above (prefixed with a 1931.80Sapb `#'), and ordinary commands performed by make(1) are 1941.80Sapb displayed. 1951.80Sapb 1961.80Sapb 3 In addition to the above, all commands performed by 1971.80Sapb make(1) are displayed, even if they would ordinarily 1981.80Sapb have been hidden through use of the ``@'' prefix in the 1991.80Sapb relevant makefile. 2001.45Slukem 2011.80Sapb 4 In addition to the above, commands executed by make(1) 2021.105Swiz are traced through use of the sh(1) ``-x'' flag. 2031.45Slukem 2041.105Swiz Default: 2 2051.45Slukem 2061.105Swiz MKCATPAGES Can be set to ``yes'' or ``no''. Indicates whether 2071.104Swiz preformatted plaintext manual pages will be created during a 2081.104Swiz build. 2091.1Stv 2101.105Swiz Default: ``no'' 2111.1Stv 2121.105Swiz MKCRYPTO Can be set to ``yes'' or ``no''. Indicates whether 2131.104Swiz cryptographic code will be included in a build; provided for 2141.104Swiz the benefit of countries that do not allow strong 2151.104Swiz cryptography. Will not affect use of the standard low- 2161.104Swiz security password encryption system, crypt(3). 2171.1Stv 2181.105Swiz Default: ``yes'' 2191.1Stv 2201.105Swiz MKDOC Can be set to ``yes'' or ``no''. Indicates whether system 2211.105Swiz documentation destined for DESTDIR/usr/share/doc will be 2221.44Slukem installed during a build. 2231.1Stv 2241.105Swiz Default: ``yes'' 2251.1Stv 2261.105Swiz MKHTML Can be set to ``yes'' or ``no''. Indicates whether 2271.104Swiz preformatted HTML manual pages will be built and installed 2281.77Slukem 2291.105Swiz Default: ``yes'' 2301.77Slukem 2311.105Swiz MKHOSTOBJ Can be set to ``yes'' or ``no''. If set to ``yes'', then for 2321.4Stv programs intended to be run on the compile host, the name, 2331.4Stv release, and architecture of the host operating system will 2341.4Stv be suffixed to the name of the object directory created by 2351.4Stv ``make obj''. (This allows multiple host systems to compile 2361.4Stv NetBSD for a single target.) If set to ``no'', then programs 2371.4Stv built to be run on the compile host will use the same object 2381.4Stv directory names as programs built to be run on the target. 2391.4Stv 2401.105Swiz Default: ``no'' 2411.4Stv 2421.105Swiz MKINFO Can be set to ``yes'' or ``no''. Indicates whether GNU Info 2431.1Stv files, used for the documentation for most of the compilation 2441.1Stv tools, will be created and installed during a build. 2451.1Stv 2461.105Swiz Default: ``yes'' 2471.1Stv 2481.105Swiz MKKMOD Can be set to ``yes'' or ``no''. Indicates whether kernel 2491.95Sapb modules are built and installed. 2501.95Sapb 2511.105Swiz Default: ``yes'' 2521.95Sapb 2531.105Swiz MKLINT Can be set to ``yes'' or ``no''. Indicates whether lint(1) 2541.1Stv will be run against portions of the NetBSD source code during 2551.1Stv the build, and whether lint libraries will be installed into 2561.105Swiz DESTDIR/usr/libdata/lint. 2571.1Stv 2581.105Swiz Default: ``yes'' 2591.1Stv 2601.105Swiz MKMAN Can be set to ``yes'' or ``no''. Indicates whether manual 2611.1Stv pages will be installed during a build. 2621.1Stv 2631.105Swiz Default: ``yes'' 2641.1Stv 2651.105Swiz MKNLS Can be set to ``yes'' or ``no''. Indicates whether Native 2661.44Slukem Language System locale zone files will be compiled and 2671.44Slukem installed during a build. 2681.1Stv 2691.105Swiz Default: ``yes'' 2701.1Stv 2711.105Swiz MKOBJ Can be set to ``yes'' or ``no''. Indicates whether object 2721.1Stv directories will be created when running ``make obj''. If 2731.1Stv set to ``no'', then all built files will be located inside 2741.1Stv the regular source tree. 2751.1Stv 2761.105Swiz Default: ``yes'' 2771.1Stv 2781.105Swiz Note that setting MKOBJ to ``no'' is not recommended and may 2791.70Sdholland cause problems when updating the tree with cvs(1). 2801.70Sdholland 2811.105Swiz MKPIC Can be set to ``yes'' or ``no''. Indicates whether shared 2821.1Stv objects and libraries will be created and installed during a 2831.1Stv build. If set to ``no'', the entire built system will be 2841.1Stv statically linked. 2851.1Stv 2861.105Swiz Default: Platform dependent. As of this writing, all 2871.105Swiz platforms except sh3 default to ``yes''. 2881.1Stv 2891.105Swiz MKPICINSTALL 2901.1Stv Can be set to ``yes'' or ``no''. Indicates whether the ar(1) 2911.105Swiz format libraries (lib*_pic.a), used to generate shared 2921.44Slukem libraries, are installed during a build. 2931.1Stv 2941.105Swiz Default: ``yes'' 2951.1Stv 2961.105Swiz MKPROFILE Can be set to ``yes'' or ``no''. Indicates whether profiled 2971.105Swiz libraries (lib*_p.a) will be built and installed during a 2981.1Stv build. 2991.1Stv 3001.105Swiz Default: ``yes''; however, some platforms turn off MKPROFILE 3011.1Stv by default at times due to toolchain problems with profiled 3021.1Stv code. 3031.1Stv 3041.105Swiz MKREPRO Can be set to ``yes'' or ``no''. Create reproducable builds. 3051.100Swiz This enables different switches to make two builds from the 3061.100Swiz same source tree result in the same build results. 3071.100Swiz 3081.105Swiz Default: ``no'' 3091.100Swiz 3101.105Swiz MKSHARE Can be set to ``yes'' or ``no''. Indicates whether files 3111.105Swiz destined to reside in DESTDIR/usr/share will be built and 3121.44Slukem installed during a build. If set to ``no'', then all of 3131.105Swiz MKCATPAGES, MKDOC, MKINFO, MKMAN, and MKNLS will be set to 3141.27Slukem ``no'' unconditionally. 3151.1Stv 3161.105Swiz Default: ``yes'' 3171.1Stv 3181.105Swiz MKSTRIPIDENT 3191.102Sabs Can be set to ``yes'' or ``no''. Indicates whether RCS IDs, 3201.104Swiz for use with ident(1), should be stripped from program 3211.104Swiz binaries and shared libraries. 3221.78Sapb 3231.105Swiz Default: ``no'' 3241.78Sapb 3251.105Swiz MKUNPRIVED Can be set to ``yes'' or ``no''. Indicates whether an 3261.104Swiz unprivileged install will occur. The user, group, 3271.104Swiz permissions, and file flags, will not be set on the installed 3281.52Sjmc items; instead the information will be appended to a file 3291.105Swiz called METALOG in DESTDIR. The contents of METALOG are used 3301.52Sjmc during the generation of the distribution tar files to ensure 3311.52Sjmc that the appropriate file ownership is stored. 3321.38Slukem 3331.105Swiz Default: ``no'' 3341.38Slukem 3351.105Swiz MKUPDATE Can be set to ``yes'' or ``no''. Indicates whether all 3361.105Swiz install operations intended to write to DESTDIR will compare 3371.38Slukem file timestamps before installing, and skip the install phase 3381.44Slukem if the destination files are up-to-date. This also has 3391.44Slukem implications on full builds (see next subsection). 3401.38Slukem 3411.105Swiz Default: ``no'' 3421.38Slukem 3431.105Swiz MKX11 Can be set to ``yes'' or ``no''. Indicates whether X11 is 3441.105Swiz built from X11SRCDIR. 3451.49Slukem 3461.105Swiz Default: ``no'' 3471.49Slukem 3481.105Swiz TOOLDIR Directory to hold the host tools, once built. If specified, 3491.59Sapb must be an absolute path. This directory should be unique to 3501.104Swiz a given host system and NetBSD source tree. (However, 3511.105Swiz multiple targets may share the same TOOLDIR; the target- 3521.104Swiz dependent files have unique names.) If unset, a default 3531.104Swiz based on the uname(1) information of the host platform will 3541.105Swiz be created in the .OBJDIR of src. 3551.1Stv 3561.105Swiz Default: Unset. 3571.1Stv 3581.105Swiz USETOOLS Indicates whether the tools specified by TOOLDIR should be 3591.1Stv used as part of a build in progress. Must be set to ``yes'' 3601.1Stv if cross-compiling. 3611.1Stv 3621.105Swiz yes Use the tools from TOOLDIR. 3631.1Stv 3641.105Swiz no Do not use the tools from TOOLDIR, but refuse to build 3651.1Stv native compilation tool components that are version- 3661.1Stv specific for that tool. 3671.1Stv 3681.105Swiz never Do not use the tools from TOOLDIR, even when building 3691.104Swiz native tool components. This is similar to the 3701.105Swiz traditional NetBSD build method, but does not verify 3711.104Swiz that the compilation tools in use are up-to-date 3721.104Swiz enough in order to build the tree successfully. This 3731.104Swiz may cause build or runtime problems when building the 3741.104Swiz whole NetBSD source tree. 3751.1Stv 3761.105Swiz Default: ``yes'', unless TOOLCHAIN_MISSING is set to ``yes''. 3771.71Sdholland 3781.105Swiz USETOOLS is also set to ``no'' when using <bsd.*.mk> outside 3791.71Sdholland the NetBSD source tree. 3801.1Stv 3811.105Swiz X11SRCDIR Directory containing the X11R6 source. If specified, must be 3821.59Sapb an absolute path. The main X11R6 source is found in 3831.105Swiz X11SRCDIR/xfree/xc. 3841.49Slukem 3851.105Swiz Default: NETBSDRCDIR/../xsrc, if that exists; otherwise 3861.105Swiz /usr/xsrc. 3871.49Slukem 3881.105Swiz X11FLAVOUR The style of X11 cross-built, set to either ``Xorg'' or 3891.79Smrg ``XFree86''. 3901.79Smrg 3911.105Swiz Default: ``Xorg'' on amd64, i386, macppc, shark and sparc64 3921.81Smrg platforms, ``XFree86'' on everything else. 3931.79Smrg 3941.105Swiz "make" variables for full builds 3951.7Slukem These variables only affect the top level ``Makefile'' and do not affect 3961.7Slukem manually building subtrees of the NetBSD source code. 3971.1Stv 3981.105Swiz INSTALLWORLDDIR Location for the ``make installworld'' target to install 3991.59Sapb to. If specified, must be an absolute path. 4001.1Stv 4011.105Swiz Default: ``/'' 4021.1Stv 4031.105Swiz MKOBJDIRS Can be set to ``yes'' or ``no''. Indicates whether 4041.44Slukem object directories will be created automatically (via a 4051.20Slukem ``make obj'' pass) at the start of a build. 4061.1Stv 4071.105Swiz Default: ``no'' 4081.1Stv 4091.105Swiz If using build.sh, the default is ``yes''. This may be 4101.105Swiz set back to ``no'' by giving build.sh the -o option. 4111.70Sdholland 4121.105Swiz MKUPDATE Can be set to ``yes'' or ``no''. If set, then in 4131.105Swiz addition to the effects described for MKUPDATE=yes 4141.105Swiz above, this implies the effects of NOCLEANDIR (i.e., 4151.104Swiz ``make cleandir'' is avoided). 4161.38Slukem 4171.105Swiz Default: ``no'' 4181.38Slukem 4191.105Swiz If using build.sh, this may be set by giving the -u 4201.70Sdholland option. 4211.70Sdholland 4221.105Swiz NBUILDJOBS Now obsolete. Use the make(1) option -j, instead. See 4231.70Sdholland below. 4241.1Stv 4251.105Swiz Default: Unset. 4261.1Stv 4271.105Swiz NOCLEANDIR If set, avoids the ``make cleandir'' phase of a full 4281.20Slukem build. This has the effect of allowing only changed 4291.20Slukem files in a source tree to be recompiled. This can speed 4301.20Slukem up builds when updating only a few files in the tree. 4311.1Stv 4321.105Swiz Default: Unset. 4331.1Stv 4341.105Swiz See also MKUPDATE. 4351.70Sdholland 4361.105Swiz NODISTRIBDIRS If set, avoids the ``make distrib-dirs'' phase of a full 4371.105Swiz build. This skips running mtree(8) on DESTDIR, useful 4381.20Slukem on systems where building as an unprivileged user, or 4391.20Slukem where it is known that the system-wide mtree files have 4401.20Slukem not changed. 4411.1Stv 4421.105Swiz Default: Unset. 4431.1Stv 4441.105Swiz NOINCLUDES If set, avoids the ``make includes'' phase of a full 4451.20Slukem build. This has the effect of preventing make(1) from 4461.44Slukem thinking that some programs are out-of-date simply 4471.44Slukem because the system include files have changed. However, 4481.20Slukem this option should not be used when updating the entire 4491.20Slukem NetBSD source tree arbitrarily; it is suggested to use 4501.105Swiz MKUPDATE=yes instead in that case. 4511.1Stv 4521.105Swiz Default: Unset. 4531.1Stv 4541.105Swiz RELEASEDIR If set, specifies the directory to which a release(7) 4551.20Slukem layout will be written at the end of a ``make release''. 4561.59Sapb If specified, must be an absolute path. 4571.20Slukem 4581.105Swiz Default: Unset. 4591.20Slukem 4601.105Swiz Note: build.sh will provide a default of releasedir (in 4611.105Swiz the top-level .OBJDIR) unless run in `expert' mode. 4621.30Slukem 4631.105SwizBUILDING 4641.105Swiz "make" command line options 4651.52Sjmc This is not a summary of all the options available to make(1); only the 4661.52Sjmc options used most frequently with NetBSD builds are listed here. 4671.1Stv 4681.105Swiz -j njob Run up to njob make(1) subjobs in parallel. Makefiles should 4691.52Sjmc use .WAIT or have explicit dependencies as necessary to 4701.74Sapb enforce build ordering. 4711.10Ssommerfe 4721.105Swiz -m dir Specify the default directory for searching for system 4731.104Swiz Makefile segments, mainly the <bsd.*.mk> files. When building 4741.104Swiz any full NetBSD source tree, this should be set to the 4751.104Swiz ``share/mk'' directory in the source tree. This is set 4761.104Swiz automatically when building from the top level, or when using 4771.105Swiz build.sh. 4781.1Stv 4791.105Swiz -n Display the commands that would have been executed, but do not 4801.1Stv actually execute them. This will still cause recursion to 4811.1Stv take place. 4821.1Stv 4831.105Swiz -V var Print make(1)'s idea of the value of var. Does not build any 4841.1Stv targets. 4851.1Stv 4861.105Swiz var=value Set the variable var to value, overriding any setting 4871.105Swiz specified by the process environment, the MAKECONF 4881.104Swiz configuration file, or the system Makefile segments. 4891.1Stv 4901.105Swiz "make" targets 4911.1Stv These default targets may be built by running make(1) in any subtree of 4921.1Stv the NetBSD source code. It is recommended that none of these be used 4931.1Stv from the top level Makefile; as a specific exception, ``make obj'' and 4941.1Stv ``make cleandir'' are useful in that context. 4951.1Stv 4961.105Swiz all Build programs, libraries, and preformatted documentation. 4971.1Stv 4981.105Swiz clean Remove program and library object code files. 4991.1Stv 5001.105Swiz cleandir Same as clean, but also remove preformatted documentation, 5011.44Slukem dependency files generated by ``make depend'', and any other 5021.49Slukem files known to be created at build time. 5031.1Stv 5041.105Swiz depend Create dependency files (.depend) containing more detailed 5051.44Slukem information about the dependencies of source code on header 5061.1Stv files. Allows programs to be recompiled automatically when a 5071.1Stv dependency changes. 5081.1Stv 5091.105Swiz dependall Does a ``make depend'' immediately followed by a ``make all''. 5101.10Ssommerfe This improves cache locality of the build since both passes 5111.10Ssommerfe read the source files in their entirety. 5121.1Stv 5131.105Swiz distclean Synonym for cleandir. 5141.49Slukem 5151.105Swiz includes Build and install system header files. Typically needed 5161.44Slukem before any system libraries or programs can be built. 5171.1Stv 5181.105Swiz install Install programs, libraries, and documentation into DESTDIR. 5191.105Swiz Few files will be installed to DESTDIR/dev, DESTDIR/etc, 5201.105Swiz DESTDIR/root or DESTDIR/var in order to prevent user supplied 5211.27Slukem configuration data from being overwritten. 5221.1Stv 5231.105Swiz lint Run lint(1) against the C source code, where appropriate, and 5241.1Stv generate system-installed lint libraries. 5251.1Stv 5261.105Swiz obj Create object directories to be used for built files, instead 5271.1Stv of building directly in the source tree. 5281.1Stv 5291.105Swiz tags Create ctags(1) searchable function lists usable by the ex(1) 5301.1Stv and vi(1) text editors. 5311.1Stv 5321.105Swiz "make" targets for the top level 5331.1Stv Additional make(1) targets are usable specifically from the top source 5341.1Stv level to facilitate building the entire NetBSD source tree. 5351.1Stv 5361.105Swiz build Build the entire NetBSD system (except the kernel). This 5371.68Sreed orders portions of the source tree such that prerequisites 5381.68Sreed will be built in the proper order. 5391.20Slukem 5401.105Swiz distribution Do a ``make build'', and then install a full distribution 5411.105Swiz (which does not include a kernel) into DESTDIR, including 5421.105Swiz files in DESTDIR/dev, DESTDIR/etc, DESTDIR/root and 5431.105Swiz DESTDIR/var. 5441.20Slukem 5451.105Swiz buildworld As per ``make distribution'', except that it ensures that 5461.105Swiz DESTDIR is not the root directory. 5471.20Slukem 5481.105Swiz installworld Install the distribution from DESTDIR to INSTALLWORLDDIR, 5491.70Sdholland which defaults to the root directory. Ensures that 5501.105Swiz INSTALLWORLDDIR is not the root directory if cross 5511.104Swiz compiling. 5521.20Slukem 5531.105Swiz The INSTALLSETS environment variable may be set to a space- 5541.95Sapb separated list of distribution sets to be installed. By 5551.95Sapb default, all sets except ``etc'' and ``xetc'' are 5561.105Swiz installed, so most files in INSTALLWORLDDIR/etc will not be 5571.95Sapb installed or modified. 5581.61Sapb 5591.105Swiz Note: Before performing this operation with 5601.105Swiz INSTALLWORLDDIR=/, it is highly recommended that you 5611.61Sapb upgrade your kernel and reboot. After performing this 5621.61Sapb operation, it is recommended that you use etcupdate(8) to 5631.105Swiz update files in INSTALLWORLDDIR/etc, and postinstall(8) to 5641.102Sabs check for or fix inconsistencies. 5651.20Slukem 5661.105Swiz sets Create distribution sets from DESTDIR into 5671.105Swiz RELEASEDIR/RELEASEMACHINEDIR/binary/sets. Should be run 5681.70Sdholland after ``make distribution'', as ``make build'' alone does 5691.70Sdholland not install all of the required files. 5701.25Slukem 5711.105Swiz sourcesets Create source sets of the source tree into 5721.105Swiz RELEASEDIR/source/sets. 5731.31Slukem 5741.105Swiz syspkgs Create syspkgs from DESTDIR into 5751.105Swiz RELEASEDIR/RELEASEMACHINEDIR/binary/syspkgs. Should be run 5761.70Sdholland after ``make distribution'', as ``make build'' alone does 5771.70Sdholland not install all of the required files. 5781.54Sapb 5791.105Swiz release Do a ``make distribution'', build kernels, distribution 5801.44Slukem media, and install sets (this as per ``make sets''), and 5811.44Slukem then package the system into a standard release layout as 5821.105Swiz described by release(7). This requires that RELEASEDIR be 5831.25Slukem set (see above). 5841.1Stv 5851.105Swiz iso-image Create a NetBSD installation CD-ROM image in the 5861.105Swiz RELEASEDIR/iso directory. The CD-ROM file system will have 5871.62Sapb a layout as described in release(7). 5881.62Sapb 5891.62Sapb For most machine types, the CD-ROM will be bootable, and 5901.104Swiz will automatically run the sysinst(8) menu-based 5911.104Swiz installation program, which can be used to install or 5921.104Swiz upgrade a NetBSD system. Bootable CD-ROMs also contain 5931.104Swiz tools that may be useful in repairing a damaged NetBSD 5941.104Swiz installation. 5951.62Sapb 5961.62Sapb Before ``make iso-image'' is attempted, RELEASEDIR must be 5971.62Sapb populated by ``make release'' or equivalent. 5981.62Sapb 5991.62Sapb Note that other, smaller, CD-ROM images may be created in 6001.105Swiz the RELEASEDIR/RELEASEMACHINEDIR/installation/cdrom 6011.104Swiz directory by ``make release''. These smaller images 6021.104Swiz usually contain the same tools as the larger images in 6031.105Swiz RELEASEDIR/iso, but do not contain additional content such 6041.69Slukem as the distribution sets. 6051.62Sapb 6061.62Sapb Note that the mac68k port still uses an older method of 6071.104Swiz creating CD-ROM images. This requires the mkisofs(1) 6081.104Swiz utility, which is not part of NetBSD, but which can be 6091.105Swiz installed from pkgsrc/sysutils/cdrtools. 6101.56Sapb 6111.105Swiz iso-image-source 6121.64Sjnemeth Create a NetBSD installation CD-ROM image in the 6131.105Swiz RELEASEDIR/iso directory. The CD-ROM file system will have 6141.64Sjnemeth a layout as described in release(7). It will have top 6151.64Sjnemeth level directories for the machine type and source. 6161.64Sjnemeth 6171.64Sjnemeth For most machine types, the CD-ROM will be bootable, and 6181.104Swiz will automatically run the sysinst(8) menu-based 6191.104Swiz installation program, which can be used to install or 6201.104Swiz upgrade a NetBSD system. Bootable CD-ROMs also contain 6211.104Swiz tools that may be useful in repairing a damaged NetBSD 6221.104Swiz installation. 6231.64Sjnemeth 6241.64Sjnemeth Before ``make iso-image-source'' is attempted, RELEASEDIR 6251.104Swiz must be populated by ``make sourcesets release'' or 6261.104Swiz equivalent. 6271.64Sjnemeth 6281.64Sjnemeth Note that other, smaller, CD-ROM images may be created in 6291.105Swiz the RELEASEDIR/RELEASEMACHINEDIR/installation/cdrom 6301.104Swiz directory by ``make release''. These smaller images 6311.104Swiz usually contain the same tools as the larger images in 6321.105Swiz RELEASEDIR/iso, but do not contain additional content such 6331.69Slukem as the distribution sets. 6341.64Sjnemeth 6351.64Sjnemeth Note that the mac68k port still uses an older method of 6361.104Swiz creating CD-ROM images. This requires the mkisofs(1) 6371.104Swiz utility, which is not part of NetBSD, but which can be 6381.105Swiz installed from pkgsrc/sysutils/cdrtools. 6391.64Sjnemeth 6401.105Swiz install-image 6411.98Sapb Create a bootable NetBSD installation disk image in the 6421.105Swiz RELEASEDIR/RELEASEMACHINEDIR/installation/installimage 6431.98Sapb directory. The installation disk image is suitable for 6441.98Sapb copying to bootable USB flash memory sticks, etc., for 6451.98Sapb machines which are able to boot from such devices. The 6461.98Sapb file system in the bootable disk image will have a layout 6471.98Sapb as described in release(7). 6481.97Stsutsui 6491.97Stsutsui The installation image is bootable, and will automatically 6501.97Stsutsui run the sysinst(8) menu-based installation program, which 6511.98Sapb can be used to install or upgrade a NetBSD system. The 6521.98Sapb image also contains tools that may be useful in repairing a 6531.98Sapb damaged NetBSD installation. 6541.97Stsutsui 6551.105Swiz Before ``make install-image'' is attempted, RELEASEDIR must 6561.98Sapb be populated by ``make release'' or equivalent. The build 6571.105Swiz must have been performed with MKUNPRIVED=yes because ``make 6581.105Swiz install-image'' relies on information in DESTDIR/METALOG. 6591.97Stsutsui 6601.97Stsutsui live-image Create NetBSD live images in the 6611.105Swiz RELEASEDIR/RELEASEMACHINEDIR/installation/liveimage 6621.104Swiz directory. The live image contains all necessary files to 6631.104Swiz boot NetBSD up to multi-user mode, including all files 6641.104Swiz which should be extracted during installation, NetBSD 6651.104Swiz disklabel, bootloaders, etc. 6661.104Swiz 6671.104Swiz The live image is suitable for use as a disk image in 6681.104Swiz virtual machine environments such as QEMU, and also useful 6691.104Swiz to boot NetBSD from a USB flash memory stick on a real 6701.98Sapb machine, without the need for installation. 6711.97Stsutsui 6721.97Stsutsui Before ``make live-image'' is attempted, RELEASEDIR must be 6731.99Stsutsui populated by ``make release'' or equivalent. The build 6741.105Swiz must have been performed with MKUNPRIVED=yes because ``make 6751.105Swiz install-image'' relies on information in DESTDIR/METALOG. 6761.97Stsutsui 6771.105Swiz regression-tests 6781.20Slukem Can only be run after building the regression tests in the 6791.70Sdholland directory ``regress''. Runs those compiled regression 6801.104Swiz tests on the local host. Note that most tests are now 6811.104Swiz managed instead using atf(7); this target should probably 6821.104Swiz run those as well but currently does not. 6831.1Stv 6841.105Swiz The "build.sh" script 6851.96Sapb This script file is a shell script designed to build the entire NetBSD 6861.104Swiz system on any host with a suitable modern shell and some common 6871.105Swiz utilities. The required shell features are described under the HOST_SH 6881.104Swiz variable. 6891.96Sapb 6901.96Sapb If a host system's default shell does support the required features, then 6911.96Sapb we suggest that you explicitly specify a suitable shell using a command 6921.96Sapb like 6931.96Sapb 6941.105Swiz /path/to/suitable/shell build.sh [options] 6951.96Sapb 6961.105Swiz The above command will usually enable build.sh to automatically set 6971.105Swiz HOST_SH=/path/to/suitable/shell, but if that fails, then the following 6981.96Sapb set of commands may be used instead: 6991.96Sapb 7001.105Swiz HOST_SH=/path/to/suitable/shell 7011.96Sapb export HOST_SH 7021.105Swiz ${HOST_SH} build.sh [options] 7031.96Sapb 7041.105Swiz If build.sh detects that it is being executed under an unsuitable shell, 7051.96Sapb it attempts to exec a suitable shell instead, or prints an error message. 7061.105Swiz If HOST_SH is not set explicitly, then build.sh sets a default using 7071.96Sapb heuristics dependent on the host platform, or from the shell under which 7081.105Swiz build.sh is executed (if that can be determined), or using the first copy 7091.105Swiz of sh found in PATH. 7101.1Stv 7111.1Stv All cross-compile builds, and most native builds, of the entire system 7121.105Swiz should make use of build.sh rather than just running ``make''. This way, 7131.104Swiz the make(1) program will be bootstrapped properly, in case the host 7141.104Swiz system has an older or incompatible ``make'' program. 7151.1Stv 7161.105Swiz When compiling the entire system via build.sh, many make(1) variables are 7171.1Stv set for you in order to help encapsulate the build process. In the list 7181.105Swiz of options below, variables that are automatically set by build.sh are 7191.1Stv noted where applicable. 7201.1Stv 7211.105Swiz The following operations are supported by build.sh: 7221.22Slukem 7231.105Swiz build Build the system as per ``make build''. Before the main 7241.105Swiz part of the build commences, this command runs the obj 7251.105Swiz operation (unless the -o option is given), ``make 7261.105Swiz cleandir'' (unless the -u option is given), and the tools 7271.70Sdholland operation. 7281.22Slukem 7291.105Swiz distribution Build a full distribution as per ``make distribution''. 7301.105Swiz This command first runs the build operation. 7311.22Slukem 7321.105Swiz release Build a full release as per ``make release''. This command 7331.105Swiz first runs the distribution operation. 7341.22Slukem 7351.105Swiz makewrapper Create the nbmake-MACHINE wrapper. This operation is 7361.104Swiz automatically performed for any of the other operations. 7371.23Slukem 7381.105Swiz cleandir Perform ``make cleandir''. 7391.75Slukem 7401.105Swiz obj Perform ``make obj''. 7411.22Slukem 7421.105Swiz tools Build and install the host tools from src/tools. This 7431.104Swiz command will first run ``make obj'' and ``make cleandir'' 7441.105Swiz in the tools subdirectory unless the -o or -u options 7451.104Swiz (respectively) are given. 7461.22Slukem 7471.105Swiz install=idir Install the contents of DESTDIR to idir, using ``make 7481.61Sapb installworld''. Note that files that are part of the 7491.95Sapb ``etc'' or ``xetc'' sets will not be installed, unless 7501.95Sapb overridden by the INSTALLSETS environment variable. 7511.35Slukem 7521.105Swiz kernel=kconf Build a new kernel. The kconf argument is the name of a 7531.105Swiz configuration file suitable for use by config(1). If kconf 7541.22Slukem does not contain any `/' characters, the configuration file 7551.105Swiz is expected to be found in the KERNCONFDIR directory, which 7561.105Swiz is typically sys/arch/MACHINE/conf. The new kernel will be 7571.105Swiz built in a subdirectory of KERNOBJDIR, which is typically 7581.105Swiz sys/arch/MACHINE/compile or an associated object directory. 7591.70Sdholland 7601.105Swiz This command does not imply the tools command; run the 7611.105Swiz tools command first unless it is certain that the tools 7621.70Sdholland already exist and are up to date. 7631.70Sdholland 7641.70Sdholland This command will run ``make cleandir'' on the kernel in 7651.105Swiz question first unless the -u option is given. 7661.22Slukem 7671.105Swiz modules This command will build kernel modules and install them 7681.105Swiz into DESTDIR. 7691.86Sjnemeth 7701.105Swiz releasekernel=kconf 7711.70Sdholland Install a gzip(1)ed copy of the kernel previously built by 7721.105Swiz kernel=kconf into 7731.105Swiz RELEASEDIR/RELEASEMACHINEDIR/binary/kernel, usually as 7741.105Swiz netbsd-kconf.gz, although the ``netbsd'' prefix is 7751.105Swiz determined from the ``config'' directives in kconf. 7761.24Slukem 7771.105Swiz sets Perform ``make sets''. 7781.31Slukem 7791.105Swiz sourcesets Perform ``make sourcesets''. 7801.22Slukem 7811.105Swiz syspkgs Perform ``make syspkgs''. 7821.54Sapb 7831.105Swiz iso-image Perform ``make iso-image''. 7841.56Sapb 7851.105Swiz iso-image-source 7861.65Sjnemeth Perform ``make iso-image-source''. 7871.65Sjnemeth 7881.105Swiz install-image 7891.98Sapb Perform ``make install-image''. 7901.97Stsutsui 7911.105Swiz live-image Perform ``make live-image''. 7921.97Stsutsui 7931.105Swiz The following command line options alter the behaviour of the build.sh 7941.51Swiz operations described above: 7951.1Stv 7961.105Swiz -a arch Set the value of MACHINE_ARCH to arch. 7971.9Sthorpej 7981.105Swiz -B buildid 7991.105Swiz Set the value of BUILDID to buildid. This will also append the 8001.67Ssborrill build identifier to the name of the ``make'' wrapper script so 8011.37Slukem that the resulting name is of the form 8021.105Swiz ``nbmake-MACHINE-BUILDID''. 8031.1Stv 8041.105Swiz -C cdextras 8051.105Swiz Append cdextras to the CDEXTRA variable, which is a space- 8061.104Swiz separated list of files or directories that will be added to 8071.104Swiz the CD-ROM image that may be create by the ``iso-image'' or 8081.87Sapb ``iso-image-source'' operations. Files will be added to the 8091.87Sapb root of the CD-ROM image, whereas directories will be copied 8101.87Sapb recursively. If relative paths are specified, they will be 8111.87Sapb converted to absolute paths before being used. Multiple paths 8121.105Swiz may be specified via multiple -C options, or via a single 8131.87Sapb option whose argument contains multiple space-separated paths. 8141.66Sjnemeth 8151.105Swiz -D dest Set the value of DESTDIR to dest. If a relative path is 8161.104Swiz specified, it will be converted to an absolute path before 8171.104Swiz being used. 8181.104Swiz 8191.105Swiz -E Set `expert' mode. This overrides various sanity checks, and 8201.105Swiz allows: DESTDIR does not have to be set to a non-root path for 8211.105Swiz builds, and MKUNPRIVED=yes does not have to be set when 8221.104Swiz building as a non-root user. 8231.23Slukem 8241.105Swiz Note: It is highly recommended that you know what you are doing 8251.23Slukem when you use this option. 8261.19Slukem 8271.105Swiz -h Print a help message. 8281.51Swiz 8291.105Swiz -j njob Run up to njob make(1) subjobs in parallel; passed through to 8301.74Sapb make(1). If you see failures for reasons other than running 8311.105Swiz out of memory while using build.sh with -j, please save 8321.104Swiz complete build logs so the failures can be analyzed. 8331.74Sapb 8341.105Swiz To achieve the fastest builds, -j values between (1 + the 8351.104Swiz number of CPUs) and (2 * the number of CPUs) are recommended. 8361.104Swiz Use lower values on machines with limited memory or I/O 8371.104Swiz bandwidth. 8381.104Swiz 8391.105Swiz -M obj Set MAKEOBJDIRPREFIX to obj. Unsets MAKEOBJDIR. See ``-O 8401.105Swiz -obj'' for more information. 8411.104Swiz 8421.105Swiz For instance, if the source directory is /usr/src, a setting of 8431.105Swiz ``-M /usr/obj'' will place build-time files under 8441.105Swiz /usr/obj/usr/src/bin, /usr/obj/usr/src/lib, 8451.105Swiz /usr/obj/usr/src/usr.bin, and so forth. 8461.88Sapb 8471.73Sapb If a relative path is specified, it will be converted to an 8481.105Swiz absolute path before being used. build.sh imposes the 8491.105Swiz restriction that the argument to the -M option must not begin 8501.104Swiz with a ``$'' (dollar sign) character; otherwise it would be too 8511.104Swiz difficult to determine whether the value is an absolute or a 8521.104Swiz relative path. If the directory does not already exist, 8531.105Swiz build.sh will create it. 8541.18Slukem 8551.105Swiz -m mach Set the value of MACHINE to mach, except in some special cases 8561.60Sapb listed below. This will also override any value of 8571.105Swiz MACHINE_ARCH in the process environment with a value deduced 8581.105Swiz from mach, unless -a is specified. All cross builds require 8591.105Swiz -m, but if unset on a NetBSD host, the host's value of MACHINE 8601.60Sapb will be detected and used automatically. 8611.60Sapb 8621.105Swiz Some machines support multiple values for MACHINE_ARCH. The 8631.105Swiz following special cases for the mach argument are defined to 8641.105Swiz set the listed values of MACHINE and MACHINE_ARCH: 8651.33Slukem 8661.105Swiz mach MACHINE MACHINE_ARCH 8671.60Sapb evbarm evbarm (not set) 8681.60Sapb evbarm-eb evbarm armeb 8691.60Sapb evbarm-el evbarm arm 8701.33Slukem evbmips evbmips (not set) 8711.33Slukem evbmips-eb evbmips mipseb 8721.33Slukem evbmips-el evbmips mipsel 8731.33Slukem evbsh3 evbsh3 (not set) 8741.33Slukem evbsh3-eb evbsh3 sh3eb 8751.33Slukem evbsh3-el evbsh3 sh3el 8761.33Slukem sbmips sbmips (not set) 8771.33Slukem sbmips-eb sbmips mipseb 8781.33Slukem sbmips-el sbmips mipsel 8791.1Stv 8801.105Swiz -N noiselevel 8811.46Slukem Set the ``noisyness'' level of the build, by setting 8821.105Swiz MAKEVERBOSE to noiselevel. 8831.45Slukem 8841.105Swiz -n Show the commands that would be executed by build.sh, but do 8851.1Stv not make any changes. This is similar in concept to ``make 8861.1Stv -n''. 8871.1Stv 8881.105Swiz -O obj Create an appropriate transform macro for MAKEOBJDIR that will 8891.105Swiz place the built object files under obj. Unsets 8901.105Swiz MAKEOBJDIRPREFIX. 8911.88Sapb 8921.105Swiz For instance, a setting of ``-O /usr/obj'' will place build- 8931.105Swiz time files under /usr/obj/bin, /usr/obj/lib, /usr/obj/usr.bin, 8941.88Sapb and so forth. 8951.88Sapb 8961.88Sapb If a relative path is specified, it will be converted to an 8971.105Swiz absolute path before being used. build.sh imposes the 8981.105Swiz restriction that the argument to the -O option must not contain 8991.104Swiz a ``$'' (dollar sign) character. If the directory does not 9001.105Swiz already exist, build.sh will create it. 9011.73Sapb 9021.105Swiz In normal use, exactly one of the -M or -O options should be 9031.105Swiz specified. If neither -M nor -O is specified, then a default 9041.78Sapb object directory will be chosen according to rules in 9051.78Sapb <bsd.obj.mk>. Relying on this default is not recommended 9061.78Sapb because it is determined by complex rules that are influenced 9071.78Sapb by the values of several variables and by the location of the 9081.78Sapb source directory. 9091.18Slukem 9101.105Swiz -o Set the value of MKOBJDIRS to ``no''. Otherwise, it will be 9111.70Sdholland automatically set to ``yes''. This default is opposite to the 9121.105Swiz behaviour when not using build.sh. 9131.1Stv 9141.105Swiz -R rel Set the value of RELEASEDIR to rel. If a relative path is 9151.59Sapb specified, it will be converted to an absolute path before 9161.59Sapb being used. 9171.18Slukem 9181.105Swiz -r Remove the contents of DESTDIR and TOOLDIR before building 9191.1Stv (provides a clean starting point). This will skip deleting 9201.105Swiz DESTDIR if building on a native system to the root directory. 9211.1Stv 9221.105Swiz -S seed Change the value of BUILDSEED to seed. This should rarely be 9231.72Sperry necessary. 9241.72Sperry 9251.105Swiz -T tools Set the value of TOOLDIR to tools. If a relative path is 9261.104Swiz specified, it will be converted to an absolute path before 9271.104Swiz being used. If set, the bootstrap ``make'' will only be 9281.104Swiz rebuilt if the source files for make(1) have changed. 9291.104Swiz 9301.105Swiz -U Set MKUNPRIVED=yes. 9311.104Swiz 9321.105Swiz -u Set MKUPDATE=yes. 9331.104Swiz 9341.105Swiz -V var=[value] 9351.105Swiz Set the environment variable var to an optional value. This is 9361.105Swiz propagated to the nbmake wrapper. 9371.105Swiz 9381.105Swiz -w wrapper 9391.105Swiz Create the nbmake wrapper script (see below) in a custom 9401.105Swiz location, specified by wrapper. This allows, for instance, to 9411.105Swiz place the wrapper in PATH automatically. Note that wrapper is 9421.59Sapb the full name of the file, not just a directory name. If a 9431.59Sapb relative path is specified, it will be converted to an absolute 9441.59Sapb path before being used. 9451.1Stv 9461.105Swiz -X x11src 9471.105Swiz Set the value of X11SRCDIR to x11src. If a relative path is 9481.59Sapb specified, it will be converted to an absolute path before 9491.59Sapb being used. 9501.49Slukem 9511.105Swiz -x Set MKX11=yes. 9521.49Slukem 9531.105Swiz -Z var Unset ("zap") the environment variable var. This is propagated 9541.105Swiz to the nbmake wrapper. 9551.40Slukem 9561.105Swiz The "nbmake-MACHINE" wrapper script 9571.105Swiz If using the build.sh script to build NetBSD, a nbmake-MACHINE script 9581.105Swiz will be created in TOOLDIR/bin upon the first build to assist in building 9591.1Stv subtrees on a cross-compile host. 9601.1Stv 9611.105Swiz nbmake-MACHINE can be invoked in lieu of make(1), and will instead call 9621.105Swiz the up-to-date version of ``nbmake'' installed into TOOLDIR/bin with 9631.105Swiz several key variables pre-set, including MACHINE, MACHINE_ARCH, and 9641.105Swiz TOOLDIR. nbmake-MACHINE will also set variables specified with -V, and 9651.105Swiz unset variables specified with -Z. 9661.40Slukem 9671.105Swiz This script can be symlinked into a directory listed in PATH, or called 9681.1Stv with an absolute path. 9691.1Stv 9701.105SwizEXAMPLES 9711.78Sapb 1. % ./build.sh [options] tools kernel=GENERIC 9721.28Slukem 9731.28Slukem Build a new toolchain, and use the new toolchain to configure and 9741.28Slukem build a new GENERIC kernel. 9751.28Slukem 9761.78Sapb 2. % ./build.sh [options] -U distribution 9771.28Slukem 9781.105Swiz Using unprivileged mode, build a complete distribution to a DESTDIR 9791.105Swiz directory that build.sh selects (and will display). 9801.28Slukem 9811.78Sapb 3. # ./build.sh [options] -U install=/ 9821.28Slukem 9831.105Swiz As root, install to / the distribution that was built by example 2. 9841.105Swiz Even though this is run as root, -U is required so that the 9851.105Swiz permissions stored in DESTDIR/METALOG are correctly applied to the 9861.105Swiz files as they're copied to /. 9871.28Slukem 9881.78Sapb 4. % ./build.sh [options] -U -u release 9891.28Slukem 9901.105Swiz Using unprivileged mode, build a complete release to DESTDIR and 9911.105Swiz RELEASEDIR directories that build.sh selects (and will display). 9921.105Swiz MKUPDATE=yes (-u) is set to prevent the ``make cleandir'', so that 9931.38Slukem if this is run after example 2, it doesn't need to redo that portion 9941.38Slukem of the release build. 9951.16Slukem 9961.105SwizOBSOLETE VARIABLES 9971.105Swiz NBUILDJOBS Use the make(1) option -j instead. 9981.15Slukem 9991.105Swiz USE_NEW_TOOLCHAIN 10001.15Slukem The new toolchain is now the default. To disable, use 10011.105Swiz TOOLCHAIN_MISSING=yes. 10021.10Ssommerfe 10031.105SwizSEE ALSO 10041.62Sapb make(1), hier(7), release(7), etcupdate(8), postinstall(8), sysinst(8), 10051.105Swiz pkgsrc/sysutils/cdrtools 10061.1Stv 10071.105SwizHISTORY 10081.105Swiz The build.sh based build scheme was introduced for NetBSD 1.6 as 10091.105Swiz USE_NEW_TOOLCHAIN, and re-worked to TOOLCHAIN_MISSING after that. 10101.1Stv 10111.104SwizNetBSD November 8, 2012 NetBSD 1012