BUILDING revision 1.100
11.100SwizBUILDING(8) System Manager's Manual BUILDING(8) 21.1Stv 31.100SwizNNAAMMEE 41.100Swiz BBUUIILLDDIINNGG -- Procedure for building NetBSD from source code. 51.1Stv 61.100SwizRREEQQUUIIRREEMMEENNTTSS 71.1Stv NetBSD is designed to be buildable on most POSIX-compliant host systems. 81.100Swiz The basic build procedure is the same whether compiling _n_a_t_i_v_e_l_y (on the 91.100Swiz same NetBSD architecture) or _c_r_o_s_s _c_o_m_p_i_l_i_n_g (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.100Swiz toolchain (mmaakkee 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.100SwizFFIILLEESS 201.100Swiz SSoouurrccee ttrreeee llaayyoouutt 211.100Swiz ddoocc//BBUUIILLDDIINNGG..mmddoocc 221.17Swiz This document (in -mdoc troff format; the original copy). 231.1Stv 241.100Swiz BBUUIILLDDIINNGG This document (in plaintext). 251.1Stv 261.100Swiz ttoooollss//ccoommppaatt//RREEAADDMMEE 271.48Sjmc Special notes for cross-hosting a NetBSD build on non- 281.48Sjmc NetBSD platforms. 291.48Sjmc 301.100Swiz MMaakkeeffiillee 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.100Swiz on a non-native host, see the bbuuiilldd..sshh shell script.) 341.1Stv 351.100Swiz UUPPDDAATTIINNGG 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.100Swiz bbuuiilldd..sshh 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.100Swiz ccrryyppttoo//ddiisstt//, ddiisstt//, ggnnuu//ddiisstt// 461.100Swiz Sources imported verbatim from third parties, without 471.100Swiz mangling the existing build structure. Other source trees 481.100Swiz in bbiinn through uussrr..ssbbiinn use the NetBSD make(1) 491.100Swiz ``reachover'' Makefile semantics when building these 501.100Swiz programs for a native host. 511.100Swiz 521.100Swiz ddiissttrriibb//, eettcc// 531.100Swiz Sources for items used when making a full release 541.100Swiz snapshot, such as files installed in DDEESSTTDDIIRR_/_e_t_c on the 551.100Swiz destination system, boot media, and release notes. 561.1Stv 571.100Swiz tteessttss//, rreeggrreessss// 581.70Sdholland Regression test harness. Can be cross-compiled, but only 591.100Swiz run natively. _t_e_s_t_s_/ uses the atf(7) test framework; 601.100Swiz _r_e_g_r_e_s_s_/ contains older tests that have not yet been 611.70Sdholland migrated to atf(7). 621.1Stv 631.100Swiz ssyyss// NetBSD kernel sources. 641.1Stv 651.100Swiz ttoooollss// ``Reachover'' build structure for the host build tools. 661.100Swiz This has a special method of determining out-of-date 671.100Swiz status. 681.1Stv 691.100Swiz bbiinn// ...... uussrr..ssbbiinn// 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.100Swiz xx1111// ``Reachover'' build structure for X11R6; the source is in 751.100Swiz XX1111SSRRCCDDIIRR. 761.49Slukem 771.100Swiz BBuuiilldd ttrreeee llaayyoouutt 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.100SwizCCOONNFFIIGGUURRAATTIIOONN 821.100Swiz EEnnvviirroonnmmeenntt vvaarriiaabblleess 831.8Slukem Several environment variables control the behaviour of NetBSD builds. 841.8Slukem 851.100Swiz HHOOSSTT__SSHH 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.100Swiz functions (which is a widely-implemented but non- 911.100Swiz standardised feature). 921.96Sapb 931.96Sapb Depending on the host system, a suitable shell may be 941.100Swiz _/_b_i_n_/_s_h, _/_u_s_r_/_x_p_g_4_/_b_i_n_/_s_h, _/_b_i_n_/_k_s_h (provided it is a 951.96Sapb variant of ksh that supports the ``local'' keyword, 961.100Swiz such as ksh88, but not ksh93), or _/_u_s_r_/_l_o_c_a_l_/_b_i_n_/_b_a_s_h. 971.96Sapb 981.100Swiz Most parts of the build require HHOOSSTT__SSHH to be an 991.100Swiz absolute path; however, bbuuiilldd..sshh allows it to be a 1001.100Swiz simple command name, which will be converted to an 1011.100Swiz absolute path by searching the PPAATTHH. 1021.58Sapb 1031.100Swiz HHOOSSTT__CCCC Path name to C compiler used to create the toolchain. 1041.53Sreed 1051.100Swiz HHOOSSTT__CCXXXX Path name to C++ compiler used to create the toolchain. 1061.53Sreed 1071.100Swiz MMAACCHHIINNEE Machine type, e.g., ``macppc''. 1081.8Slukem 1091.100Swiz MMAACCHHIINNEE__AARRCCHH Machine architecture, e.g., ``powerpc''. 1101.8Slukem 1111.100Swiz MMAAKKEE Path name to invoke make(1) as. 1121.8Slukem 1131.100Swiz MMAAKKEEFFLLAAGGSS Flags to invoke make(1) with. Note that bbuuiilldd..sshh 1141.100Swiz ignores the value of MMAAKKEEFFLLAAGGSS passed in the 1151.100Swiz environment, but allows MMAAKKEEFFLLAAGGSS to be set via the --VV 1161.100Swiz option. 1171.8Slukem 1181.100Swiz MMAAKKEEOOBBJJDDIIRR Directory to use as the ..OOBBJJDDIIRR for the current 1191.100Swiz directory. The value is subjected to variable 1201.100Swiz expansion by make(1). Typical usage is to set this 1211.100Swiz variable to a value involving the use of 1221.100Swiz `${.CURDIR:S...}' or `${.CURDIR:C...}', to derive the 1231.100Swiz value of ..OOBBJJDDIIRR from the value of ..CCUURRDDIIRR. Used only 1241.100Swiz if MMAAKKEEOOBBJJDDIIRRPPRREEFFIIXX is not defined. MMAAKKEEOOBBJJDDIIRR can be 1251.100Swiz provided only in the environment or via the --OO flag of 1261.100Swiz bbuuiilldd..sshh; it cannot usefully be set inside a Makefile, 1271.100Swiz including _m_k_._c_o_n_f or $${{MMAAKKEECCOONNFF}}. 1281.8Slukem 1291.100Swiz MMAAKKEEOOBBJJDDIIRRPPRREEFFIIXX Top level directory of the object directory tree. The 1301.88Sapb value is subjected to variable expansion by make(1). 1311.100Swiz bbuuiilldd..sshh will create the ${MAKEOBJDIRPREFIX} directory 1321.100Swiz if necessary, but if make(1) is used without bbuuiilldd..sshh, 1331.88Sapb then rules in <bsd.obj.mk> will abort the build if the 1341.88Sapb ${MAKEOBJDIRPREFIX} directory does not exist. If the 1351.100Swiz value is defined and valid, then 1361.100Swiz ${MAKEOBJDIRPREFIX}/${.CURDIR} is used as the ..OOBBJJDDIIRR 1371.100Swiz for the current directory. The current directory may 1381.100Swiz be read only. MMAAKKEEOOBBJJDDIIRRPPRREEFFIIXX can be provided only in 1391.100Swiz the environment or via the --MM flag of bbuuiilldd..sshh; it 1401.100Swiz cannot usefully be set inside a Makefile, including 1411.100Swiz _m_k_._c_o_n_f or $${{MMAAKKEECCOONNFF}}. 1421.100Swiz 1431.100Swiz ""mmaakkee"" vvaarriiaabblleess 1441.100Swiz Several variables control the behavior of NetBSD builds. Unless 1451.100Swiz otherwise specified, these variables may be set in either the process 1461.100Swiz environment or the make(1) configuration file specified by MMAAKKEECCOONNFF. 1471.1Stv 1481.100Swiz BBUUIILLDDIIDD Identifier for the build. The identifier will be appended to 1491.9Sthorpej object directory names, and can be consulted in the make(1) 1501.100Swiz configuration file in order to set additional build 1511.100Swiz parameters, such as compiler flags. 1521.9Sthorpej 1531.100Swiz BBUUIILLDDSSEEEEDD GCC uses random numbers when compiling C++ code. This 1541.100Swiz variable seeds the gcc random number generator using the 1551.100Swiz -frandom-seed flag with this value. By default, it is set to 1561.100Swiz NetBSD-(majorversion). Using a fixed value causes C++ 1571.100Swiz binaries to be the same when built from the same sources, 1581.100Swiz resulting in identical (reproducible) builds. Additional 1591.100Swiz information is available in the GCC documentation of 1601.100Swiz -frandom-seed. 1611.100Swiz 1621.100Swiz DDEESSTTDDIIRR Directory to contain the built NetBSD system. If set, 1631.100Swiz special options are passed to the compilation tools to 1641.100Swiz prevent their default use of the host system's //uussrr//iinncclluuddee, 1651.100Swiz //uussrr//lliibb, and so forth. This pathname must be an absolute 1661.100Swiz path, and should _n_o_t end with a slash (/) character. (For 1671.100Swiz installation into the system's root directory, set DDEESSTTDDIIRR 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.100Swiz _D_e_f_a_u_l_t: Empty string if UUSSEETTOOOOLLSS is ``yes''; unset 1721.100Swiz otherwise. 1731.1Stv 1741.100Swiz _N_o_t_e: bbuuiilldd..sshh will provide a default of _d_e_s_t_d_i_r_.MMAACCHHIINNEE (in 1751.100Swiz the top-level ..OOBBJJDDIIRR) unless run in `expert' mode. 1761.30Slukem 1771.100Swiz MMAAKKEECCOONNFF The name of the make(1) configuration file. _O_n_l_y _s_e_t_t_a_b_l_e _i_n 1781.100Swiz _t_h_e _p_r_o_c_e_s_s _e_n_v_i_r_o_n_m_e_n_t_. 1791.1Stv 1801.100Swiz _D_e_f_a_u_l_t: ``/etc/mk.conf'' 1811.1Stv 1821.100Swiz MMAAKKEEVVEERRBBOOSSEE 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.100Swiz but the actual commands executed by make(1) are not 1901.100Swiz 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.100Swiz are traced through use of the sh(1) ``--xx'' flag. 2031.45Slukem 2041.100Swiz _D_e_f_a_u_l_t: 2 2051.45Slukem 2061.100Swiz MMKKCCAATTPPAAGGEESS Can be set to ``yes'' or ``no''. Indicates whether 2071.100Swiz preformatted plaintext manual pages will be created during a 2081.100Swiz build. 2091.1Stv 2101.100Swiz _D_e_f_a_u_l_t: ``yes'' 2111.1Stv 2121.100Swiz MMKKCCRRYYPPTTOO Can be set to ``yes'' or ``no''. Indicates whether 2131.100Swiz cryptographic code will be included in a build; provided for 2141.100Swiz the benefit of countries that do not allow strong 2151.100Swiz cryptography. Will not affect use of the standard low- 2161.100Swiz security password encryption system, crypt(3). 2171.1Stv 2181.100Swiz _D_e_f_a_u_l_t: ``yes'' 2191.1Stv 2201.100Swiz MMKKDDOOCC Can be set to ``yes'' or ``no''. Indicates whether system 2211.100Swiz documentation destined for DDEESSTTDDIIRR_/_u_s_r_/_s_h_a_r_e_/_d_o_c will be 2221.44Slukem installed during a build. 2231.1Stv 2241.100Swiz _D_e_f_a_u_l_t: ``yes'' 2251.1Stv 2261.100Swiz MMKKHHTTMMLL Can be set to ``yes'' or ``no''. Indicates whether 2271.100Swiz preformatted HTML manual pages will be built and installed 2281.77Slukem 2291.100Swiz _D_e_f_a_u_l_t: ``yes'' 2301.77Slukem 2311.100Swiz MMKKHHOOSSTTOOBBJJ 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.100Swiz _D_e_f_a_u_l_t: ``no'' 2411.4Stv 2421.100Swiz MMKKIINNFFOO 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.100Swiz _D_e_f_a_u_l_t: ``yes'' 2471.1Stv 2481.100Swiz MMKKKKMMOODD Can be set to ``yes'' or ``no''. Indicates whether kernel 2491.95Sapb modules are built and installed. 2501.95Sapb 2511.100Swiz _D_e_f_a_u_l_t: ``yes'' 2521.95Sapb 2531.100Swiz MMKKLLIINNTT 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.100Swiz DDEESSTTDDIIRR_/_u_s_r_/_l_i_b_d_a_t_a_/_l_i_n_t. 2571.1Stv 2581.100Swiz _D_e_f_a_u_l_t: ``yes'' 2591.1Stv 2601.100Swiz MMKKMMAANN Can be set to ``yes'' or ``no''. Indicates whether manual 2611.1Stv pages will be installed during a build. 2621.1Stv 2631.100Swiz _D_e_f_a_u_l_t: ``yes'' 2641.1Stv 2651.100Swiz MMKKNNLLSS 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.100Swiz _D_e_f_a_u_l_t: ``yes'' 2701.1Stv 2711.100Swiz MMKKOOBBJJ 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.100Swiz _D_e_f_a_u_l_t: ``yes'' 2771.1Stv 2781.100Swiz Note that setting MMKKOOBBJJ to ``no'' is not recommended and may 2791.70Sdholland cause problems when updating the tree with cvs(1). 2801.70Sdholland 2811.100Swiz MMKKPPIICC 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.100Swiz _D_e_f_a_u_l_t: Platform dependent. As of this writing, all 2871.100Swiz platforms except sshh33 default to ``yes''. 2881.1Stv 2891.100Swiz MMKKPPIICCIINNSSTTAALLLL 2901.1Stv Can be set to ``yes'' or ``no''. Indicates whether the ar(1) 2911.100Swiz format libraries (lliibb**__ppiicc..aa), used to generate shared 2921.44Slukem libraries, are installed during a build. 2931.1Stv 2941.100Swiz _D_e_f_a_u_l_t: ``yes'' 2951.1Stv 2961.100Swiz MMKKPPRROOFFIILLEE Can be set to ``yes'' or ``no''. Indicates whether profiled 2971.100Swiz libraries (lliibb**__pp..aa) will be built and installed during a 2981.1Stv build. 2991.1Stv 3001.100Swiz _D_e_f_a_u_l_t: ``yes''; however, some platforms turn off MMKKPPRROOFFIILLEE 3011.1Stv by default at times due to toolchain problems with profiled 3021.1Stv code. 3031.1Stv 3041.100Swiz MMKKRREEPPRROO 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.100Swiz _D_e_f_a_u_l_t: ``no'' 3091.100Swiz 3101.100Swiz MMKKSSHHAARREE Can be set to ``yes'' or ``no''. Indicates whether files 3111.100Swiz destined to reside in DDEESSTTDDIIRR_/_u_s_r_/_s_h_a_r_e will be built and 3121.44Slukem installed during a build. If set to ``no'', then all of 3131.100Swiz MMKKCCAATTPPAAGGEESS, MMKKDDOOCC, MMKKIINNFFOO, MMKKMMAANN, and MMKKNNLLSS will be set to 3141.27Slukem ``no'' unconditionally. 3151.1Stv 3161.100Swiz _D_e_f_a_u_l_t: ``yes'' 3171.1Stv 3181.100Swiz MMKKSSTTRRIIPPIIDDEENNTT 3191.78Sapb Can be set to ``yes'' or ``no''. Indicates whether program 3201.78Sapb binaries and shared libraries should be built to include RCS 3211.78Sapb IDs for use with ident(1). 3221.78Sapb 3231.100Swiz _D_e_f_a_u_l_t: ``no'' 3241.78Sapb 3251.100Swiz MMKKUUNNPPRRIIVVEEDD Can be set to ``yes'' or ``no''. Indicates whether an 3261.100Swiz unprivileged install will occur. The user, group, 3271.100Swiz permissions, and file flags, will not be set on the installed 3281.52Sjmc items; instead the information will be appended to a file 3291.100Swiz called _M_E_T_A_L_O_G in DDEESSTTDDIIRR. The contents of _M_E_T_A_L_O_G 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.100Swiz _D_e_f_a_u_l_t: ``no'' 3341.38Slukem 3351.100Swiz MMKKUUPPDDAATTEE Can be set to ``yes'' or ``no''. Indicates whether all 3361.100Swiz install operations intended to write to DDEESSTTDDIIRR 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.100Swiz _D_e_f_a_u_l_t: ``no'' 3421.38Slukem 3431.100Swiz MMKKXX1111 Can be set to ``yes'' or ``no''. Indicates whether X11 is 3441.100Swiz built from XX1111SSRRCCDDIIRR. 3451.49Slukem 3461.100Swiz _D_e_f_a_u_l_t: ``no'' 3471.49Slukem 3481.100Swiz TTOOOOLLDDIIRR Directory to hold the host tools, once built. If specified, 3491.59Sapb must be an absolute path. This directory should be unique to 3501.100Swiz a given host system and NetBSD source tree. (However, 3511.100Swiz multiple targets may share the same TTOOOOLLDDIIRR; the target- 3521.100Swiz dependent files have unique names.) If unset, a default 3531.100Swiz based on the uname(1) information of the host platform will 3541.100Swiz be created in the ..OOBBJJDDIIRR of _s_r_c. 3551.1Stv 3561.100Swiz _D_e_f_a_u_l_t: Unset. 3571.1Stv 3581.100Swiz UUSSEETTOOOOLLSS Indicates whether the tools specified by TTOOOOLLDDIIRR 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.100Swiz yyeess Use the tools from TTOOOOLLDDIIRR. 3631.1Stv 3641.100Swiz nnoo Do not use the tools from TTOOOOLLDDIIRR, but refuse to build 3651.1Stv native compilation tool components that are version- 3661.1Stv specific for that tool. 3671.1Stv 3681.100Swiz nneevveerr Do not use the tools from TTOOOOLLDDIIRR, even when building 3691.100Swiz native tool components. This is similar to the 3701.100Swiz traditional NetBSD build method, but does _n_o_t verify 3711.100Swiz that the compilation tools in use are up-to-date 3721.100Swiz enough in order to build the tree successfully. This 3731.100Swiz may cause build or runtime problems when building the 3741.100Swiz whole NetBSD source tree. 3751.1Stv 3761.100Swiz _D_e_f_a_u_l_t: ``yes'', unless TTOOOOLLCCHHAAIINN__MMIISSSSIINNGG is set to ``yes''. 3771.71Sdholland 3781.100Swiz UUSSEETTOOOOLLSS is also set to ``no'' when using <bsd.*.mk> outside 3791.71Sdholland the NetBSD source tree. 3801.1Stv 3811.100Swiz XX1111SSRRCCDDIIRR Directory containing the X11R6 source. If specified, must be 3821.59Sapb an absolute path. The main X11R6 source is found in 3831.100Swiz XX1111SSRRCCDDIIRR_/_x_f_r_e_e_/_x_c. 3841.49Slukem 3851.100Swiz _D_e_f_a_u_l_t: NNEETTBBSSDDRRCCDDIIRR_/_._._/_x_s_r_c, if that exists; otherwise 3861.100Swiz _/_u_s_r_/_x_s_r_c. 3871.49Slukem 3881.100Swiz XX1111FFLLAAVVOOUURR The style of X11 cross-built, set to either ``Xorg'' or 3891.79Smrg ``XFree86''. 3901.79Smrg 3911.100Swiz _D_e_f_a_u_l_t: ``Xorg'' on amd64, i386, macppc, shark and sparc64 3921.81Smrg platforms, ``XFree86'' on everything else. 3931.79Smrg 3941.100Swiz ""mmaakkee"" vvaarriiaabblleess ffoorr ffuullll bbuuiillddss 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.100Swiz IINNSSTTAALLLLWWOORRLLDDDDIIRR Location for the ``make installworld'' target to install 3991.59Sapb to. If specified, must be an absolute path. 4001.1Stv 4011.100Swiz _D_e_f_a_u_l_t: ``/'' 4021.1Stv 4031.100Swiz MMKKOOBBJJDDIIRRSS 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.100Swiz _D_e_f_a_u_l_t: ``no'' 4081.1Stv 4091.100Swiz If using bbuuiilldd..sshh, the default is ``yes''. This may be 4101.100Swiz set back to ``no'' by giving bbuuiilldd..sshh the --oo option. 4111.70Sdholland 4121.100Swiz MMKKUUPPDDAATTEE Can be set to ``yes'' or ``no''. If set, then in 4131.100Swiz addition to the effects described for MMKKUUPPDDAATTEE==yyeess 4141.100Swiz above, this implies the effects of NNOOCCLLEEAANNDDIIRR (i.e., 4151.100Swiz ``make cleandir'' is avoided). 4161.38Slukem 4171.100Swiz _D_e_f_a_u_l_t: ``no'' 4181.38Slukem 4191.100Swiz If using bbuuiilldd..sshh, this may be set by giving the --uu 4201.70Sdholland option. 4211.70Sdholland 4221.100Swiz NNBBUUIILLDDJJOOBBSS Now obsolete. Use the make(1) option --jj, instead. See 4231.70Sdholland below. 4241.1Stv 4251.100Swiz _D_e_f_a_u_l_t: Unset. 4261.1Stv 4271.100Swiz NNOOCCLLEEAANNDDIIRR 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.100Swiz _D_e_f_a_u_l_t: Unset. 4331.1Stv 4341.100Swiz See also MMKKUUPPDDAATTEE. 4351.70Sdholland 4361.100Swiz NNOODDIISSTTRRIIBBDDIIRRSS If set, avoids the ``make distrib-dirs'' phase of a full 4371.100Swiz build. This skips running mtree(8) on DDEESSTTDDIIRR, 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.100Swiz _D_e_f_a_u_l_t: Unset. 4431.1Stv 4441.100Swiz NNOOIINNCCLLUUDDEESS 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.100Swiz MMKKUUPPDDAATTEE==yyeess instead in that case. 4511.1Stv 4521.100Swiz _D_e_f_a_u_l_t: Unset. 4531.1Stv 4541.100Swiz RREELLEEAASSEEDDIIRR 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.100Swiz _D_e_f_a_u_l_t: Unset. 4591.20Slukem 4601.100Swiz _N_o_t_e: bbuuiilldd..sshh will provide a default of _r_e_l_e_a_s_e_d_i_r (in 4611.100Swiz the top-level ..OOBBJJDDIIRR) unless run in `expert' mode. 4621.30Slukem 4631.100SwizBBUUIILLDDIINNGG 4641.100Swiz ""mmaakkee"" ccoommmmaanndd lliinnee ooppttiioonnss 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.100Swiz --jj _n_j_o_b Run up to _n_j_o_b 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.100Swiz --mm _d_i_r Specify the default directory for searching for system 4731.100Swiz Makefile segments, mainly the <bsd.*.mk> files. When building 4741.100Swiz any full NetBSD source tree, this should be set to the 4751.100Swiz ``share/mk'' directory in the source tree. This is set 4761.100Swiz automatically when building from the top level, or when using 4771.100Swiz bbuuiilldd..sshh. 4781.1Stv 4791.100Swiz --nn 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.100Swiz --VV _v_a_r Print make(1)'s idea of the value of _v_a_r. Does not build any 4841.1Stv targets. 4851.1Stv 4861.100Swiz _v_a_r_=_v_a_l_u_e Set the variable _v_a_r to _v_a_l_u_e, overriding any setting 4871.100Swiz specified by the process environment, the MMAAKKEECCOONNFF 4881.100Swiz configuration file, or the system Makefile segments. 4891.1Stv 4901.100Swiz ""mmaakkee"" ttaarrggeettss 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.100Swiz aallll Build programs, libraries, and preformatted documentation. 4971.1Stv 4981.100Swiz cclleeaann Remove program and library object code files. 4991.1Stv 5001.100Swiz cclleeaannddiirr Same as cclleeaann, 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.100Swiz ddeeppeenndd Create dependency files (..ddeeppeenndd) 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.100Swiz ddeeppeennddaallll 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.100Swiz ddiissttcclleeaann Synonym for cclleeaannddiirr. 5141.49Slukem 5151.100Swiz iinncclluuddeess Build and install system header files. Typically needed 5161.44Slukem before any system libraries or programs can be built. 5171.1Stv 5181.100Swiz iinnssttaallll Install programs, libraries, and documentation into DDEESSTTDDIIRR. 5191.100Swiz Few files will be installed to DDEESSTTDDIIRR_/_d_e_v, DDEESSTTDDIIRR_/_e_t_c, 5201.100Swiz DDEESSTTDDIIRR_/_r_o_o_t or DDEESSTTDDIIRR_/_v_a_r in order to prevent user supplied 5211.27Slukem configuration data from being overwritten. 5221.1Stv 5231.100Swiz lliinntt Run lint(1) against the C source code, where appropriate, and 5241.1Stv generate system-installed lint libraries. 5251.1Stv 5261.100Swiz oobbjj Create object directories to be used for built files, instead 5271.1Stv of building directly in the source tree. 5281.1Stv 5291.100Swiz ttaaggss Create ctags(1) searchable function lists usable by the ex(1) 5301.1Stv and vi(1) text editors. 5311.1Stv 5321.100Swiz ""mmaakkee"" ttaarrggeettss ffoorr tthhee ttoopp lleevveell 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.100Swiz bbuuiilldd 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.100Swiz ddiissttrriibbuuttiioonn Do a ``make build'', and then install a full distribution 5411.100Swiz (which does not include a kernel) into DDEESSTTDDIIRR, including 5421.100Swiz files in DDEESSTTDDIIRR_/_d_e_v, DDEESSTTDDIIRR_/_e_t_c, DDEESSTTDDIIRR_/_r_o_o_t and 5431.100Swiz DDEESSTTDDIIRR_/_v_a_r. 5441.20Slukem 5451.100Swiz bbuuiillddwwoorrlldd As per ``make distribution'', except that it ensures that 5461.100Swiz DDEESSTTDDIIRR is not the root directory. 5471.20Slukem 5481.100Swiz iinnssttaallllwwoorrlldd Install the distribution from DDEESSTTDDIIRR to IINNSSTTAALLLLWWOORRLLDDDDIIRR, 5491.70Sdholland which defaults to the root directory. Ensures that 5501.100Swiz IINNSSTTAALLLLWWOORRLLDDDDIIRR is not the root directory if cross 5511.100Swiz compiling. 5521.20Slukem 5531.100Swiz The IINNSSTTAALLLLSSEETTSS 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.100Swiz installed, so most files in IINNSSTTAALLLLWWOORRLLDDDDIIRR_/_e_t_c will not be 5571.95Sapb installed or modified. 5581.61Sapb 5591.100Swiz _N_o_t_e: Before performing this operation with 5601.100Swiz IINNSSTTAALLLLWWOORRLLDDDDIIRR=_/, 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.100Swiz update files in IINNSSTTAALLLLWWOORRLLDDDDIIRR_/_e_t_c and that you use 5641.61Sapb postinstall(8) to check for inconsistencies (and possibly 5651.61Sapb to fix them). 5661.20Slukem 5671.100Swiz sseettss Create distribution sets from DDEESSTTDDIIRR into 5681.100Swiz RREELLEEAASSEEDDIIRR//RREELLEEAASSEEMMAACCHHIINNEEDDIIRR_/_b_i_n_a_r_y_/_s_e_t_s. Should be run 5691.70Sdholland after ``make distribution'', as ``make build'' alone does 5701.70Sdholland not install all of the required files. 5711.25Slukem 5721.100Swiz ssoouurrcceesseettss Create source sets of the source tree into 5731.100Swiz RREELLEEAASSEEDDIIRR_/_s_o_u_r_c_e_/_s_e_t_s. 5741.31Slukem 5751.100Swiz ssyyssppkkggss Create syspkgs from DDEESSTTDDIIRR into 5761.100Swiz RREELLEEAASSEEDDIIRR//RREELLEEAASSEEMMAACCHHIINNEEDDIIRR_/_b_i_n_a_r_y_/_s_y_s_p_k_g_s. Should be run 5771.70Sdholland after ``make distribution'', as ``make build'' alone does 5781.70Sdholland not install all of the required files. 5791.54Sapb 5801.100Swiz rreelleeaassee Do a ``make distribution'', build kernels, distribution 5811.44Slukem media, and install sets (this as per ``make sets''), and 5821.44Slukem then package the system into a standard release layout as 5831.100Swiz described by release(7). This requires that RREELLEEAASSEEDDIIRR be 5841.25Slukem set (see above). 5851.1Stv 5861.100Swiz iissoo--iimmaaggee Create a NetBSD installation CD-ROM image in the 5871.100Swiz RREELLEEAASSEEDDIIRR_/_i_s_o directory. The CD-ROM file system will have 5881.62Sapb a layout as described in release(7). 5891.62Sapb 5901.62Sapb For most machine types, the CD-ROM will be bootable, and 5911.100Swiz will automatically run the sysinst(8) menu-based 5921.100Swiz installation program, which can be used to install or 5931.100Swiz upgrade a NetBSD system. Bootable CD-ROMs also contain 5941.100Swiz tools that may be useful in repairing a damaged NetBSD 5951.100Swiz installation. 5961.62Sapb 5971.62Sapb Before ``make iso-image'' is attempted, RELEASEDIR must be 5981.62Sapb populated by ``make release'' or equivalent. 5991.62Sapb 6001.62Sapb Note that other, smaller, CD-ROM images may be created in 6011.100Swiz the RREELLEEAASSEEDDIIRR//RREELLEEAASSEEMMAACCHHIINNEEDDIIRR_/_i_n_s_t_a_l_l_a_t_i_o_n_/_c_d_r_o_m 6021.100Swiz directory by ``make release''. These smaller images 6031.100Swiz usually contain the same tools as the larger images in 6041.100Swiz RREELLEEAASSEEDDIIRR_/_i_s_o, but do not contain additional content such 6051.69Slukem as the distribution sets. 6061.62Sapb 6071.62Sapb Note that the mac68k port still uses an older method of 6081.100Swiz creating CD-ROM images. This requires the mkisofs(1) 6091.100Swiz utility, which is not part of NetBSD, but which can be 6101.100Swiz installed from _p_k_g_s_r_c_/_s_y_s_u_t_i_l_s_/_c_d_r_t_o_o_l_s. 6111.56Sapb 6121.100Swiz iissoo--iimmaaggee--ssoouurrccee 6131.64Sjnemeth Create a NetBSD installation CD-ROM image in the 6141.100Swiz RREELLEEAASSEEDDIIRR_/_i_s_o directory. The CD-ROM file system will have 6151.64Sjnemeth a layout as described in release(7). It will have top 6161.64Sjnemeth level directories for the machine type and source. 6171.64Sjnemeth 6181.64Sjnemeth For most machine types, the CD-ROM will be bootable, and 6191.100Swiz will automatically run the sysinst(8) menu-based 6201.100Swiz installation program, which can be used to install or 6211.100Swiz upgrade a NetBSD system. Bootable CD-ROMs also contain 6221.100Swiz tools that may be useful in repairing a damaged NetBSD 6231.100Swiz installation. 6241.64Sjnemeth 6251.64Sjnemeth Before ``make iso-image-source'' is attempted, RELEASEDIR 6261.100Swiz must be populated by ``make sourcesets release'' or 6271.100Swiz equivalent. 6281.64Sjnemeth 6291.64Sjnemeth Note that other, smaller, CD-ROM images may be created in 6301.100Swiz the RREELLEEAASSEEDDIIRR//RREELLEEAASSEEMMAACCHHIINNEEDDIIRR_/_i_n_s_t_a_l_l_a_t_i_o_n_/_c_d_r_o_m 6311.100Swiz directory by ``make release''. These smaller images 6321.100Swiz usually contain the same tools as the larger images in 6331.100Swiz RREELLEEAASSEEDDIIRR_/_i_s_o, but do not contain additional content such 6341.69Slukem as the distribution sets. 6351.64Sjnemeth 6361.64Sjnemeth Note that the mac68k port still uses an older method of 6371.100Swiz creating CD-ROM images. This requires the mkisofs(1) 6381.100Swiz utility, which is not part of NetBSD, but which can be 6391.100Swiz installed from _p_k_g_s_r_c_/_s_y_s_u_t_i_l_s_/_c_d_r_t_o_o_l_s. 6401.64Sjnemeth 6411.100Swiz iinnssttaallll--iimmaaggee 6421.98Sapb Create a bootable NetBSD installation disk image in the 6431.100Swiz RREELLEEAASSEEDDIIRR//RREELLEEAASSEEMMAACCHHIINNEEDDIIRR_/_i_n_s_t_a_l_l_a_t_i_o_n_/_i_n_s_t_a_l_l_i_m_a_g_e 6441.98Sapb directory. The installation disk image is suitable for 6451.98Sapb copying to bootable USB flash memory sticks, etc., for 6461.98Sapb machines which are able to boot from such devices. The 6471.98Sapb file system in the bootable disk image will have a layout 6481.98Sapb as described in release(7). 6491.97Stsutsui 6501.97Stsutsui The installation image is bootable, and will automatically 6511.97Stsutsui run the sysinst(8) menu-based installation program, which 6521.98Sapb can be used to install or upgrade a NetBSD system. The 6531.98Sapb image also contains tools that may be useful in repairing a 6541.98Sapb damaged NetBSD installation. 6551.97Stsutsui 6561.100Swiz Before ``make install-image'' is attempted, RREELLEEAASSEEDDIIRR must 6571.98Sapb be populated by ``make release'' or equivalent. The build 6581.100Swiz must have been performed with MMKKUUNNPPRRIIVVEEDD==yyeess because ``make 6591.100Swiz install-image'' relies on information in DDEESSTTDDIIRR_/_M_E_T_A_L_O_G. 6601.97Stsutsui 6611.97Stsutsui live-image Create NetBSD live images in the 6621.100Swiz RREELLEEAASSEEDDIIRR//RREELLEEAASSEEMMAACCHHIINNEEDDIIRR_/_i_n_s_t_a_l_l_a_t_i_o_n_/_l_i_v_e_i_m_a_g_e 6631.100Swiz directory. The live image contains all necessary files to 6641.100Swiz boot NetBSD up to multi-user mode, including all files 6651.100Swiz which should be extracted during installation, NetBSD 6661.100Swiz disklabel, bootloaders, etc. 6671.100Swiz 6681.100Swiz The live image is suitable for use as a disk image in 6691.100Swiz virtual machine environments such as QEMU, and also useful 6701.100Swiz to boot NetBSD from a USB flash memory stick on a real 6711.98Sapb machine, without the need for installation. 6721.97Stsutsui 6731.97Stsutsui Before ``make live-image'' is attempted, RELEASEDIR must be 6741.99Stsutsui populated by ``make release'' or equivalent. The build 6751.100Swiz must have been performed with MMKKUUNNPPRRIIVVEEDD==yyeess because ``make 6761.100Swiz install-image'' relies on information in DDEESSTTDDIIRR_/_M_E_T_A_L_O_G. 6771.97Stsutsui 6781.100Swiz rreeggrreessssiioonn--tteessttss 6791.20Slukem Can only be run after building the regression tests in the 6801.70Sdholland directory ``regress''. Runs those compiled regression 6811.100Swiz tests on the local host. Note that most tests are now 6821.100Swiz managed instead using atf(7); this target should probably 6831.100Swiz run those as well but currently does not. 6841.1Stv 6851.100Swiz TThhee ""bbuuiilldd..sshh"" ssccrriipptt 6861.96Sapb This script file is a shell script designed to build the entire NetBSD 6871.100Swiz system on any host with a suitable modern shell and some common 6881.100Swiz utilities. The required shell features are described under the HHOOSSTT__SSHH 6891.100Swiz variable. 6901.96Sapb 6911.96Sapb If a host system's default shell does support the required features, then 6921.96Sapb we suggest that you explicitly specify a suitable shell using a command 6931.96Sapb like 6941.96Sapb 6951.100Swiz /path/to/suitable/shell build.sh [_o_p_t_i_o_n_s] 6961.96Sapb 6971.100Swiz The above command will usually enable bbuuiilldd..sshh to automatically set 6981.100Swiz HHOOSSTT__SSHH==_/_p_a_t_h_/_t_o_/_s_u_i_t_a_b_l_e_/_s_h_e_l_l, but if that fails, then the following 6991.96Sapb set of commands may be used instead: 7001.96Sapb 7011.100Swiz HOST_SH=_/_p_a_t_h_/_t_o_/_s_u_i_t_a_b_l_e_/_s_h_e_l_l 7021.96Sapb export HOST_SH 7031.100Swiz ${HOST_SH} build.sh [_o_p_t_i_o_n_s] 7041.96Sapb 7051.100Swiz If bbuuiilldd..sshh detects that it is being executed under an unsuitable shell, 7061.96Sapb it attempts to exec a suitable shell instead, or prints an error message. 7071.100Swiz If HHOOSSTT__SSHH is not set explicitly, then bbuuiilldd..sshh sets a default using 7081.96Sapb heuristics dependent on the host platform, or from the shell under which 7091.100Swiz bbuuiilldd..sshh is executed (if that can be determined), or using the first copy 7101.100Swiz of _s_h found in PPAATTHH. 7111.1Stv 7121.1Stv All cross-compile builds, and most native builds, of the entire system 7131.100Swiz should make use of bbuuiilldd..sshh rather than just running ``make''. This way, 7141.100Swiz the make(1) program will be bootstrapped properly, in case the host 7151.100Swiz system has an older or incompatible ``make'' program. 7161.1Stv 7171.100Swiz When compiling the entire system via bbuuiilldd..sshh, many make(1) variables are 7181.1Stv set for you in order to help encapsulate the build process. In the list 7191.100Swiz of options below, variables that are automatically set by bbuuiilldd..sshh are 7201.1Stv noted where applicable. 7211.1Stv 7221.100Swiz The following operations are supported by bbuuiilldd..sshh: 7231.22Slukem 7241.100Swiz bbuuiilldd Build the system as per ``make build''. Before the main 7251.100Swiz part of the build commences, this command runs the oobbjj 7261.100Swiz operation (unless the --oo option is given), ``make 7271.100Swiz cleandir'' (unless the --uu option is given), and the ttoooollss 7281.70Sdholland operation. 7291.22Slukem 7301.100Swiz ddiissttrriibbuuttiioonn Build a full distribution as per ``make distribution''. 7311.100Swiz This command first runs the bbuuiilldd operation. 7321.22Slukem 7331.100Swiz rreelleeaassee Build a full release as per ``make release''. This command 7341.100Swiz first runs the ddiissttrriibbuuttiioonn operation. 7351.22Slukem 7361.100Swiz mmaakkeewwrraappppeerr Create the nnbbmmaakkee--MMAACCHHIINNEE wrapper. This operation is 7371.100Swiz automatically performed for any of the other operations. 7381.23Slukem 7391.100Swiz cclleeaannddiirr Perform ``make cleandir''. 7401.75Slukem 7411.100Swiz oobbjj Perform ``make obj''. 7421.22Slukem 7431.100Swiz ttoooollss Build and install the host tools from _s_r_c_/_t_o_o_l_s. This 7441.100Swiz command will first run ``make obj'' and ``make cleandir'' 7451.100Swiz in the _t_o_o_l_s subdirectory unless the --oo or --uu options 7461.100Swiz (respectively) are given. 7471.22Slukem 7481.100Swiz iinnssttaallll=_i_d_i_r Install the contents of DDEESSTTDDIIRR to _i_d_i_r, using ``make 7491.61Sapb installworld''. Note that files that are part of the 7501.95Sapb ``etc'' or ``xetc'' sets will not be installed, unless 7511.95Sapb overridden by the INSTALLSETS environment variable. 7521.35Slukem 7531.100Swiz kkeerrnneell=_k_c_o_n_f Build a new kernel. The _k_c_o_n_f argument is the name of a 7541.100Swiz configuration file suitable for use by config(1). If _k_c_o_n_f 7551.22Slukem does not contain any `/' characters, the configuration file 7561.100Swiz is expected to be found in the KKEERRNNCCOONNFFDDIIRR directory, which 7571.100Swiz is typically ssyyss//aarrcchh//MMAACCHHIINNEE//ccoonnff. The new kernel will be 7581.100Swiz built in a subdirectory of KKEERRNNOOBBJJDDIIRR, which is typically 7591.100Swiz ssyyss//aarrcchh//MMAACCHHIINNEE//ccoommppiillee or an associated object directory. 7601.70Sdholland 7611.100Swiz This command does _n_o_t imply the ttoooollss command; run the 7621.100Swiz ttoooollss command first unless it is _c_e_r_t_a_i_n that the tools 7631.70Sdholland already exist and are up to date. 7641.70Sdholland 7651.70Sdholland This command will run ``make cleandir'' on the kernel in 7661.100Swiz question first unless the --uu option is given. 7671.22Slukem 7681.100Swiz mmoodduulleess This command will build kernel modules and install them 7691.100Swiz into DDEESSTTDDIIRR. 7701.86Sjnemeth 7711.100Swiz rreelleeaasseekkeerrnneell=_k_c_o_n_f 7721.70Sdholland Install a gzip(1)ed copy of the kernel previously built by 7731.100Swiz kkeerrnneell=_k_c_o_n_f into 7741.100Swiz RREELLEEAASSEEDDIIRR//RREELLEEAASSEEMMAACCHHIINNEEDDIIRR_/_b_i_n_a_r_y_/_k_e_r_n_e_l, usually as 7751.100Swiz _n_e_t_b_s_d_-_k_c_o_n_f_._g_z, although the ``_n_e_t_b_s_d'' prefix is 7761.100Swiz determined from the ``ccoonnffiigg'' directives in _k_c_o_n_f. 7771.24Slukem 7781.100Swiz sseettss Perform ``make sets''. 7791.31Slukem 7801.100Swiz ssoouurrcceesseettss Perform ``make sourcesets''. 7811.22Slukem 7821.100Swiz ssyyssppkkggss Perform ``make syspkgs''. 7831.54Sapb 7841.100Swiz iissoo--iimmaaggee Perform ``make iso-image''. 7851.56Sapb 7861.100Swiz iissoo--iimmaaggee--ssoouurrccee 7871.65Sjnemeth Perform ``make iso-image-source''. 7881.65Sjnemeth 7891.100Swiz iinnssttaallll--iimmaaggee 7901.98Sapb Perform ``make install-image''. 7911.97Stsutsui 7921.100Swiz lliivvee--iimmaaggee Perform ``make live-image''. 7931.97Stsutsui 7941.100Swiz The following command line options alter the behaviour of the bbuuiilldd..sshh 7951.51Swiz operations described above: 7961.1Stv 7971.100Swiz --aa _a_r_c_h Set the value of MMAACCHHIINNEE__AARRCCHH to _a_r_c_h. 7981.9Sthorpej 7991.100Swiz --BB _b_u_i_l_d_i_d 8001.100Swiz Set the value of BBUUIILLDDIIDD to _b_u_i_l_d_i_d. This will also append the 8011.67Ssborrill build identifier to the name of the ``make'' wrapper script so 8021.37Slukem that the resulting name is of the form 8031.100Swiz ``nnbbmmaakkee--MMAACCHHIINNEE--BBUUIILLDDIIDD''. 8041.1Stv 8051.100Swiz --CC _c_d_e_x_t_r_a_s 8061.100Swiz Append _c_d_e_x_t_r_a_s to the CCDDEEXXTTRRAA variable, which is a space- 8071.100Swiz separated list of files or directories that will be added to 8081.100Swiz the CD-ROM image that may be create by the ``iso-image'' or 8091.87Sapb ``iso-image-source'' operations. Files will be added to the 8101.87Sapb root of the CD-ROM image, whereas directories will be copied 8111.87Sapb recursively. If relative paths are specified, they will be 8121.87Sapb converted to absolute paths before being used. Multiple paths 8131.100Swiz may be specified via multiple --CC options, or via a single 8141.87Sapb option whose argument contains multiple space-separated paths. 8151.66Sjnemeth 8161.100Swiz --DD _d_e_s_t Set the value of DDEESSTTDDIIRR to _d_e_s_t. If a relative path is 8171.100Swiz specified, it will be converted to an absolute path before 8181.100Swiz being used. 8191.100Swiz 8201.100Swiz --EE Set `expert' mode. This overrides various sanity checks, and 8211.100Swiz allows: DDEESSTTDDIIRR does not have to be set to a non-root path for 8221.100Swiz builds, and MMKKUUNNPPRRIIVVEEDD==yyeess does not have to be set when 8231.100Swiz building as a non-root user. 8241.23Slukem 8251.100Swiz _N_o_t_e: It is highly recommended that you know what you are doing 8261.23Slukem when you use this option. 8271.19Slukem 8281.100Swiz --hh Print a help message. 8291.51Swiz 8301.100Swiz --jj _n_j_o_b Run up to _n_j_o_b make(1) subjobs in parallel; passed through to 8311.74Sapb make(1). If you see failures for reasons other than running 8321.100Swiz out of memory while using bbuuiilldd..sshh with --jj, please save 8331.100Swiz complete build logs so the failures can be analyzed. 8341.74Sapb 8351.100Swiz To achieve the fastest builds, --jj values between (1 + the 8361.100Swiz number of CPUs) and (2 * the number of CPUs) are recommended. 8371.100Swiz Use lower values on machines with limited memory or I/O 8381.100Swiz bandwidth. 8391.100Swiz 8401.100Swiz --MM _o_b_j Set MMAAKKEEOOBBJJDDIIRRPPRREEFFIIXX to _o_b_j. Unsets MMAAKKEEOOBBJJDDIIRR. See ``--OO 8411.100Swiz --oobbjj'' for more information. 8421.100Swiz 8431.100Swiz For instance, if the source directory is _/_u_s_r_/_s_r_c, a setting of 8441.100Swiz ``--MM _/_u_s_r_/_o_b_j'' will place build-time files under 8451.100Swiz _/_u_s_r_/_o_b_j_/_u_s_r_/_s_r_c_/_b_i_n, _/_u_s_r_/_o_b_j_/_u_s_r_/_s_r_c_/_l_i_b, 8461.100Swiz _/_u_s_r_/_o_b_j_/_u_s_r_/_s_r_c_/_u_s_r_._b_i_n, and so forth. 8471.88Sapb 8481.73Sapb If a relative path is specified, it will be converted to an 8491.100Swiz absolute path before being used. bbuuiilldd..sshh imposes the 8501.100Swiz restriction that the argument to the --MM option must not begin 8511.100Swiz with a ``$'' (dollar sign) character; otherwise it would be too 8521.100Swiz difficult to determine whether the value is an absolute or a 8531.100Swiz relative path. If the directory does not already exist, 8541.100Swiz bbuuiilldd..sshh will create it. 8551.18Slukem 8561.100Swiz --mm _m_a_c_h Set the value of MMAACCHHIINNEE to _m_a_c_h, except in some special cases 8571.60Sapb listed below. This will also override any value of 8581.100Swiz MMAACCHHIINNEE__AARRCCHH in the process environment with a value deduced 8591.100Swiz from _m_a_c_h, unless --aa is specified. All cross builds require 8601.100Swiz --mm, but if unset on a NetBSD host, the host's value of MACHINE 8611.60Sapb will be detected and used automatically. 8621.60Sapb 8631.100Swiz Some machines support multiple values for MMAACCHHIINNEE__AARRCCHH. The 8641.100Swiz following special cases for the _m_a_c_h argument are defined to 8651.100Swiz set the listed values of MMAACCHHIINNEE and MMAACCHHIINNEE__AARRCCHH: 8661.33Slukem 8671.100Swiz mmaacchh MMAACCHHIINNEE MMAACCHHIINNEE__AARRCCHH 8681.60Sapb evbarm evbarm (not set) 8691.60Sapb evbarm-eb evbarm armeb 8701.60Sapb evbarm-el evbarm arm 8711.33Slukem evbmips evbmips (not set) 8721.33Slukem evbmips-eb evbmips mipseb 8731.33Slukem evbmips-el evbmips mipsel 8741.33Slukem evbsh3 evbsh3 (not set) 8751.33Slukem evbsh3-eb evbsh3 sh3eb 8761.33Slukem evbsh3-el evbsh3 sh3el 8771.33Slukem sbmips sbmips (not set) 8781.33Slukem sbmips-eb sbmips mipseb 8791.33Slukem sbmips-el sbmips mipsel 8801.1Stv 8811.100Swiz --NN _n_o_i_s_e_l_e_v_e_l 8821.46Slukem Set the ``noisyness'' level of the build, by setting 8831.100Swiz MMAAKKEEVVEERRBBOOSSEE to _n_o_i_s_e_l_e_v_e_l. 8841.45Slukem 8851.100Swiz --nn Show the commands that would be executed by bbuuiilldd..sshh, but do 8861.1Stv not make any changes. This is similar in concept to ``make 8871.1Stv -n''. 8881.1Stv 8891.100Swiz --OO _o_b_j Create an appropriate transform macro for MMAAKKEEOOBBJJDDIIRR that will 8901.100Swiz place the built object files under _o_b_j. Unsets 8911.100Swiz MMAAKKEEOOBBJJDDIIRRPPRREEFFIIXX. 8921.88Sapb 8931.100Swiz For instance, a setting of ``--OO _/_u_s_r_/_o_b_j'' will place build- 8941.100Swiz time files under _/_u_s_r_/_o_b_j_/_b_i_n, _/_u_s_r_/_o_b_j_/_l_i_b, _/_u_s_r_/_o_b_j_/_u_s_r_._b_i_n, 8951.88Sapb and so forth. 8961.88Sapb 8971.88Sapb If a relative path is specified, it will be converted to an 8981.100Swiz absolute path before being used. bbuuiilldd..sshh imposes the 8991.100Swiz restriction that the argument to the --OO option must not contain 9001.100Swiz a ``$'' (dollar sign) character. If the directory does not 9011.100Swiz already exist, bbuuiilldd..sshh will create it. 9021.73Sapb 9031.100Swiz In normal use, exactly one of the --MM or --OO options should be 9041.100Swiz specified. If neither --MM nor --OO is specified, then a default 9051.78Sapb object directory will be chosen according to rules in 9061.78Sapb <bsd.obj.mk>. Relying on this default is not recommended 9071.78Sapb because it is determined by complex rules that are influenced 9081.78Sapb by the values of several variables and by the location of the 9091.78Sapb source directory. 9101.18Slukem 9111.100Swiz --oo Set the value of MMKKOOBBJJDDIIRRSS to ``no''. Otherwise, it will be 9121.70Sdholland automatically set to ``yes''. This default is opposite to the 9131.100Swiz behaviour when not using bbuuiilldd..sshh. 9141.1Stv 9151.100Swiz --RR _r_e_l Set the value of RREELLEEAASSEEDDIIRR to _r_e_l. If a relative path is 9161.59Sapb specified, it will be converted to an absolute path before 9171.59Sapb being used. 9181.18Slukem 9191.100Swiz --rr Remove the contents of DDEESSTTDDIIRR and TTOOOOLLDDIIRR before building 9201.1Stv (provides a clean starting point). This will skip deleting 9211.100Swiz DDEESSTTDDIIRR if building on a native system to the root directory. 9221.1Stv 9231.100Swiz --SS _s_e_e_d Change the value of BBUUIILLDDSSEEEEDD to _s_e_e_d. This should rarely be 9241.72Sperry necessary. 9251.72Sperry 9261.100Swiz --TT _t_o_o_l_s Set the value of TTOOOOLLDDIIRR to _t_o_o_l_s. If a relative path is 9271.100Swiz specified, it will be converted to an absolute path before 9281.100Swiz being used. If set, the bootstrap ``make'' will only be 9291.100Swiz rebuilt if the source files for make(1) have changed. 9301.100Swiz 9311.100Swiz --UU Set MMKKUUNNPPRRIIVVEEDD==yyeess. 9321.100Swiz 9331.100Swiz --uu Set MMKKUUPPDDAATTEE==yyeess. 9341.100Swiz 9351.100Swiz --VV _v_a_r=[_v_a_l_u_e] 9361.100Swiz Set the environment variable _v_a_r to an optional _v_a_l_u_e. This is 9371.100Swiz propagated to the nnbbmmaakkee wrapper. 9381.100Swiz 9391.100Swiz --ww _w_r_a_p_p_e_r 9401.100Swiz Create the nnbbmmaakkee wrapper script (see below) in a custom 9411.100Swiz location, specified by _w_r_a_p_p_e_r. This allows, for instance, to 9421.100Swiz place the wrapper in PPAATTHH automatically. Note that _w_r_a_p_p_e_r is 9431.59Sapb the full name of the file, not just a directory name. If a 9441.59Sapb relative path is specified, it will be converted to an absolute 9451.59Sapb path before being used. 9461.1Stv 9471.100Swiz --XX _x_1_1_s_r_c 9481.100Swiz Set the value of XX1111SSRRCCDDIIRR to _x_1_1_s_r_c. If a relative path is 9491.59Sapb specified, it will be converted to an absolute path before 9501.59Sapb being used. 9511.49Slukem 9521.100Swiz --xx Set MMKKXX1111==yyeess. 9531.49Slukem 9541.100Swiz --ZZ _v_a_r Unset ("zap") the environment variable _v_a_r. This is propagated 9551.100Swiz to the nnbbmmaakkee wrapper. 9561.40Slukem 9571.100Swiz TThhee ""nnbbmmaakkee--MMAACCHHIINNEE"" wwrraappppeerr ssccrriipptt 9581.100Swiz If using the bbuuiilldd..sshh script to build NetBSD, a nnbbmmaakkee--MMAACCHHIINNEE script 9591.100Swiz will be created in TTOOOOLLDDIIRR//bbiinn upon the first build to assist in building 9601.1Stv subtrees on a cross-compile host. 9611.1Stv 9621.100Swiz nnbbmmaakkee--MMAACCHHIINNEE can be invoked in lieu of make(1), and will instead call 9631.100Swiz the up-to-date version of ``nbmake'' installed into TTOOOOLLDDIIRR//bbiinn with 9641.100Swiz several key variables pre-set, including MMAACCHHIINNEE, MMAACCHHIINNEE__AARRCCHH, and 9651.100Swiz TTOOOOLLDDIIRR. nnbbmmaakkee--MMAACCHHIINNEE will also set variables specified with --VV, and 9661.100Swiz unset variables specified with --ZZ. 9671.40Slukem 9681.100Swiz This script can be symlinked into a directory listed in PPAATTHH, or called 9691.1Stv with an absolute path. 9701.1Stv 9711.100SwizEEXXAAMMPPLLEESS 9721.78Sapb 1. % ./build.sh [options] tools kernel=GENERIC 9731.28Slukem 9741.28Slukem Build a new toolchain, and use the new toolchain to configure and 9751.28Slukem build a new GENERIC kernel. 9761.28Slukem 9771.78Sapb 2. % ./build.sh [options] -U distribution 9781.28Slukem 9791.100Swiz Using unprivileged mode, build a complete distribution to a DDEESSTTDDIIRR 9801.100Swiz directory that bbuuiilldd..sshh selects (and will display). 9811.28Slukem 9821.78Sapb 3. # ./build.sh [options] -U install=/ 9831.28Slukem 9841.100Swiz As root, install to _/ the distribution that was built by example 2. 9851.100Swiz Even though this is run as root, --UU is required so that the 9861.100Swiz permissions stored in DDEESSTTDDIIRR_/_M_E_T_A_L_O_G are correctly applied to the 9871.100Swiz files as they're copied to _/. 9881.28Slukem 9891.78Sapb 4. % ./build.sh [options] -U -u release 9901.28Slukem 9911.100Swiz Using unprivileged mode, build a complete release to DDEESSTTDDIIRR and 9921.100Swiz RREELLEEAASSEEDDIIRR directories that bbuuiilldd..sshh selects (and will display). 9931.100Swiz MMKKUUPPDDAATTEE==yyeess (--uu) is set to prevent the ``make cleandir'', so that 9941.38Slukem if this is run after example 2, it doesn't need to redo that portion 9951.38Slukem of the release build. 9961.16Slukem 9971.100SwizOOBBSSOOLLEETTEE VVAARRIIAABBLLEESS 9981.100Swiz NNBBUUIILLDDJJOOBBSS Use the make(1) option --jj instead. 9991.15Slukem 10001.100Swiz UUSSEE__NNEEWW__TTOOOOLLCCHHAAIINN 10011.15Slukem The new toolchain is now the default. To disable, use 10021.100Swiz TTOOOOLLCCHHAAIINN__MMIISSSSIINNGG==yyeess. 10031.10Ssommerfe 10041.100SwizSSEEEE AALLSSOO 10051.62Sapb make(1), hier(7), release(7), etcupdate(8), postinstall(8), sysinst(8), 10061.100Swiz _p_k_g_s_r_c_/_s_y_s_u_t_i_l_s_/_c_d_r_t_o_o_l_s 10071.1Stv 10081.100SwizHHIISSTTOORRYY 10091.100Swiz The bbuuiilldd..sshh based build scheme was introduced for NetBSD 1.6 as 10101.100Swiz UUSSEE__NNEEWW__TTOOOOLLCCHHAAIINN, and re-worked to TTOOOOLLCCHHAAIINN__MMIISSSSIINNGG after that. 10111.1Stv 10121.100SwizNetBSD May 25, 2012 NetBSD 1013