1 BUILDING(8) NetBSD System Manager's Manual BUILDING(8)
4 BUILDING -- Procedure for building NetBSD from source code.
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
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.)
22 This document (in -mdoc troff format; the original copy).
24 BUILDING This document (in plaintext).
27 Special notes for cross-hosting a NetBSD build on non-
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.)
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.
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
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
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.
58 Regression test harness. Can be cross-compiled, but only
59 run natively. tests/ uses the atf(7) test framework;
60 regress/ contains older tests that have not yet been
63 sys/ NetBSD kernel sources.
65 tools/ ``Reachover'' build structure for the host build tools.
66 This has a special method of determining out-of-date sta-
70 Sources to the NetBSD userland (non-kernel) programs. If
71 any of these directories are missing, they will be skipped
74 x11/ ``Reachover'' build structure for X11R6; the source is in
78 The NetBSD build tree is described in hier(7), and the release layout is
79 described in release(7).
83 Several environment variables control the behaviour of NetBSD builds.
85 HOST_SH Path name to a POSIX-compliant shell. If this is not
86 set explicitly, then the default is set using heuris-
87 tics dependent on the host platform, or from the shell
88 under which build.sh is executed (if that can be deter-
89 mined), or using the first copy of sh found in PATH.
90 If the host system's /bin/sh is not POSIX-compliant, we
91 suggest that you build using commands like
93 HOST_SH=/path/to/working/shell
95 ${HOST_SH} build.sh [options]
97 HOST_CC Path name to C compiler used to create the toolchain.
99 HOST_CXX Path name to C++ compiler used to create the toolchain.
101 MACHINE Machine type, e.g., ``macppc''.
103 MACHINE_ARCH Machine architecture, e.g., ``powerpc''.
105 MAKE Path name to invoke make(1) as.
107 MAKEFLAGS Flags to invoke make(1) with.
109 MAKEOBJDIR Directory to use as the .OBJDIR for the current direc-
110 tory. The value is subjected to variable expansion by
111 make(1). Typical usage is to set this variable to a
112 value involving the use of `${.CURDIR:S...}' or
113 `${.CURDIR:C...}', to derive the value of .OBJDIR from
114 the value of .CURDIR. Used only if MAKEOBJDIRPREFIX is
115 not defined. MAKEOBJDIR can be provided only in the
116 environment or via the -O flag of build.sh; it cannot
117 usefully be set inside a Makefile.
119 MAKEOBJDIRPREFIX Top level directory of the object directory tree. If
120 specified, must be an absolute path. If this is
121 defined, ${MAKEOBJDIRPREFIX}/${.CURDIR} is used as the
122 .OBJDIR for the current directory. The current direc-
123 tory may be read only. MAKEOBJDIRPREFIX can be pro-
124 vided only in the environment or via the -M flag of
125 build.sh; it cannot usefully be set inside a Makefile.
128 Several variables control the behavior of NetBSD builds. Unless other-
129 wise specified, these variables may be set in either the process environ-
130 ment or the make(1) configuration file specified by MAKECONF.
132 BUILDID Identifier for the build. The identifier will be appended to
133 object directory names, and can be consulted in the make(1)
134 configuration file in order to set additional build parame-
135 ters, such as compiler flags.
137 BUILDSEED GCC uses random numbers when compiling C++ code. This vari-
138 able seeds the gcc random number generator using the -fran-
139 dom-seed flag with this value. By default, it is set to
140 NetBSD-(majorversion). Using a fixed value causes C++ bina-
141 ries to be the same when built from the same sources. Addi-
142 tional information is available in the GCC documentation of
145 DESTDIR Directory to contain the built NetBSD system. If set, spe-
146 cial options are passed to the compilation tools to prevent
147 their default use of the host system's /usr/include,
148 /usr/lib, and so forth. This pathname must be an absolute
149 path, and should not end with a slash (/) character. (For
150 installation into the system's root directory, set DESTDIR to
151 an empty string, not to ``/''). The directory must reside on
152 a file system which supports long file names and hard links.
154 Default: Empty string if USETOOLS is ``yes''; unset other-
157 Note: build.sh will provide a default of destdir.MACHINE (in
158 the top-level .OBJDIR) unless run in `expert' mode.
160 MAKECONF The name of the make(1) configuration file. Only settable in
161 the process environment.
163 Default: ``/etc/mk.conf''
166 Level of verbosity of status messages. Supported values:
168 0 No descriptive messages are shown.
170 1 Descriptive messages are shown.
172 2 Descriptive messages (prefixed with a `#') and command
173 output is not suppressed.
177 MKCATPAGES Can be set to ``yes'' or ``no''. Indicates whether prefor-
178 matted plaintext manual pages will be created during a build.
182 MKCRYPTO Can be set to ``yes'' or ``no''. Indicates whether crypto-
183 graphic code will be included in a build; provided for the
184 benefit of countries that do not allow strong cryptography.
185 Will not affect use of the standard low-security password
186 encryption system, crypt(3).
190 MKDOC Can be set to ``yes'' or ``no''. Indicates whether system
191 documentation destined for DESTDIR/usr/share/doc will be
192 installed during a build.
196 MKHOSTOBJ Can be set to ``yes'' or ``no''. If set to ``yes'', then for
197 programs intended to be run on the compile host, the name,
198 release, and architecture of the host operating system will
199 be suffixed to the name of the object directory created by
200 ``make obj''. (This allows multiple host systems to compile
201 NetBSD for a single target.) If set to ``no'', then programs
202 built to be run on the compile host will use the same object
203 directory names as programs built to be run on the target.
207 MKINFO Can be set to ``yes'' or ``no''. Indicates whether GNU Info
208 files, used for the documentation for most of the compilation
209 tools, will be created and installed during a build.
213 MKLINT Can be set to ``yes'' or ``no''. Indicates whether lint(1)
214 will be run against portions of the NetBSD source code during
215 the build, and whether lint libraries will be installed into
216 DESTDIR/usr/libdata/lint.
220 MKMAN Can be set to ``yes'' or ``no''. Indicates whether manual
221 pages will be installed during a build.
225 MKNLS Can be set to ``yes'' or ``no''. Indicates whether Native
226 Language System locale zone files will be compiled and
227 installed during a build.
231 MKOBJ Can be set to ``yes'' or ``no''. Indicates whether object
232 directories will be created when running ``make obj''. If
233 set to ``no'', then all built files will be located inside
234 the regular source tree.
238 Note that setting MKOBJ to ``no'' is not recommended and may
239 cause problems when updating the tree with cvs(1).
241 MKPIC Can be set to ``yes'' or ``no''. Indicates whether shared
242 objects and libraries will be created and installed during a
243 build. If set to ``no'', the entire built system will be
246 Default: Platform dependent. As of this writing, all plat-
247 forms except sh3 default to ``yes''.
250 Can be set to ``yes'' or ``no''. Indicates whether the ar(1)
251 format libraries (lib*_pic.a), used to generate shared
252 libraries, are installed during a build.
256 MKPROFILE Can be set to ``yes'' or ``no''. Indicates whether profiled
257 libraries (lib*_p.a) will be built and installed during a
260 Default: ``yes''; however, some platforms turn off MKPROFILE
261 by default at times due to toolchain problems with profiled
264 MKSHARE Can be set to ``yes'' or ``no''. Indicates whether files
265 destined to reside in DESTDIR/usr/share will be built and
266 installed during a build. If set to ``no'', then all of
267 MKCATPAGES, MKDOC, MKINFO, MKMAN, and MKNLS will be set to
268 ``no'' unconditionally.
272 MKTTINTERP Can be set to ``yes'' or ``no''. For X builds, decides if
273 the TrueType bytecode interpreter is turned on. See
274 http://www.freetype.org/patents.html for details.
278 MKUNPRIVED Can be set to ``yes'' or ``no''. Indicates whether an
279 unprivileged install will occur. The user, group, permis-
280 sions, and file flags, will not be set on the installed
281 items; instead the information will be appended to a file
282 called METALOG in DESTDIR. The contents of METALOG are used
283 during the generation of the distribution tar files to ensure
284 that the appropriate file ownership is stored.
288 MKUPDATE Can be set to ``yes'' or ``no''. Indicates whether all
289 install operations intended to write to DESTDIR will compare
290 file timestamps before installing, and skip the install phase
291 if the destination files are up-to-date. This also has
292 implications on full builds (see next subsection).
296 MKX11 Can be set to ``yes'' or ``no''. Indicates whether X11R6 is
297 built from X11SRCDIR.
299 Mutually exclusive to MKXORG != no.
303 MKXORG Can be set to ``yes'' or ``no''. Indicates whether X11R7
304 (modular Xorg) is built from X11SRCDIR.
306 Mutually exclusive to MKX11 != no.
310 TOOLDIR Directory to hold the host tools, once built. If specified,
311 must be an absolute path. This directory should be unique to
312 a given host system and NetBSD source tree. (However, multi-
313 ple targets may share the same TOOLDIR; the target-dependent
314 files have unique names.) If unset, a default based on the
315 uname(1) information of the host platform will be created in
320 USETOOLS Indicates whether the tools specified by TOOLDIR should be
321 used as part of a build in progress. Must be set to ``yes''
324 yes Use the tools from TOOLDIR.
326 no Do not use the tools from TOOLDIR, but refuse to build
327 native compilation tool components that are version-
328 specific for that tool.
330 never Do not use the tools from TOOLDIR, even when building
331 native tool components. This is similar to the tradi-
332 tional NetBSD build method, but does not verify that
333 the compilation tools in use are up-to-date enough in
334 order to build the tree successfully. This may cause
335 build or runtime problems when building the whole
338 Default: ``yes'', unless TOOLCHAIN_MISSING is set to ``yes''.
340 USETOOLS is also set to ``no'' when using <bsd.*.mk> outside
341 the NetBSD source tree.
343 X11SRCDIR Directory containing the X11R6 source. If specified, must be
344 an absolute path. The main X11R6 source is found in
347 Default: ``/usr/xsrc''
349 "make" variables for full builds
350 These variables only affect the top level ``Makefile'' and do not affect
351 manually building subtrees of the NetBSD source code.
353 INSTALLWORLDDIR Location for the ``make installworld'' target to install
354 to. If specified, must be an absolute path.
358 MKOBJDIRS Can be set to ``yes'' or ``no''. Indicates whether
359 object directories will be created automatically (via a
360 ``make obj'' pass) at the start of a build.
364 If using build.sh, the default is ``yes''. This may be
365 set back to ``no'' by giving build.sh the -o option.
367 MKUPDATE Can be set to ``yes'' or ``no''. If set, then in addi-
368 tion to the effects described for MKUPDATE=yes above,
369 this implies the effects of NOCLEANDIR (i.e., ``make
370 cleandir'' is avoided).
374 If using build.sh, this may be set by giving the -u
377 NBUILDJOBS Now obsolete. Use the make(1) option -j, instead. See
382 NOCLEANDIR If set, avoids the ``make cleandir'' phase of a full
383 build. This has the effect of allowing only changed
384 files in a source tree to be recompiled. This can speed
385 up builds when updating only a few files in the tree.
391 NODISTRIBDIRS If set, avoids the ``make distrib-dirs'' phase of a full
392 build. This skips running mtree(8) on DESTDIR, useful
393 on systems where building as an unprivileged user, or
394 where it is known that the system-wide mtree files have
399 NOINCLUDES If set, avoids the ``make includes'' phase of a full
400 build. This has the effect of preventing make(1) from
401 thinking that some programs are out-of-date simply
402 because the system include files have changed. However,
403 this option should not be used when updating the entire
404 NetBSD source tree arbitrarily; it is suggested to use
405 MKUPDATE=yes instead in that case.
409 RELEASEDIR If set, specifies the directory to which a release(7)
410 layout will be written at the end of a ``make release''.
411 If specified, must be an absolute path.
415 Note: build.sh will provide a default of releasedir (in
416 the top-level .OBJDIR) unless run in `expert' mode.
419 "make" command line options
420 This is not a summary of all the options available to make(1); only the
421 options used most frequently with NetBSD builds are listed here.
423 -j njob Run up to njob make(1) subjobs in parallel. Makefiles should
424 use .WAIT or have explicit dependencies as necessary to
425 enforce build ordering.
427 -m dir Specify the default directory for searching for system Make-
428 file segments, mainly the <bsd.*.mk> files. When building any
429 full NetBSD source tree, this should be set to the
430 ``share/mk'' directory in the source tree. This is set auto-
431 matically when building from the top level, or when using
434 -n Display the commands that would have been executed, but do not
435 actually execute them. This will still cause recursion to
438 -V var Print make(1)'s idea of the value of var. Does not build any
441 var=value Set the variable var to value, overriding any setting speci-
442 fied by the process environment, the MAKECONF configuration
443 file, or the system Makefile segments.
446 These default targets may be built by running make(1) in any subtree of
447 the NetBSD source code. It is recommended that none of these be used
448 from the top level Makefile; as a specific exception, ``make obj'' and
449 ``make cleandir'' are useful in that context.
451 all Build programs, libraries, and preformatted documentation.
453 clean Remove program and library object code files.
455 cleandir Same as clean, but also remove preformatted documentation,
456 dependency files generated by ``make depend'', and any other
457 files known to be created at build time.
459 depend Create dependency files (.depend) containing more detailed
460 information about the dependencies of source code on header
461 files. Allows programs to be recompiled automatically when a
464 dependall Does a ``make depend'' immediately followed by a ``make all''.
465 This improves cache locality of the build since both passes
466 read the source files in their entirety.
468 distclean Synonym for cleandir.
470 includes Build and install system header files. Typically needed
471 before any system libraries or programs can be built.
473 install Install programs, libraries, and documentation into DESTDIR.
474 Few files will be installed to DESTDIR/dev, DESTDIR/etc,
475 DESTDIR/root or DESTDIR/var in order to prevent user supplied
476 configuration data from being overwritten.
478 lint Run lint(1) against the C source code, where appropriate, and
479 generate system-installed lint libraries.
481 obj Create object directories to be used for built files, instead
482 of building directly in the source tree.
484 tags Create ctags(1) searchable function lists usable by the ex(1)
485 and vi(1) text editors.
487 "make" targets for the top level
488 Additional make(1) targets are usable specifically from the top source
489 level to facilitate building the entire NetBSD source tree.
491 build Build the entire NetBSD system (except the kernel). This
492 orders portions of the source tree such that prerequisites
493 will be built in the proper order.
495 distribution Do a ``make build'', and then install a full distribution
496 (which does not include a kernel) into DESTDIR, including
497 files in DESTDIR/dev, DESTDIR/etc, DESTDIR/root and
500 buildworld As per ``make distribution'', except that it ensures that
501 DESTDIR is not the root directory.
503 installworld Install the distribution from DESTDIR to INSTALLWORLDDIR,
504 which defaults to the root directory. Ensures that
505 INSTALLWORLDDIR is not the root directory if cross compil-
508 The INSTALLSETS environment variable may be set to a list
509 of distribution sets to be installed. By default, all sets
510 except ``etc'' and ``xetc'' are installed, so most files in
511 INSTALLWORLDDIR/etc will not be installed or modified.
513 Note: Before performing this operation with
514 INSTALLWORLDDIR=/, it is highly recommended that you
515 upgrade your kernel and reboot. After performing this
516 operation, it is recommended that you use etcupdate(8) to
517 update files in INSTALLWORLDDIR/etc and that you use
518 postinstall(8) to check for inconsistencies (and possibly
521 sets Create distribution sets from DESTDIR into
522 RELEASEDIR/RELEASEMACHINEDIR/binary/sets. Should be run
523 after ``make distribution'', as ``make build'' alone does
524 not install all of the required files.
526 sourcesets Create source sets of the source tree into
527 RELEASEDIR/source/sets.
529 syspkgs Create syspkgs from DESTDIR into
530 RELEASEDIR/RELEASEMACHINEDIR/binary/syspkgs. Should be run
531 after ``make distribution'', as ``make build'' alone does
532 not install all of the required files.
534 release Do a ``make distribution'', build kernels, distribution
535 media, and install sets (this as per ``make sets''), and
536 then package the system into a standard release layout as
537 described by release(7). This requires that RELEASEDIR be
540 iso-image Create a NetBSD installation CD-ROM image in the
541 RELEASEDIR/iso directory. The CD-ROM file system will have
542 a layout as described in release(7).
544 For most machine types, the CD-ROM will be bootable, and
545 will automatically run the sysinst(8) menu-based installa-
546 tion program, which can be used to install or upgrade a
547 NetBSD system. Bootable CD-ROMs also contain tools that
548 may be useful in repairing a damaged NetBSD installation.
550 Before ``make iso-image'' is attempted, RELEASEDIR must be
551 populated by ``make release'' or equivalent.
553 Note that other, smaller, CD-ROM images may be created in
554 the RELEASEDIR/RELEASEMACHINEDIR/installation/cdrom direc-
555 tory by ``make release''. These smaller images usually
556 contain the same tools as the larger images in
557 RELEASEDIR/iso, but do not contain additional content such
558 as the distribution sets.
560 Note that the mac68k port still uses an older method of
561 creating CD-ROM images. This requires the mkisofs(1) util-
562 ity, which is not part of NetBSD, but which can be
563 installed from pkgsrc/sysutils/cdrtools.
566 Create a NetBSD installation CD-ROM image in the
567 RELEASEDIR/iso directory. The CD-ROM file system will have
568 a layout as described in release(7). It will have top
569 level directories for the machine type and source.
571 For most machine types, the CD-ROM will be bootable, and
572 will automatically run the sysinst(8) menu-based installa-
573 tion program, which can be used to install or upgrade a
574 NetBSD system. Bootable CD-ROMs also contain tools that
575 may be useful in repairing a damaged NetBSD installation.
577 Before ``make iso-image-source'' is attempted, RELEASEDIR
578 must be populated by ``make sourcesets release'' or equiva-
581 Note that other, smaller, CD-ROM images may be created in
582 the RELEASEDIR/RELEASEMACHINEDIR/installation/cdrom direc-
583 tory by ``make release''. These smaller images usually
584 contain the same tools as the larger images in
585 RELEASEDIR/iso, but do not contain additional content such
586 as the distribution sets.
588 Note that the mac68k port still uses an older method of
589 creating CD-ROM images. This requires the mkisofs(1) util-
590 ity, which is not part of NetBSD, but which can be
591 installed from pkgsrc/sysutils/cdrtools.
594 Can only be run after building the regression tests in the
595 directory ``regress''. Runs those compiled regression
596 tests on the local host. Note that most tests are now man-
597 aged instead using atf(7); this target should probably run
598 those as well but currently does not.
600 The "build.sh" script
601 This script file is a Bourne shell script designed to build the entire
602 NetBSD system on any host with a Bourne shell in /bin/sh, including many
603 that are not POSIX compliant. Note that if a host system's /bin/sh is
604 unusually old and broken, the Korn Shell (/bin/ksh), if available, may be
605 a usable alternative.
607 All cross-compile builds, and most native builds, of the entire system
608 should make use of build.sh rather than just running ``make''. This way,
609 the make(1) program will be bootstrapped properly, in case the host sys-
610 tem has an older or incompatible ``make'' program.
612 When compiling the entire system via build.sh, many make(1) variables are
613 set for you in order to help encapsulate the build process. In the list
614 of options below, variables that are automatically set by build.sh are
615 noted where applicable.
617 The following operations are supported by build.sh:
619 build Build the system as per ``make build''. Before the main
620 part of the build commences, this command runs the obj
621 operation (unless the -o option is given), ``make
622 cleandir'' (unless the -u option is given), and the tools
625 distribution Build a full distribution as per ``make distribution''.
626 This command first runs the build operation.
628 release Build a full release as per ``make release''. This command
629 first runs the distribution operation.
631 makewrapper Create the nbmake-MACHINE wrapper. This operation is auto-
632 matically performed for any of the other operations.
634 cleandir Perform ``make cleandir''.
636 obj Perform ``make obj''.
638 tools Build and install the host tools from src/tools. This com-
639 mand will first run ``make obj'' and ``make cleandir'' in
640 the tools subdirectory unless the -o or -u options (respec-
643 install=idir Install the contents of DESTDIR to idir, using ``make
644 installworld''. Note that files that are part of the
645 ``etc'' or ``xetc'' sets will not be installed.
647 kernel=kconf Build a new kernel. The kconf argument is the name of a
648 configuration file suitable for use by config(1). If kconf
649 does not contain any `/' characters, the configuration file
650 is expected to be found in the KERNCONFDIR directory, which
651 is typically sys/arch/MACHINE/conf. The new kernel will be
652 built in a subdirectory of KERNOBJDIR, which is typically
653 sys/arch/MACHINE/compile or an associated object directory.
655 This command does not imply the tools command; run the
656 tools command first unless it is certain that the tools
657 already exist and are up to date.
659 This command will run ``make cleandir'' on the kernel in
660 question first unless the -u option is given.
663 Install a gzip(1)ed copy of the kernel previously built by
665 RELEASEDIR/RELEASEMACHINEDIR/binary/kernel, usually as
666 netbsd-kconf.gz, although the ``netbsd'' prefix is deter-
667 mined from the ``config'' directives in kconf.
669 sets Perform ``make sets''.
671 sourcesets Perform ``make sourcesets''.
673 syspkgs Perform ``make syspkgs''.
675 iso-image Perform ``make iso-image''.
678 Perform ``make iso-image-source''.
680 The following command line options alter the behaviour of the build.sh
681 operations described above:
683 -a arch Set the value of MACHINE_ARCH to arch.
686 Set the value of BUILDID to buildid. This will also append the
687 build identifier to the name of the ``make'' wrapper script so
688 that the resulting name is of the form
689 ``nbmake-MACHINE-BUILDID''.
692 Set the value of CDEXTRA to cdextras which is a space-separated
693 list of files or directories which will be added in order to
694 the CD-ROM image when used in conjunction with ``iso-image'' or
695 ``iso-image-source''. Files will be added to the root of the
696 CD-ROM image, whereas directories will be copied recursively.
697 If relative paths are specified, they will be converted to
698 absolute paths before being used.
700 -D dest Set the value of DESTDIR to dest. If a relative path is speci-
701 fied, it will be converted to an absolute path before being
704 -E Set `expert' mode. This overrides various sanity checks, and
705 allows: DESTDIR does not have to be set to a non-root path for
706 builds, and MKUNPRIVED=yes does not have to be set when build-
707 ing as a non-root user.
709 Note: It is highly recommended that you know what you are doing
710 when you use this option.
712 -h Print a help message.
714 -j njob Run up to njob make(1) subjobs in parallel; passed through to
715 make(1). If you see failures for reasons other than running
716 out of memory while using build.sh with -j, please save com-
717 plete build logs so the failures can be analyzed.
719 To achieve the fastest builds, -j values between (1 + the num-
720 ber of CPUs) and (2 * the number of CPUs) are recommended. Use
721 lower values on machines with limited memory or I/O bandwidth.
723 -M obj Set MAKEOBJDIRPREFIX to obj. For instance, if the source
724 directory is /usr/src, a setting of ``-M /usr/obj'' will place
725 build-time files under /usr/obj/usr/src/bin,
726 /usr/obj/usr/src/lib, /usr/obj/usr/src/usr.bin, and so forth.
727 If a relative path is specified, it will be converted to an
728 absolute path before being used. Unsets MAKEOBJDIR. See ``-O
729 -obj'' for more information.
731 -m mach Set the value of MACHINE to mach, except in some special cases
732 listed below. This will also override any value of
733 MACHINE_ARCH in the process environment with a value deduced
734 from mach, unless -a is specified. All cross builds require
735 -m, but if unset on a NetBSD host, the host's value of MACHINE
736 will be detected and used automatically.
738 Some machines support multiple values for MACHINE_ARCH. The
739 following special cases for the mach argument are defined to
740 set the listed values of MACHINE and MACHINE_ARCH:
742 mach MACHINE MACHINE_ARCH
743 evbarm evbarm (not set)
744 evbarm-eb evbarm armeb
746 evbmips evbmips (not set)
747 evbmips-eb evbmips mipseb
748 evbmips-el evbmips mipsel
749 evbsh3 evbsh3 (not set)
750 evbsh3-eb evbsh3 sh3eb
751 evbsh3-el evbsh3 sh3el
752 sbmips sbmips (not set)
753 sbmips-eb sbmips mipseb
754 sbmips-el sbmips mipsel
757 Set the ``noisyness'' level of the build, by setting
758 MAKEVERBOSE to noiselevel.
760 -n Show the commands that would be executed by build.sh, but do
761 not make any changes. This is similar in concept to ``make
764 -O obj Create an appropriate transform macro for MAKEOBJDIR that will
765 place the built object files under obj. For instance, a set-
766 ting of ``-O /usr/obj'' will place build-time files under
767 /usr/obj/bin, /usr/obj/lib, /usr/obj/usr.bin, and so forth. If
768 a relative path is specified, it will be converted to an abso-
769 lute path before being used. Unsets MAKEOBJDIRPREFIX.
771 In normal use, exactly one of the -M or -O options should be
772 specified. If the source directory is /usr/src and neither -M
773 nor -O is specified, then a default object directory will be
774 chosen according to rules in <bsd.obj.mk>; this default is usu-
775 ally either /usr/obj or /usr/obj.MACHINE.
777 -o Set the value of MKOBJDIRS to ``no''. Otherwise, it will be
778 automatically set to ``yes''. This default is opposite to the
779 behaviour when not using build.sh.
781 -R rel Set the value of RELEASEDIR to rel. If a relative path is
782 specified, it will be converted to an absolute path before
785 -r Remove the contents of DESTDIR and TOOLDIR before building
786 (provides a clean starting point). This will skip deleting
787 DESTDIR if building on a native system to the root directory.
789 -S seed Change the value of BUILDSEED to seed. This should rarely be
792 -T tools Set the value of TOOLDIR to tools. If a relative path is spec-
793 ified, it will be converted to an absolute path before being
794 used. If set, the bootstrap ``make'' will only be rebuilt if
795 the source files for make(1) have changed.
797 -U Set MKUNPRIVED=yes.
802 Set the environment variable var to an optional value. This is
803 propagated to the nbmake wrapper.
806 Create the nbmake wrapper script (see below) in a custom loca-
807 tion, specified by wrapper. This allows, for instance, to
808 place the wrapper in PATH automatically. Note that wrapper is
809 the full name of the file, not just a directory name. If a
810 relative path is specified, it will be converted to an absolute
811 path before being used.
814 Set the value of X11SRCDIR to x11src. If a relative path is
815 specified, it will be converted to an absolute path before
820 -Z var Unset ("zap") the environment variable var. This is propagated
821 to the nbmake wrapper.
823 The "nbmake-MACHINE" wrapper script
824 If using the build.sh script to build NetBSD, a nbmake-MACHINE script
825 will be created in TOOLDIR/bin upon the first build to assist in building
826 subtrees on a cross-compile host.
828 nbmake-MACHINE can be invoked in lieu of make(1), and will instead call
829 the up-to-date version of ``nbmake'' installed into TOOLDIR/bin with sev-
830 eral key variables pre-set, including MACHINE, MACHINE_ARCH, and TOOLDIR.
831 nbmake-MACHINE will also set variables specified with -V, and unset vari-
832 ables specified with -Z.
834 This script can be symlinked into a directory listed in PATH, or called
835 with an absolute path.
838 1. % ./build.sh tools kernel=GENERIC
840 Build a new toolchain, and use the new toolchain to configure and
841 build a new GENERIC kernel.
843 2. % ./build.sh -U distribution
845 Using unprivileged mode, build a complete distribution to a DESTDIR
846 directory that build.sh selects (and will display).
848 3. # ./build.sh -U install=/
850 As root, install to / the distribution that was built by example 2.
851 Even though this is run as root, -U is required so that the permis-
852 sions stored in DESTDIR/METALOG are correctly applied to the files
853 as they're copied to /.
855 4. % ./build.sh -U -u release
857 Using unprivileged mode, build a complete release to DESTDIR and
858 RELEASEDIR directories that build.sh selects (and will display).
859 MKUPDATE=yes (-u) is set to prevent the ``make cleandir'', so that
860 if this is run after example 2, it doesn't need to redo that portion
861 of the release build.
864 NBUILDJOBS Use the make(1) option -j instead.
867 The new toolchain is now the default. To disable, use
868 TOOLCHAIN_MISSING=yes.
871 make(1), hier(7), release(7), etcupdate(8), postinstall(8), sysinst(8),
872 pkgsrc/sysutils/cdrtools
875 The build.sh based build scheme was introduced for NetBSD 1.6 as
876 USE_NEW_TOOLCHAIN, and re-worked to TOOLCHAIN_MISSING after that.
878 NetBSD August 18, 2008 NetBSD