BUILDING revision 1.67.4.1
1BUILDING(8) NetBSD System Manager's Manual BUILDING(8) 2 3NAME 4 BUILDING -- Procedure for building NetBSD from source code. 5 6REQUIREMENTS 7 NetBSD is designed to be buildable on most POSIX-compliant host systems. 8 The basic build procedure is the same whether compiling natively (on the 9 same NetBSD architecture) or cross compiling (on another architecture or 10 OS). 11 12 This source tree contains a special subtree, ``tools'', which uses the 13 host system to create a build toolchain for the target architecture. The 14 host system must have at least C and C++ compilers in order to create the 15 toolchain (make is not required); all other tools are created as part of 16 the NetBSD build process. (See the environment variables section below 17 if you need to override or manually select your compilers.) 18 19FILES 20 Source tree layout 21 doc/BUILDING.mdoc 22 This document (in -mdoc troff format; the original copy). 23 24 BUILDING This document (in plaintext). 25 26 tools/compat/README 27 Special notes for cross-hosting a NetBSD build on non- 28 NetBSD platforms. 29 30 Makefile The main Makefile for NetBSD; should only be run for 31 native builds with an appropriately up-to-date version of 32 NetBSD make(1). (For building from out-of-date systems or 33 on a non-native host, see the build.sh shell script.) 34 35 UPDATING Special notes for updating from an earlier revision of 36 NetBSD. It is important to read this file before every 37 build of an updated source tree. 38 39 build.sh Bourne-compatible shell script used for building the host 40 build tools and the NetBSD system from scratch. Can be 41 used for both native and cross builds, and should be used 42 instead of make(1) for any source tree that is updated and 43 recompiled regularly. 44 45 crypto/dist/, dist/, gnu/dist/ 46 Sources imported verbatim from third parties, without man- 47 gling the existing build structure. Other source trees in 48 bin through usr.sbin use the NetBSD make(1) ``reachover'' 49 Makefile semantics when building these programs for a 50 native host. 51 52 distrib/, etc/ 53 Sources for items used when making a full release snap- 54 shot, such as files installed in DESTDIR/etc on the desti- 55 nation system, boot media, and release notes. 56 57 regress/ Regression test harness. Can be cross-compiled, but only 58 run natively. 59 60 sys/ NetBSD kernel sources. 61 62 tools/ ``Reachover'' build structure for the host build tools. 63 This has a special method of determining out-of-date sta- 64 tus. 65 66 bin/ ... usr.sbin/ 67 Sources to the NetBSD userland (non-kernel) programs. If 68 any of these directories are missing, they will be skipped 69 during the build. 70 71 x11/ ``Reachover'' build structure for X11R6; the source is in 72 X11SRCDIR. 73 74 Build tree layout 75 The NetBSD build tree is described in hier(7), and the release layout is 76 described in release(7). 77 78CONFIGURATION 79 Environment variables 80 Several environment variables control the behaviour of NetBSD builds. 81 82 HOST_SH Path name to a POSIX-compliant shell. If this is not 83 set explicitly, then the default is set using heuris- 84 tics dependent on the host platform, or from the shell 85 under which build.sh is executed (if that can be deter- 86 mined), or using the first copy of sh found in PATH. 87 If the host system's /bin/sh is not POSIX-compliant, we 88 suggest that you build using commands like 89 90 HOST_SH=/path/to/working/shell 91 export HOST_SH 92 ${HOST_SH} build.sh [options] 93 94 HOST_CC Path name to C compiler used to create the toolchain. 95 96 HOST_CXX Path name to C++ compiler used to create the toolchain. 97 98 MACHINE Machine type. 99 100 MACHINE_ARCH Machine architecture. 101 102 MAKE Path name to invoke make(1) as. 103 104 MAKEFLAGS Flags to invoke make(1) with. 105 106 MAKEOBJDIR Directory to use as the .OBJDIR for the current direc- 107 tory. The value is subjected to variable expansion by 108 make(1). Used only if MAKEOBJDIRPREFIX is not defined. 109 MAKEOBJDIR can only be provided in the environment or 110 via the -O flag of build.sh. 111 112 MAKEOBJDIRPREFIX Top level directory of the object directory tree. If 113 specified, must be an absolute path. If this is 114 defined, ${MAKEOBJDIRPREFIX}/${.CURDIR} is used as the 115 .OBJDIR for the current directory. The current direc- 116 tory may be read only. MAKEOBJDIRPREFIX can only be 117 provided in the environment or via the -M flag of 118 build.sh. 119 120 "make" variables 121 Several variables control the behavior of NetBSD builds. Unless other- 122 wise specified, these variables may be set in either the process environ- 123 ment or the make(1) configuration file specified by MAKECONF. 124 125 BUILDID Identifier for the build. The identifier will be appended to 126 object directory names, and can be consulted in the make(1) 127 configuration file in order to set additional build parame- 128 ters, such as compiler flags. 129 130 DESTDIR Directory to contain the built NetBSD system. If set, spe- 131 cial options are passed to the compilation tools to prevent 132 their default use of the host system's /usr/include, 133 /usr/lib, and so forth. This pathname must be an absolute 134 path, and should not end with a slash (/) character. (For 135 installation into the system's root directory, set DESTDIR to 136 an empty string, not to ``/''). The directory must reside on 137 a file system which supports long file names and hard links. 138 139 Default: Empty string if USETOOLS is ``yes''; unset other- 140 wise. 141 142 Note: build.sh will provide a default of destdir.MACHINE (in 143 the top-level .OBJDIR) unless run in `expert' mode 144 145 MAKECONF The name of the make(1) configuration file. Only settable in 146 the process environment. 147 148 Default: ``/etc/mk.conf'' 149 150 MAKEVERBOSE 151 Level of verbosity of status messages. Supported values: 152 153 0 No descriptive messages are shown. 154 155 1 Descriptive messages are shown. 156 157 2 Descriptive messages (prefixed with a `#') and command 158 output is not suppressed. 159 160 Default: 2 161 162 MKCATPAGES Can be set to ``yes'' or ``no''. Indicates whether prefor- 163 matted plaintext manual pages will be created during a build. 164 165 Default: ``yes'' 166 167 MKCRYPTO Can be set to ``yes'' or ``no''. Indicates whether crypto- 168 graphic code will be included in a build; provided for the 169 benefit of countries that do not allow strong cryptography. 170 Will not affect use of the standard low-security password 171 encryption system, crypt(3). 172 173 Default: ``yes'' 174 175 MKDOC Can be set to ``yes'' or ``no''. Indicates whether system 176 documentation destined for DESTDIR/usr/share/doc will be 177 installed during a build. 178 179 Default: ``yes'' 180 181 MKHOSTOBJ Can be set to ``yes'' or ``no''. If set to ``yes'', then for 182 programs intended to be run on the compile host, the name, 183 release, and architecture of the host operating system will 184 be suffixed to the name of the object directory created by 185 ``make obj''. (This allows multiple host systems to compile 186 NetBSD for a single target.) If set to ``no'', then programs 187 built to be run on the compile host will use the same object 188 directory names as programs built to be run on the target. 189 190 Default: ``no'' 191 192 MKINFO Can be set to ``yes'' or ``no''. Indicates whether GNU Info 193 files, used for the documentation for most of the compilation 194 tools, will be created and installed during a build. 195 196 Default: ``yes'' 197 198 MKLINT Can be set to ``yes'' or ``no''. Indicates whether lint(1) 199 will be run against portions of the NetBSD source code during 200 the build, and whether lint libraries will be installed into 201 DESTDIR/usr/libdata/lint. 202 203 Default: ``yes'' 204 205 MKMAN Can be set to ``yes'' or ``no''. Indicates whether manual 206 pages will be installed during a build. 207 208 Default: ``yes'' 209 210 MKNLS Can be set to ``yes'' or ``no''. Indicates whether Native 211 Language System locale zone files will be compiled and 212 installed during a build. 213 214 Default: ``yes'' 215 216 MKOBJ Can be set to ``yes'' or ``no''. Indicates whether object 217 directories will be created when running ``make obj''. If 218 set to ``no'', then all built files will be located inside 219 the regular source tree. 220 221 Default: ``yes'' 222 223 MKPIC Can be set to ``yes'' or ``no''. Indicates whether shared 224 objects and libraries will be created and installed during a 225 build. If set to ``no'', the entire built system will be 226 statically linked. 227 228 Default: Platform dependent. As of this writing, all plat- 229 forms except sh3 default to ``yes''. 230 231 MKPICINSTALL 232 Can be set to ``yes'' or ``no''. Indicates whether the ar(1) 233 format libraries (lib*_pic.a), used to generate shared 234 libraries, are installed during a build. 235 236 Default: ``yes'' 237 238 MKPROFILE Can be set to ``yes'' or ``no''. Indicates whether profiled 239 libraries (lib*_p.a) will be built and installed during a 240 build. 241 242 Default: ``yes''; however, some platforms turn off MKPROFILE 243 by default at times due to toolchain problems with profiled 244 code. 245 246 MKSHARE Can be set to ``yes'' or ``no''. Indicates whether files 247 destined to reside in DESTDIR/usr/share will be built and 248 installed during a build. If set to ``no'', then all of 249 MKCATPAGES, MKDOC, MKINFO, MKMAN, and MKNLS will be set to 250 ``no'' unconditionally. 251 252 Default: ``yes'' 253 254 MKTTINTERP Can be set to ``yes'' or ``no''. For X builds, decides if 255 the TrueType bytecode interpreter is turned on. See 256 http://www.freetype.org/patents.html for details. 257 258 Default: ``no'' 259 260 MKUNPRIVED Can be set to ``yes'' or ``no''. Indicates whether an 261 unprivileged install will occur. The user, group, permis- 262 sions, and file flags, will not be set on the installed 263 items; instead the information will be appended to a file 264 called METALOG in DESTDIR. The contents of METALOG are used 265 during the generation of the distribution tar files to ensure 266 that the appropriate file ownership is stored. 267 268 Default: ``no'' 269 270 MKUPDATE Can be set to ``yes'' or ``no''. Indicates whether all 271 install operations intended to write to DESTDIR will compare 272 file timestamps before installing, and skip the install phase 273 if the destination files are up-to-date. This also has 274 implications on full builds (see next subsection). 275 276 Default: ``no'' 277 278 MKX11 Can be set to ``yes'' or ``no''. Indicates whether X11R6 is 279 built from X11SRCDIR. 280 281 Default: ``no'' 282 283 TOOLDIR Directory to hold the host tools, once built. If specified, 284 must be an absolute path. This directory should be unique to 285 a given host system and NetBSD source tree. (However, multi- 286 ple targets may share the same TOOLDIR; the target-dependent 287 files have unique names.) If unset, a default based on the 288 uname(1) information of the host platform will be created in 289 the .OBJDIR of src. 290 291 Default: Unset. 292 293 USETOOLS Indicates whether the tools specified by TOOLDIR should be 294 used as part of a build in progress. Must be set to ``yes'' 295 if cross-compiling. 296 297 yes Use the tools from TOOLDIR. 298 299 no Do not use the tools from TOOLDIR, but refuse to build 300 native compilation tool components that are version- 301 specific for that tool. 302 303 never Do not use the tools from TOOLDIR, even when building 304 native tool components. This is similar to the tradi- 305 tional NetBSD build method, but does not verify that 306 the compilation tools in use are up-to-date enough in 307 order to build the tree successfully. This may cause 308 build or runtime problems when building the whole 309 NetBSD source tree. 310 311 Default: ``yes'' if building all or part of a whole NetBSD 312 source tree (detected automatically); ``no'' otherwise (to 313 preserve traditional semantics of the <bsd.*.mk> make(1) 314 include files). 315 316 X11SRCDIR Directory containing the X11R6 source. If specified, must be 317 an absolute path. The main X11R6 source is found in 318 X11SRCDIR/xfree/xc. 319 320 Default: ``/usr/xsrc'' 321 322 "make" variables for full builds 323 These variables only affect the top level ``Makefile'' and do not affect 324 manually building subtrees of the NetBSD source code. 325 326 INSTALLWORLDDIR Location for the ``make installworld'' target to install 327 to. If specified, must be an absolute path. 328 329 Default: ``/'' 330 331 MKOBJDIRS Can be set to ``yes'' or ``no''. Indicates whether 332 object directories will be created automatically (via a 333 ``make obj'' pass) at the start of a build. 334 335 Default: ``no'' 336 337 MKUPDATE Can be set to ``yes'' or ``no''. If set, then in addi- 338 tion to the effects described for MKUPDATE=yes above, 339 this implies the effects of NOCLEANDIR (i.e., ``make 340 cleandir'' is avoided). 341 342 Default: ``no'' 343 344 NBUILDJOBS Now obsolete. Use the make(1) option -j, instead (see 345 below) 346 347 Default: Unset. 348 349 NOCLEANDIR If set, avoids the ``make cleandir'' phase of a full 350 build. This has the effect of allowing only changed 351 files in a source tree to be recompiled. This can speed 352 up builds when updating only a few files in the tree. 353 354 Default: Unset. 355 356 NODISTRIBDIRS If set, avoids the ``make distrib-dirs'' phase of a full 357 build. This skips running mtree(8) on DESTDIR, useful 358 on systems where building as an unprivileged user, or 359 where it is known that the system-wide mtree files have 360 not changed. 361 362 Default: Unset. 363 364 NOINCLUDES If set, avoids the ``make includes'' phase of a full 365 build. This has the effect of preventing make(1) from 366 thinking that some programs are out-of-date simply 367 because the system include files have changed. However, 368 this option should not be used when updating the entire 369 NetBSD source tree arbitrarily; it is suggested to use 370 MKUPDATE=yes in that case. 371 372 Default: Unset. 373 374 RELEASEDIR If set, specifies the directory to which a release(7) 375 layout will be written at the end of a ``make release''. 376 If specified, must be an absolute path. 377 378 Default: Unset. 379 380 Note: build.sh will provide a default of releasedir (in 381 the top-level .OBJDIR) unless run in `expert' mode 382 383BUILDING 384 "make" command line options 385 This is not a summary of all the options available to make(1); only the 386 options used most frequently with NetBSD builds are listed here. 387 388 -j njob Run up to njob make(1) subjobs in parallel. Makefiles should 389 use .WAIT or have explicit dependencies as necessary to 390 enforce build ordering. If you see build failures with -j, 391 please save complete build logs so the failures can be ana- 392 lyzed. 393 394 -m dir Specify the default directory for searching for system Make- 395 file segments, mainly the <bsd.*.mk> files. When building any 396 full NetBSD source tree, this should be set to the 397 ``share/mk'' directory in the source tree. (This is set auto- 398 matically when building from the top level.) 399 400 -n Display the commands that would have been executed, but do not 401 actually execute them. This will still cause recursion to 402 take place. 403 404 -V var Print make(1)'s idea of the value of var. Does not build any 405 targets. 406 407 var=value Set the variable var to value, overriding any setting speci- 408 fied by the process environment, the MAKECONF configuration 409 file, or the system Makefile segments. 410 411 "make" targets 412 These default targets may be built by running make(1) in any subtree of 413 the NetBSD source code. It is recommended that none of these be used 414 from the top level Makefile; as a specific exception, ``make obj'' and 415 ``make cleandir'' are useful in that context. 416 417 all Build programs, libraries, and preformatted documentation. 418 419 clean Remove program and library object code files. 420 421 cleandir Same as clean, but also remove preformatted documentation, 422 dependency files generated by ``make depend'', and any other 423 files known to be created at build time. 424 425 depend Create dependency files (.depend) containing more detailed 426 information about the dependencies of source code on header 427 files. Allows programs to be recompiled automatically when a 428 dependency changes. 429 430 dependall Does a ``make depend'' immediately followed by a ``make all''. 431 This improves cache locality of the build since both passes 432 read the source files in their entirety. 433 434 distclean Synonym for cleandir. 435 436 includes Build and install system header files. Typically needed 437 before any system libraries or programs can be built. 438 439 install Install programs, libraries, and documentation into DESTDIR. 440 Few files will be installed to DESTDIR/dev, DESTDIR/etc, 441 DESTDIR/root or DESTDIR/var in order to prevent user supplied 442 configuration data from being overwritten. 443 444 lint Run lint(1) against the C source code, where appropriate, and 445 generate system-installed lint libraries. 446 447 obj Create object directories to be used for built files, instead 448 of building directly in the source tree. 449 450 tags Create ctags(1) searchable function lists usable by the ex(1) 451 and vi(1) text editors. 452 453 "make" targets for the top level 454 Additional make(1) targets are usable specifically from the top source 455 level to facilitate building the entire NetBSD source tree. 456 457 build Build the entire NetBSD system (except the kernel). This 458 orders portions of the source tree such that prerequisites 459 will be built in the proper order. 460 461 distribution Do a ``make build'', and then install a full distribution 462 (which does not include a kernel) into DESTDIR, including 463 files in DESTDIR/dev, DESTDIR/etc, DESTDIR/root and 464 DESTDIR/var. 465 466 buildworld As per ``make distribution'', except that it ensures that 467 DESTDIR is not the root directory. 468 469 installworld Install the distribution from DESTDIR to INSTALLWORLDDIR 470 (which defaults to the root directory). Ensures that 471 INSTALLWORLDDIR is not the root directory if cross compil- 472 ing. 473 474 The INSTALLSETS environment variable may be set to a list 475 of distribution sets to be installed. By default, all sets 476 except ``etc'' and ``xetc'' are installed (so most files in 477 INSTALLWORLDDIR/etc will not be installed or modified). 478 479 Note: Before performing this operation with 480 INSTALLWORLDDIR=/, it is highly recommended that you 481 upgrade your kernel and reboot. After performing this 482 operation, it is recommended that you use etcupdate(8) to 483 update files in INSTALLWORLDDIR/etc and that you use 484 postinstall(8) to check for inconsistencies (and possibly 485 to fix them). 486 487 sets Create distribution sets from DESTDIR into 488 RELEASEDIR/RELEASEMACHINEDIR/binary/sets. Should be run 489 after ``make distribution'' (as ``make build'' does not 490 install all of the required files). 491 492 sourcesets Create source sets of the source tree into 493 RELEASEDIR/source/sets. 494 495 syspkgs Create syspkgs from DESTDIR into 496 RELEASEDIR/RELEASEMACHINEDIR/binary/syspkgs. Should be run 497 after ``make distribution'' (as ``make build'' does not 498 install all of the required files). 499 500 release Do a ``make distribution'', build kernels, distribution 501 media, and install sets (this as per ``make sets''), and 502 then package the system into a standard release layout as 503 described by release(7). This requires that RELEASEDIR be 504 set (see above). 505 506 iso-image Create a NetBSD installation CD-ROM image in the 507 RELEASEDIR/iso directory. The CD-ROM file system will have 508 a layout as described in release(7). 509 510 For most machine types, the CD-ROM will be bootable, and 511 will automatically run the sysinst(8) menu-based installa- 512 tion program, which can be used to install or upgrade a 513 NetBSD system. Bootable CD-ROMs also contain tools that 514 may be useful in repairing a damaged NetBSD installation. 515 516 Before ``make iso-image'' is attempted, RELEASEDIR must be 517 populated by ``make release'' or equivalent. 518 519 Note that other, smaller, CD-ROM images may be created in 520 the RELEASEDIR/RELEASEMACHINEDIR/installation/cdrom direc- 521 tory by ``make release''. These smaller images usually 522 contain the same tools as the larger images in 523 RELEASEDIR/iso, but do not contain additional content such 524 as the distribution sets. 525 526 Note that the mac68k port still uses an older method of 527 creating CD-ROM images. This requires the mkisofs(1) util- 528 ity, which is not part of NetBSD, but which can be 529 installed from pkgsrc/sysutils/cdrtools. 530 531 iso-image-source 532 Create a NetBSD installation CD-ROM image in the 533 RELEASEDIR/iso directory. The CD-ROM file system will have 534 a layout as described in release(7). It will have top 535 level directories for the machine type and source. 536 537 For most machine types, the CD-ROM will be bootable, and 538 will automatically run the sysinst(8) menu-based installa- 539 tion program, which can be used to install or upgrade a 540 NetBSD system. Bootable CD-ROMs also contain tools that 541 may be useful in repairing a damaged NetBSD installation. 542 543 Before ``make iso-image-source'' is attempted, RELEASEDIR 544 must be populated by ``make sourcesets release'' or equiva- 545 lent. 546 547 Note that other, smaller, CD-ROM images may be created in 548 the RELEASEDIR/RELEASEMACHINEDIR/installation/cdrom direc- 549 tory by ``make release''. These smaller images usually 550 contain the same tools as the larger images in 551 RELEASEDIR/iso, but do not contain additional content such 552 as the distribution sets. 553 554 Note that the mac68k port still uses an older method of 555 creating CD-ROM images. This requires the mkisofs(1) util- 556 ity, which is not part of NetBSD, but which can be 557 installed from pkgsrc/sysutils/cdrtools. 558 559 regression-tests 560 Can only be run after building the regression tests in the 561 directory ``regress''. Runs the compiled regression tests 562 on the local host. 563 564 The "build.sh" script 565 This script file is a Bourne shell script designed to build the entire 566 NetBSD system on any host with a Bourne shell in /bin/sh, including many 567 that are not POSIX compliant. Note that if a host system's /bin/sh is 568 unusually old and broken, the Korn Shell (/bin/ksh), if available, may be 569 a usable alternative. 570 571 All cross-compile builds, and most native builds, of the entire system 572 should make use of build.sh rather than just running ``make''. This way, 573 the make(1) program will be bootstrapped properly, in case the host sys- 574 tem has an older or incompatible ``make'' program. 575 576 When compiling the entire system via build.sh, many make(1) variables are 577 set for you in order to help encapsulate the build process. In the list 578 of options below, variables that are automatically set by build.sh are 579 noted where applicable. 580 581 The following operations are supported by build.sh: 582 583 build Build the system as per ``make build''. This option 584 implies the obj and tools operations. 585 586 distribution Build a full distribution as per ``make distribution''. 587 This option implies the build operation. 588 589 release Build a full release as per ``make release''. This option 590 implies the distribution operation. 591 592 makewrapper Create the nbmake-MACHINE wrapper. This operation is auto- 593 matically performed for any of the other operations. 594 595 obj Perform ``make obj''. 596 597 tools Build and install the host tools from src/tools. 598 599 install=idir Install the contents of DESTDIR to idir, using ``make 600 installworld''. Note that files that are part of the 601 ``etc'' or ``xetc'' sets will not be installed. 602 603 kernel=kconf Build a new kernel. The kconf argument is the name of a 604 configuration file suitable for use by config(1). If kconf 605 does not contain any `/' characters, the configuration file 606 is expected to be found in the KERNCONFDIR directory, which 607 is typically sys/arch/MACHINE/conf. The new kernel will be 608 built in a subdirectory of KERNOBJDIR, which is typically 609 sys/arch/MACHINE/compile or an associated object directory. 610 In order to ensure that the kernel is built using up-to- 611 date tools, it is strongly recommended that the tools be 612 rebuilt (using the tools operation). 613 614 releasekernel=kconf 615 Install a gzip(1)ed copy of the kernel built by 616 kernel=kconf into 617 RELEASEDIR/RELEASEMACHINEDIR/binary/kernel, usually as 618 netbsd-kconf.gz, although the ``netbsd'' prefix is deter- 619 mined from the ``config'' directives in kconf. 620 621 sets Perform ``make sets''. 622 623 sourcesets Perform ``make sourcesets''. 624 625 syspkgs Perform ``make syspkgs''. 626 627 iso-image Perform ``make iso-image''. 628 629 iso-image-source 630 Perform ``make iso-image-source''. 631 632 The following command line options alter the behaviour of the build.sh 633 operations described above: 634 635 -a arch Set the value of MACHINE_ARCH to arch. 636 637 -B buildid 638 Set the value of BUILDID to buildid. This will also append the 639 build identifier to the name of the ``make'' wrapper script so 640 that the resulting name is of the form 641 ``nbmake-MACHINE-BUILDID''. 642 643 -C cdextras 644 Set the value of CDEXTRA to cdextras which is a space-separated 645 list of files or directories which will be added in order to 646 the CD-ROM image when used in conjunction with ``iso-image'' or 647 ``iso-image-source''. Files will be added to the root of the 648 CD-ROM image, whereas directories will be copied recursively. 649 If relative paths are specified, they will be converted to 650 absolute paths before being used. 651 652 -D dest Set the value of DESTDIR to dest. If a relative path is speci- 653 fied, it will be converted to an absolute path before being 654 used. 655 656 -E Set `expert' mode. This overrides various sanity checks, and 657 allows: DESTDIR does not have to be set to a non-root path for 658 builds, and MKUNPRIVED=yes does not have to be set when build- 659 ing as a non-root user. 660 661 Note: It is highly recommended that you know what you are doing 662 when you use this option. 663 664 -h Print a help message. 665 666 -j njob Passed through to make(1). Makefiles should use .WAIT or have 667 explicit dependancies as necessary to enforce build ordering. 668 If you see build failures with -j, please save complete build 669 logs so the failures can be analyzed. 670 671 -M obj Set MAKEOBJDIRPREFIX to obj. If a relative path is specified, 672 it will be converted to an absolute path before being used. 673 Unsets MAKEOBJDIR. 674 675 -m mach Set the value of MACHINE to mach, except in some special cases 676 listed below. This will also override any value of 677 MACHINE_ARCH in the process environment with a value deduced 678 from mach, unless -a is specified. All cross builds require 679 -m, but if unset on a NetBSD host, the host's value of MACHINE 680 will be detected and used automatically. 681 682 Some machines support multiple values for MACHINE_ARCH. The 683 following special cases for the mach argument are defined to 684 set the listed values of MACHINE and MACHINE_ARCH: 685 686 mach MACHINE MACHINE_ARCH 687 evbarm evbarm (not set) 688 evbarm-eb evbarm armeb 689 evbarm-el evbarm arm 690 evbmips evbmips (not set) 691 evbmips-eb evbmips mipseb 692 evbmips-el evbmips mipsel 693 evbsh3 evbsh3 (not set) 694 evbsh3-eb evbsh3 sh3eb 695 evbsh3-el evbsh3 sh3el 696 sbmips sbmips (not set) 697 sbmips-eb sbmips mipseb 698 sbmips-el sbmips mipsel 699 700 -N noiselevel 701 Set the ``noisyness'' level of the build, by setting 702 MAKEVERBOSE to noiselevel. 703 704 -n Show the commands that would be executed by build.sh, but do 705 not make any changes. This is similar in concept to ``make 706 -n''. 707 708 -O obj Create an appropriate transform macro for MAKEOBJDIR that will 709 place the built object files under obj. If a relative path is 710 specified, it will be converted to an absolute path before 711 being used. For instance, a setting of /usr/obj will place 712 build-time files under /usr/obj/bin, /usr/obj/lib, 713 /usr/obj/usr.bin, and so forth. Unsets MAKEOBJDIRPREFIX. 714 715 -o Set the value of MKOBJDIRS to ``no''. Otherwise, it will be 716 automatically set to ``yes'' (which is opposite to the default 717 behaviour). 718 719 -R rel Set the value of RELEASEDIR to rel. If a relative path is 720 specified, it will be converted to an absolute path before 721 being used. 722 723 -r Remove the contents of DESTDIR and TOOLDIR before building 724 (provides a clean starting point). This will skip deleting 725 DESTDIR if building on a native system to the root directory. 726 727 -T tools Set the value of TOOLDIR to tools. If a relative path is spec- 728 ified, it will be converted to an absolute path before being 729 used. If set, the bootstrap ``make'' will only be rebuilt as 730 needed (when the source files for make(1) change). 731 732 -U Set MKUNPRIVED=yes. 733 734 -u Set MKUPDATE=yes. 735 736 -V var=[value] 737 Set the environment variable var to an optional value. This is 738 propagated to the nbmake wrapper. 739 740 -w wrapper 741 Create the nbmake wrapper script (see below) in a custom loca- 742 tion, specified by wrapper. This allows, for instance, to 743 place the wrapper in PATH automatically. Note that wrapper is 744 the full name of the file, not just a directory name. If a 745 relative path is specified, it will be converted to an absolute 746 path before being used. 747 748 -X x11src 749 Set the value of X11SRCDIR to x11src. If a relative path is 750 specified, it will be converted to an absolute path before 751 being used. 752 753 -x Set MKX11=yes. 754 755 -Z var Unset ("zap") the environment variable var. This is propagated 756 to the nbmake wrapper. 757 758 The "nbmake-MACHINE" wrapper script 759 If using the build.sh script to build NetBSD, a nbmake-MACHINE script 760 will be created in TOOLDIR/bin upon the first build to assist in building 761 subtrees on a cross-compile host. 762 763 nbmake-MACHINE can be invoked in lieu of make(1), and will instead call 764 the up-to-date version of ``nbmake'' installed into TOOLDIR/bin with sev- 765 eral key variables pre-set, including MACHINE, MACHINE_ARCH, and TOOLDIR. 766 build.sh will also set variables specified with -V, and unset variables 767 specified with -Z. 768 769 This script can be symlinked into a directory listed in PATH, or called 770 with an absolute path. 771 772EXAMPLES 773 1. % ./build.sh tools kernel=GENERIC 774 775 Build a new toolchain, and use the new toolchain to configure and 776 build a new GENERIC kernel. 777 778 2. % ./build.sh -U distribution 779 780 Using unprivileged mode, build a complete distribution to a DESTDIR 781 directory that build.sh selects (and will display). 782 783 3. # ./build.sh -U install=/ 784 785 As root, install to / the distribution that was built by example 2. 786 Even though this is run as root, -U is required so that the permis- 787 sions stored in DESTDIR/METALOG are correctly applied to the files 788 as they're copied to /. 789 790 4. % ./build.sh -U -u release 791 792 Using unprivileged mode, build a complete release to DESTDIR and 793 RELEASEDIR directories that build.sh selects (and will display). 794 MKUPDATE=yes (-u) is set to prevent the ``make cleandir'', so that 795 if this is run after example 2, it doesn't need to redo that portion 796 of the release build. 797 798OBSOLETE VARIABLES 799 NBUILDJOBS Use the make(1) option -j, instead. 800 801 USE_NEW_TOOLCHAIN 802 The new toolchain is now the default. To disable, use 803 TOOLCHAIN_MISSING=yes. 804 805SEE ALSO 806 make(1), hier(7), release(7), etcupdate(8), postinstall(8), sysinst(8), 807 pkgsrc/sysutils/cdrtools 808 809HISTORY 810 The build.sh based build scheme was introduced for NetBSD 1.6 as 811 USE_NEW_TOOLCHAIN, and re-worked to TOOLCHAIN_MISSING after that. 812 813BUGS 814 A few platforms are not yet using this build system. 815 816NetBSD March 18, 2008 NetBSD 817