History log of /netbsd-current/BUILDING
Revision (<<< Hide revision tags) (Show revision tags >>>) Date Author Comments
# 1.160 22-Jul-2023 lukem

BUILDING: list known mk.conf vars. tweak section headers

List known supported and obsolete mk.conf(5) variables,
so that searches in this document at least find them.
This partially reverts my revision 1.144 on 2023-06-12
which completely removed the duplication with mk.conf(5).

Remove quote characters from some section headings;
it makes it harder to search for a section by known name
when rendering in markup variations that use smart quotes.


# 1.159 21-Jul-2023 lukem

BUILDING: clarify environ vs mk.conf behaviour

Document that variables set in the environment or the
nbmake-MACHINE wrapper script don't override variable
assignments in mk.conf(5), and that using ?= in mk.conf
allows environment / nbmake-MACHINE variables to override
mk.conf.

Consistently refer to "nbmake-MACHINE wrapper script".


# 1.158 19-Jul-2023 lukem

BUILDING: consistency fix


# 1.157 18-Jul-2023 lukem

build.sh: use mk.conf (if present) as MAKECONF

Set MAKECONF to mk.conf in the same directory as build.sh
(i.e., the top of the source tree) if mk.conf is present.
This means unprivileged users can benefit from mk.conf(5)
semantics without write privileges to /etc/mk.conf, and
also simplifies per-source-directory configuration.

Fail early if $MAKECONF is empty, since build.sh will fail
anyway after rebuilding nbmake.

Ensure that the computed MAKECONF isn't empty, and then
always set MAKECONF in the makewrapper (nbmake-$MACHINE).

Improve some formatting consistency in BUILDING.mdoc,
(even if BUILDING is generated without markup).


# 1.156 05-Jul-2023 lukem

BUILDING: wording tweaks


# 1.155 11-Jun-2023 lukem

BUILDING: remove duplication from mk.conf(5)

Remove all "make" variables / mk.conf(5) variables already documented
in mk.conf(5). The duplication was a maintenance headache, as I've
experienced over recent weeks getting the build documentation up to
date.

Add notes clarifying that manual page references are to the NetBSD
manual pages, not to the host manual pages, and how to format from
source, or find online at https://man.netbsd.org.

Add explicit links to the mdoc(7) in-tree source for mk.conf(5),
hier(7), and release(7) because those are directly relevant to the host
build information in BUILDING.

Note: We don't normally need these notes for native documentation,
but BUILDING is intended for users on host systems which might not
be NetBSD(-current).

Add missing defaults.


# 1.154 11-Jun-2023 lukem

BUILDING: update from mk.conf(5). reorder

Sync variable entries from mk.conf(5).

Merge the "make variables for full builds" section into the previous.
Having two separate sections and some entries duplicated was confusing
when searching for variables.


# 1.153 11-Jun-2023 lukem

more NBUILDJOBS deprecation

The NBUILDJOBS option was deprecated in 2002;
there's no need to keep warning about it,
remove from params / show-params,
and only document as obsolete.


# 1.152 05-Jun-2023 lukem

BUILDING: editorial

MKX11=yes wants MKINET6=yes

Change the width of the variable lists to 14n (from 15n)
so that when the lists are rendered and then left aligned,
the column is 16 characters (aka 2 tabs) which makes
copypasta to bsd.README easier.


# 1.151 04-Jun-2023 lukem

BUILDING: update from canonical mk.conf(5)

Incorporate content and styles updates for mk.conf entries
from share/man/man5/mk.conf.5, which is the canonical
reference for mk.conf.

Add: BSDOBJDIR, BSDSRCDIR, EXTERNAL_TOOLCHAIN, MKDEBUGKERNEL,
MKDEBUGTOOLS, MKHTML, MKLINKLIB, MKOBJDIRS, TOOLCHAIN_MISSING,
NETBSDSRCDIR

It's for further study as to whether we just replace the
most of subsection "make" variables with a link to mk.conf(5).

Style:
- Add more .de macros per mk.conf.5.
- Order list items alphabetically. When multiple items are present
in a list item, sort within the item first.
- More cross-references.


# 1.150 02-Jun-2023 lukem

build.sh: MAKECONF and mk.conf(5) improvements

Move MAKECONF to the Environment variables section.
Add mk.conf(5) cross-references.
Make Notes more obvious.
Fix mandoc lint.


# 1.149 18-May-2023 lukem

BUILDING: TMPDIR must not be noexec

Describe $TMPDIR as used by build.sh, and
add a note that it can't be mounted noexec.

PR toolchain/44459


# 1.148 16-May-2023 lukem

build.sh, BUILDING: consistency improvements

Consistently use "show", instead of sometimes using "display" or "print".
Fix mdoc markup (even though BUILDING is raw text).
Document help, -P, -?


# 1.147 16-May-2023 lukem

BUILDING: update upstream, regen

doc/BUILDING.mdoc is the upstream for BUILDING, so add recent changes
in the latter to the former, formatting correctly.

Move INSTALLBOOT_UBOOT_PATHS to Environment variables.
Move INSTALLBOOT_BOARDS to "make" variables for full builds.
Add installboot(8) cross-reference.


Revision tags: netbsd-10-base
# 1.146 01-Oct-2022 rillig

fix documentation for MKLINT

Since share/mk/bsd.own.mk 1.749 from 2013-08-26, MKLINT defaults to no.


# 1.145 22-Aug-2022 brook

By default, do not install any bootable images.

The previous commit introduced the ability to install a set of
bootable images as a normal part of a release build. While this made
it easy to install bootable images, the contents of a release build
depend on whether or not U-Boot packages are installed in /usr/pkgsrc,
which is the default location searched by installboot(8).

This commit requires users to explicitly list the bootable images to
be installed, which by default is none (i.e., prior behavior).


# 1.144 21-Aug-2022 brook

Create bootable images in ${RELEASEDIR}/${RELEASEMACHINEDIR}/binary/gzimg.

Release builds for arm platforms create compressed images in
${RELEASEDIR}/${RELEASEMACHINEDIR}/binary/gzimg. However, in some
cases, e.g., armv7.img.gz, they are not bootable. Consequently, boot
blocks must be manually installed in the images, which is an extra
barrier for testing systems or adopting NetBSD. This has prompted
creation of external repositories, e.g., armbsd.org, to host a
collection of bootable images. However, this does not ease the burden
on developers compiling their own systems; for them, manual
installation of boot blocks is still required.

For arm platforms, etc/etc.evbarm/Makefile.inc contains the commands
used to create system images. Because installboot(8) can write boot
blocks directly to system images, a loop through possible boards can
create a series of bootable images during the normal build process.

In the case of many arm platforms, installboot(8) uses U-Boot boot
blocks, which are not part of the NetBSD source code. Developers can,
however, install as many U-Boot boot blocks as desired, either in the
default location of /usr/pkg/share/u-boot or in a set of directories
pointed to by the U-Boot search path, the INSTALLBOOT_UBOOT_PATHS
environment variable. For each board with an available boot block, a
board-specific bootable image will be created in
${RELEASEDIR}/${RELEASEMACHINEDIR}/binary/gzimg. If a boot block is
not available, which is the typical situation currently, no additional
image will be created.

This facility creates opportunities to build bootable images for any
number of boards within the scope of a standard release build.
However, that is not required and will not occur without the
intervention of installing U-Boot boot blocks prior to the build.


# 1.143 21-Aug-2022 lukem

BUILDING: regen for removal of extsrc/


# 1.142 28-May-2022 andvar

s/knowlege/knowledge/


# 1.141 20-Dec-2021 christos

Rename:
MKKDEBUG -> MKDEBUGKERNEL
MKTOOLSDEBUG -> MKDEBUGTOOLS
while keeping compatibility with the old names. Add missing documentation.
Now all debugging tunables are prefixed with MKDEBUG.


Revision tags: cjep_sun2x-base1 cjep_sun2x-base cjep_staticlib_x-base1 cjep_staticlib_x-base
# 1.140 10-Nov-2020 kamil

Reintroduce the support of MKCATPAGES

Requested by <mrg>


# 1.139 08-Nov-2020 kamil

Remove the support for MKCATPAGES

It was optional since 1999 and disabled by default since 2012.

Proposed on tech-userlevel@.


# 1.138 13-Oct-2020 thorpej

Document CPUFLAGS here (it's already documented in share/mk/bsd.README).
This will address the initial concern in PR port-alpha/55545.


# 1.137 12-Oct-2020 uwe

Mention HOST_CFLAGS and HOST_CXXFLAGS.


# 1.136 12-Oct-2020 uwe

Bump date and regen for BUILDING.mdoc revision 1.127
that introduced build.sh -c <compiler> option.


Revision tags: netbsd-9-3-RELEASE netbsd-9-2-RELEASE netbsd-9-1-RELEASE phil-wifi-20200421 phil-wifi-20200411 is-mlppp-base phil-wifi-20200406 netbsd-9-0-RELEASE netbsd-9-0-RC2 netbsd-9-0-RC1 phil-wifi-20191119 netbsd-9-base phil-wifi-20190609
# 1.135 08-May-2019 leot

Fix a typo

Reported by Tobias Ulmer via netbsd-docs@ ML, thanks!


Revision tags: pgoyette-compat-20190127 pgoyette-compat-20190118 pgoyette-compat-1226 pgoyette-compat-1126 pgoyette-compat-1020 pgoyette-compat-0930 pgoyette-compat-0906
# 1.134 29-Jul-2018 sevan

regen


Revision tags: pgoyette-compat-0728 phil-wifi-base pgoyette-compat-0625 pgoyette-compat-0521
# 1.133 02-May-2018 pgoyette

branches: 1.133.2;
Re-add files that were accidentally deleted in my previous commit.


# 1.132 02-May-2018 pgoyette

Synch with HEAD


Revision tags: pgoyette-compat-0502 pgoyette-compat-0422 pgoyette-compat-0415 pgoyette-compat-0407 pgoyette-compat-0330 pgoyette-compat-0322 pgoyette-compat-0315 pgoyette-compat-base
# 1.131 16-Feb-2018 leot

branches: 1.131.2;
regen


# 1.130 29-Dec-2017 sevan

regen


# 1.129 21-Oct-2017 sevan

regen


Revision tags: netbsd-8-2-RELEASE netbsd-8-1-RELEASE netbsd-8-1-RC1 netbsd-8-0-RELEASE netbsd-8-0-RC2 netbsd-8-0-RC1 matt-nb8-mediatek-base perseant-stdc-iso10646-base netbsd-8-base
# 1.128 21-May-2017 riastradh

regen


Revision tags: prg-localcount2-base3 prg-localcount2-base2 prg-localcount2-base1 prg-localcount2-base pgoyette-localcount-20170426
# 1.127 22-Apr-2017 plunky

regen


Revision tags: bouyer-socketcan-base1
# 1.126 20-Apr-2017 wiz

regen using regen target in doc.


# 1.125 20-Apr-2017 ozaki-r

Introduce MKSTRIPSYM build option

If it's yes, all local symbols of shared libraries are stripped
(default). If it's no, only temporary local symbols are stripped;
for example, symbols of static functions are kept. Keeping such
symbols is useful on using DTrace for userland libraries and
getting a backtrace from a rump server loading modules (shared
libraries).

Proposed and discussed on tech-kern and tech-toolchain


Revision tags: pgoyette-localcount-20170320
# 1.124 20-Feb-2017 christos

regen


# 1.123 16-Feb-2017 rin

The default values for MKPIC are yes and no for sh3 and m68000, respectively.
Bump date.


Revision tags: bouyer-socketcan-base pgoyette-localcount-20170107 pgoyette-localcount-20161104 localcount-20160914 pgoyette-localcount-20160806 pgoyette-localcount-20160726 pgoyette-localcount-base
# 1.122 29-Jan-2016 wiz

branches: 1.122.2; 1.122.4;
Document MKREPRO_TIMESTAMP.


# 1.121 23-Jul-2015 mrg

remove the xfree86 reachover makefiles and the vast majority of
the support in the rest of the source tree.

X11 sets could use some cleaning up perhaps (just deletion, as
we've never really marked the old X11R6 as obsolete for native
xorg using platforms so far either.)


# 1.120 07-Jun-2015 pgoyette

Update to reflect changes made in rev 1.398 of src/etc/Makefile


# 1.119 08-Apr-2015 wiz

regen


# 1.118 30-Nov-2014 uebayasi

regen


# 1.117 16-Nov-2014 uebayasi

regen


# 1.116 16-Nov-2014 uebayasi

regen


# 1.115 13-Nov-2014 apb

regen from doc/BUILDING.mdoc revision 1.107.
This reinstates documentation for "extsrc" which was lost in 2009.


# 1.114 08-Nov-2014 snj

fourth time's the charm, i guess. when committing a generated file,
it's best to use the latest revision of the source file (hi uebs!)

regen to include changes from revision 1.105 of doc/BUILDING.mdoc


# 1.113 06-Nov-2014 uebayasi

regen


# 1.112 06-Nov-2014 uebayasi

Expand TABs.


# 1.111 06-Nov-2014 uebayasi

Document the new "kernels" operation, prompted by joerg@.


# 1.110 05-Nov-2014 snj

regen


Revision tags: netbsd-7-base tls-earlyentropy-base tls-maxphys-base
# 1.109 07-Aug-2014 apb

branches: 1.109.2;
regen BUILDING from doc/BUILDING.mdoc


# 1.108 03-Aug-2014 apb

BUILDINFO part6: regen BUILDING from doc/BUILDING.mdoc


# 1.107 14-Jun-2014 apb

Regen from doc/BUILDING.mdoc;1.100:
Improve documentation for BUILDID.


# 1.106 21-May-2014 wiz

regen


Revision tags: yamt-pagecache-base9 riastradh-xf86-video-intel-2-7-1-pre-2-21-15 riastradh-drm2-base3 riastradh-drm2-base2 riastradh-drm2-base1 riastradh-drm2-base
# 1.105 29-May-2013 wiz

branches: 1.105.4;
regen using 'make regen' from src/doc.


# 1.104 29-May-2013 wiz

regen (using mandoc doc/BUILDING.mdoc > BUILDING -- let me know
if a different way is preferred, I see that it now contains formatting).


Revision tags: agc-symver-base yamt-pagecache-base8 yamt-pagecache-base7
# 1.103 08-Nov-2012 dholland

regen


Revision tags: yamt-pagecache-base6
# 1.102 19-Sep-2012 abs

regen


# 1.101 25-May-2012 wiz

branches: 1.101.2;
regen using 'make regen' in doc/


# 1.100 25-May-2012 wiz

Document MKREPRO using joerg's wording.


Revision tags: yamt-pagecache-base5 yamt-pagecache-base4
# 1.99 23-Feb-2012 tsutsui

Add a missing period.


Revision tags: netbsd-6-base
# 1.98 14-Feb-2012 apb

branches: 1.98.2;
Regen from revision 1.87 of doc/BUILDING.mdoc.


# 1.97 22-Jan-2012 tsutsui

Add "live-image" and "install-image" target support to build.sh.

"live-image" target builds pre-installed disk images that can be used on
emulators or boot from USB memory sticks to try NetBSD without installation.
Currently amd64, i386, pmax, sparc, sparc64, sun2, sun3, and vax
(which have working emulators and don't require extra tools like preparing
msdosfs or partitioning MD label structures) support this target.

"install-image" target builds an bootable installation disk image that can
be used as an install CD but burned into USB memory sticks etc.
Current only amd64 and i386 (which would support USB boot) have this target.

For more details (and known issue) see following posts on netbsd-bugs@:
http://mail-index.NetBSD.org/netbsd-bugs/2011/08/06/msg023639.html
http://mail-index.NetBSD.org/netbsd-bugs/2011/09/23/msg024207.html
http://mail-index.NetBSD.org/netbsd-bugs/2011/12/07/msg025166.html
http://mail-index.NetBSD.org/netbsd-bugs/2011/12/08/msg025178.html

No particular comments about implementation, and
"go ahead" comments from mrg@, riz@ and christos@.

Closes PR toolchain/45153 and PR misc/45155.


Revision tags: yamt-pagecache-base3 yamt-pagecache-base2 yamt-pagecache-base
# 1.96 09-Sep-2011 apb

branches: 1.96.2;
Add tests for the shell under which build.sh is run. If the
shell fails the tests, then build.sh tries to re-exec itself
under a more suitable shell.


# 1.95 09-Sep-2011 apb

Revisions 1.92 and 1.93 of src/BUILDING were not reflected in
src/doc/BUILDING.mdoc, so those changes were lost when src/BUILDING
was regenerated in revision 1.94.

Now update src/doc/BUILDING.mdoc and regenerate src/BUILDING to
reinstate the lost changes. (I also edited one of the changes, to use
the phrase "space-separated list" for consistency with other parts of
the document.)

The original changes were:


# 1.93 06-Aug-2011 jnemeth

Add description of MKKMOD, part of PR misc/45216


Revision tags: cherry-xenmp-base bouyer-quota2-nbase bouyer-quota2-base
# 1.92 29-Jan-2011 jym

Pass down INSTALLSETS variable to installsets target. Use :Q to escape
shell meta-characters, as the variable contains a list of sets, separated
by spaces.

$ ./build.sh -V INSTALLSETS="base etc" install=idir

should now work as expected.

Reviewed by apb@ on tech-toolchain.


# 1.94 09-Sep-2011 apb

Allow MAKEFLAGS to be set via build.sh -V. Somebody asked for this
in 2008.

Also add comments above a few functions in build.sh, and bump copyright
dates.


# 1.93 06-Aug-2011 jnemeth

Add description of MKKMOD, part of PR misc/45216


Revision tags: cherry-xenmp-base bouyer-quota2-nbase bouyer-quota2-base
# 1.92 29-Jan-2011 jym

Pass down INSTALLSETS variable to installsets target. Use :Q to escape
shell meta-characters, as the variable contains a list of sets, separated
by spaces.

$ ./build.sh -V INSTALLSETS="base etc" install=idir

should now work as expected.

Reviewed by apb@ on tech-toolchain.


Revision tags: matt-mips64-premerge-20101231
# 1.91 25-Jul-2010 mrg

branches: 1.91.2;
remove the MKSUBPIXEL/MKTTINTERP options; they're going away.

regenerate.


Revision tags: matt-premerge-20091211
# 1.90 30-Nov-2009 uebayasi

Support "extsrc", externally added programs and libraries. Users can write
their own reach-overs, cross-build, install, and get set files just like base
and X11 / X.org. (These sets are not included as TNF releases.)


# 1.89 10-Oct-2009 apb

If ${NETBDSRCDIR}/../xsrc exists, then use it as the default value
of X11SRCDIR. If it doesn't exist, then use /usr/xsrc as before.

OK mrg


# 1.88 27-Sep-2009 apb

* Use a more robust method of creating the top level object directory.
Use getmakevar to expand MAKEOBJDIRPREFIX or MAKEOBJDIR, or (if
neither of those variables is set) use a non-recursive "make obj" in
the top level source directory.

* Do not let TOP_objdir default to ${TOP}. It's now set only by the
-M or -O command line options, or after using getmakevar to expand
MAKEOBJDIRPREFIX or MAKEOBJDIR.

* Make try_set_TOOLDIR handle MAKEOBJDIRPERFIX passed from the
environment. It runs too early to use getmakevar, so it will not work
if the value contains embedded '${...}' variable references.

* Use '$TOOLDIR' (with a literal '$') instead of 'nonexistent' in
a message when rebuilding make when TOOLDIR is not yet known.


# 1.87 27-Sep-2009 apb

Allow build.sh "-C cdextra" option to be specified multiple times.


# 1.86 07-Sep-2009 jnemeth

Add a modules operation to build.sh, which builds and installs kernel modules
into DESTDIR.

This is based on the patch provided by tsutsui@ on tech-toolchain@.


# 1.85 12-Jul-2009 hubertf

regen


# 1.84 12-Jul-2009 hubertf

regen


Revision tags: jym-xensuspend-nbase jym-xensuspend-base
# 1.83 01-May-2009 snj

Introduce MKSUBPIXEL, which allows enabling subpixel rendering code
in FreeType.


# 1.82 02-Dec-2008 mrg

branches: 1.82.2;
be explicit about MAKEOBJDIR and MAKEOBJDIRPREFIX not being for
mk.conf or ${MAKECONF}.


# 1.81 15-Nov-2008 mrg

revert sparc back to default of XFree86 at the request of macallan.


# 1.80 13-Nov-2008 apb

Add support for new MAKEVERBOSE levels 3 and 4. The complete list is now:

0 Minimal output ("quiet")
1 Describe what is occurring
2 Describe what is occurring and echo the actual command
3 Ignore the effect of the "@" prefix in make commands
4 Trace shell commands using the shell's -x flag

The default remains MAKEVERBOSE=2.


# 1.79 09-Nov-2008 mrg

- retire MKXORG from public use
- introduce X11FLAVOUR to choose src/x11 vs src/external/mit/xorg
for the X11 to build if MKX11=yes is set. it takes the values
of either Xorg or XFree86.
- default to Xorg on alpha, i386, macppc, shark, sparc and sparc64
- remove MKXORG_WITH_XSRC_XSERVER, unused and never useful


Revision tags: netbsd-5-base matt-mips64-base2
# 1.78 24-Sep-2008 apb

branches: 1.78.2;
regen for recent change to examples and objdir advice,
and for the older MKSTRIPIDENT change.


Revision tags: wrstuden-revivesa-base-3 wrstuden-revivesa-base-2
# 1.77 06-Sep-2008 lukem

regen for MKHTML


# 1.76 28-Aug-2008 lukem

Improve support for MKXORG!=no to enable builds into external/mit/xorg.
This will be mutually exclusive to MKX11!=no.


# 1.75 18-Aug-2008 lukem

Document "build.sh cleandir".
Fix formatting nit.
Remove BUGS; all the in-tree platforms are using build.sh now.


# 1.74 11-Aug-2008 apb

* Suggest a "-j" value between 1+NCPU and 2*NCPU for the fastest builds.
* Remove some duplicated content that appeared in both the section about
make's -j flag and the section about build.sh's -j flag.


# 1.73 05-Aug-2008 apb

* Add more detail for build.sh -M and -O options.
* Mention new default when source is /usr/src but build.sh is run
with neither -M nor -O.


# 1.72 05-Aug-2008 perry

Builds now use "BUILDSEED" so that c++ binaries are reproduceable.
By default BUILDSEED is set to NetBSD-{majorversion} -- a -S flag may
be used to change it.

Discussed on tech-toolchain.


Revision tags: wrstuden-revivesa-base-1 yamt-pf42-base4 yamt-pf42-base3 hpcarm-cleanup-nbase yamt-pf42-baseX yamt-pf42-base2 wrstuden-revivesa-base keiichi-mipv6-nbase yamt-pf42-base keiichi-mipv6-base
# 1.71 29-Mar-2008 dholland

branches: 1.71.4;
Correct/clarify the default setting of USETOOLS in the previous version.
Noted by apb.


# 1.70 28-Mar-2008 dholland

Assorted updates and clarifications, grammar fixes and wording improvements,
and so on. Significant highlights:
- mention src/tests and reference atf;
- provide examples of MACHINE and MACHINE_ARCH;
- mention that MKOBJ=no is not recommended;
- correct the description of the default setting of USETOOLS;
- document the interactions of build.sh -[uo] with various things;
- document the interactions of build.sh tools and kernel=FOO;
- use a lot fewer parentheses.
Discussed on netbsd-docs.


Revision tags: matt-armv6-nbase
# 1.69 18-Mar-2008 lukem

Consistently document RELEASEDIR/RELEASEMACHINEDIR.


# 1.68 08-Mar-2008 reed

Mention that "build" and "distribution" do not build nor install (to DESTDIR)
a kernel.


Revision tags: cube-autoconf-base matt-armv6-base hpcarm-cleanup-base
# 1.67 23-Nov-2007 sborrill

branches: 1.67.4;
Add support for CDBUILDEXTRA which acts like CDEXTRA to add extra items
to the CD-ROM image.
Make CDEXTRA and CDBUILDEXTRA be able to contain lists of files and directories
which are added in turn.
Add support for CDEXTRA_SKIP which contains a list of fnmatch(3) items to
skip during the copy. This is _very_ useful for skipping CVS dirs for example.
CDBUILDEXTRA and CDEXTRA_SKIP are to be used in Makefiles creating the images,
CDEXTRA remains to be used from build.sh.
Update documentation and build.sh help text to show that -C can be used to
specify a list of files and directories rather than just a single dir.


# 1.66 01-Sep-2007 jnemeth

Convert build.sh iso-dir=directory option to -C cddir as per jmmv@ on
source-changes.


# 1.65 01-Sep-2007 jnemeth

Add an iso-dir=directory option. When combined with iso-image or
iso-image-source, it will cause directory to be added to the CD-ROM image.


# 1.64 30-Aug-2007 jnemeth

describe new iso-image-source target


# 1.63 30-Aug-2007 ad

Remove STATUS paragraph which makes it sound like the build system is
half baked.


Revision tags: matt-mips64-base
# 1.62 13-Apr-2007 apb

branches: 1.62.4;
Document recent changes to "make iso-image".


# 1.61 26-Mar-2007 apb

Document the fact that "make installworld" and "build.sh
installworld=..." do not install the etc or xetc sets. Suggest using
etcupdate(8) and postinstall(8) after installworld.


# 1.60 27-Jan-2007 apb

Try to clarify the description of build.sh -m mach.
Document new evbarm-eb and evbarm-el aliases.


Revision tags: netbsd-4-base
# 1.59 08-Oct-2006 apb

branches: 1.59.2;
Clarify that DESTDIR/OBJDIR/etc are absolute paths, but build.sh
-D/-O/etc allows relative paths.

Closes PR 32345 by Andre Luiz de Oliveira.


# 1.58 29-Sep-2006 apb

Use ${HOST_SH} instead of the host system's /bin/sh wherever possible:

* Describe the HOST_SH variable, and the way build.sh attempts to set it.

* Suggest passing HOST_SH in the environment if /bin/sh is not a working
shell.


Revision tags: abandoned-netbsd-4-base
# 1.57 29-Jan-2006 apb

mkisofs is in pkgsrc/sysutils/cdrtools now, not pkgsrc/sysutils/cdrecord.
Reported by Jukka Salmi.


# 1.56 28-Jan-2006 apb

* Add an "iso-image" target in the top level Makefile,
which invokes make iso-image in the etc directory.
* Add an "iso-image" action in build.sh, which
invokes make iso-image.
* Document the above in doc/BUILDING.mdoc.
* Re-generate BUILDING.

Approved by christos


# 1.55 12-Jan-2006 wiz

Bump date for syspkgs.


# 1.54 04-Jan-2006 apb

Document "make syspkgs" and "build.sh syspkgs".

Reviewed by agc


Revision tags: netbsd-3-1-1-RELEASE netbsd-3-0-3-RELEASE netbsd-3-1-RELEASE netbsd-3-0-2-RELEASE netbsd-3-1-RC4 netbsd-3-1-RC3 netbsd-3-1-RC2 netbsd-3-1-RC1 netbsd-3-0-1-RELEASE netbsd-3-0-RELEASE netbsd-3-0-RC6 netbsd-3-0-RC5 netbsd-3-0-RC4 netbsd-3-0-RC3 netbsd-3-0-RC2 netbsd-3-0-RC1 netbsd-3-base
# 1.53 15-Feb-2005 reed

Document the environment variables for if you need to override or
manually select your compilers.
(And regen BUILDING from doc/BUILDING.mdoc.)


# 1.52 12-Oct-2004 jmc

Fix some typo's/bad wording as highlighted in PR#27219


# 1.51 25-Jun-2004 wiz

regen (Document -h. From Karsten Kruse in PR 25974.
While here, remove a duplicate sentence).


Revision tags: netbsd-2-0-3-RELEASE netbsd-2-1-RELEASE netbsd-2-1-RC6 netbsd-2-1-RC5 netbsd-2-1-RC4 netbsd-2-1-RC3 netbsd-2-1-RC2 netbsd-2-1-RC1 netbsd-2-0-2-RELEASE netbsd-2-0-1-RELEASE netbsd-2-base netbsd-2-0-RELEASE netbsd-2-0-RC5 netbsd-2-0-RC4 netbsd-2-0-RC3 netbsd-2-0-RC2 netbsd-2-0-RC1 netbsd-2-0-base
# 1.50 19-Mar-2004 wiz

Document MKTTINTERP.


# 1.49 06-Feb-2004 lukem

* Document build.sh -X and -x
* Document MKX11 and X11SRCDIR
* Remove note warning against cross-building from systems other than NetBSD;
it works on many other platforms.


# 1.48 29-Dec-2003 jmc

Note tools/compat/README as the place to get notes from non-native cross builds


# 1.47 19-Dec-2003 zuntum

Change -v to -V in the following section:

"Print make(1)'s idea of the value of var. Does not build any targets."

To reflect reality.

Found by Tomasz Marciniak <Tomasz.Marciniak@felix.fizyka.amu.edu.pl>, thanks!


# 1.46 26-Oct-2003 lukem

Improve how build.sh -N and MAKEVERBOSE interoperate;
rather than adding '-s' to make's command line in the makewrapper,
use the .SILENT target based on MAKEVERBOSE's value.

This means that you can do:
./build.sh -N 1 makewrapper

$TOOLDIR/bin/nbmake-$MACHINE
# runs at MAKEVERBOSE==1, with command lines suppressed

$TOOLDIR/bin/nbmake-$MACHINE MAKEVERBOSE=2
# runs at MAKEVERBOSE==2 for this invocation, with command lines shown


# 1.45 25-Oct-2003 lukem

Implement build -N noisy, which sets MAKEVERBOSE to noisy and adds
`-s' to MAKEFLAGS for noisy < 2.


# 1.44 29-Sep-2003 lukem

regenerate for "%" prompt update


# 1.43 19-Aug-2003 martti

Backout the previous commit


# 1.42 19-Aug-2003 martti

Remove # from the example.


# 1.41 08-Aug-2003 lukem

fix description of MAKEOBJDIR. from Martin Husemann


# 1.40 29-Jul-2003 lukem

Add build.sh -Z var, to unset a variable and ensure it's unset in makewrapper.
For -M MAKEOBJDIRPREFIX, unset MAKEOBJDIR.
For -O MAKEOBJDIR, unset MAKEOBJDIRPREFIX.


# 1.39 18-Jul-2003 lukem

fix default location of TOOLDIR


# 1.38 18-Jul-2003 lukem

Update for the MKUNPRIVED/MKUPDATE changes.


# 1.37 18-Jul-2003 lukem

rebuild with new groff


# 1.36 03-Jul-2003 lukem

attempt to clarify how MAKEOBJDIR{,PREFIX} may be provided ...
(this document needs a rototill, which i may get to whilst writing a
paper about build.sh)


# 1.35 25-May-2003 lukem

all:
* add "releasekernel=conf", to install a gzipped copy of the kernels
built by "kernel=conf" to RELEASEDIR/MACHINE/binary/kernel

build.sh:
* be more consistent in various status messages
* move the {release,}kernel=conf conf parsing code into getkernelconf()
and use in both buildkernel() and releasekernel()
* only warn once when building multiple kernels without updating the tools


# 1.34 18-May-2003 lukem

For normal builds, MKOBJDIRS default to `no' (not `yes').
It's only build.sh that sets this to `yes' by default.
Noted by OGAWA Takaya in [toolchain/19823]


# 1.33 17-May-2003 lukem

improve description of how "build.sh -m mach" sets the default
MACHINE_ARCH, and list the special cases that this does not occur for.


# 1.32 10-May-2003 lukem

crank date for previous


# 1.31 10-May-2003 lukem

Add "sourcesets" argument/target, which builds source sets into
RELEASEDIR/source/sets


# 1.30 08-May-2003 lukem

build.sh now provides defaults for DESTDIR and RELEASEDIR if not expert mode.
Remove -D and -R from EXAMPLES since they're not necessary any more.


# 1.29 08-Feb-2003 lukem

Fix example 3; the build.sh target is "install" not "installworld".
Improve description.
Noted by Valeriy Ushakov (uwe@) in private email.


# 1.28 02-Feb-2003 lukem

attempt to further improve and clarify the examples...


# 1.27 30-Jan-2003 lukem

Prefix various paths with 'DESTDIR', to highlight that the DESTDIR
is taken into account.


# 1.26 29-Jan-2003 lukem

allow toolprefix to be easily changed


# 1.25 26-Jan-2003 lukem

Various improvements per discussion with Alan Barrett.


# 1.24 26-Jan-2003 lukem

- Add "sets" top-level Makefile target and build.sh operation.
[Latter suggested by Julio Merino in private email]
- Add "help" build.sh operation.


# 1.23 26-Jan-2003 lukem

Change build.sh so that at least one operation is required.
Add "makewrapper" operation to build.sh.
[The above changes were suggested by Alan Barrett on current-users@]

Fail if building as non-root unless: UNPRIVED is set, -U is given, or -E
(expert mode) is given.
[Suggested by James Wetterau in private email]

Improve the examples in BUILDING.


# 1.22 23-Jan-2003 lukem

Rework how build.sh functions, so that command line options set various
parameters, and a list of "operations" defines what to do.
The full usage is show below. Notes:
`-b' has been deprecated (it always occurs now)
`-d' is replaced by "distribution"
`-R rel' onlys sets RELEASEDIR; use "release" to build a release
`-k kern' has been replaced by "kernel=kern"
`-i idir' has been replaced by "install=idir"
-r now occurs before nbmake is rebuilt

Add a copyright (long due!). Rework the code to (a KNF inspired) ShellNF.
Use functions appropriately. Allow `nb' prefix to be easily changed to
something else. Solve world peace (just kidding)

This is part of the (never achievable) goal of attempting to make
NetBSD easier to build...


--8<-- new usage follows --8<--

Usage: build.sh [-EnorUu] [-a arch] [-B buildid] [-D dest] [-j njob] [-M obj]
[-m mach] [-O obj] [-R release] [-T tools] [-V var=[value]]
[-w wrapper] [operation [...] ]

System build operations (all imply "obj" and "tools"):
build Run "make build"
distribution Run "make distribution" (includes etc/ files)
release Run "make release" (includes kernels & distrib media)

Other operations:
obj Run "make obj" (default unless -o)
tools Build and install tools
kernel=conf Build kernel with config file `conf'
install=idir Run "make installworld" to `idir'
(useful after 'distribution' or 'release')

Options:
-a arch Set MACHINE_ARCH to arch (otherwise deduced from MACHINE)
-B buildId Set BUILDID to buildId
-D dest Set DESTDIR to dest
-E Set "expert" mode; disables some DESTDIR checks
-j njob Run up to njob jobs in parallel; see make(1)
-M obj Set obj root directory to obj (sets MAKEOBJDIRPREFIX)
-m mach Set MACHINE to mach (not required if NetBSD native)
-n Show commands that would be executed, but do not execute them
-O obj Set obj root directory to obj (sets a MAKEOBJDIR pattern)
-o Set MKOBJDIRS=no (do not create objdirs at start of build)
-R release Set RELEASEDIR to release
-r Remove contents of TOOLDIR and DESTDIR before building
-T tools Set TOOLDIR to tools. If unset, and TOOLDIR is not set in
the environment, nbmake will be (re)built unconditionally.
-U Set UNPRIVED
-u Set UPDATE
-V v=[val] Set variable `v' to `val'
-w wrapper Create nbmake script as wrapper
(default: ${TOOLDIR}/bin/nbmake-${MACHINE})


# 1.21 04-Jan-2003 lukem

Add "-V var=[value]", for setting arbitrary variables which will also
be added to the nbmake-${MACHINE} wrapper.
Useful for setting RELEASEDIR, without -R's habit of building a release.


Revision tags: fvdl_fs64_base
# 1.20 25-Dec-2002 lukem

Document:
* build.sh -i idir
* top level targets: distribution, buildworld, installworld
* top level variables: INSTALLWORLDDIR


# 1.19 08-Dec-2002 lukem

Add -E - "expert mode". If this is not specified, builds to DESTDIR=/ are
not permitted.
By using this flag, you are taking responsibility for any issues that
may occur because of this...


# 1.18 08-Dec-2002 lukem

- be consistent about option ordering in build.sh usage display
- use Fl and Ar instead of Sy and Em to format options


# 1.17 25-Nov-2002 wiz

Update location of BUILDING.mdoc.


# 1.16 20-Oct-2002 lukem

regen for build.sh -k


# 1.15 21-Sep-2002 lukem

regen for: USE_NEW_TOOLCHAIN was replaced with TOOLCHAIN_MISSING


# 1.14 17-Sep-2002 fredb

Expand on the difference between ``build.sh -d'' and ``make install'',
as requested by Brian Stark in PR toolchain/18228 (which this closes).


# 1.13 22-Jul-2002 wiz

Remove duplicate 'files'. From Ryo HAYASAKA in toolchain/17674.


Revision tags: netbsd-1-6-PATCH002-RC3 netbsd-1-6-PATCH002-RC2 netbsd-1-6-PATCH002-RC1 netbsd-1-6-PATCH001 netbsd-1-6-PATCH001-RELEASE netbsd-1-6-PATCH001-RC3 netbsd-1-6-PATCH001-RC2 netbsd-1-6-PATCH001-RC1 netbsd-1-6-RELEASE netbsd-1-6-RC3 netbsd-1-6-RC2 netbsd-1-6-RC1 netbsd-1-6-base
# 1.12 13-May-2002 lukem

branches: 1.12.2;
add "-M makeobjdirprefix" to build.sh


# 1.11 03-May-2002 lukem

Move the METALOG from ${_SRC_TOP_OBJ_} to ${DESTDIR}.

There were too many synchronisation problems with using the former;
including situations such as a "make clean" performed between two
installs to the same DESTDIR would result in a truncated METALOG and
the resultant sets would be missing stuff such as include files that
don't get reinstalled if they haven't changed, even with !UPDATE.


# 1.10 02-May-2002 sommerfeld

Re-gen.


# 1.9 14-Mar-2002 thorpej

Add a -B option to set the BUILDID for the build. This also causes
the make(1) wrapper script to be named "nbmake-MACHINE-BUILDID".


# 1.8 05-Mar-2002 lukem

document various supported environment variables, including MAKEOBJDIRPREFIX


# 1.7 04-Mar-2002 lukem

document:
- make's UNPRIVED support
- build.sh's -U support
- the build system currently needs to build onto a file system with
long file name and hard link support


# 1.6 25-Nov-2001 thorpej

Document the -d option to build.sh


# 1.5 15-Nov-2001 tv

Note only <bsd.own.mk> as the authority for determining whether the new
BUILDING instructions should be used.


# 1.4 14-Nov-2001 tv

Turn off host-specific objdirs by default. Set MKHOSTOBJ=yes to enable.


# 1.3 12-Nov-2001 tv

Major overhaul of src/tools and host toolchain. Summary of changes:

* Rewrite src/tools Make logic to work like the rest of the tree wrt
"dependall" and "install". The old "make build" hack is gone.

* Remove the MKTOOLS logic. This was linked to the "make build" hack,
and was only needed because TOOLDIR originally had no writable default.

* Redo the GNU configure/make logic to make it fit reasonably in a
BSD make wrapper. Use new ${.ALLTARGETS} variable to scan for
targets in $(srcdir), and mark them with .MADE: to prevent rebuilding.

* Only build cross tools in src/tools; remove some messy logic in
src/usr.* and src/gnu/usr.* that would do target filename rewriting
(improves consistency and readability).

* Add the ability to build cross gdb at tool build time by setting
MKCROSSGDB (default no) to "yes" in mk.conf.

* Add src/tools/groff and set up paths to work with this cross groff.


# 1.2 08-Nov-2001 wiz

Remove mention of BUILDLING.html, and follow rename of BUILDING.txt to
BUILDING.
Noted by Love <lha@stacken.kth.se> on tech-toolchain.


# 1.1 01-Nov-2001 tv

By popular demand, one preformatted version of BUILDING, plaintext, no CRs.


# 1.160 22-Jul-2023 lukem

BUILDING: list known mk.conf vars. tweak section headers

List known supported and obsolete mk.conf(5) variables,
so that searches in this document at least find them.
This partially reverts my revision 1.144 on 2023-06-12
which completely removed the duplication with mk.conf(5).

Remove quote characters from some section headings;
it makes it harder to search for a section by known name
when rendering in markup variations that use smart quotes.


# 1.159 21-Jul-2023 lukem

BUILDING: clarify environ vs mk.conf behaviour

Document that variables set in the environment or the
nbmake-MACHINE wrapper script don't override variable
assignments in mk.conf(5), and that using ?= in mk.conf
allows environment / nbmake-MACHINE variables to override
mk.conf.

Consistently refer to "nbmake-MACHINE wrapper script".


# 1.158 19-Jul-2023 lukem

BUILDING: consistency fix


# 1.157 18-Jul-2023 lukem

build.sh: use mk.conf (if present) as MAKECONF

Set MAKECONF to mk.conf in the same directory as build.sh
(i.e., the top of the source tree) if mk.conf is present.
This means unprivileged users can benefit from mk.conf(5)
semantics without write privileges to /etc/mk.conf, and
also simplifies per-source-directory configuration.

Fail early if $MAKECONF is empty, since build.sh will fail
anyway after rebuilding nbmake.

Ensure that the computed MAKECONF isn't empty, and then
always set MAKECONF in the makewrapper (nbmake-$MACHINE).

Improve some formatting consistency in BUILDING.mdoc,
(even if BUILDING is generated without markup).


# 1.156 05-Jul-2023 lukem

BUILDING: wording tweaks


# 1.155 11-Jun-2023 lukem

BUILDING: remove duplication from mk.conf(5)

Remove all "make" variables / mk.conf(5) variables already documented
in mk.conf(5). The duplication was a maintenance headache, as I've
experienced over recent weeks getting the build documentation up to
date.

Add notes clarifying that manual page references are to the NetBSD
manual pages, not to the host manual pages, and how to format from
source, or find online at https://man.netbsd.org.

Add explicit links to the mdoc(7) in-tree source for mk.conf(5),
hier(7), and release(7) because those are directly relevant to the host
build information in BUILDING.

Note: We don't normally need these notes for native documentation,
but BUILDING is intended for users on host systems which might not
be NetBSD(-current).

Add missing defaults.


# 1.154 11-Jun-2023 lukem

BUILDING: update from mk.conf(5). reorder

Sync variable entries from mk.conf(5).

Merge the "make variables for full builds" section into the previous.
Having two separate sections and some entries duplicated was confusing
when searching for variables.


# 1.153 11-Jun-2023 lukem

more NBUILDJOBS deprecation

The NBUILDJOBS option was deprecated in 2002;
there's no need to keep warning about it,
remove from params / show-params,
and only document as obsolete.


# 1.152 05-Jun-2023 lukem

BUILDING: editorial

MKX11=yes wants MKINET6=yes

Change the width of the variable lists to 14n (from 15n)
so that when the lists are rendered and then left aligned,
the column is 16 characters (aka 2 tabs) which makes
copypasta to bsd.README easier.


# 1.151 04-Jun-2023 lukem

BUILDING: update from canonical mk.conf(5)

Incorporate content and styles updates for mk.conf entries
from share/man/man5/mk.conf.5, which is the canonical
reference for mk.conf.

Add: BSDOBJDIR, BSDSRCDIR, EXTERNAL_TOOLCHAIN, MKDEBUGKERNEL,
MKDEBUGTOOLS, MKHTML, MKLINKLIB, MKOBJDIRS, TOOLCHAIN_MISSING,
NETBSDSRCDIR

It's for further study as to whether we just replace the
most of subsection "make" variables with a link to mk.conf(5).

Style:
- Add more .de macros per mk.conf.5.
- Order list items alphabetically. When multiple items are present
in a list item, sort within the item first.
- More cross-references.


# 1.150 02-Jun-2023 lukem

build.sh: MAKECONF and mk.conf(5) improvements

Move MAKECONF to the Environment variables section.
Add mk.conf(5) cross-references.
Make Notes more obvious.
Fix mandoc lint.


# 1.149 18-May-2023 lukem

BUILDING: TMPDIR must not be noexec

Describe $TMPDIR as used by build.sh, and
add a note that it can't be mounted noexec.

PR toolchain/44459


# 1.148 16-May-2023 lukem

build.sh, BUILDING: consistency improvements

Consistently use "show", instead of sometimes using "display" or "print".
Fix mdoc markup (even though BUILDING is raw text).
Document help, -P, -?


# 1.147 16-May-2023 lukem

BUILDING: update upstream, regen

doc/BUILDING.mdoc is the upstream for BUILDING, so add recent changes
in the latter to the former, formatting correctly.

Move INSTALLBOOT_UBOOT_PATHS to Environment variables.
Move INSTALLBOOT_BOARDS to "make" variables for full builds.
Add installboot(8) cross-reference.


Revision tags: netbsd-10-base
# 1.146 01-Oct-2022 rillig

fix documentation for MKLINT

Since share/mk/bsd.own.mk 1.749 from 2013-08-26, MKLINT defaults to no.


# 1.145 22-Aug-2022 brook

By default, do not install any bootable images.

The previous commit introduced the ability to install a set of
bootable images as a normal part of a release build. While this made
it easy to install bootable images, the contents of a release build
depend on whether or not U-Boot packages are installed in /usr/pkgsrc,
which is the default location searched by installboot(8).

This commit requires users to explicitly list the bootable images to
be installed, which by default is none (i.e., prior behavior).


# 1.144 21-Aug-2022 brook

Create bootable images in ${RELEASEDIR}/${RELEASEMACHINEDIR}/binary/gzimg.

Release builds for arm platforms create compressed images in
${RELEASEDIR}/${RELEASEMACHINEDIR}/binary/gzimg. However, in some
cases, e.g., armv7.img.gz, they are not bootable. Consequently, boot
blocks must be manually installed in the images, which is an extra
barrier for testing systems or adopting NetBSD. This has prompted
creation of external repositories, e.g., armbsd.org, to host a
collection of bootable images. However, this does not ease the burden
on developers compiling their own systems; for them, manual
installation of boot blocks is still required.

For arm platforms, etc/etc.evbarm/Makefile.inc contains the commands
used to create system images. Because installboot(8) can write boot
blocks directly to system images, a loop through possible boards can
create a series of bootable images during the normal build process.

In the case of many arm platforms, installboot(8) uses U-Boot boot
blocks, which are not part of the NetBSD source code. Developers can,
however, install as many U-Boot boot blocks as desired, either in the
default location of /usr/pkg/share/u-boot or in a set of directories
pointed to by the U-Boot search path, the INSTALLBOOT_UBOOT_PATHS
environment variable. For each board with an available boot block, a
board-specific bootable image will be created in
${RELEASEDIR}/${RELEASEMACHINEDIR}/binary/gzimg. If a boot block is
not available, which is the typical situation currently, no additional
image will be created.

This facility creates opportunities to build bootable images for any
number of boards within the scope of a standard release build.
However, that is not required and will not occur without the
intervention of installing U-Boot boot blocks prior to the build.


# 1.143 21-Aug-2022 lukem

BUILDING: regen for removal of extsrc/


# 1.142 28-May-2022 andvar

s/knowlege/knowledge/


# 1.141 20-Dec-2021 christos

Rename:
MKKDEBUG -> MKDEBUGKERNEL
MKTOOLSDEBUG -> MKDEBUGTOOLS
while keeping compatibility with the old names. Add missing documentation.
Now all debugging tunables are prefixed with MKDEBUG.


Revision tags: cjep_sun2x-base1 cjep_sun2x-base cjep_staticlib_x-base1 cjep_staticlib_x-base
# 1.140 10-Nov-2020 kamil

Reintroduce the support of MKCATPAGES

Requested by <mrg>


# 1.139 08-Nov-2020 kamil

Remove the support for MKCATPAGES

It was optional since 1999 and disabled by default since 2012.

Proposed on tech-userlevel@.


# 1.138 13-Oct-2020 thorpej

Document CPUFLAGS here (it's already documented in share/mk/bsd.README).
This will address the initial concern in PR port-alpha/55545.


# 1.137 12-Oct-2020 uwe

Mention HOST_CFLAGS and HOST_CXXFLAGS.


# 1.136 12-Oct-2020 uwe

Bump date and regen for BUILDING.mdoc revision 1.127
that introduced build.sh -c <compiler> option.


Revision tags: netbsd-9-3-RELEASE netbsd-9-2-RELEASE netbsd-9-1-RELEASE phil-wifi-20200421 phil-wifi-20200411 is-mlppp-base phil-wifi-20200406 netbsd-9-0-RELEASE netbsd-9-0-RC2 netbsd-9-0-RC1 phil-wifi-20191119 netbsd-9-base phil-wifi-20190609
# 1.135 08-May-2019 leot

Fix a typo

Reported by Tobias Ulmer via netbsd-docs@ ML, thanks!


Revision tags: pgoyette-compat-20190127 pgoyette-compat-20190118 pgoyette-compat-1226 pgoyette-compat-1126 pgoyette-compat-1020 pgoyette-compat-0930 pgoyette-compat-0906
# 1.134 29-Jul-2018 sevan

regen


Revision tags: pgoyette-compat-0728 phil-wifi-base pgoyette-compat-0625 pgoyette-compat-0521
# 1.133 02-May-2018 pgoyette

branches: 1.133.2;
Re-add files that were accidentally deleted in my previous commit.


# 1.132 02-May-2018 pgoyette

Synch with HEAD


Revision tags: pgoyette-compat-0502 pgoyette-compat-0422 pgoyette-compat-0415 pgoyette-compat-0407 pgoyette-compat-0330 pgoyette-compat-0322 pgoyette-compat-0315 pgoyette-compat-base
# 1.131 16-Feb-2018 leot

branches: 1.131.2;
regen


# 1.130 29-Dec-2017 sevan

regen


# 1.129 21-Oct-2017 sevan

regen


Revision tags: netbsd-8-2-RELEASE netbsd-8-1-RELEASE netbsd-8-1-RC1 netbsd-8-0-RELEASE netbsd-8-0-RC2 netbsd-8-0-RC1 matt-nb8-mediatek-base perseant-stdc-iso10646-base netbsd-8-base
# 1.128 21-May-2017 riastradh

regen


Revision tags: prg-localcount2-base3 prg-localcount2-base2 prg-localcount2-base1 prg-localcount2-base pgoyette-localcount-20170426
# 1.127 22-Apr-2017 plunky

regen


Revision tags: bouyer-socketcan-base1
# 1.126 20-Apr-2017 wiz

regen using regen target in doc.


# 1.125 20-Apr-2017 ozaki-r

Introduce MKSTRIPSYM build option

If it's yes, all local symbols of shared libraries are stripped
(default). If it's no, only temporary local symbols are stripped;
for example, symbols of static functions are kept. Keeping such
symbols is useful on using DTrace for userland libraries and
getting a backtrace from a rump server loading modules (shared
libraries).

Proposed and discussed on tech-kern and tech-toolchain


Revision tags: pgoyette-localcount-20170320
# 1.124 20-Feb-2017 christos

regen


# 1.123 16-Feb-2017 rin

The default values for MKPIC are yes and no for sh3 and m68000, respectively.
Bump date.


Revision tags: bouyer-socketcan-base pgoyette-localcount-20170107 pgoyette-localcount-20161104 localcount-20160914 pgoyette-localcount-20160806 pgoyette-localcount-20160726 pgoyette-localcount-base
# 1.122 29-Jan-2016 wiz

branches: 1.122.2; 1.122.4;
Document MKREPRO_TIMESTAMP.


# 1.121 23-Jul-2015 mrg

remove the xfree86 reachover makefiles and the vast majority of
the support in the rest of the source tree.

X11 sets could use some cleaning up perhaps (just deletion, as
we've never really marked the old X11R6 as obsolete for native
xorg using platforms so far either.)


# 1.120 07-Jun-2015 pgoyette

Update to reflect changes made in rev 1.398 of src/etc/Makefile


# 1.119 08-Apr-2015 wiz

regen


# 1.118 30-Nov-2014 uebayasi

regen


# 1.117 16-Nov-2014 uebayasi

regen


# 1.116 16-Nov-2014 uebayasi

regen


# 1.115 13-Nov-2014 apb

regen from doc/BUILDING.mdoc revision 1.107.
This reinstates documentation for "extsrc" which was lost in 2009.


# 1.114 08-Nov-2014 snj

fourth time's the charm, i guess. when committing a generated file,
it's best to use the latest revision of the source file (hi uebs!)

regen to include changes from revision 1.105 of doc/BUILDING.mdoc


# 1.113 06-Nov-2014 uebayasi

regen


# 1.112 06-Nov-2014 uebayasi

Expand TABs.


# 1.111 06-Nov-2014 uebayasi

Document the new "kernels" operation, prompted by joerg@.


# 1.110 05-Nov-2014 snj

regen


Revision tags: netbsd-7-base tls-earlyentropy-base tls-maxphys-base
# 1.109 07-Aug-2014 apb

branches: 1.109.2;
regen BUILDING from doc/BUILDING.mdoc


# 1.108 03-Aug-2014 apb

BUILDINFO part6: regen BUILDING from doc/BUILDING.mdoc


# 1.107 14-Jun-2014 apb

Regen from doc/BUILDING.mdoc;1.100:
Improve documentation for BUILDID.


# 1.106 21-May-2014 wiz

regen


Revision tags: yamt-pagecache-base9 riastradh-xf86-video-intel-2-7-1-pre-2-21-15 riastradh-drm2-base3 riastradh-drm2-base2 riastradh-drm2-base1 riastradh-drm2-base
# 1.105 29-May-2013 wiz

branches: 1.105.4;
regen using 'make regen' from src/doc.


# 1.104 29-May-2013 wiz

regen (using mandoc doc/BUILDING.mdoc > BUILDING -- let me know
if a different way is preferred, I see that it now contains formatting).


Revision tags: agc-symver-base yamt-pagecache-base8 yamt-pagecache-base7
# 1.103 08-Nov-2012 dholland

regen


Revision tags: yamt-pagecache-base6
# 1.102 19-Sep-2012 abs

regen


# 1.101 25-May-2012 wiz

branches: 1.101.2;
regen using 'make regen' in doc/


# 1.100 25-May-2012 wiz

Document MKREPRO using joerg's wording.


Revision tags: yamt-pagecache-base5 yamt-pagecache-base4
# 1.99 23-Feb-2012 tsutsui

Add a missing period.


Revision tags: netbsd-6-base
# 1.98 14-Feb-2012 apb

branches: 1.98.2;
Regen from revision 1.87 of doc/BUILDING.mdoc.


# 1.97 22-Jan-2012 tsutsui

Add "live-image" and "install-image" target support to build.sh.

"live-image" target builds pre-installed disk images that can be used on
emulators or boot from USB memory sticks to try NetBSD without installation.
Currently amd64, i386, pmax, sparc, sparc64, sun2, sun3, and vax
(which have working emulators and don't require extra tools like preparing
msdosfs or partitioning MD label structures) support this target.

"install-image" target builds an bootable installation disk image that can
be used as an install CD but burned into USB memory sticks etc.
Current only amd64 and i386 (which would support USB boot) have this target.

For more details (and known issue) see following posts on netbsd-bugs@:
http://mail-index.NetBSD.org/netbsd-bugs/2011/08/06/msg023639.html
http://mail-index.NetBSD.org/netbsd-bugs/2011/09/23/msg024207.html
http://mail-index.NetBSD.org/netbsd-bugs/2011/12/07/msg025166.html
http://mail-index.NetBSD.org/netbsd-bugs/2011/12/08/msg025178.html

No particular comments about implementation, and
"go ahead" comments from mrg@, riz@ and christos@.

Closes PR toolchain/45153 and PR misc/45155.


Revision tags: yamt-pagecache-base3 yamt-pagecache-base2 yamt-pagecache-base
# 1.96 09-Sep-2011 apb

branches: 1.96.2;
Add tests for the shell under which build.sh is run. If the
shell fails the tests, then build.sh tries to re-exec itself
under a more suitable shell.


# 1.95 09-Sep-2011 apb

Revisions 1.92 and 1.93 of src/BUILDING were not reflected in
src/doc/BUILDING.mdoc, so those changes were lost when src/BUILDING
was regenerated in revision 1.94.

Now update src/doc/BUILDING.mdoc and regenerate src/BUILDING to
reinstate the lost changes. (I also edited one of the changes, to use
the phrase "space-separated list" for consistency with other parts of
the document.)

The original changes were:


# 1.93 06-Aug-2011 jnemeth

Add description of MKKMOD, part of PR misc/45216


Revision tags: cherry-xenmp-base bouyer-quota2-nbase bouyer-quota2-base
# 1.92 29-Jan-2011 jym

Pass down INSTALLSETS variable to installsets target. Use :Q to escape
shell meta-characters, as the variable contains a list of sets, separated
by spaces.

$ ./build.sh -V INSTALLSETS="base etc" install=idir

should now work as expected.

Reviewed by apb@ on tech-toolchain.


# 1.94 09-Sep-2011 apb

Allow MAKEFLAGS to be set via build.sh -V. Somebody asked for this
in 2008.

Also add comments above a few functions in build.sh, and bump copyright
dates.


# 1.93 06-Aug-2011 jnemeth

Add description of MKKMOD, part of PR misc/45216


Revision tags: cherry-xenmp-base bouyer-quota2-nbase bouyer-quota2-base
# 1.92 29-Jan-2011 jym

Pass down INSTALLSETS variable to installsets target. Use :Q to escape
shell meta-characters, as the variable contains a list of sets, separated
by spaces.

$ ./build.sh -V INSTALLSETS="base etc" install=idir

should now work as expected.

Reviewed by apb@ on tech-toolchain.


Revision tags: matt-mips64-premerge-20101231
# 1.91 25-Jul-2010 mrg

branches: 1.91.2;
remove the MKSUBPIXEL/MKTTINTERP options; they're going away.

regenerate.


Revision tags: matt-premerge-20091211
# 1.90 30-Nov-2009 uebayasi

Support "extsrc", externally added programs and libraries. Users can write
their own reach-overs, cross-build, install, and get set files just like base
and X11 / X.org. (These sets are not included as TNF releases.)


# 1.89 10-Oct-2009 apb

If ${NETBDSRCDIR}/../xsrc exists, then use it as the default value
of X11SRCDIR. If it doesn't exist, then use /usr/xsrc as before.

OK mrg


# 1.88 27-Sep-2009 apb

* Use a more robust method of creating the top level object directory.
Use getmakevar to expand MAKEOBJDIRPREFIX or MAKEOBJDIR, or (if
neither of those variables is set) use a non-recursive "make obj" in
the top level source directory.

* Do not let TOP_objdir default to ${TOP}. It's now set only by the
-M or -O command line options, or after using getmakevar to expand
MAKEOBJDIRPREFIX or MAKEOBJDIR.

* Make try_set_TOOLDIR handle MAKEOBJDIRPERFIX passed from the
environment. It runs too early to use getmakevar, so it will not work
if the value contains embedded '${...}' variable references.

* Use '$TOOLDIR' (with a literal '$') instead of 'nonexistent' in
a message when rebuilding make when TOOLDIR is not yet known.


# 1.87 27-Sep-2009 apb

Allow build.sh "-C cdextra" option to be specified multiple times.


# 1.86 07-Sep-2009 jnemeth

Add a modules operation to build.sh, which builds and installs kernel modules
into DESTDIR.

This is based on the patch provided by tsutsui@ on tech-toolchain@.


# 1.85 12-Jul-2009 hubertf

regen


# 1.84 12-Jul-2009 hubertf

regen


Revision tags: jym-xensuspend-nbase jym-xensuspend-base
# 1.83 01-May-2009 snj

Introduce MKSUBPIXEL, which allows enabling subpixel rendering code
in FreeType.


# 1.82 02-Dec-2008 mrg

branches: 1.82.2;
be explicit about MAKEOBJDIR and MAKEOBJDIRPREFIX not being for
mk.conf or ${MAKECONF}.


# 1.81 15-Nov-2008 mrg

revert sparc back to default of XFree86 at the request of macallan.


# 1.80 13-Nov-2008 apb

Add support for new MAKEVERBOSE levels 3 and 4. The complete list is now:

0 Minimal output ("quiet")
1 Describe what is occurring
2 Describe what is occurring and echo the actual command
3 Ignore the effect of the "@" prefix in make commands
4 Trace shell commands using the shell's -x flag

The default remains MAKEVERBOSE=2.


# 1.79 09-Nov-2008 mrg

- retire MKXORG from public use
- introduce X11FLAVOUR to choose src/x11 vs src/external/mit/xorg
for the X11 to build if MKX11=yes is set. it takes the values
of either Xorg or XFree86.
- default to Xorg on alpha, i386, macppc, shark, sparc and sparc64
- remove MKXORG_WITH_XSRC_XSERVER, unused and never useful


Revision tags: netbsd-5-base matt-mips64-base2
# 1.78 24-Sep-2008 apb

branches: 1.78.2;
regen for recent change to examples and objdir advice,
and for the older MKSTRIPIDENT change.


Revision tags: wrstuden-revivesa-base-3 wrstuden-revivesa-base-2
# 1.77 06-Sep-2008 lukem

regen for MKHTML


# 1.76 28-Aug-2008 lukem

Improve support for MKXORG!=no to enable builds into external/mit/xorg.
This will be mutually exclusive to MKX11!=no.


# 1.75 18-Aug-2008 lukem

Document "build.sh cleandir".
Fix formatting nit.
Remove BUGS; all the in-tree platforms are using build.sh now.


# 1.74 11-Aug-2008 apb

* Suggest a "-j" value between 1+NCPU and 2*NCPU for the fastest builds.
* Remove some duplicated content that appeared in both the section about
make's -j flag and the section about build.sh's -j flag.


# 1.73 05-Aug-2008 apb

* Add more detail for build.sh -M and -O options.
* Mention new default when source is /usr/src but build.sh is run
with neither -M nor -O.


# 1.72 05-Aug-2008 perry

Builds now use "BUILDSEED" so that c++ binaries are reproduceable.
By default BUILDSEED is set to NetBSD-{majorversion} -- a -S flag may
be used to change it.

Discussed on tech-toolchain.


Revision tags: wrstuden-revivesa-base-1 yamt-pf42-base4 yamt-pf42-base3 hpcarm-cleanup-nbase yamt-pf42-baseX yamt-pf42-base2 wrstuden-revivesa-base keiichi-mipv6-nbase yamt-pf42-base keiichi-mipv6-base
# 1.71 29-Mar-2008 dholland

branches: 1.71.4;
Correct/clarify the default setting of USETOOLS in the previous version.
Noted by apb.


# 1.70 28-Mar-2008 dholland

Assorted updates and clarifications, grammar fixes and wording improvements,
and so on. Significant highlights:
- mention src/tests and reference atf;
- provide examples of MACHINE and MACHINE_ARCH;
- mention that MKOBJ=no is not recommended;
- correct the description of the default setting of USETOOLS;
- document the interactions of build.sh -[uo] with various things;
- document the interactions of build.sh tools and kernel=FOO;
- use a lot fewer parentheses.
Discussed on netbsd-docs.


Revision tags: matt-armv6-nbase
# 1.69 18-Mar-2008 lukem

Consistently document RELEASEDIR/RELEASEMACHINEDIR.


# 1.68 08-Mar-2008 reed

Mention that "build" and "distribution" do not build nor install (to DESTDIR)
a kernel.


Revision tags: cube-autoconf-base matt-armv6-base hpcarm-cleanup-base
# 1.67 23-Nov-2007 sborrill

branches: 1.67.4;
Add support for CDBUILDEXTRA which acts like CDEXTRA to add extra items
to the CD-ROM image.
Make CDEXTRA and CDBUILDEXTRA be able to contain lists of files and directories
which are added in turn.
Add support for CDEXTRA_SKIP which contains a list of fnmatch(3) items to
skip during the copy. This is _very_ useful for skipping CVS dirs for example.
CDBUILDEXTRA and CDEXTRA_SKIP are to be used in Makefiles creating the images,
CDEXTRA remains to be used from build.sh.
Update documentation and build.sh help text to show that -C can be used to
specify a list of files and directories rather than just a single dir.


# 1.66 01-Sep-2007 jnemeth

Convert build.sh iso-dir=directory option to -C cddir as per jmmv@ on
source-changes.


# 1.65 01-Sep-2007 jnemeth

Add an iso-dir=directory option. When combined with iso-image or
iso-image-source, it will cause directory to be added to the CD-ROM image.


# 1.64 30-Aug-2007 jnemeth

describe new iso-image-source target


# 1.63 30-Aug-2007 ad

Remove STATUS paragraph which makes it sound like the build system is
half baked.


Revision tags: matt-mips64-base
# 1.62 13-Apr-2007 apb

branches: 1.62.4;
Document recent changes to "make iso-image".


# 1.61 26-Mar-2007 apb

Document the fact that "make installworld" and "build.sh
installworld=..." do not install the etc or xetc sets. Suggest using
etcupdate(8) and postinstall(8) after installworld.


# 1.60 27-Jan-2007 apb

Try to clarify the description of build.sh -m mach.
Document new evbarm-eb and evbarm-el aliases.


Revision tags: netbsd-4-base
# 1.59 08-Oct-2006 apb

branches: 1.59.2;
Clarify that DESTDIR/OBJDIR/etc are absolute paths, but build.sh
-D/-O/etc allows relative paths.

Closes PR 32345 by Andre Luiz de Oliveira.


# 1.58 29-Sep-2006 apb

Use ${HOST_SH} instead of the host system's /bin/sh wherever possible:

* Describe the HOST_SH variable, and the way build.sh attempts to set it.

* Suggest passing HOST_SH in the environment if /bin/sh is not a working
shell.


Revision tags: abandoned-netbsd-4-base
# 1.57 29-Jan-2006 apb

mkisofs is in pkgsrc/sysutils/cdrtools now, not pkgsrc/sysutils/cdrecord.
Reported by Jukka Salmi.


# 1.56 28-Jan-2006 apb

* Add an "iso-image" target in the top level Makefile,
which invokes make iso-image in the etc directory.
* Add an "iso-image" action in build.sh, which
invokes make iso-image.
* Document the above in doc/BUILDING.mdoc.
* Re-generate BUILDING.

Approved by christos


# 1.55 12-Jan-2006 wiz

Bump date for syspkgs.


# 1.54 04-Jan-2006 apb

Document "make syspkgs" and "build.sh syspkgs".

Reviewed by agc


Revision tags: netbsd-3-1-1-RELEASE netbsd-3-0-3-RELEASE netbsd-3-1-RELEASE netbsd-3-0-2-RELEASE netbsd-3-1-RC4 netbsd-3-1-RC3 netbsd-3-1-RC2 netbsd-3-1-RC1 netbsd-3-0-1-RELEASE netbsd-3-0-RELEASE netbsd-3-0-RC6 netbsd-3-0-RC5 netbsd-3-0-RC4 netbsd-3-0-RC3 netbsd-3-0-RC2 netbsd-3-0-RC1 netbsd-3-base
# 1.53 15-Feb-2005 reed

Document the environment variables for if you need to override or
manually select your compilers.
(And regen BUILDING from doc/BUILDING.mdoc.)


# 1.52 12-Oct-2004 jmc

Fix some typo's/bad wording as highlighted in PR#27219


# 1.51 25-Jun-2004 wiz

regen (Document -h. From Karsten Kruse in PR 25974.
While here, remove a duplicate sentence).


Revision tags: netbsd-2-0-3-RELEASE netbsd-2-1-RELEASE netbsd-2-1-RC6 netbsd-2-1-RC5 netbsd-2-1-RC4 netbsd-2-1-RC3 netbsd-2-1-RC2 netbsd-2-1-RC1 netbsd-2-0-2-RELEASE netbsd-2-0-1-RELEASE netbsd-2-base netbsd-2-0-RELEASE netbsd-2-0-RC5 netbsd-2-0-RC4 netbsd-2-0-RC3 netbsd-2-0-RC2 netbsd-2-0-RC1 netbsd-2-0-base
# 1.50 19-Mar-2004 wiz

Document MKTTINTERP.


# 1.49 06-Feb-2004 lukem

* Document build.sh -X and -x
* Document MKX11 and X11SRCDIR
* Remove note warning against cross-building from systems other than NetBSD;
it works on many other platforms.


# 1.48 29-Dec-2003 jmc

Note tools/compat/README as the place to get notes from non-native cross builds


# 1.47 19-Dec-2003 zuntum

Change -v to -V in the following section:

"Print make(1)'s idea of the value of var. Does not build any targets."

To reflect reality.

Found by Tomasz Marciniak <Tomasz.Marciniak@felix.fizyka.amu.edu.pl>, thanks!


# 1.46 26-Oct-2003 lukem

Improve how build.sh -N and MAKEVERBOSE interoperate;
rather than adding '-s' to make's command line in the makewrapper,
use the .SILENT target based on MAKEVERBOSE's value.

This means that you can do:
./build.sh -N 1 makewrapper

$TOOLDIR/bin/nbmake-$MACHINE
# runs at MAKEVERBOSE==1, with command lines suppressed

$TOOLDIR/bin/nbmake-$MACHINE MAKEVERBOSE=2
# runs at MAKEVERBOSE==2 for this invocation, with command lines shown


# 1.45 25-Oct-2003 lukem

Implement build -N noisy, which sets MAKEVERBOSE to noisy and adds
`-s' to MAKEFLAGS for noisy < 2.


# 1.44 29-Sep-2003 lukem

regenerate for "%" prompt update


# 1.43 19-Aug-2003 martti

Backout the previous commit


# 1.42 19-Aug-2003 martti

Remove # from the example.


# 1.41 08-Aug-2003 lukem

fix description of MAKEOBJDIR. from Martin Husemann


# 1.40 29-Jul-2003 lukem

Add build.sh -Z var, to unset a variable and ensure it's unset in makewrapper.
For -M MAKEOBJDIRPREFIX, unset MAKEOBJDIR.
For -O MAKEOBJDIR, unset MAKEOBJDIRPREFIX.


# 1.39 18-Jul-2003 lukem

fix default location of TOOLDIR


# 1.38 18-Jul-2003 lukem

Update for the MKUNPRIVED/MKUPDATE changes.


# 1.37 18-Jul-2003 lukem

rebuild with new groff


# 1.36 03-Jul-2003 lukem

attempt to clarify how MAKEOBJDIR{,PREFIX} may be provided ...
(this document needs a rototill, which i may get to whilst writing a
paper about build.sh)


# 1.35 25-May-2003 lukem

all:
* add "releasekernel=conf", to install a gzipped copy of the kernels
built by "kernel=conf" to RELEASEDIR/MACHINE/binary/kernel

build.sh:
* be more consistent in various status messages
* move the {release,}kernel=conf conf parsing code into getkernelconf()
and use in both buildkernel() and releasekernel()
* only warn once when building multiple kernels without updating the tools


# 1.34 18-May-2003 lukem

For normal builds, MKOBJDIRS default to `no' (not `yes').
It's only build.sh that sets this to `yes' by default.
Noted by OGAWA Takaya in [toolchain/19823]


# 1.33 17-May-2003 lukem

improve description of how "build.sh -m mach" sets the default
MACHINE_ARCH, and list the special cases that this does not occur for.


# 1.32 10-May-2003 lukem

crank date for previous


# 1.31 10-May-2003 lukem

Add "sourcesets" argument/target, which builds source sets into
RELEASEDIR/source/sets


# 1.30 08-May-2003 lukem

build.sh now provides defaults for DESTDIR and RELEASEDIR if not expert mode.
Remove -D and -R from EXAMPLES since they're not necessary any more.


# 1.29 08-Feb-2003 lukem

Fix example 3; the build.sh target is "install" not "installworld".
Improve description.
Noted by Valeriy Ushakov (uwe@) in private email.


# 1.28 02-Feb-2003 lukem

attempt to further improve and clarify the examples...


# 1.27 30-Jan-2003 lukem

Prefix various paths with 'DESTDIR', to highlight that the DESTDIR
is taken into account.


# 1.26 29-Jan-2003 lukem

allow toolprefix to be easily changed


# 1.25 26-Jan-2003 lukem

Various improvements per discussion with Alan Barrett.


# 1.24 26-Jan-2003 lukem

- Add "sets" top-level Makefile target and build.sh operation.
[Latter suggested by Julio Merino in private email]
- Add "help" build.sh operation.


# 1.23 26-Jan-2003 lukem

Change build.sh so that at least one operation is required.
Add "makewrapper" operation to build.sh.
[The above changes were suggested by Alan Barrett on current-users@]

Fail if building as non-root unless: UNPRIVED is set, -U is given, or -E
(expert mode) is given.
[Suggested by James Wetterau in private email]

Improve the examples in BUILDING.


# 1.22 23-Jan-2003 lukem

Rework how build.sh functions, so that command line options set various
parameters, and a list of "operations" defines what to do.
The full usage is show below. Notes:
`-b' has been deprecated (it always occurs now)
`-d' is replaced by "distribution"
`-R rel' onlys sets RELEASEDIR; use "release" to build a release
`-k kern' has been replaced by "kernel=kern"
`-i idir' has been replaced by "install=idir"
-r now occurs before nbmake is rebuilt

Add a copyright (long due!). Rework the code to (a KNF inspired) ShellNF.
Use functions appropriately. Allow `nb' prefix to be easily changed to
something else. Solve world peace (just kidding)

This is part of the (never achievable) goal of attempting to make
NetBSD easier to build...


--8<-- new usage follows --8<--

Usage: build.sh [-EnorUu] [-a arch] [-B buildid] [-D dest] [-j njob] [-M obj]
[-m mach] [-O obj] [-R release] [-T tools] [-V var=[value]]
[-w wrapper] [operation [...] ]

System build operations (all imply "obj" and "tools"):
build Run "make build"
distribution Run "make distribution" (includes etc/ files)
release Run "make release" (includes kernels & distrib media)

Other operations:
obj Run "make obj" (default unless -o)
tools Build and install tools
kernel=conf Build kernel with config file `conf'
install=idir Run "make installworld" to `idir'
(useful after 'distribution' or 'release')

Options:
-a arch Set MACHINE_ARCH to arch (otherwise deduced from MACHINE)
-B buildId Set BUILDID to buildId
-D dest Set DESTDIR to dest
-E Set "expert" mode; disables some DESTDIR checks
-j njob Run up to njob jobs in parallel; see make(1)
-M obj Set obj root directory to obj (sets MAKEOBJDIRPREFIX)
-m mach Set MACHINE to mach (not required if NetBSD native)
-n Show commands that would be executed, but do not execute them
-O obj Set obj root directory to obj (sets a MAKEOBJDIR pattern)
-o Set MKOBJDIRS=no (do not create objdirs at start of build)
-R release Set RELEASEDIR to release
-r Remove contents of TOOLDIR and DESTDIR before building
-T tools Set TOOLDIR to tools. If unset, and TOOLDIR is not set in
the environment, nbmake will be (re)built unconditionally.
-U Set UNPRIVED
-u Set UPDATE
-V v=[val] Set variable `v' to `val'
-w wrapper Create nbmake script as wrapper
(default: ${TOOLDIR}/bin/nbmake-${MACHINE})


# 1.21 04-Jan-2003 lukem

Add "-V var=[value]", for setting arbitrary variables which will also
be added to the nbmake-${MACHINE} wrapper.
Useful for setting RELEASEDIR, without -R's habit of building a release.


Revision tags: fvdl_fs64_base
# 1.20 25-Dec-2002 lukem

Document:
* build.sh -i idir
* top level targets: distribution, buildworld, installworld
* top level variables: INSTALLWORLDDIR


# 1.19 08-Dec-2002 lukem

Add -E - "expert mode". If this is not specified, builds to DESTDIR=/ are
not permitted.
By using this flag, you are taking responsibility for any issues that
may occur because of this...


# 1.18 08-Dec-2002 lukem

- be consistent about option ordering in build.sh usage display
- use Fl and Ar instead of Sy and Em to format options


# 1.17 25-Nov-2002 wiz

Update location of BUILDING.mdoc.


# 1.16 20-Oct-2002 lukem

regen for build.sh -k


# 1.15 21-Sep-2002 lukem

regen for: USE_NEW_TOOLCHAIN was replaced with TOOLCHAIN_MISSING


# 1.14 17-Sep-2002 fredb

Expand on the difference between ``build.sh -d'' and ``make install'',
as requested by Brian Stark in PR toolchain/18228 (which this closes).


# 1.13 22-Jul-2002 wiz

Remove duplicate 'files'. From Ryo HAYASAKA in toolchain/17674.


Revision tags: netbsd-1-6-PATCH002-RC3 netbsd-1-6-PATCH002-RC2 netbsd-1-6-PATCH002-RC1 netbsd-1-6-PATCH001 netbsd-1-6-PATCH001-RELEASE netbsd-1-6-PATCH001-RC3 netbsd-1-6-PATCH001-RC2 netbsd-1-6-PATCH001-RC1 netbsd-1-6-RELEASE netbsd-1-6-RC3 netbsd-1-6-RC2 netbsd-1-6-RC1 netbsd-1-6-base
# 1.12 13-May-2002 lukem

branches: 1.12.2;
add "-M makeobjdirprefix" to build.sh


# 1.11 03-May-2002 lukem

Move the METALOG from ${_SRC_TOP_OBJ_} to ${DESTDIR}.

There were too many synchronisation problems with using the former;
including situations such as a "make clean" performed between two
installs to the same DESTDIR would result in a truncated METALOG and
the resultant sets would be missing stuff such as include files that
don't get reinstalled if they haven't changed, even with !UPDATE.


# 1.10 02-May-2002 sommerfeld

Re-gen.


# 1.9 14-Mar-2002 thorpej

Add a -B option to set the BUILDID for the build. This also causes
the make(1) wrapper script to be named "nbmake-MACHINE-BUILDID".


# 1.8 05-Mar-2002 lukem

document various supported environment variables, including MAKEOBJDIRPREFIX


# 1.7 04-Mar-2002 lukem

document:
- make's UNPRIVED support
- build.sh's -U support
- the build system currently needs to build onto a file system with
long file name and hard link support


# 1.6 25-Nov-2001 thorpej

Document the -d option to build.sh


# 1.5 15-Nov-2001 tv

Note only <bsd.own.mk> as the authority for determining whether the new
BUILDING instructions should be used.


# 1.4 14-Nov-2001 tv

Turn off host-specific objdirs by default. Set MKHOSTOBJ=yes to enable.


# 1.3 12-Nov-2001 tv

Major overhaul of src/tools and host toolchain. Summary of changes:

* Rewrite src/tools Make logic to work like the rest of the tree wrt
"dependall" and "install". The old "make build" hack is gone.

* Remove the MKTOOLS logic. This was linked to the "make build" hack,
and was only needed because TOOLDIR originally had no writable default.

* Redo the GNU configure/make logic to make it fit reasonably in a
BSD make wrapper. Use new ${.ALLTARGETS} variable to scan for
targets in $(srcdir), and mark them with .MADE: to prevent rebuilding.

* Only build cross tools in src/tools; remove some messy logic in
src/usr.* and src/gnu/usr.* that would do target filename rewriting
(improves consistency and readability).

* Add the ability to build cross gdb at tool build time by setting
MKCROSSGDB (default no) to "yes" in mk.conf.

* Add src/tools/groff and set up paths to work with this cross groff.


# 1.2 08-Nov-2001 wiz

Remove mention of BUILDLING.html, and follow rename of BUILDING.txt to
BUILDING.
Noted by Love <lha@stacken.kth.se> on tech-toolchain.


# 1.1 01-Nov-2001 tv

By popular demand, one preformatted version of BUILDING, plaintext, no CRs.


# 1.158 19-Jul-2023 lukem

BUILDING: consistency fix


# 1.157 18-Jul-2023 lukem

build.sh: use mk.conf (if present) as MAKECONF

Set MAKECONF to mk.conf in the same directory as build.sh
(i.e., the top of the source tree) if mk.conf is present.
This means unprivileged users can benefit from mk.conf(5)
semantics without write privileges to /etc/mk.conf, and
also simplifies per-source-directory configuration.

Fail early if $MAKECONF is empty, since build.sh will fail
anyway after rebuilding nbmake.

Ensure that the computed MAKECONF isn't empty, and then
always set MAKECONF in the makewrapper (nbmake-$MACHINE).

Improve some formatting consistency in BUILDING.mdoc,
(even if BUILDING is generated without markup).


# 1.156 05-Jul-2023 lukem

BUILDING: wording tweaks


# 1.155 11-Jun-2023 lukem

BUILDING: remove duplication from mk.conf(5)

Remove all "make" variables / mk.conf(5) variables already documented
in mk.conf(5). The duplication was a maintenance headache, as I've
experienced over recent weeks getting the build documentation up to
date.

Add notes clarifying that manual page references are to the NetBSD
manual pages, not to the host manual pages, and how to format from
source, or find online at https://man.netbsd.org.

Add explicit links to the mdoc(7) in-tree source for mk.conf(5),
hier(7), and release(7) because those are directly relevant to the host
build information in BUILDING.

Note: We don't normally need these notes for native documentation,
but BUILDING is intended for users on host systems which might not
be NetBSD(-current).

Add missing defaults.


# 1.154 11-Jun-2023 lukem

BUILDING: update from mk.conf(5). reorder

Sync variable entries from mk.conf(5).

Merge the "make variables for full builds" section into the previous.
Having two separate sections and some entries duplicated was confusing
when searching for variables.


# 1.153 11-Jun-2023 lukem

more NBUILDJOBS deprecation

The NBUILDJOBS option was deprecated in 2002;
there's no need to keep warning about it,
remove from params / show-params,
and only document as obsolete.


# 1.152 05-Jun-2023 lukem

BUILDING: editorial

MKX11=yes wants MKINET6=yes

Change the width of the variable lists to 14n (from 15n)
so that when the lists are rendered and then left aligned,
the column is 16 characters (aka 2 tabs) which makes
copypasta to bsd.README easier.


# 1.151 04-Jun-2023 lukem

BUILDING: update from canonical mk.conf(5)

Incorporate content and styles updates for mk.conf entries
from share/man/man5/mk.conf.5, which is the canonical
reference for mk.conf.

Add: BSDOBJDIR, BSDSRCDIR, EXTERNAL_TOOLCHAIN, MKDEBUGKERNEL,
MKDEBUGTOOLS, MKHTML, MKLINKLIB, MKOBJDIRS, TOOLCHAIN_MISSING,
NETBSDSRCDIR

It's for further study as to whether we just replace the
most of subsection "make" variables with a link to mk.conf(5).

Style:
- Add more .de macros per mk.conf.5.
- Order list items alphabetically. When multiple items are present
in a list item, sort within the item first.
- More cross-references.


# 1.150 02-Jun-2023 lukem

build.sh: MAKECONF and mk.conf(5) improvements

Move MAKECONF to the Environment variables section.
Add mk.conf(5) cross-references.
Make Notes more obvious.
Fix mandoc lint.


# 1.149 18-May-2023 lukem

BUILDING: TMPDIR must not be noexec

Describe $TMPDIR as used by build.sh, and
add a note that it can't be mounted noexec.

PR toolchain/44459


# 1.148 16-May-2023 lukem

build.sh, BUILDING: consistency improvements

Consistently use "show", instead of sometimes using "display" or "print".
Fix mdoc markup (even though BUILDING is raw text).
Document help, -P, -?


# 1.147 16-May-2023 lukem

BUILDING: update upstream, regen

doc/BUILDING.mdoc is the upstream for BUILDING, so add recent changes
in the latter to the former, formatting correctly.

Move INSTALLBOOT_UBOOT_PATHS to Environment variables.
Move INSTALLBOOT_BOARDS to "make" variables for full builds.
Add installboot(8) cross-reference.


Revision tags: netbsd-10-base
# 1.146 01-Oct-2022 rillig

fix documentation for MKLINT

Since share/mk/bsd.own.mk 1.749 from 2013-08-26, MKLINT defaults to no.


# 1.145 22-Aug-2022 brook

By default, do not install any bootable images.

The previous commit introduced the ability to install a set of
bootable images as a normal part of a release build. While this made
it easy to install bootable images, the contents of a release build
depend on whether or not U-Boot packages are installed in /usr/pkgsrc,
which is the default location searched by installboot(8).

This commit requires users to explicitly list the bootable images to
be installed, which by default is none (i.e., prior behavior).


# 1.144 21-Aug-2022 brook

Create bootable images in ${RELEASEDIR}/${RELEASEMACHINEDIR}/binary/gzimg.

Release builds for arm platforms create compressed images in
${RELEASEDIR}/${RELEASEMACHINEDIR}/binary/gzimg. However, in some
cases, e.g., armv7.img.gz, they are not bootable. Consequently, boot
blocks must be manually installed in the images, which is an extra
barrier for testing systems or adopting NetBSD. This has prompted
creation of external repositories, e.g., armbsd.org, to host a
collection of bootable images. However, this does not ease the burden
on developers compiling their own systems; for them, manual
installation of boot blocks is still required.

For arm platforms, etc/etc.evbarm/Makefile.inc contains the commands
used to create system images. Because installboot(8) can write boot
blocks directly to system images, a loop through possible boards can
create a series of bootable images during the normal build process.

In the case of many arm platforms, installboot(8) uses U-Boot boot
blocks, which are not part of the NetBSD source code. Developers can,
however, install as many U-Boot boot blocks as desired, either in the
default location of /usr/pkg/share/u-boot or in a set of directories
pointed to by the U-Boot search path, the INSTALLBOOT_UBOOT_PATHS
environment variable. For each board with an available boot block, a
board-specific bootable image will be created in
${RELEASEDIR}/${RELEASEMACHINEDIR}/binary/gzimg. If a boot block is
not available, which is the typical situation currently, no additional
image will be created.

This facility creates opportunities to build bootable images for any
number of boards within the scope of a standard release build.
However, that is not required and will not occur without the
intervention of installing U-Boot boot blocks prior to the build.


# 1.143 21-Aug-2022 lukem

BUILDING: regen for removal of extsrc/


# 1.142 28-May-2022 andvar

s/knowlege/knowledge/


# 1.141 20-Dec-2021 christos

Rename:
MKKDEBUG -> MKDEBUGKERNEL
MKTOOLSDEBUG -> MKDEBUGTOOLS
while keeping compatibility with the old names. Add missing documentation.
Now all debugging tunables are prefixed with MKDEBUG.


Revision tags: cjep_sun2x-base1 cjep_sun2x-base cjep_staticlib_x-base1 cjep_staticlib_x-base
# 1.140 10-Nov-2020 kamil

Reintroduce the support of MKCATPAGES

Requested by <mrg>


# 1.139 08-Nov-2020 kamil

Remove the support for MKCATPAGES

It was optional since 1999 and disabled by default since 2012.

Proposed on tech-userlevel@.


# 1.138 13-Oct-2020 thorpej

Document CPUFLAGS here (it's already documented in share/mk/bsd.README).
This will address the initial concern in PR port-alpha/55545.


# 1.137 12-Oct-2020 uwe

Mention HOST_CFLAGS and HOST_CXXFLAGS.


# 1.136 12-Oct-2020 uwe

Bump date and regen for BUILDING.mdoc revision 1.127
that introduced build.sh -c <compiler> option.


Revision tags: netbsd-9-3-RELEASE netbsd-9-2-RELEASE netbsd-9-1-RELEASE phil-wifi-20200421 phil-wifi-20200411 is-mlppp-base phil-wifi-20200406 netbsd-9-0-RELEASE netbsd-9-0-RC2 netbsd-9-0-RC1 phil-wifi-20191119 netbsd-9-base phil-wifi-20190609
# 1.135 08-May-2019 leot

Fix a typo

Reported by Tobias Ulmer via netbsd-docs@ ML, thanks!


Revision tags: pgoyette-compat-20190127 pgoyette-compat-20190118 pgoyette-compat-1226 pgoyette-compat-1126 pgoyette-compat-1020 pgoyette-compat-0930 pgoyette-compat-0906
# 1.134 29-Jul-2018 sevan

regen


Revision tags: pgoyette-compat-0728 phil-wifi-base pgoyette-compat-0625 pgoyette-compat-0521
# 1.133 02-May-2018 pgoyette

branches: 1.133.2;
Re-add files that were accidentally deleted in my previous commit.


# 1.132 02-May-2018 pgoyette

Synch with HEAD


Revision tags: pgoyette-compat-0502 pgoyette-compat-0422 pgoyette-compat-0415 pgoyette-compat-0407 pgoyette-compat-0330 pgoyette-compat-0322 pgoyette-compat-0315 pgoyette-compat-base
# 1.131 16-Feb-2018 leot

branches: 1.131.2;
regen


# 1.130 29-Dec-2017 sevan

regen


# 1.129 21-Oct-2017 sevan

regen


Revision tags: netbsd-8-2-RELEASE netbsd-8-1-RELEASE netbsd-8-1-RC1 netbsd-8-0-RELEASE netbsd-8-0-RC2 netbsd-8-0-RC1 matt-nb8-mediatek-base perseant-stdc-iso10646-base netbsd-8-base
# 1.128 21-May-2017 riastradh

regen


Revision tags: prg-localcount2-base3 prg-localcount2-base2 prg-localcount2-base1 prg-localcount2-base pgoyette-localcount-20170426
# 1.127 22-Apr-2017 plunky

regen


Revision tags: bouyer-socketcan-base1
# 1.126 20-Apr-2017 wiz

regen using regen target in doc.


# 1.125 20-Apr-2017 ozaki-r

Introduce MKSTRIPSYM build option

If it's yes, all local symbols of shared libraries are stripped
(default). If it's no, only temporary local symbols are stripped;
for example, symbols of static functions are kept. Keeping such
symbols is useful on using DTrace for userland libraries and
getting a backtrace from a rump server loading modules (shared
libraries).

Proposed and discussed on tech-kern and tech-toolchain


Revision tags: pgoyette-localcount-20170320
# 1.124 20-Feb-2017 christos

regen


# 1.123 16-Feb-2017 rin

The default values for MKPIC are yes and no for sh3 and m68000, respectively.
Bump date.


Revision tags: bouyer-socketcan-base pgoyette-localcount-20170107 pgoyette-localcount-20161104 localcount-20160914 pgoyette-localcount-20160806 pgoyette-localcount-20160726 pgoyette-localcount-base
# 1.122 29-Jan-2016 wiz

branches: 1.122.2; 1.122.4;
Document MKREPRO_TIMESTAMP.


# 1.121 23-Jul-2015 mrg

remove the xfree86 reachover makefiles and the vast majority of
the support in the rest of the source tree.

X11 sets could use some cleaning up perhaps (just deletion, as
we've never really marked the old X11R6 as obsolete for native
xorg using platforms so far either.)


# 1.120 07-Jun-2015 pgoyette

Update to reflect changes made in rev 1.398 of src/etc/Makefile


# 1.119 08-Apr-2015 wiz

regen


# 1.118 30-Nov-2014 uebayasi

regen


# 1.117 16-Nov-2014 uebayasi

regen


# 1.116 16-Nov-2014 uebayasi

regen


# 1.115 13-Nov-2014 apb

regen from doc/BUILDING.mdoc revision 1.107.
This reinstates documentation for "extsrc" which was lost in 2009.


# 1.114 08-Nov-2014 snj

fourth time's the charm, i guess. when committing a generated file,
it's best to use the latest revision of the source file (hi uebs!)

regen to include changes from revision 1.105 of doc/BUILDING.mdoc


# 1.113 06-Nov-2014 uebayasi

regen


# 1.112 06-Nov-2014 uebayasi

Expand TABs.


# 1.111 06-Nov-2014 uebayasi

Document the new "kernels" operation, prompted by joerg@.


# 1.110 05-Nov-2014 snj

regen


Revision tags: netbsd-7-base tls-earlyentropy-base tls-maxphys-base
# 1.109 07-Aug-2014 apb

branches: 1.109.2;
regen BUILDING from doc/BUILDING.mdoc


# 1.108 03-Aug-2014 apb

BUILDINFO part6: regen BUILDING from doc/BUILDING.mdoc


# 1.107 14-Jun-2014 apb

Regen from doc/BUILDING.mdoc;1.100:
Improve documentation for BUILDID.


# 1.106 21-May-2014 wiz

regen


Revision tags: yamt-pagecache-base9 riastradh-xf86-video-intel-2-7-1-pre-2-21-15 riastradh-drm2-base3 riastradh-drm2-base2 riastradh-drm2-base1 riastradh-drm2-base
# 1.105 29-May-2013 wiz

branches: 1.105.4;
regen using 'make regen' from src/doc.


# 1.104 29-May-2013 wiz

regen (using mandoc doc/BUILDING.mdoc > BUILDING -- let me know
if a different way is preferred, I see that it now contains formatting).


Revision tags: agc-symver-base yamt-pagecache-base8 yamt-pagecache-base7
# 1.103 08-Nov-2012 dholland

regen


Revision tags: yamt-pagecache-base6
# 1.102 19-Sep-2012 abs

regen


# 1.101 25-May-2012 wiz

branches: 1.101.2;
regen using 'make regen' in doc/


# 1.100 25-May-2012 wiz

Document MKREPRO using joerg's wording.


Revision tags: yamt-pagecache-base5 yamt-pagecache-base4
# 1.99 23-Feb-2012 tsutsui

Add a missing period.


Revision tags: netbsd-6-base
# 1.98 14-Feb-2012 apb

branches: 1.98.2;
Regen from revision 1.87 of doc/BUILDING.mdoc.


# 1.97 22-Jan-2012 tsutsui

Add "live-image" and "install-image" target support to build.sh.

"live-image" target builds pre-installed disk images that can be used on
emulators or boot from USB memory sticks to try NetBSD without installation.
Currently amd64, i386, pmax, sparc, sparc64, sun2, sun3, and vax
(which have working emulators and don't require extra tools like preparing
msdosfs or partitioning MD label structures) support this target.

"install-image" target builds an bootable installation disk image that can
be used as an install CD but burned into USB memory sticks etc.
Current only amd64 and i386 (which would support USB boot) have this target.

For more details (and known issue) see following posts on netbsd-bugs@:
http://mail-index.NetBSD.org/netbsd-bugs/2011/08/06/msg023639.html
http://mail-index.NetBSD.org/netbsd-bugs/2011/09/23/msg024207.html
http://mail-index.NetBSD.org/netbsd-bugs/2011/12/07/msg025166.html
http://mail-index.NetBSD.org/netbsd-bugs/2011/12/08/msg025178.html

No particular comments about implementation, and
"go ahead" comments from mrg@, riz@ and christos@.

Closes PR toolchain/45153 and PR misc/45155.


Revision tags: yamt-pagecache-base3 yamt-pagecache-base2 yamt-pagecache-base
# 1.96 09-Sep-2011 apb

branches: 1.96.2;
Add tests for the shell under which build.sh is run. If the
shell fails the tests, then build.sh tries to re-exec itself
under a more suitable shell.


# 1.95 09-Sep-2011 apb

Revisions 1.92 and 1.93 of src/BUILDING were not reflected in
src/doc/BUILDING.mdoc, so those changes were lost when src/BUILDING
was regenerated in revision 1.94.

Now update src/doc/BUILDING.mdoc and regenerate src/BUILDING to
reinstate the lost changes. (I also edited one of the changes, to use
the phrase "space-separated list" for consistency with other parts of
the document.)

The original changes were:


# 1.93 06-Aug-2011 jnemeth

Add description of MKKMOD, part of PR misc/45216


Revision tags: cherry-xenmp-base bouyer-quota2-nbase bouyer-quota2-base
# 1.92 29-Jan-2011 jym

Pass down INSTALLSETS variable to installsets target. Use :Q to escape
shell meta-characters, as the variable contains a list of sets, separated
by spaces.

$ ./build.sh -V INSTALLSETS="base etc" install=idir

should now work as expected.

Reviewed by apb@ on tech-toolchain.


# 1.94 09-Sep-2011 apb

Allow MAKEFLAGS to be set via build.sh -V. Somebody asked for this
in 2008.

Also add comments above a few functions in build.sh, and bump copyright
dates.


# 1.93 06-Aug-2011 jnemeth

Add description of MKKMOD, part of PR misc/45216


Revision tags: cherry-xenmp-base bouyer-quota2-nbase bouyer-quota2-base
# 1.92 29-Jan-2011 jym

Pass down INSTALLSETS variable to installsets target. Use :Q to escape
shell meta-characters, as the variable contains a list of sets, separated
by spaces.

$ ./build.sh -V INSTALLSETS="base etc" install=idir

should now work as expected.

Reviewed by apb@ on tech-toolchain.


Revision tags: matt-mips64-premerge-20101231
# 1.91 25-Jul-2010 mrg

branches: 1.91.2;
remove the MKSUBPIXEL/MKTTINTERP options; they're going away.

regenerate.


Revision tags: matt-premerge-20091211
# 1.90 30-Nov-2009 uebayasi

Support "extsrc", externally added programs and libraries. Users can write
their own reach-overs, cross-build, install, and get set files just like base
and X11 / X.org. (These sets are not included as TNF releases.)


# 1.89 10-Oct-2009 apb

If ${NETBDSRCDIR}/../xsrc exists, then use it as the default value
of X11SRCDIR. If it doesn't exist, then use /usr/xsrc as before.

OK mrg


# 1.88 27-Sep-2009 apb

* Use a more robust method of creating the top level object directory.
Use getmakevar to expand MAKEOBJDIRPREFIX or MAKEOBJDIR, or (if
neither of those variables is set) use a non-recursive "make obj" in
the top level source directory.

* Do not let TOP_objdir default to ${TOP}. It's now set only by the
-M or -O command line options, or after using getmakevar to expand
MAKEOBJDIRPREFIX or MAKEOBJDIR.

* Make try_set_TOOLDIR handle MAKEOBJDIRPERFIX passed from the
environment. It runs too early to use getmakevar, so it will not work
if the value contains embedded '${...}' variable references.

* Use '$TOOLDIR' (with a literal '$') instead of 'nonexistent' in
a message when rebuilding make when TOOLDIR is not yet known.


# 1.87 27-Sep-2009 apb

Allow build.sh "-C cdextra" option to be specified multiple times.


# 1.86 07-Sep-2009 jnemeth

Add a modules operation to build.sh, which builds and installs kernel modules
into DESTDIR.

This is based on the patch provided by tsutsui@ on tech-toolchain@.


# 1.85 12-Jul-2009 hubertf

regen


# 1.84 12-Jul-2009 hubertf

regen


Revision tags: jym-xensuspend-nbase jym-xensuspend-base
# 1.83 01-May-2009 snj

Introduce MKSUBPIXEL, which allows enabling subpixel rendering code
in FreeType.


# 1.82 02-Dec-2008 mrg

branches: 1.82.2;
be explicit about MAKEOBJDIR and MAKEOBJDIRPREFIX not being for
mk.conf or ${MAKECONF}.


# 1.81 15-Nov-2008 mrg

revert sparc back to default of XFree86 at the request of macallan.


# 1.80 13-Nov-2008 apb

Add support for new MAKEVERBOSE levels 3 and 4. The complete list is now:

0 Minimal output ("quiet")
1 Describe what is occurring
2 Describe what is occurring and echo the actual command
3 Ignore the effect of the "@" prefix in make commands
4 Trace shell commands using the shell's -x flag

The default remains MAKEVERBOSE=2.


# 1.79 09-Nov-2008 mrg

- retire MKXORG from public use
- introduce X11FLAVOUR to choose src/x11 vs src/external/mit/xorg
for the X11 to build if MKX11=yes is set. it takes the values
of either Xorg or XFree86.
- default to Xorg on alpha, i386, macppc, shark, sparc and sparc64
- remove MKXORG_WITH_XSRC_XSERVER, unused and never useful


Revision tags: netbsd-5-base matt-mips64-base2
# 1.78 24-Sep-2008 apb

branches: 1.78.2;
regen for recent change to examples and objdir advice,
and for the older MKSTRIPIDENT change.


Revision tags: wrstuden-revivesa-base-3 wrstuden-revivesa-base-2
# 1.77 06-Sep-2008 lukem

regen for MKHTML


# 1.76 28-Aug-2008 lukem

Improve support for MKXORG!=no to enable builds into external/mit/xorg.
This will be mutually exclusive to MKX11!=no.


# 1.75 18-Aug-2008 lukem

Document "build.sh cleandir".
Fix formatting nit.
Remove BUGS; all the in-tree platforms are using build.sh now.


# 1.74 11-Aug-2008 apb

* Suggest a "-j" value between 1+NCPU and 2*NCPU for the fastest builds.
* Remove some duplicated content that appeared in both the section about
make's -j flag and the section about build.sh's -j flag.


# 1.73 05-Aug-2008 apb

* Add more detail for build.sh -M and -O options.
* Mention new default when source is /usr/src but build.sh is run
with neither -M nor -O.


# 1.72 05-Aug-2008 perry

Builds now use "BUILDSEED" so that c++ binaries are reproduceable.
By default BUILDSEED is set to NetBSD-{majorversion} -- a -S flag may
be used to change it.

Discussed on tech-toolchain.


Revision tags: wrstuden-revivesa-base-1 yamt-pf42-base4 yamt-pf42-base3 hpcarm-cleanup-nbase yamt-pf42-baseX yamt-pf42-base2 wrstuden-revivesa-base keiichi-mipv6-nbase yamt-pf42-base keiichi-mipv6-base
# 1.71 29-Mar-2008 dholland

branches: 1.71.4;
Correct/clarify the default setting of USETOOLS in the previous version.
Noted by apb.


# 1.70 28-Mar-2008 dholland

Assorted updates and clarifications, grammar fixes and wording improvements,
and so on. Significant highlights:
- mention src/tests and reference atf;
- provide examples of MACHINE and MACHINE_ARCH;
- mention that MKOBJ=no is not recommended;
- correct the description of the default setting of USETOOLS;
- document the interactions of build.sh -[uo] with various things;
- document the interactions of build.sh tools and kernel=FOO;
- use a lot fewer parentheses.
Discussed on netbsd-docs.


Revision tags: matt-armv6-nbase
# 1.69 18-Mar-2008 lukem

Consistently document RELEASEDIR/RELEASEMACHINEDIR.


# 1.68 08-Mar-2008 reed

Mention that "build" and "distribution" do not build nor install (to DESTDIR)
a kernel.


Revision tags: cube-autoconf-base matt-armv6-base hpcarm-cleanup-base
# 1.67 23-Nov-2007 sborrill

branches: 1.67.4;
Add support for CDBUILDEXTRA which acts like CDEXTRA to add extra items
to the CD-ROM image.
Make CDEXTRA and CDBUILDEXTRA be able to contain lists of files and directories
which are added in turn.
Add support for CDEXTRA_SKIP which contains a list of fnmatch(3) items to
skip during the copy. This is _very_ useful for skipping CVS dirs for example.
CDBUILDEXTRA and CDEXTRA_SKIP are to be used in Makefiles creating the images,
CDEXTRA remains to be used from build.sh.
Update documentation and build.sh help text to show that -C can be used to
specify a list of files and directories rather than just a single dir.


# 1.66 01-Sep-2007 jnemeth

Convert build.sh iso-dir=directory option to -C cddir as per jmmv@ on
source-changes.


# 1.65 01-Sep-2007 jnemeth

Add an iso-dir=directory option. When combined with iso-image or
iso-image-source, it will cause directory to be added to the CD-ROM image.


# 1.64 30-Aug-2007 jnemeth

describe new iso-image-source target


# 1.63 30-Aug-2007 ad

Remove STATUS paragraph which makes it sound like the build system is
half baked.


Revision tags: matt-mips64-base
# 1.62 13-Apr-2007 apb

branches: 1.62.4;
Document recent changes to "make iso-image".


# 1.61 26-Mar-2007 apb

Document the fact that "make installworld" and "build.sh
installworld=..." do not install the etc or xetc sets. Suggest using
etcupdate(8) and postinstall(8) after installworld.


# 1.60 27-Jan-2007 apb

Try to clarify the description of build.sh -m mach.
Document new evbarm-eb and evbarm-el aliases.


Revision tags: netbsd-4-base
# 1.59 08-Oct-2006 apb

branches: 1.59.2;
Clarify that DESTDIR/OBJDIR/etc are absolute paths, but build.sh
-D/-O/etc allows relative paths.

Closes PR 32345 by Andre Luiz de Oliveira.


# 1.58 29-Sep-2006 apb

Use ${HOST_SH} instead of the host system's /bin/sh wherever possible:

* Describe the HOST_SH variable, and the way build.sh attempts to set it.

* Suggest passing HOST_SH in the environment if /bin/sh is not a working
shell.


Revision tags: abandoned-netbsd-4-base
# 1.57 29-Jan-2006 apb

mkisofs is in pkgsrc/sysutils/cdrtools now, not pkgsrc/sysutils/cdrecord.
Reported by Jukka Salmi.


# 1.56 28-Jan-2006 apb

* Add an "iso-image" target in the top level Makefile,
which invokes make iso-image in the etc directory.
* Add an "iso-image" action in build.sh, which
invokes make iso-image.
* Document the above in doc/BUILDING.mdoc.
* Re-generate BUILDING.

Approved by christos


# 1.55 12-Jan-2006 wiz

Bump date for syspkgs.


# 1.54 04-Jan-2006 apb

Document "make syspkgs" and "build.sh syspkgs".

Reviewed by agc


Revision tags: netbsd-3-1-1-RELEASE netbsd-3-0-3-RELEASE netbsd-3-1-RELEASE netbsd-3-0-2-RELEASE netbsd-3-1-RC4 netbsd-3-1-RC3 netbsd-3-1-RC2 netbsd-3-1-RC1 netbsd-3-0-1-RELEASE netbsd-3-0-RELEASE netbsd-3-0-RC6 netbsd-3-0-RC5 netbsd-3-0-RC4 netbsd-3-0-RC3 netbsd-3-0-RC2 netbsd-3-0-RC1 netbsd-3-base
# 1.53 15-Feb-2005 reed

Document the environment variables for if you need to override or
manually select your compilers.
(And regen BUILDING from doc/BUILDING.mdoc.)


# 1.52 12-Oct-2004 jmc

Fix some typo's/bad wording as highlighted in PR#27219


# 1.51 25-Jun-2004 wiz

regen (Document -h. From Karsten Kruse in PR 25974.
While here, remove a duplicate sentence).


Revision tags: netbsd-2-0-3-RELEASE netbsd-2-1-RELEASE netbsd-2-1-RC6 netbsd-2-1-RC5 netbsd-2-1-RC4 netbsd-2-1-RC3 netbsd-2-1-RC2 netbsd-2-1-RC1 netbsd-2-0-2-RELEASE netbsd-2-0-1-RELEASE netbsd-2-base netbsd-2-0-RELEASE netbsd-2-0-RC5 netbsd-2-0-RC4 netbsd-2-0-RC3 netbsd-2-0-RC2 netbsd-2-0-RC1 netbsd-2-0-base
# 1.50 19-Mar-2004 wiz

Document MKTTINTERP.


# 1.49 06-Feb-2004 lukem

* Document build.sh -X and -x
* Document MKX11 and X11SRCDIR
* Remove note warning against cross-building from systems other than NetBSD;
it works on many other platforms.


# 1.48 29-Dec-2003 jmc

Note tools/compat/README as the place to get notes from non-native cross builds


# 1.47 19-Dec-2003 zuntum

Change -v to -V in the following section:

"Print make(1)'s idea of the value of var. Does not build any targets."

To reflect reality.

Found by Tomasz Marciniak <Tomasz.Marciniak@felix.fizyka.amu.edu.pl>, thanks!


# 1.46 26-Oct-2003 lukem

Improve how build.sh -N and MAKEVERBOSE interoperate;
rather than adding '-s' to make's command line in the makewrapper,
use the .SILENT target based on MAKEVERBOSE's value.

This means that you can do:
./build.sh -N 1 makewrapper

$TOOLDIR/bin/nbmake-$MACHINE
# runs at MAKEVERBOSE==1, with command lines suppressed

$TOOLDIR/bin/nbmake-$MACHINE MAKEVERBOSE=2
# runs at MAKEVERBOSE==2 for this invocation, with command lines shown


# 1.45 25-Oct-2003 lukem

Implement build -N noisy, which sets MAKEVERBOSE to noisy and adds
`-s' to MAKEFLAGS for noisy < 2.


# 1.44 29-Sep-2003 lukem

regenerate for "%" prompt update


# 1.43 19-Aug-2003 martti

Backout the previous commit


# 1.42 19-Aug-2003 martti

Remove # from the example.


# 1.41 08-Aug-2003 lukem

fix description of MAKEOBJDIR. from Martin Husemann


# 1.40 29-Jul-2003 lukem

Add build.sh -Z var, to unset a variable and ensure it's unset in makewrapper.
For -M MAKEOBJDIRPREFIX, unset MAKEOBJDIR.
For -O MAKEOBJDIR, unset MAKEOBJDIRPREFIX.


# 1.39 18-Jul-2003 lukem

fix default location of TOOLDIR


# 1.38 18-Jul-2003 lukem

Update for the MKUNPRIVED/MKUPDATE changes.


# 1.37 18-Jul-2003 lukem

rebuild with new groff


# 1.36 03-Jul-2003 lukem

attempt to clarify how MAKEOBJDIR{,PREFIX} may be provided ...
(this document needs a rototill, which i may get to whilst writing a
paper about build.sh)


# 1.35 25-May-2003 lukem

all:
* add "releasekernel=conf", to install a gzipped copy of the kernels
built by "kernel=conf" to RELEASEDIR/MACHINE/binary/kernel

build.sh:
* be more consistent in various status messages
* move the {release,}kernel=conf conf parsing code into getkernelconf()
and use in both buildkernel() and releasekernel()
* only warn once when building multiple kernels without updating the tools


# 1.34 18-May-2003 lukem

For normal builds, MKOBJDIRS default to `no' (not `yes').
It's only build.sh that sets this to `yes' by default.
Noted by OGAWA Takaya in [toolchain/19823]


# 1.33 17-May-2003 lukem

improve description of how "build.sh -m mach" sets the default
MACHINE_ARCH, and list the special cases that this does not occur for.


# 1.32 10-May-2003 lukem

crank date for previous


# 1.31 10-May-2003 lukem

Add "sourcesets" argument/target, which builds source sets into
RELEASEDIR/source/sets


# 1.30 08-May-2003 lukem

build.sh now provides defaults for DESTDIR and RELEASEDIR if not expert mode.
Remove -D and -R from EXAMPLES since they're not necessary any more.


# 1.29 08-Feb-2003 lukem

Fix example 3; the build.sh target is "install" not "installworld".
Improve description.
Noted by Valeriy Ushakov (uwe@) in private email.


# 1.28 02-Feb-2003 lukem

attempt to further improve and clarify the examples...


# 1.27 30-Jan-2003 lukem

Prefix various paths with 'DESTDIR', to highlight that the DESTDIR
is taken into account.


# 1.26 29-Jan-2003 lukem

allow toolprefix to be easily changed


# 1.25 26-Jan-2003 lukem

Various improvements per discussion with Alan Barrett.


# 1.24 26-Jan-2003 lukem

- Add "sets" top-level Makefile target and build.sh operation.
[Latter suggested by Julio Merino in private email]
- Add "help" build.sh operation.


# 1.23 26-Jan-2003 lukem

Change build.sh so that at least one operation is required.
Add "makewrapper" operation to build.sh.
[The above changes were suggested by Alan Barrett on current-users@]

Fail if building as non-root unless: UNPRIVED is set, -U is given, or -E
(expert mode) is given.
[Suggested by James Wetterau in private email]

Improve the examples in BUILDING.


# 1.22 23-Jan-2003 lukem

Rework how build.sh functions, so that command line options set various
parameters, and a list of "operations" defines what to do.
The full usage is show below. Notes:
`-b' has been deprecated (it always occurs now)
`-d' is replaced by "distribution"
`-R rel' onlys sets RELEASEDIR; use "release" to build a release
`-k kern' has been replaced by "kernel=kern"
`-i idir' has been replaced by "install=idir"
-r now occurs before nbmake is rebuilt

Add a copyright (long due!). Rework the code to (a KNF inspired) ShellNF.
Use functions appropriately. Allow `nb' prefix to be easily changed to
something else. Solve world peace (just kidding)

This is part of the (never achievable) goal of attempting to make
NetBSD easier to build...


--8<-- new usage follows --8<--

Usage: build.sh [-EnorUu] [-a arch] [-B buildid] [-D dest] [-j njob] [-M obj]
[-m mach] [-O obj] [-R release] [-T tools] [-V var=[value]]
[-w wrapper] [operation [...] ]

System build operations (all imply "obj" and "tools"):
build Run "make build"
distribution Run "make distribution" (includes etc/ files)
release Run "make release" (includes kernels & distrib media)

Other operations:
obj Run "make obj" (default unless -o)
tools Build and install tools
kernel=conf Build kernel with config file `conf'
install=idir Run "make installworld" to `idir'
(useful after 'distribution' or 'release')

Options:
-a arch Set MACHINE_ARCH to arch (otherwise deduced from MACHINE)
-B buildId Set BUILDID to buildId
-D dest Set DESTDIR to dest
-E Set "expert" mode; disables some DESTDIR checks
-j njob Run up to njob jobs in parallel; see make(1)
-M obj Set obj root directory to obj (sets MAKEOBJDIRPREFIX)
-m mach Set MACHINE to mach (not required if NetBSD native)
-n Show commands that would be executed, but do not execute them
-O obj Set obj root directory to obj (sets a MAKEOBJDIR pattern)
-o Set MKOBJDIRS=no (do not create objdirs at start of build)
-R release Set RELEASEDIR to release
-r Remove contents of TOOLDIR and DESTDIR before building
-T tools Set TOOLDIR to tools. If unset, and TOOLDIR is not set in
the environment, nbmake will be (re)built unconditionally.
-U Set UNPRIVED
-u Set UPDATE
-V v=[val] Set variable `v' to `val'
-w wrapper Create nbmake script as wrapper
(default: ${TOOLDIR}/bin/nbmake-${MACHINE})


# 1.21 04-Jan-2003 lukem

Add "-V var=[value]", for setting arbitrary variables which will also
be added to the nbmake-${MACHINE} wrapper.
Useful for setting RELEASEDIR, without -R's habit of building a release.


Revision tags: fvdl_fs64_base
# 1.20 25-Dec-2002 lukem

Document:
* build.sh -i idir
* top level targets: distribution, buildworld, installworld
* top level variables: INSTALLWORLDDIR


# 1.19 08-Dec-2002 lukem

Add -E - "expert mode". If this is not specified, builds to DESTDIR=/ are
not permitted.
By using this flag, you are taking responsibility for any issues that
may occur because of this...


# 1.18 08-Dec-2002 lukem

- be consistent about option ordering in build.sh usage display
- use Fl and Ar instead of Sy and Em to format options


# 1.17 25-Nov-2002 wiz

Update location of BUILDING.mdoc.


# 1.16 20-Oct-2002 lukem

regen for build.sh -k


# 1.15 21-Sep-2002 lukem

regen for: USE_NEW_TOOLCHAIN was replaced with TOOLCHAIN_MISSING


# 1.14 17-Sep-2002 fredb

Expand on the difference between ``build.sh -d'' and ``make install'',
as requested by Brian Stark in PR toolchain/18228 (which this closes).


# 1.13 22-Jul-2002 wiz

Remove duplicate 'files'. From Ryo HAYASAKA in toolchain/17674.


Revision tags: netbsd-1-6-PATCH002-RC3 netbsd-1-6-PATCH002-RC2 netbsd-1-6-PATCH002-RC1 netbsd-1-6-PATCH001 netbsd-1-6-PATCH001-RELEASE netbsd-1-6-PATCH001-RC3 netbsd-1-6-PATCH001-RC2 netbsd-1-6-PATCH001-RC1 netbsd-1-6-RELEASE netbsd-1-6-RC3 netbsd-1-6-RC2 netbsd-1-6-RC1 netbsd-1-6-base
# 1.12 13-May-2002 lukem

branches: 1.12.2;
add "-M makeobjdirprefix" to build.sh


# 1.11 03-May-2002 lukem

Move the METALOG from ${_SRC_TOP_OBJ_} to ${DESTDIR}.

There were too many synchronisation problems with using the former;
including situations such as a "make clean" performed between two
installs to the same DESTDIR would result in a truncated METALOG and
the resultant sets would be missing stuff such as include files that
don't get reinstalled if they haven't changed, even with !UPDATE.


# 1.10 02-May-2002 sommerfeld

Re-gen.


# 1.9 14-Mar-2002 thorpej

Add a -B option to set the BUILDID for the build. This also causes
the make(1) wrapper script to be named "nbmake-MACHINE-BUILDID".


# 1.8 05-Mar-2002 lukem

document various supported environment variables, including MAKEOBJDIRPREFIX


# 1.7 04-Mar-2002 lukem

document:
- make's UNPRIVED support
- build.sh's -U support
- the build system currently needs to build onto a file system with
long file name and hard link support


# 1.6 25-Nov-2001 thorpej

Document the -d option to build.sh


# 1.5 15-Nov-2001 tv

Note only <bsd.own.mk> as the authority for determining whether the new
BUILDING instructions should be used.


# 1.4 14-Nov-2001 tv

Turn off host-specific objdirs by default. Set MKHOSTOBJ=yes to enable.


# 1.3 12-Nov-2001 tv

Major overhaul of src/tools and host toolchain. Summary of changes:

* Rewrite src/tools Make logic to work like the rest of the tree wrt
"dependall" and "install". The old "make build" hack is gone.

* Remove the MKTOOLS logic. This was linked to the "make build" hack,
and was only needed because TOOLDIR originally had no writable default.

* Redo the GNU configure/make logic to make it fit reasonably in a
BSD make wrapper. Use new ${.ALLTARGETS} variable to scan for
targets in $(srcdir), and mark them with .MADE: to prevent rebuilding.

* Only build cross tools in src/tools; remove some messy logic in
src/usr.* and src/gnu/usr.* that would do target filename rewriting
(improves consistency and readability).

* Add the ability to build cross gdb at tool build time by setting
MKCROSSGDB (default no) to "yes" in mk.conf.

* Add src/tools/groff and set up paths to work with this cross groff.


# 1.2 08-Nov-2001 wiz

Remove mention of BUILDLING.html, and follow rename of BUILDING.txt to
BUILDING.
Noted by Love <lha@stacken.kth.se> on tech-toolchain.


# 1.1 01-Nov-2001 tv

By popular demand, one preformatted version of BUILDING, plaintext, no CRs.


# 1.156 05-Jul-2023 lukem

BUILDING: wording tweaks


# 1.155 11-Jun-2023 lukem

BUILDING: remove duplication from mk.conf(5)

Remove all "make" variables / mk.conf(5) variables already documented
in mk.conf(5). The duplication was a maintenance headache, as I've
experienced over recent weeks getting the build documentation up to
date.

Add notes clarifying that manual page references are to the NetBSD
manual pages, not to the host manual pages, and how to format from
source, or find online at https://man.netbsd.org.

Add explicit links to the mdoc(7) in-tree source for mk.conf(5),
hier(7), and release(7) because those are directly relevant to the host
build information in BUILDING.

Note: We don't normally need these notes for native documentation,
but BUILDING is intended for users on host systems which might not
be NetBSD(-current).

Add missing defaults.


# 1.154 11-Jun-2023 lukem

BUILDING: update from mk.conf(5). reorder

Sync variable entries from mk.conf(5).

Merge the "make variables for full builds" section into the previous.
Having two separate sections and some entries duplicated was confusing
when searching for variables.


# 1.153 11-Jun-2023 lukem

more NBUILDJOBS deprecation

The NBUILDJOBS option was deprecated in 2002;
there's no need to keep warning about it,
remove from params / show-params,
and only document as obsolete.


# 1.152 05-Jun-2023 lukem

BUILDING: editorial

MKX11=yes wants MKINET6=yes

Change the width of the variable lists to 14n (from 15n)
so that when the lists are rendered and then left aligned,
the column is 16 characters (aka 2 tabs) which makes
copypasta to bsd.README easier.


# 1.151 04-Jun-2023 lukem

BUILDING: update from canonical mk.conf(5)

Incorporate content and styles updates for mk.conf entries
from share/man/man5/mk.conf.5, which is the canonical
reference for mk.conf.

Add: BSDOBJDIR, BSDSRCDIR, EXTERNAL_TOOLCHAIN, MKDEBUGKERNEL,
MKDEBUGTOOLS, MKHTML, MKLINKLIB, MKOBJDIRS, TOOLCHAIN_MISSING,
NETBSDSRCDIR

It's for further study as to whether we just replace the
most of subsection "make" variables with a link to mk.conf(5).

Style:
- Add more .de macros per mk.conf.5.
- Order list items alphabetically. When multiple items are present
in a list item, sort within the item first.
- More cross-references.


# 1.150 02-Jun-2023 lukem

build.sh: MAKECONF and mk.conf(5) improvements

Move MAKECONF to the Environment variables section.
Add mk.conf(5) cross-references.
Make Notes more obvious.
Fix mandoc lint.


# 1.149 18-May-2023 lukem

BUILDING: TMPDIR must not be noexec

Describe $TMPDIR as used by build.sh, and
add a note that it can't be mounted noexec.

PR toolchain/44459


# 1.148 16-May-2023 lukem

build.sh, BUILDING: consistency improvements

Consistently use "show", instead of sometimes using "display" or "print".
Fix mdoc markup (even though BUILDING is raw text).
Document help, -P, -?


# 1.147 16-May-2023 lukem

BUILDING: update upstream, regen

doc/BUILDING.mdoc is the upstream for BUILDING, so add recent changes
in the latter to the former, formatting correctly.

Move INSTALLBOOT_UBOOT_PATHS to Environment variables.
Move INSTALLBOOT_BOARDS to "make" variables for full builds.
Add installboot(8) cross-reference.


Revision tags: netbsd-10-base
# 1.146 01-Oct-2022 rillig

fix documentation for MKLINT

Since share/mk/bsd.own.mk 1.749 from 2013-08-26, MKLINT defaults to no.


# 1.145 22-Aug-2022 brook

By default, do not install any bootable images.

The previous commit introduced the ability to install a set of
bootable images as a normal part of a release build. While this made
it easy to install bootable images, the contents of a release build
depend on whether or not U-Boot packages are installed in /usr/pkgsrc,
which is the default location searched by installboot(8).

This commit requires users to explicitly list the bootable images to
be installed, which by default is none (i.e., prior behavior).


# 1.144 21-Aug-2022 brook

Create bootable images in ${RELEASEDIR}/${RELEASEMACHINEDIR}/binary/gzimg.

Release builds for arm platforms create compressed images in
${RELEASEDIR}/${RELEASEMACHINEDIR}/binary/gzimg. However, in some
cases, e.g., armv7.img.gz, they are not bootable. Consequently, boot
blocks must be manually installed in the images, which is an extra
barrier for testing systems or adopting NetBSD. This has prompted
creation of external repositories, e.g., armbsd.org, to host a
collection of bootable images. However, this does not ease the burden
on developers compiling their own systems; for them, manual
installation of boot blocks is still required.

For arm platforms, etc/etc.evbarm/Makefile.inc contains the commands
used to create system images. Because installboot(8) can write boot
blocks directly to system images, a loop through possible boards can
create a series of bootable images during the normal build process.

In the case of many arm platforms, installboot(8) uses U-Boot boot
blocks, which are not part of the NetBSD source code. Developers can,
however, install as many U-Boot boot blocks as desired, either in the
default location of /usr/pkg/share/u-boot or in a set of directories
pointed to by the U-Boot search path, the INSTALLBOOT_UBOOT_PATHS
environment variable. For each board with an available boot block, a
board-specific bootable image will be created in
${RELEASEDIR}/${RELEASEMACHINEDIR}/binary/gzimg. If a boot block is
not available, which is the typical situation currently, no additional
image will be created.

This facility creates opportunities to build bootable images for any
number of boards within the scope of a standard release build.
However, that is not required and will not occur without the
intervention of installing U-Boot boot blocks prior to the build.


# 1.143 21-Aug-2022 lukem

BUILDING: regen for removal of extsrc/


# 1.142 28-May-2022 andvar

s/knowlege/knowledge/


# 1.141 20-Dec-2021 christos

Rename:
MKKDEBUG -> MKDEBUGKERNEL
MKTOOLSDEBUG -> MKDEBUGTOOLS
while keeping compatibility with the old names. Add missing documentation.
Now all debugging tunables are prefixed with MKDEBUG.


Revision tags: cjep_sun2x-base1 cjep_sun2x-base cjep_staticlib_x-base1 cjep_staticlib_x-base
# 1.140 10-Nov-2020 kamil

Reintroduce the support of MKCATPAGES

Requested by <mrg>


# 1.139 08-Nov-2020 kamil

Remove the support for MKCATPAGES

It was optional since 1999 and disabled by default since 2012.

Proposed on tech-userlevel@.


# 1.138 13-Oct-2020 thorpej

Document CPUFLAGS here (it's already documented in share/mk/bsd.README).
This will address the initial concern in PR port-alpha/55545.


# 1.137 12-Oct-2020 uwe

Mention HOST_CFLAGS and HOST_CXXFLAGS.


# 1.136 12-Oct-2020 uwe

Bump date and regen for BUILDING.mdoc revision 1.127
that introduced build.sh -c <compiler> option.


Revision tags: netbsd-9-3-RELEASE netbsd-9-2-RELEASE netbsd-9-1-RELEASE phil-wifi-20200421 phil-wifi-20200411 is-mlppp-base phil-wifi-20200406 netbsd-9-0-RELEASE netbsd-9-0-RC2 netbsd-9-0-RC1 phil-wifi-20191119 netbsd-9-base phil-wifi-20190609
# 1.135 08-May-2019 leot

Fix a typo

Reported by Tobias Ulmer via netbsd-docs@ ML, thanks!


Revision tags: pgoyette-compat-20190127 pgoyette-compat-20190118 pgoyette-compat-1226 pgoyette-compat-1126 pgoyette-compat-1020 pgoyette-compat-0930 pgoyette-compat-0906
# 1.134 29-Jul-2018 sevan

regen


Revision tags: pgoyette-compat-0728 phil-wifi-base pgoyette-compat-0625 pgoyette-compat-0521
# 1.133 02-May-2018 pgoyette

branches: 1.133.2;
Re-add files that were accidentally deleted in my previous commit.


# 1.132 02-May-2018 pgoyette

Synch with HEAD


Revision tags: pgoyette-compat-0502 pgoyette-compat-0422 pgoyette-compat-0415 pgoyette-compat-0407 pgoyette-compat-0330 pgoyette-compat-0322 pgoyette-compat-0315 pgoyette-compat-base
# 1.131 16-Feb-2018 leot

branches: 1.131.2;
regen


# 1.130 29-Dec-2017 sevan

regen


# 1.129 21-Oct-2017 sevan

regen


Revision tags: netbsd-8-2-RELEASE netbsd-8-1-RELEASE netbsd-8-1-RC1 netbsd-8-0-RELEASE netbsd-8-0-RC2 netbsd-8-0-RC1 matt-nb8-mediatek-base perseant-stdc-iso10646-base netbsd-8-base
# 1.128 21-May-2017 riastradh

regen


Revision tags: prg-localcount2-base3 prg-localcount2-base2 prg-localcount2-base1 prg-localcount2-base pgoyette-localcount-20170426
# 1.127 22-Apr-2017 plunky

regen


Revision tags: bouyer-socketcan-base1
# 1.126 20-Apr-2017 wiz

regen using regen target in doc.


# 1.125 20-Apr-2017 ozaki-r

Introduce MKSTRIPSYM build option

If it's yes, all local symbols of shared libraries are stripped
(default). If it's no, only temporary local symbols are stripped;
for example, symbols of static functions are kept. Keeping such
symbols is useful on using DTrace for userland libraries and
getting a backtrace from a rump server loading modules (shared
libraries).

Proposed and discussed on tech-kern and tech-toolchain


Revision tags: pgoyette-localcount-20170320
# 1.124 20-Feb-2017 christos

regen


# 1.123 16-Feb-2017 rin

The default values for MKPIC are yes and no for sh3 and m68000, respectively.
Bump date.


Revision tags: bouyer-socketcan-base pgoyette-localcount-20170107 pgoyette-localcount-20161104 localcount-20160914 pgoyette-localcount-20160806 pgoyette-localcount-20160726 pgoyette-localcount-base
# 1.122 29-Jan-2016 wiz

branches: 1.122.2; 1.122.4;
Document MKREPRO_TIMESTAMP.


# 1.121 23-Jul-2015 mrg

remove the xfree86 reachover makefiles and the vast majority of
the support in the rest of the source tree.

X11 sets could use some cleaning up perhaps (just deletion, as
we've never really marked the old X11R6 as obsolete for native
xorg using platforms so far either.)


# 1.120 07-Jun-2015 pgoyette

Update to reflect changes made in rev 1.398 of src/etc/Makefile


# 1.119 08-Apr-2015 wiz

regen


# 1.118 30-Nov-2014 uebayasi

regen


# 1.117 16-Nov-2014 uebayasi

regen


# 1.116 16-Nov-2014 uebayasi

regen


# 1.115 13-Nov-2014 apb

regen from doc/BUILDING.mdoc revision 1.107.
This reinstates documentation for "extsrc" which was lost in 2009.


# 1.114 08-Nov-2014 snj

fourth time's the charm, i guess. when committing a generated file,
it's best to use the latest revision of the source file (hi uebs!)

regen to include changes from revision 1.105 of doc/BUILDING.mdoc


# 1.113 06-Nov-2014 uebayasi

regen


# 1.112 06-Nov-2014 uebayasi

Expand TABs.


# 1.111 06-Nov-2014 uebayasi

Document the new "kernels" operation, prompted by joerg@.


# 1.110 05-Nov-2014 snj

regen


Revision tags: netbsd-7-base tls-earlyentropy-base tls-maxphys-base
# 1.109 07-Aug-2014 apb

branches: 1.109.2;
regen BUILDING from doc/BUILDING.mdoc


# 1.108 03-Aug-2014 apb

BUILDINFO part6: regen BUILDING from doc/BUILDING.mdoc


# 1.107 14-Jun-2014 apb

Regen from doc/BUILDING.mdoc;1.100:
Improve documentation for BUILDID.


# 1.106 21-May-2014 wiz

regen


Revision tags: yamt-pagecache-base9 riastradh-xf86-video-intel-2-7-1-pre-2-21-15 riastradh-drm2-base3 riastradh-drm2-base2 riastradh-drm2-base1 riastradh-drm2-base
# 1.105 29-May-2013 wiz

branches: 1.105.4;
regen using 'make regen' from src/doc.


# 1.104 29-May-2013 wiz

regen (using mandoc doc/BUILDING.mdoc > BUILDING -- let me know
if a different way is preferred, I see that it now contains formatting).


Revision tags: agc-symver-base yamt-pagecache-base8 yamt-pagecache-base7
# 1.103 08-Nov-2012 dholland

regen


Revision tags: yamt-pagecache-base6
# 1.102 19-Sep-2012 abs

regen


# 1.101 25-May-2012 wiz

branches: 1.101.2;
regen using 'make regen' in doc/


# 1.100 25-May-2012 wiz

Document MKREPRO using joerg's wording.


Revision tags: yamt-pagecache-base5 yamt-pagecache-base4
# 1.99 23-Feb-2012 tsutsui

Add a missing period.


Revision tags: netbsd-6-base
# 1.98 14-Feb-2012 apb

branches: 1.98.2;
Regen from revision 1.87 of doc/BUILDING.mdoc.


# 1.97 22-Jan-2012 tsutsui

Add "live-image" and "install-image" target support to build.sh.

"live-image" target builds pre-installed disk images that can be used on
emulators or boot from USB memory sticks to try NetBSD without installation.
Currently amd64, i386, pmax, sparc, sparc64, sun2, sun3, and vax
(which have working emulators and don't require extra tools like preparing
msdosfs or partitioning MD label structures) support this target.

"install-image" target builds an bootable installation disk image that can
be used as an install CD but burned into USB memory sticks etc.
Current only amd64 and i386 (which would support USB boot) have this target.

For more details (and known issue) see following posts on netbsd-bugs@:
http://mail-index.NetBSD.org/netbsd-bugs/2011/08/06/msg023639.html
http://mail-index.NetBSD.org/netbsd-bugs/2011/09/23/msg024207.html
http://mail-index.NetBSD.org/netbsd-bugs/2011/12/07/msg025166.html
http://mail-index.NetBSD.org/netbsd-bugs/2011/12/08/msg025178.html

No particular comments about implementation, and
"go ahead" comments from mrg@, riz@ and christos@.

Closes PR toolchain/45153 and PR misc/45155.


Revision tags: yamt-pagecache-base3 yamt-pagecache-base2 yamt-pagecache-base
# 1.96 09-Sep-2011 apb

branches: 1.96.2;
Add tests for the shell under which build.sh is run. If the
shell fails the tests, then build.sh tries to re-exec itself
under a more suitable shell.


# 1.95 09-Sep-2011 apb

Revisions 1.92 and 1.93 of src/BUILDING were not reflected in
src/doc/BUILDING.mdoc, so those changes were lost when src/BUILDING
was regenerated in revision 1.94.

Now update src/doc/BUILDING.mdoc and regenerate src/BUILDING to
reinstate the lost changes. (I also edited one of the changes, to use
the phrase "space-separated list" for consistency with other parts of
the document.)

The original changes were:


# 1.93 06-Aug-2011 jnemeth

Add description of MKKMOD, part of PR misc/45216


Revision tags: cherry-xenmp-base bouyer-quota2-nbase bouyer-quota2-base
# 1.92 29-Jan-2011 jym

Pass down INSTALLSETS variable to installsets target. Use :Q to escape
shell meta-characters, as the variable contains a list of sets, separated
by spaces.

$ ./build.sh -V INSTALLSETS="base etc" install=idir

should now work as expected.

Reviewed by apb@ on tech-toolchain.


# 1.94 09-Sep-2011 apb

Allow MAKEFLAGS to be set via build.sh -V. Somebody asked for this
in 2008.

Also add comments above a few functions in build.sh, and bump copyright
dates.


# 1.93 06-Aug-2011 jnemeth

Add description of MKKMOD, part of PR misc/45216


Revision tags: cherry-xenmp-base bouyer-quota2-nbase bouyer-quota2-base
# 1.92 29-Jan-2011 jym

Pass down INSTALLSETS variable to installsets target. Use :Q to escape
shell meta-characters, as the variable contains a list of sets, separated
by spaces.

$ ./build.sh -V INSTALLSETS="base etc" install=idir

should now work as expected.

Reviewed by apb@ on tech-toolchain.


Revision tags: matt-mips64-premerge-20101231
# 1.91 25-Jul-2010 mrg

branches: 1.91.2;
remove the MKSUBPIXEL/MKTTINTERP options; they're going away.

regenerate.


Revision tags: matt-premerge-20091211
# 1.90 30-Nov-2009 uebayasi

Support "extsrc", externally added programs and libraries. Users can write
their own reach-overs, cross-build, install, and get set files just like base
and X11 / X.org. (These sets are not included as TNF releases.)


# 1.89 10-Oct-2009 apb

If ${NETBDSRCDIR}/../xsrc exists, then use it as the default value
of X11SRCDIR. If it doesn't exist, then use /usr/xsrc as before.

OK mrg


# 1.88 27-Sep-2009 apb

* Use a more robust method of creating the top level object directory.
Use getmakevar to expand MAKEOBJDIRPREFIX or MAKEOBJDIR, or (if
neither of those variables is set) use a non-recursive "make obj" in
the top level source directory.

* Do not let TOP_objdir default to ${TOP}. It's now set only by the
-M or -O command line options, or after using getmakevar to expand
MAKEOBJDIRPREFIX or MAKEOBJDIR.

* Make try_set_TOOLDIR handle MAKEOBJDIRPERFIX passed from the
environment. It runs too early to use getmakevar, so it will not work
if the value contains embedded '${...}' variable references.

* Use '$TOOLDIR' (with a literal '$') instead of 'nonexistent' in
a message when rebuilding make when TOOLDIR is not yet known.


# 1.87 27-Sep-2009 apb

Allow build.sh "-C cdextra" option to be specified multiple times.


# 1.86 07-Sep-2009 jnemeth

Add a modules operation to build.sh, which builds and installs kernel modules
into DESTDIR.

This is based on the patch provided by tsutsui@ on tech-toolchain@.


# 1.85 12-Jul-2009 hubertf

regen


# 1.84 12-Jul-2009 hubertf

regen


Revision tags: jym-xensuspend-nbase jym-xensuspend-base
# 1.83 01-May-2009 snj

Introduce MKSUBPIXEL, which allows enabling subpixel rendering code
in FreeType.


# 1.82 02-Dec-2008 mrg

branches: 1.82.2;
be explicit about MAKEOBJDIR and MAKEOBJDIRPREFIX not being for
mk.conf or ${MAKECONF}.


# 1.81 15-Nov-2008 mrg

revert sparc back to default of XFree86 at the request of macallan.


# 1.80 13-Nov-2008 apb

Add support for new MAKEVERBOSE levels 3 and 4. The complete list is now:

0 Minimal output ("quiet")
1 Describe what is occurring
2 Describe what is occurring and echo the actual command
3 Ignore the effect of the "@" prefix in make commands
4 Trace shell commands using the shell's -x flag

The default remains MAKEVERBOSE=2.


# 1.79 09-Nov-2008 mrg

- retire MKXORG from public use
- introduce X11FLAVOUR to choose src/x11 vs src/external/mit/xorg
for the X11 to build if MKX11=yes is set. it takes the values
of either Xorg or XFree86.
- default to Xorg on alpha, i386, macppc, shark, sparc and sparc64
- remove MKXORG_WITH_XSRC_XSERVER, unused and never useful


Revision tags: netbsd-5-base matt-mips64-base2
# 1.78 24-Sep-2008 apb

branches: 1.78.2;
regen for recent change to examples and objdir advice,
and for the older MKSTRIPIDENT change.


Revision tags: wrstuden-revivesa-base-3 wrstuden-revivesa-base-2
# 1.77 06-Sep-2008 lukem

regen for MKHTML


# 1.76 28-Aug-2008 lukem

Improve support for MKXORG!=no to enable builds into external/mit/xorg.
This will be mutually exclusive to MKX11!=no.


# 1.75 18-Aug-2008 lukem

Document "build.sh cleandir".
Fix formatting nit.
Remove BUGS; all the in-tree platforms are using build.sh now.


# 1.74 11-Aug-2008 apb

* Suggest a "-j" value between 1+NCPU and 2*NCPU for the fastest builds.
* Remove some duplicated content that appeared in both the section about
make's -j flag and the section about build.sh's -j flag.


# 1.73 05-Aug-2008 apb

* Add more detail for build.sh -M and -O options.
* Mention new default when source is /usr/src but build.sh is run
with neither -M nor -O.


# 1.72 05-Aug-2008 perry

Builds now use "BUILDSEED" so that c++ binaries are reproduceable.
By default BUILDSEED is set to NetBSD-{majorversion} -- a -S flag may
be used to change it.

Discussed on tech-toolchain.


Revision tags: wrstuden-revivesa-base-1 yamt-pf42-base4 yamt-pf42-base3 hpcarm-cleanup-nbase yamt-pf42-baseX yamt-pf42-base2 wrstuden-revivesa-base keiichi-mipv6-nbase yamt-pf42-base keiichi-mipv6-base
# 1.71 29-Mar-2008 dholland

branches: 1.71.4;
Correct/clarify the default setting of USETOOLS in the previous version.
Noted by apb.


# 1.70 28-Mar-2008 dholland

Assorted updates and clarifications, grammar fixes and wording improvements,
and so on. Significant highlights:
- mention src/tests and reference atf;
- provide examples of MACHINE and MACHINE_ARCH;
- mention that MKOBJ=no is not recommended;
- correct the description of the default setting of USETOOLS;
- document the interactions of build.sh -[uo] with various things;
- document the interactions of build.sh tools and kernel=FOO;
- use a lot fewer parentheses.
Discussed on netbsd-docs.


Revision tags: matt-armv6-nbase
# 1.69 18-Mar-2008 lukem

Consistently document RELEASEDIR/RELEASEMACHINEDIR.


# 1.68 08-Mar-2008 reed

Mention that "build" and "distribution" do not build nor install (to DESTDIR)
a kernel.


Revision tags: cube-autoconf-base matt-armv6-base hpcarm-cleanup-base
# 1.67 23-Nov-2007 sborrill

branches: 1.67.4;
Add support for CDBUILDEXTRA which acts like CDEXTRA to add extra items
to the CD-ROM image.
Make CDEXTRA and CDBUILDEXTRA be able to contain lists of files and directories
which are added in turn.
Add support for CDEXTRA_SKIP which contains a list of fnmatch(3) items to
skip during the copy. This is _very_ useful for skipping CVS dirs for example.
CDBUILDEXTRA and CDEXTRA_SKIP are to be used in Makefiles creating the images,
CDEXTRA remains to be used from build.sh.
Update documentation and build.sh help text to show that -C can be used to
specify a list of files and directories rather than just a single dir.


# 1.66 01-Sep-2007 jnemeth

Convert build.sh iso-dir=directory option to -C cddir as per jmmv@ on
source-changes.


# 1.65 01-Sep-2007 jnemeth

Add an iso-dir=directory option. When combined with iso-image or
iso-image-source, it will cause directory to be added to the CD-ROM image.


# 1.64 30-Aug-2007 jnemeth

describe new iso-image-source target


# 1.63 30-Aug-2007 ad

Remove STATUS paragraph which makes it sound like the build system is
half baked.


Revision tags: matt-mips64-base
# 1.62 13-Apr-2007 apb

branches: 1.62.4;
Document recent changes to "make iso-image".


# 1.61 26-Mar-2007 apb

Document the fact that "make installworld" and "build.sh
installworld=..." do not install the etc or xetc sets. Suggest using
etcupdate(8) and postinstall(8) after installworld.


# 1.60 27-Jan-2007 apb

Try to clarify the description of build.sh -m mach.
Document new evbarm-eb and evbarm-el aliases.


Revision tags: netbsd-4-base
# 1.59 08-Oct-2006 apb

branches: 1.59.2;
Clarify that DESTDIR/OBJDIR/etc are absolute paths, but build.sh
-D/-O/etc allows relative paths.

Closes PR 32345 by Andre Luiz de Oliveira.


# 1.58 29-Sep-2006 apb

Use ${HOST_SH} instead of the host system's /bin/sh wherever possible:

* Describe the HOST_SH variable, and the way build.sh attempts to set it.

* Suggest passing HOST_SH in the environment if /bin/sh is not a working
shell.


Revision tags: abandoned-netbsd-4-base
# 1.57 29-Jan-2006 apb

mkisofs is in pkgsrc/sysutils/cdrtools now, not pkgsrc/sysutils/cdrecord.
Reported by Jukka Salmi.


# 1.56 28-Jan-2006 apb

* Add an "iso-image" target in the top level Makefile,
which invokes make iso-image in the etc directory.
* Add an "iso-image" action in build.sh, which
invokes make iso-image.
* Document the above in doc/BUILDING.mdoc.
* Re-generate BUILDING.

Approved by christos


# 1.55 12-Jan-2006 wiz

Bump date for syspkgs.


# 1.54 04-Jan-2006 apb

Document "make syspkgs" and "build.sh syspkgs".

Reviewed by agc


Revision tags: netbsd-3-1-1-RELEASE netbsd-3-0-3-RELEASE netbsd-3-1-RELEASE netbsd-3-0-2-RELEASE netbsd-3-1-RC4 netbsd-3-1-RC3 netbsd-3-1-RC2 netbsd-3-1-RC1 netbsd-3-0-1-RELEASE netbsd-3-0-RELEASE netbsd-3-0-RC6 netbsd-3-0-RC5 netbsd-3-0-RC4 netbsd-3-0-RC3 netbsd-3-0-RC2 netbsd-3-0-RC1 netbsd-3-base
# 1.53 15-Feb-2005 reed

Document the environment variables for if you need to override or
manually select your compilers.
(And regen BUILDING from doc/BUILDING.mdoc.)


# 1.52 12-Oct-2004 jmc

Fix some typo's/bad wording as highlighted in PR#27219


# 1.51 25-Jun-2004 wiz

regen (Document -h. From Karsten Kruse in PR 25974.
While here, remove a duplicate sentence).


Revision tags: netbsd-2-0-3-RELEASE netbsd-2-1-RELEASE netbsd-2-1-RC6 netbsd-2-1-RC5 netbsd-2-1-RC4 netbsd-2-1-RC3 netbsd-2-1-RC2 netbsd-2-1-RC1 netbsd-2-0-2-RELEASE netbsd-2-0-1-RELEASE netbsd-2-base netbsd-2-0-RELEASE netbsd-2-0-RC5 netbsd-2-0-RC4 netbsd-2-0-RC3 netbsd-2-0-RC2 netbsd-2-0-RC1 netbsd-2-0-base
# 1.50 19-Mar-2004 wiz

Document MKTTINTERP.


# 1.49 06-Feb-2004 lukem

* Document build.sh -X and -x
* Document MKX11 and X11SRCDIR
* Remove note warning against cross-building from systems other than NetBSD;
it works on many other platforms.


# 1.48 29-Dec-2003 jmc

Note tools/compat/README as the place to get notes from non-native cross builds


# 1.47 19-Dec-2003 zuntum

Change -v to -V in the following section:

"Print make(1)'s idea of the value of var. Does not build any targets."

To reflect reality.

Found by Tomasz Marciniak <Tomasz.Marciniak@felix.fizyka.amu.edu.pl>, thanks!


# 1.46 26-Oct-2003 lukem

Improve how build.sh -N and MAKEVERBOSE interoperate;
rather than adding '-s' to make's command line in the makewrapper,
use the .SILENT target based on MAKEVERBOSE's value.

This means that you can do:
./build.sh -N 1 makewrapper

$TOOLDIR/bin/nbmake-$MACHINE
# runs at MAKEVERBOSE==1, with command lines suppressed

$TOOLDIR/bin/nbmake-$MACHINE MAKEVERBOSE=2
# runs at MAKEVERBOSE==2 for this invocation, with command lines shown


# 1.45 25-Oct-2003 lukem

Implement build -N noisy, which sets MAKEVERBOSE to noisy and adds
`-s' to MAKEFLAGS for noisy < 2.


# 1.44 29-Sep-2003 lukem

regenerate for "%" prompt update


# 1.43 19-Aug-2003 martti

Backout the previous commit


# 1.42 19-Aug-2003 martti

Remove # from the example.


# 1.41 08-Aug-2003 lukem

fix description of MAKEOBJDIR. from Martin Husemann


# 1.40 29-Jul-2003 lukem

Add build.sh -Z var, to unset a variable and ensure it's unset in makewrapper.
For -M MAKEOBJDIRPREFIX, unset MAKEOBJDIR.
For -O MAKEOBJDIR, unset MAKEOBJDIRPREFIX.


# 1.39 18-Jul-2003 lukem

fix default location of TOOLDIR


# 1.38 18-Jul-2003 lukem

Update for the MKUNPRIVED/MKUPDATE changes.


# 1.37 18-Jul-2003 lukem

rebuild with new groff


# 1.36 03-Jul-2003 lukem

attempt to clarify how MAKEOBJDIR{,PREFIX} may be provided ...
(this document needs a rototill, which i may get to whilst writing a
paper about build.sh)


# 1.35 25-May-2003 lukem

all:
* add "releasekernel=conf", to install a gzipped copy of the kernels
built by "kernel=conf" to RELEASEDIR/MACHINE/binary/kernel

build.sh:
* be more consistent in various status messages
* move the {release,}kernel=conf conf parsing code into getkernelconf()
and use in both buildkernel() and releasekernel()
* only warn once when building multiple kernels without updating the tools


# 1.34 18-May-2003 lukem

For normal builds, MKOBJDIRS default to `no' (not `yes').
It's only build.sh that sets this to `yes' by default.
Noted by OGAWA Takaya in [toolchain/19823]


# 1.33 17-May-2003 lukem

improve description of how "build.sh -m mach" sets the default
MACHINE_ARCH, and list the special cases that this does not occur for.


# 1.32 10-May-2003 lukem

crank date for previous


# 1.31 10-May-2003 lukem

Add "sourcesets" argument/target, which builds source sets into
RELEASEDIR/source/sets


# 1.30 08-May-2003 lukem

build.sh now provides defaults for DESTDIR and RELEASEDIR if not expert mode.
Remove -D and -R from EXAMPLES since they're not necessary any more.


# 1.29 08-Feb-2003 lukem

Fix example 3; the build.sh target is "install" not "installworld".
Improve description.
Noted by Valeriy Ushakov (uwe@) in private email.


# 1.28 02-Feb-2003 lukem

attempt to further improve and clarify the examples...


# 1.27 30-Jan-2003 lukem

Prefix various paths with 'DESTDIR', to highlight that the DESTDIR
is taken into account.


# 1.26 29-Jan-2003 lukem

allow toolprefix to be easily changed


# 1.25 26-Jan-2003 lukem

Various improvements per discussion with Alan Barrett.


# 1.24 26-Jan-2003 lukem

- Add "sets" top-level Makefile target and build.sh operation.
[Latter suggested by Julio Merino in private email]
- Add "help" build.sh operation.


# 1.23 26-Jan-2003 lukem

Change build.sh so that at least one operation is required.
Add "makewrapper" operation to build.sh.
[The above changes were suggested by Alan Barrett on current-users@]

Fail if building as non-root unless: UNPRIVED is set, -U is given, or -E
(expert mode) is given.
[Suggested by James Wetterau in private email]

Improve the examples in BUILDING.


# 1.22 23-Jan-2003 lukem

Rework how build.sh functions, so that command line options set various
parameters, and a list of "operations" defines what to do.
The full usage is show below. Notes:
`-b' has been deprecated (it always occurs now)
`-d' is replaced by "distribution"
`-R rel' onlys sets RELEASEDIR; use "release" to build a release
`-k kern' has been replaced by "kernel=kern"
`-i idir' has been replaced by "install=idir"
-r now occurs before nbmake is rebuilt

Add a copyright (long due!). Rework the code to (a KNF inspired) ShellNF.
Use functions appropriately. Allow `nb' prefix to be easily changed to
something else. Solve world peace (just kidding)

This is part of the (never achievable) goal of attempting to make
NetBSD easier to build...


--8<-- new usage follows --8<--

Usage: build.sh [-EnorUu] [-a arch] [-B buildid] [-D dest] [-j njob] [-M obj]
[-m mach] [-O obj] [-R release] [-T tools] [-V var=[value]]
[-w wrapper] [operation [...] ]

System build operations (all imply "obj" and "tools"):
build Run "make build"
distribution Run "make distribution" (includes etc/ files)
release Run "make release" (includes kernels & distrib media)

Other operations:
obj Run "make obj" (default unless -o)
tools Build and install tools
kernel=conf Build kernel with config file `conf'
install=idir Run "make installworld" to `idir'
(useful after 'distribution' or 'release')

Options:
-a arch Set MACHINE_ARCH to arch (otherwise deduced from MACHINE)
-B buildId Set BUILDID to buildId
-D dest Set DESTDIR to dest
-E Set "expert" mode; disables some DESTDIR checks
-j njob Run up to njob jobs in parallel; see make(1)
-M obj Set obj root directory to obj (sets MAKEOBJDIRPREFIX)
-m mach Set MACHINE to mach (not required if NetBSD native)
-n Show commands that would be executed, but do not execute them
-O obj Set obj root directory to obj (sets a MAKEOBJDIR pattern)
-o Set MKOBJDIRS=no (do not create objdirs at start of build)
-R release Set RELEASEDIR to release
-r Remove contents of TOOLDIR and DESTDIR before building
-T tools Set TOOLDIR to tools. If unset, and TOOLDIR is not set in
the environment, nbmake will be (re)built unconditionally.
-U Set UNPRIVED
-u Set UPDATE
-V v=[val] Set variable `v' to `val'
-w wrapper Create nbmake script as wrapper
(default: ${TOOLDIR}/bin/nbmake-${MACHINE})


# 1.21 04-Jan-2003 lukem

Add "-V var=[value]", for setting arbitrary variables which will also
be added to the nbmake-${MACHINE} wrapper.
Useful for setting RELEASEDIR, without -R's habit of building a release.


Revision tags: fvdl_fs64_base
# 1.20 25-Dec-2002 lukem

Document:
* build.sh -i idir
* top level targets: distribution, buildworld, installworld
* top level variables: INSTALLWORLDDIR


# 1.19 08-Dec-2002 lukem

Add -E - "expert mode". If this is not specified, builds to DESTDIR=/ are
not permitted.
By using this flag, you are taking responsibility for any issues that
may occur because of this...


# 1.18 08-Dec-2002 lukem

- be consistent about option ordering in build.sh usage display
- use Fl and Ar instead of Sy and Em to format options


# 1.17 25-Nov-2002 wiz

Update location of BUILDING.mdoc.


# 1.16 20-Oct-2002 lukem

regen for build.sh -k


# 1.15 21-Sep-2002 lukem

regen for: USE_NEW_TOOLCHAIN was replaced with TOOLCHAIN_MISSING


# 1.14 17-Sep-2002 fredb

Expand on the difference between ``build.sh -d'' and ``make install'',
as requested by Brian Stark in PR toolchain/18228 (which this closes).


# 1.13 22-Jul-2002 wiz

Remove duplicate 'files'. From Ryo HAYASAKA in toolchain/17674.


Revision tags: netbsd-1-6-PATCH002-RC3 netbsd-1-6-PATCH002-RC2 netbsd-1-6-PATCH002-RC1 netbsd-1-6-PATCH001 netbsd-1-6-PATCH001-RELEASE netbsd-1-6-PATCH001-RC3 netbsd-1-6-PATCH001-RC2 netbsd-1-6-PATCH001-RC1 netbsd-1-6-RELEASE netbsd-1-6-RC3 netbsd-1-6-RC2 netbsd-1-6-RC1 netbsd-1-6-base
# 1.12 13-May-2002 lukem

branches: 1.12.2;
add "-M makeobjdirprefix" to build.sh


# 1.11 03-May-2002 lukem

Move the METALOG from ${_SRC_TOP_OBJ_} to ${DESTDIR}.

There were too many synchronisation problems with using the former;
including situations such as a "make clean" performed between two
installs to the same DESTDIR would result in a truncated METALOG and
the resultant sets would be missing stuff such as include files that
don't get reinstalled if they haven't changed, even with !UPDATE.


# 1.10 02-May-2002 sommerfeld

Re-gen.


# 1.9 14-Mar-2002 thorpej

Add a -B option to set the BUILDID for the build. This also causes
the make(1) wrapper script to be named "nbmake-MACHINE-BUILDID".


# 1.8 05-Mar-2002 lukem

document various supported environment variables, including MAKEOBJDIRPREFIX


# 1.7 04-Mar-2002 lukem

document:
- make's UNPRIVED support
- build.sh's -U support
- the build system currently needs to build onto a file system with
long file name and hard link support


# 1.6 25-Nov-2001 thorpej

Document the -d option to build.sh


# 1.5 15-Nov-2001 tv

Note only <bsd.own.mk> as the authority for determining whether the new
BUILDING instructions should be used.


# 1.4 14-Nov-2001 tv

Turn off host-specific objdirs by default. Set MKHOSTOBJ=yes to enable.


# 1.3 12-Nov-2001 tv

Major overhaul of src/tools and host toolchain. Summary of changes:

* Rewrite src/tools Make logic to work like the rest of the tree wrt
"dependall" and "install". The old "make build" hack is gone.

* Remove the MKTOOLS logic. This was linked to the "make build" hack,
and was only needed because TOOLDIR originally had no writable default.

* Redo the GNU configure/make logic to make it fit reasonably in a
BSD make wrapper. Use new ${.ALLTARGETS} variable to scan for
targets in $(srcdir), and mark them with .MADE: to prevent rebuilding.

* Only build cross tools in src/tools; remove some messy logic in
src/usr.* and src/gnu/usr.* that would do target filename rewriting
(improves consistency and readability).

* Add the ability to build cross gdb at tool build time by setting
MKCROSSGDB (default no) to "yes" in mk.conf.

* Add src/tools/groff and set up paths to work with this cross groff.


# 1.2 08-Nov-2001 wiz

Remove mention of BUILDLING.html, and follow rename of BUILDING.txt to
BUILDING.
Noted by Love <lha@stacken.kth.se> on tech-toolchain.


# 1.1 01-Nov-2001 tv

By popular demand, one preformatted version of BUILDING, plaintext, no CRs.


# 1.155 11-Jun-2023 lukem

BUILDING: remove duplication from mk.conf(5)

Remove all "make" variables / mk.conf(5) variables already documented
in mk.conf(5). The duplication was a maintenance headache, as I've
experienced over recent weeks getting the build documentation up to
date.

Add notes clarifying that manual page references are to the NetBSD
manual pages, not to the host manual pages, and how to format from
source, or find online at https://man.netbsd.org.

Add explicit links to the mdoc(7) in-tree source for mk.conf(5),
hier(7), and release(7) because those are directly relevant to the host
build information in BUILDING.

Note: We don't normally need these notes for native documentation,
but BUILDING is intended for users on host systems which might not
be NetBSD(-current).

Add missing defaults.


# 1.154 11-Jun-2023 lukem

BUILDING: update from mk.conf(5). reorder

Sync variable entries from mk.conf(5).

Merge the "make variables for full builds" section into the previous.
Having two separate sections and some entries duplicated was confusing
when searching for variables.


# 1.153 11-Jun-2023 lukem

more NBUILDJOBS deprecation

The NBUILDJOBS option was deprecated in 2002;
there's no need to keep warning about it,
remove from params / show-params,
and only document as obsolete.


# 1.152 05-Jun-2023 lukem

BUILDING: editorial

MKX11=yes wants MKINET6=yes

Change the width of the variable lists to 14n (from 15n)
so that when the lists are rendered and then left aligned,
the column is 16 characters (aka 2 tabs) which makes
copypasta to bsd.README easier.


# 1.151 04-Jun-2023 lukem

BUILDING: update from canonical mk.conf(5)

Incorporate content and styles updates for mk.conf entries
from share/man/man5/mk.conf.5, which is the canonical
reference for mk.conf.

Add: BSDOBJDIR, BSDSRCDIR, EXTERNAL_TOOLCHAIN, MKDEBUGKERNEL,
MKDEBUGTOOLS, MKHTML, MKLINKLIB, MKOBJDIRS, TOOLCHAIN_MISSING,
NETBSDSRCDIR

It's for further study as to whether we just replace the
most of subsection "make" variables with a link to mk.conf(5).

Style:
- Add more .de macros per mk.conf.5.
- Order list items alphabetically. When multiple items are present
in a list item, sort within the item first.
- More cross-references.


# 1.150 02-Jun-2023 lukem

build.sh: MAKECONF and mk.conf(5) improvements

Move MAKECONF to the Environment variables section.
Add mk.conf(5) cross-references.
Make Notes more obvious.
Fix mandoc lint.


# 1.149 18-May-2023 lukem

BUILDING: TMPDIR must not be noexec

Describe $TMPDIR as used by build.sh, and
add a note that it can't be mounted noexec.

PR toolchain/44459


# 1.148 16-May-2023 lukem

build.sh, BUILDING: consistency improvements

Consistently use "show", instead of sometimes using "display" or "print".
Fix mdoc markup (even though BUILDING is raw text).
Document help, -P, -?


# 1.147 16-May-2023 lukem

BUILDING: update upstream, regen

doc/BUILDING.mdoc is the upstream for BUILDING, so add recent changes
in the latter to the former, formatting correctly.

Move INSTALLBOOT_UBOOT_PATHS to Environment variables.
Move INSTALLBOOT_BOARDS to "make" variables for full builds.
Add installboot(8) cross-reference.


Revision tags: netbsd-10-base
# 1.146 01-Oct-2022 rillig

fix documentation for MKLINT

Since share/mk/bsd.own.mk 1.749 from 2013-08-26, MKLINT defaults to no.


# 1.145 22-Aug-2022 brook

By default, do not install any bootable images.

The previous commit introduced the ability to install a set of
bootable images as a normal part of a release build. While this made
it easy to install bootable images, the contents of a release build
depend on whether or not U-Boot packages are installed in /usr/pkgsrc,
which is the default location searched by installboot(8).

This commit requires users to explicitly list the bootable images to
be installed, which by default is none (i.e., prior behavior).


# 1.144 21-Aug-2022 brook

Create bootable images in ${RELEASEDIR}/${RELEASEMACHINEDIR}/binary/gzimg.

Release builds for arm platforms create compressed images in
${RELEASEDIR}/${RELEASEMACHINEDIR}/binary/gzimg. However, in some
cases, e.g., armv7.img.gz, they are not bootable. Consequently, boot
blocks must be manually installed in the images, which is an extra
barrier for testing systems or adopting NetBSD. This has prompted
creation of external repositories, e.g., armbsd.org, to host a
collection of bootable images. However, this does not ease the burden
on developers compiling their own systems; for them, manual
installation of boot blocks is still required.

For arm platforms, etc/etc.evbarm/Makefile.inc contains the commands
used to create system images. Because installboot(8) can write boot
blocks directly to system images, a loop through possible boards can
create a series of bootable images during the normal build process.

In the case of many arm platforms, installboot(8) uses U-Boot boot
blocks, which are not part of the NetBSD source code. Developers can,
however, install as many U-Boot boot blocks as desired, either in the
default location of /usr/pkg/share/u-boot or in a set of directories
pointed to by the U-Boot search path, the INSTALLBOOT_UBOOT_PATHS
environment variable. For each board with an available boot block, a
board-specific bootable image will be created in
${RELEASEDIR}/${RELEASEMACHINEDIR}/binary/gzimg. If a boot block is
not available, which is the typical situation currently, no additional
image will be created.

This facility creates opportunities to build bootable images for any
number of boards within the scope of a standard release build.
However, that is not required and will not occur without the
intervention of installing U-Boot boot blocks prior to the build.


# 1.143 21-Aug-2022 lukem

BUILDING: regen for removal of extsrc/


# 1.142 28-May-2022 andvar

s/knowlege/knowledge/


# 1.141 20-Dec-2021 christos

Rename:
MKKDEBUG -> MKDEBUGKERNEL
MKTOOLSDEBUG -> MKDEBUGTOOLS
while keeping compatibility with the old names. Add missing documentation.
Now all debugging tunables are prefixed with MKDEBUG.


Revision tags: cjep_sun2x-base1 cjep_sun2x-base cjep_staticlib_x-base1 cjep_staticlib_x-base
# 1.140 10-Nov-2020 kamil

Reintroduce the support of MKCATPAGES

Requested by <mrg>


# 1.139 08-Nov-2020 kamil

Remove the support for MKCATPAGES

It was optional since 1999 and disabled by default since 2012.

Proposed on tech-userlevel@.


# 1.138 13-Oct-2020 thorpej

Document CPUFLAGS here (it's already documented in share/mk/bsd.README).
This will address the initial concern in PR port-alpha/55545.


# 1.137 12-Oct-2020 uwe

Mention HOST_CFLAGS and HOST_CXXFLAGS.


# 1.136 12-Oct-2020 uwe

Bump date and regen for BUILDING.mdoc revision 1.127
that introduced build.sh -c <compiler> option.


Revision tags: netbsd-9-3-RELEASE netbsd-9-2-RELEASE netbsd-9-1-RELEASE phil-wifi-20200421 phil-wifi-20200411 is-mlppp-base phil-wifi-20200406 netbsd-9-0-RELEASE netbsd-9-0-RC2 netbsd-9-0-RC1 phil-wifi-20191119 netbsd-9-base phil-wifi-20190609
# 1.135 08-May-2019 leot

Fix a typo

Reported by Tobias Ulmer via netbsd-docs@ ML, thanks!


Revision tags: pgoyette-compat-20190127 pgoyette-compat-20190118 pgoyette-compat-1226 pgoyette-compat-1126 pgoyette-compat-1020 pgoyette-compat-0930 pgoyette-compat-0906
# 1.134 29-Jul-2018 sevan

regen


Revision tags: pgoyette-compat-0728 phil-wifi-base pgoyette-compat-0625 pgoyette-compat-0521
# 1.133 02-May-2018 pgoyette

branches: 1.133.2;
Re-add files that were accidentally deleted in my previous commit.


# 1.132 02-May-2018 pgoyette

Synch with HEAD


Revision tags: pgoyette-compat-0502 pgoyette-compat-0422 pgoyette-compat-0415 pgoyette-compat-0407 pgoyette-compat-0330 pgoyette-compat-0322 pgoyette-compat-0315 pgoyette-compat-base
# 1.131 16-Feb-2018 leot

branches: 1.131.2;
regen


# 1.130 29-Dec-2017 sevan

regen


# 1.129 21-Oct-2017 sevan

regen


Revision tags: netbsd-8-2-RELEASE netbsd-8-1-RELEASE netbsd-8-1-RC1 netbsd-8-0-RELEASE netbsd-8-0-RC2 netbsd-8-0-RC1 matt-nb8-mediatek-base perseant-stdc-iso10646-base netbsd-8-base
# 1.128 21-May-2017 riastradh

regen


Revision tags: prg-localcount2-base3 prg-localcount2-base2 prg-localcount2-base1 prg-localcount2-base pgoyette-localcount-20170426
# 1.127 22-Apr-2017 plunky

regen


Revision tags: bouyer-socketcan-base1
# 1.126 20-Apr-2017 wiz

regen using regen target in doc.


# 1.125 20-Apr-2017 ozaki-r

Introduce MKSTRIPSYM build option

If it's yes, all local symbols of shared libraries are stripped
(default). If it's no, only temporary local symbols are stripped;
for example, symbols of static functions are kept. Keeping such
symbols is useful on using DTrace for userland libraries and
getting a backtrace from a rump server loading modules (shared
libraries).

Proposed and discussed on tech-kern and tech-toolchain


Revision tags: pgoyette-localcount-20170320
# 1.124 20-Feb-2017 christos

regen


# 1.123 16-Feb-2017 rin

The default values for MKPIC are yes and no for sh3 and m68000, respectively.
Bump date.


Revision tags: bouyer-socketcan-base pgoyette-localcount-20170107 pgoyette-localcount-20161104 localcount-20160914 pgoyette-localcount-20160806 pgoyette-localcount-20160726 pgoyette-localcount-base
# 1.122 29-Jan-2016 wiz

branches: 1.122.2; 1.122.4;
Document MKREPRO_TIMESTAMP.


# 1.121 23-Jul-2015 mrg

remove the xfree86 reachover makefiles and the vast majority of
the support in the rest of the source tree.

X11 sets could use some cleaning up perhaps (just deletion, as
we've never really marked the old X11R6 as obsolete for native
xorg using platforms so far either.)


# 1.120 07-Jun-2015 pgoyette

Update to reflect changes made in rev 1.398 of src/etc/Makefile


# 1.119 08-Apr-2015 wiz

regen


# 1.118 30-Nov-2014 uebayasi

regen


# 1.117 16-Nov-2014 uebayasi

regen


# 1.116 16-Nov-2014 uebayasi

regen


# 1.115 13-Nov-2014 apb

regen from doc/BUILDING.mdoc revision 1.107.
This reinstates documentation for "extsrc" which was lost in 2009.


# 1.114 08-Nov-2014 snj

fourth time's the charm, i guess. when committing a generated file,
it's best to use the latest revision of the source file (hi uebs!)

regen to include changes from revision 1.105 of doc/BUILDING.mdoc


# 1.113 06-Nov-2014 uebayasi

regen


# 1.112 06-Nov-2014 uebayasi

Expand TABs.


# 1.111 06-Nov-2014 uebayasi

Document the new "kernels" operation, prompted by joerg@.


# 1.110 05-Nov-2014 snj

regen


Revision tags: netbsd-7-base tls-earlyentropy-base tls-maxphys-base
# 1.109 07-Aug-2014 apb

branches: 1.109.2;
regen BUILDING from doc/BUILDING.mdoc


# 1.108 03-Aug-2014 apb

BUILDINFO part6: regen BUILDING from doc/BUILDING.mdoc


# 1.107 14-Jun-2014 apb

Regen from doc/BUILDING.mdoc;1.100:
Improve documentation for BUILDID.


# 1.106 21-May-2014 wiz

regen


Revision tags: yamt-pagecache-base9 riastradh-xf86-video-intel-2-7-1-pre-2-21-15 riastradh-drm2-base3 riastradh-drm2-base2 riastradh-drm2-base1 riastradh-drm2-base
# 1.105 29-May-2013 wiz

branches: 1.105.4;
regen using 'make regen' from src/doc.


# 1.104 29-May-2013 wiz

regen (using mandoc doc/BUILDING.mdoc > BUILDING -- let me know
if a different way is preferred, I see that it now contains formatting).


Revision tags: agc-symver-base yamt-pagecache-base8 yamt-pagecache-base7
# 1.103 08-Nov-2012 dholland

regen


Revision tags: yamt-pagecache-base6
# 1.102 19-Sep-2012 abs

regen


# 1.101 25-May-2012 wiz

branches: 1.101.2;
regen using 'make regen' in doc/


# 1.100 25-May-2012 wiz

Document MKREPRO using joerg's wording.


Revision tags: yamt-pagecache-base5 yamt-pagecache-base4
# 1.99 23-Feb-2012 tsutsui

Add a missing period.


Revision tags: netbsd-6-base
# 1.98 14-Feb-2012 apb

branches: 1.98.2;
Regen from revision 1.87 of doc/BUILDING.mdoc.


# 1.97 22-Jan-2012 tsutsui

Add "live-image" and "install-image" target support to build.sh.

"live-image" target builds pre-installed disk images that can be used on
emulators or boot from USB memory sticks to try NetBSD without installation.
Currently amd64, i386, pmax, sparc, sparc64, sun2, sun3, and vax
(which have working emulators and don't require extra tools like preparing
msdosfs or partitioning MD label structures) support this target.

"install-image" target builds an bootable installation disk image that can
be used as an install CD but burned into USB memory sticks etc.
Current only amd64 and i386 (which would support USB boot) have this target.

For more details (and known issue) see following posts on netbsd-bugs@:
http://mail-index.NetBSD.org/netbsd-bugs/2011/08/06/msg023639.html
http://mail-index.NetBSD.org/netbsd-bugs/2011/09/23/msg024207.html
http://mail-index.NetBSD.org/netbsd-bugs/2011/12/07/msg025166.html
http://mail-index.NetBSD.org/netbsd-bugs/2011/12/08/msg025178.html

No particular comments about implementation, and
"go ahead" comments from mrg@, riz@ and christos@.

Closes PR toolchain/45153 and PR misc/45155.


Revision tags: yamt-pagecache-base3 yamt-pagecache-base2 yamt-pagecache-base
# 1.96 09-Sep-2011 apb

branches: 1.96.2;
Add tests for the shell under which build.sh is run. If the
shell fails the tests, then build.sh tries to re-exec itself
under a more suitable shell.


# 1.95 09-Sep-2011 apb

Revisions 1.92 and 1.93 of src/BUILDING were not reflected in
src/doc/BUILDING.mdoc, so those changes were lost when src/BUILDING
was regenerated in revision 1.94.

Now update src/doc/BUILDING.mdoc and regenerate src/BUILDING to
reinstate the lost changes. (I also edited one of the changes, to use
the phrase "space-separated list" for consistency with other parts of
the document.)

The original changes were:


# 1.93 06-Aug-2011 jnemeth

Add description of MKKMOD, part of PR misc/45216


Revision tags: cherry-xenmp-base bouyer-quota2-nbase bouyer-quota2-base
# 1.92 29-Jan-2011 jym

Pass down INSTALLSETS variable to installsets target. Use :Q to escape
shell meta-characters, as the variable contains a list of sets, separated
by spaces.

$ ./build.sh -V INSTALLSETS="base etc" install=idir

should now work as expected.

Reviewed by apb@ on tech-toolchain.


# 1.94 09-Sep-2011 apb

Allow MAKEFLAGS to be set via build.sh -V. Somebody asked for this
in 2008.

Also add comments above a few functions in build.sh, and bump copyright
dates.


# 1.93 06-Aug-2011 jnemeth

Add description of MKKMOD, part of PR misc/45216


Revision tags: cherry-xenmp-base bouyer-quota2-nbase bouyer-quota2-base
# 1.92 29-Jan-2011 jym

Pass down INSTALLSETS variable to installsets target. Use :Q to escape
shell meta-characters, as the variable contains a list of sets, separated
by spaces.

$ ./build.sh -V INSTALLSETS="base etc" install=idir

should now work as expected.

Reviewed by apb@ on tech-toolchain.


Revision tags: matt-mips64-premerge-20101231
# 1.91 25-Jul-2010 mrg

branches: 1.91.2;
remove the MKSUBPIXEL/MKTTINTERP options; they're going away.

regenerate.


Revision tags: matt-premerge-20091211
# 1.90 30-Nov-2009 uebayasi

Support "extsrc", externally added programs and libraries. Users can write
their own reach-overs, cross-build, install, and get set files just like base
and X11 / X.org. (These sets are not included as TNF releases.)


# 1.89 10-Oct-2009 apb

If ${NETBDSRCDIR}/../xsrc exists, then use it as the default value
of X11SRCDIR. If it doesn't exist, then use /usr/xsrc as before.

OK mrg


# 1.88 27-Sep-2009 apb

* Use a more robust method of creating the top level object directory.
Use getmakevar to expand MAKEOBJDIRPREFIX or MAKEOBJDIR, or (if
neither of those variables is set) use a non-recursive "make obj" in
the top level source directory.

* Do not let TOP_objdir default to ${TOP}. It's now set only by the
-M or -O command line options, or after using getmakevar to expand
MAKEOBJDIRPREFIX or MAKEOBJDIR.

* Make try_set_TOOLDIR handle MAKEOBJDIRPERFIX passed from the
environment. It runs too early to use getmakevar, so it will not work
if the value contains embedded '${...}' variable references.

* Use '$TOOLDIR' (with a literal '$') instead of 'nonexistent' in
a message when rebuilding make when TOOLDIR is not yet known.


# 1.87 27-Sep-2009 apb

Allow build.sh "-C cdextra" option to be specified multiple times.


# 1.86 07-Sep-2009 jnemeth

Add a modules operation to build.sh, which builds and installs kernel modules
into DESTDIR.

This is based on the patch provided by tsutsui@ on tech-toolchain@.


# 1.85 12-Jul-2009 hubertf

regen


# 1.84 12-Jul-2009 hubertf

regen


Revision tags: jym-xensuspend-nbase jym-xensuspend-base
# 1.83 01-May-2009 snj

Introduce MKSUBPIXEL, which allows enabling subpixel rendering code
in FreeType.


# 1.82 02-Dec-2008 mrg

branches: 1.82.2;
be explicit about MAKEOBJDIR and MAKEOBJDIRPREFIX not being for
mk.conf or ${MAKECONF}.


# 1.81 15-Nov-2008 mrg

revert sparc back to default of XFree86 at the request of macallan.


# 1.80 13-Nov-2008 apb

Add support for new MAKEVERBOSE levels 3 and 4. The complete list is now:

0 Minimal output ("quiet")
1 Describe what is occurring
2 Describe what is occurring and echo the actual command
3 Ignore the effect of the "@" prefix in make commands
4 Trace shell commands using the shell's -x flag

The default remains MAKEVERBOSE=2.


# 1.79 09-Nov-2008 mrg

- retire MKXORG from public use
- introduce X11FLAVOUR to choose src/x11 vs src/external/mit/xorg
for the X11 to build if MKX11=yes is set. it takes the values
of either Xorg or XFree86.
- default to Xorg on alpha, i386, macppc, shark, sparc and sparc64
- remove MKXORG_WITH_XSRC_XSERVER, unused and never useful


Revision tags: netbsd-5-base matt-mips64-base2
# 1.78 24-Sep-2008 apb

branches: 1.78.2;
regen for recent change to examples and objdir advice,
and for the older MKSTRIPIDENT change.


Revision tags: wrstuden-revivesa-base-3 wrstuden-revivesa-base-2
# 1.77 06-Sep-2008 lukem

regen for MKHTML


# 1.76 28-Aug-2008 lukem

Improve support for MKXORG!=no to enable builds into external/mit/xorg.
This will be mutually exclusive to MKX11!=no.


# 1.75 18-Aug-2008 lukem

Document "build.sh cleandir".
Fix formatting nit.
Remove BUGS; all the in-tree platforms are using build.sh now.


# 1.74 11-Aug-2008 apb

* Suggest a "-j" value between 1+NCPU and 2*NCPU for the fastest builds.
* Remove some duplicated content that appeared in both the section about
make's -j flag and the section about build.sh's -j flag.


# 1.73 05-Aug-2008 apb

* Add more detail for build.sh -M and -O options.
* Mention new default when source is /usr/src but build.sh is run
with neither -M nor -O.


# 1.72 05-Aug-2008 perry

Builds now use "BUILDSEED" so that c++ binaries are reproduceable.
By default BUILDSEED is set to NetBSD-{majorversion} -- a -S flag may
be used to change it.

Discussed on tech-toolchain.


Revision tags: wrstuden-revivesa-base-1 yamt-pf42-base4 yamt-pf42-base3 hpcarm-cleanup-nbase yamt-pf42-baseX yamt-pf42-base2 wrstuden-revivesa-base keiichi-mipv6-nbase yamt-pf42-base keiichi-mipv6-base
# 1.71 29-Mar-2008 dholland

branches: 1.71.4;
Correct/clarify the default setting of USETOOLS in the previous version.
Noted by apb.


# 1.70 28-Mar-2008 dholland

Assorted updates and clarifications, grammar fixes and wording improvements,
and so on. Significant highlights:
- mention src/tests and reference atf;
- provide examples of MACHINE and MACHINE_ARCH;
- mention that MKOBJ=no is not recommended;
- correct the description of the default setting of USETOOLS;
- document the interactions of build.sh -[uo] with various things;
- document the interactions of build.sh tools and kernel=FOO;
- use a lot fewer parentheses.
Discussed on netbsd-docs.


Revision tags: matt-armv6-nbase
# 1.69 18-Mar-2008 lukem

Consistently document RELEASEDIR/RELEASEMACHINEDIR.


# 1.68 08-Mar-2008 reed

Mention that "build" and "distribution" do not build nor install (to DESTDIR)
a kernel.


Revision tags: cube-autoconf-base matt-armv6-base hpcarm-cleanup-base
# 1.67 23-Nov-2007 sborrill

branches: 1.67.4;
Add support for CDBUILDEXTRA which acts like CDEXTRA to add extra items
to the CD-ROM image.
Make CDEXTRA and CDBUILDEXTRA be able to contain lists of files and directories
which are added in turn.
Add support for CDEXTRA_SKIP which contains a list of fnmatch(3) items to
skip during the copy. This is _very_ useful for skipping CVS dirs for example.
CDBUILDEXTRA and CDEXTRA_SKIP are to be used in Makefiles creating the images,
CDEXTRA remains to be used from build.sh.
Update documentation and build.sh help text to show that -C can be used to
specify a list of files and directories rather than just a single dir.


# 1.66 01-Sep-2007 jnemeth

Convert build.sh iso-dir=directory option to -C cddir as per jmmv@ on
source-changes.


# 1.65 01-Sep-2007 jnemeth

Add an iso-dir=directory option. When combined with iso-image or
iso-image-source, it will cause directory to be added to the CD-ROM image.


# 1.64 30-Aug-2007 jnemeth

describe new iso-image-source target


# 1.63 30-Aug-2007 ad

Remove STATUS paragraph which makes it sound like the build system is
half baked.


Revision tags: matt-mips64-base
# 1.62 13-Apr-2007 apb

branches: 1.62.4;
Document recent changes to "make iso-image".


# 1.61 26-Mar-2007 apb

Document the fact that "make installworld" and "build.sh
installworld=..." do not install the etc or xetc sets. Suggest using
etcupdate(8) and postinstall(8) after installworld.


# 1.60 27-Jan-2007 apb

Try to clarify the description of build.sh -m mach.
Document new evbarm-eb and evbarm-el aliases.


Revision tags: netbsd-4-base
# 1.59 08-Oct-2006 apb

branches: 1.59.2;
Clarify that DESTDIR/OBJDIR/etc are absolute paths, but build.sh
-D/-O/etc allows relative paths.

Closes PR 32345 by Andre Luiz de Oliveira.


# 1.58 29-Sep-2006 apb

Use ${HOST_SH} instead of the host system's /bin/sh wherever possible:

* Describe the HOST_SH variable, and the way build.sh attempts to set it.

* Suggest passing HOST_SH in the environment if /bin/sh is not a working
shell.


Revision tags: abandoned-netbsd-4-base
# 1.57 29-Jan-2006 apb

mkisofs is in pkgsrc/sysutils/cdrtools now, not pkgsrc/sysutils/cdrecord.
Reported by Jukka Salmi.


# 1.56 28-Jan-2006 apb

* Add an "iso-image" target in the top level Makefile,
which invokes make iso-image in the etc directory.
* Add an "iso-image" action in build.sh, which
invokes make iso-image.
* Document the above in doc/BUILDING.mdoc.
* Re-generate BUILDING.

Approved by christos


# 1.55 12-Jan-2006 wiz

Bump date for syspkgs.


# 1.54 04-Jan-2006 apb

Document "make syspkgs" and "build.sh syspkgs".

Reviewed by agc


Revision tags: netbsd-3-1-1-RELEASE netbsd-3-0-3-RELEASE netbsd-3-1-RELEASE netbsd-3-0-2-RELEASE netbsd-3-1-RC4 netbsd-3-1-RC3 netbsd-3-1-RC2 netbsd-3-1-RC1 netbsd-3-0-1-RELEASE netbsd-3-0-RELEASE netbsd-3-0-RC6 netbsd-3-0-RC5 netbsd-3-0-RC4 netbsd-3-0-RC3 netbsd-3-0-RC2 netbsd-3-0-RC1 netbsd-3-base
# 1.53 15-Feb-2005 reed

Document the environment variables for if you need to override or
manually select your compilers.
(And regen BUILDING from doc/BUILDING.mdoc.)


# 1.52 12-Oct-2004 jmc

Fix some typo's/bad wording as highlighted in PR#27219


# 1.51 25-Jun-2004 wiz

regen (Document -h. From Karsten Kruse in PR 25974.
While here, remove a duplicate sentence).


Revision tags: netbsd-2-0-3-RELEASE netbsd-2-1-RELEASE netbsd-2-1-RC6 netbsd-2-1-RC5 netbsd-2-1-RC4 netbsd-2-1-RC3 netbsd-2-1-RC2 netbsd-2-1-RC1 netbsd-2-0-2-RELEASE netbsd-2-0-1-RELEASE netbsd-2-base netbsd-2-0-RELEASE netbsd-2-0-RC5 netbsd-2-0-RC4 netbsd-2-0-RC3 netbsd-2-0-RC2 netbsd-2-0-RC1 netbsd-2-0-base
# 1.50 19-Mar-2004 wiz

Document MKTTINTERP.


# 1.49 06-Feb-2004 lukem

* Document build.sh -X and -x
* Document MKX11 and X11SRCDIR
* Remove note warning against cross-building from systems other than NetBSD;
it works on many other platforms.


# 1.48 29-Dec-2003 jmc

Note tools/compat/README as the place to get notes from non-native cross builds


# 1.47 19-Dec-2003 zuntum

Change -v to -V in the following section:

"Print make(1)'s idea of the value of var. Does not build any targets."

To reflect reality.

Found by Tomasz Marciniak <Tomasz.Marciniak@felix.fizyka.amu.edu.pl>, thanks!


# 1.46 26-Oct-2003 lukem

Improve how build.sh -N and MAKEVERBOSE interoperate;
rather than adding '-s' to make's command line in the makewrapper,
use the .SILENT target based on MAKEVERBOSE's value.

This means that you can do:
./build.sh -N 1 makewrapper

$TOOLDIR/bin/nbmake-$MACHINE
# runs at MAKEVERBOSE==1, with command lines suppressed

$TOOLDIR/bin/nbmake-$MACHINE MAKEVERBOSE=2
# runs at MAKEVERBOSE==2 for this invocation, with command lines shown


# 1.45 25-Oct-2003 lukem

Implement build -N noisy, which sets MAKEVERBOSE to noisy and adds
`-s' to MAKEFLAGS for noisy < 2.


# 1.44 29-Sep-2003 lukem

regenerate for "%" prompt update


# 1.43 19-Aug-2003 martti

Backout the previous commit


# 1.42 19-Aug-2003 martti

Remove # from the example.


# 1.41 08-Aug-2003 lukem

fix description of MAKEOBJDIR. from Martin Husemann


# 1.40 29-Jul-2003 lukem

Add build.sh -Z var, to unset a variable and ensure it's unset in makewrapper.
For -M MAKEOBJDIRPREFIX, unset MAKEOBJDIR.
For -O MAKEOBJDIR, unset MAKEOBJDIRPREFIX.


# 1.39 18-Jul-2003 lukem

fix default location of TOOLDIR


# 1.38 18-Jul-2003 lukem

Update for the MKUNPRIVED/MKUPDATE changes.


# 1.37 18-Jul-2003 lukem

rebuild with new groff


# 1.36 03-Jul-2003 lukem

attempt to clarify how MAKEOBJDIR{,PREFIX} may be provided ...
(this document needs a rototill, which i may get to whilst writing a
paper about build.sh)


# 1.35 25-May-2003 lukem

all:
* add "releasekernel=conf", to install a gzipped copy of the kernels
built by "kernel=conf" to RELEASEDIR/MACHINE/binary/kernel

build.sh:
* be more consistent in various status messages
* move the {release,}kernel=conf conf parsing code into getkernelconf()
and use in both buildkernel() and releasekernel()
* only warn once when building multiple kernels without updating the tools


# 1.34 18-May-2003 lukem

For normal builds, MKOBJDIRS default to `no' (not `yes').
It's only build.sh that sets this to `yes' by default.
Noted by OGAWA Takaya in [toolchain/19823]


# 1.33 17-May-2003 lukem

improve description of how "build.sh -m mach" sets the default
MACHINE_ARCH, and list the special cases that this does not occur for.


# 1.32 10-May-2003 lukem

crank date for previous


# 1.31 10-May-2003 lukem

Add "sourcesets" argument/target, which builds source sets into
RELEASEDIR/source/sets


# 1.30 08-May-2003 lukem

build.sh now provides defaults for DESTDIR and RELEASEDIR if not expert mode.
Remove -D and -R from EXAMPLES since they're not necessary any more.


# 1.29 08-Feb-2003 lukem

Fix example 3; the build.sh target is "install" not "installworld".
Improve description.
Noted by Valeriy Ushakov (uwe@) in private email.


# 1.28 02-Feb-2003 lukem

attempt to further improve and clarify the examples...


# 1.27 30-Jan-2003 lukem

Prefix various paths with 'DESTDIR', to highlight that the DESTDIR
is taken into account.


# 1.26 29-Jan-2003 lukem

allow toolprefix to be easily changed


# 1.25 26-Jan-2003 lukem

Various improvements per discussion with Alan Barrett.


# 1.24 26-Jan-2003 lukem

- Add "sets" top-level Makefile target and build.sh operation.
[Latter suggested by Julio Merino in private email]
- Add "help" build.sh operation.


# 1.23 26-Jan-2003 lukem

Change build.sh so that at least one operation is required.
Add "makewrapper" operation to build.sh.
[The above changes were suggested by Alan Barrett on current-users@]

Fail if building as non-root unless: UNPRIVED is set, -U is given, or -E
(expert mode) is given.
[Suggested by James Wetterau in private email]

Improve the examples in BUILDING.


# 1.22 23-Jan-2003 lukem

Rework how build.sh functions, so that command line options set various
parameters, and a list of "operations" defines what to do.
The full usage is show below. Notes:
`-b' has been deprecated (it always occurs now)
`-d' is replaced by "distribution"
`-R rel' onlys sets RELEASEDIR; use "release" to build a release
`-k kern' has been replaced by "kernel=kern"
`-i idir' has been replaced by "install=idir"
-r now occurs before nbmake is rebuilt

Add a copyright (long due!). Rework the code to (a KNF inspired) ShellNF.
Use functions appropriately. Allow `nb' prefix to be easily changed to
something else. Solve world peace (just kidding)

This is part of the (never achievable) goal of attempting to make
NetBSD easier to build...


--8<-- new usage follows --8<--

Usage: build.sh [-EnorUu] [-a arch] [-B buildid] [-D dest] [-j njob] [-M obj]
[-m mach] [-O obj] [-R release] [-T tools] [-V var=[value]]
[-w wrapper] [operation [...] ]

System build operations (all imply "obj" and "tools"):
build Run "make build"
distribution Run "make distribution" (includes etc/ files)
release Run "make release" (includes kernels & distrib media)

Other operations:
obj Run "make obj" (default unless -o)
tools Build and install tools
kernel=conf Build kernel with config file `conf'
install=idir Run "make installworld" to `idir'
(useful after 'distribution' or 'release')

Options:
-a arch Set MACHINE_ARCH to arch (otherwise deduced from MACHINE)
-B buildId Set BUILDID to buildId
-D dest Set DESTDIR to dest
-E Set "expert" mode; disables some DESTDIR checks
-j njob Run up to njob jobs in parallel; see make(1)
-M obj Set obj root directory to obj (sets MAKEOBJDIRPREFIX)
-m mach Set MACHINE to mach (not required if NetBSD native)
-n Show commands that would be executed, but do not execute them
-O obj Set obj root directory to obj (sets a MAKEOBJDIR pattern)
-o Set MKOBJDIRS=no (do not create objdirs at start of build)
-R release Set RELEASEDIR to release
-r Remove contents of TOOLDIR and DESTDIR before building
-T tools Set TOOLDIR to tools. If unset, and TOOLDIR is not set in
the environment, nbmake will be (re)built unconditionally.
-U Set UNPRIVED
-u Set UPDATE
-V v=[val] Set variable `v' to `val'
-w wrapper Create nbmake script as wrapper
(default: ${TOOLDIR}/bin/nbmake-${MACHINE})


# 1.21 04-Jan-2003 lukem

Add "-V var=[value]", for setting arbitrary variables which will also
be added to the nbmake-${MACHINE} wrapper.
Useful for setting RELEASEDIR, without -R's habit of building a release.


Revision tags: fvdl_fs64_base
# 1.20 25-Dec-2002 lukem

Document:
* build.sh -i idir
* top level targets: distribution, buildworld, installworld
* top level variables: INSTALLWORLDDIR


# 1.19 08-Dec-2002 lukem

Add -E - "expert mode". If this is not specified, builds to DESTDIR=/ are
not permitted.
By using this flag, you are taking responsibility for any issues that
may occur because of this...


# 1.18 08-Dec-2002 lukem

- be consistent about option ordering in build.sh usage display
- use Fl and Ar instead of Sy and Em to format options


# 1.17 25-Nov-2002 wiz

Update location of BUILDING.mdoc.


# 1.16 20-Oct-2002 lukem

regen for build.sh -k


# 1.15 21-Sep-2002 lukem

regen for: USE_NEW_TOOLCHAIN was replaced with TOOLCHAIN_MISSING


# 1.14 17-Sep-2002 fredb

Expand on the difference between ``build.sh -d'' and ``make install'',
as requested by Brian Stark in PR toolchain/18228 (which this closes).


# 1.13 22-Jul-2002 wiz

Remove duplicate 'files'. From Ryo HAYASAKA in toolchain/17674.


Revision tags: netbsd-1-6-PATCH002-RC3 netbsd-1-6-PATCH002-RC2 netbsd-1-6-PATCH002-RC1 netbsd-1-6-PATCH001 netbsd-1-6-PATCH001-RELEASE netbsd-1-6-PATCH001-RC3 netbsd-1-6-PATCH001-RC2 netbsd-1-6-PATCH001-RC1 netbsd-1-6-RELEASE netbsd-1-6-RC3 netbsd-1-6-RC2 netbsd-1-6-RC1 netbsd-1-6-base
# 1.12 13-May-2002 lukem

branches: 1.12.2;
add "-M makeobjdirprefix" to build.sh


# 1.11 03-May-2002 lukem

Move the METALOG from ${_SRC_TOP_OBJ_} to ${DESTDIR}.

There were too many synchronisation problems with using the former;
including situations such as a "make clean" performed between two
installs to the same DESTDIR would result in a truncated METALOG and
the resultant sets would be missing stuff such as include files that
don't get reinstalled if they haven't changed, even with !UPDATE.


# 1.10 02-May-2002 sommerfeld

Re-gen.


# 1.9 14-Mar-2002 thorpej

Add a -B option to set the BUILDID for the build. This also causes
the make(1) wrapper script to be named "nbmake-MACHINE-BUILDID".


# 1.8 05-Mar-2002 lukem

document various supported environment variables, including MAKEOBJDIRPREFIX


# 1.7 04-Mar-2002 lukem

document:
- make's UNPRIVED support
- build.sh's -U support
- the build system currently needs to build onto a file system with
long file name and hard link support


# 1.6 25-Nov-2001 thorpej

Document the -d option to build.sh


# 1.5 15-Nov-2001 tv

Note only <bsd.own.mk> as the authority for determining whether the new
BUILDING instructions should be used.


# 1.4 14-Nov-2001 tv

Turn off host-specific objdirs by default. Set MKHOSTOBJ=yes to enable.


# 1.3 12-Nov-2001 tv

Major overhaul of src/tools and host toolchain. Summary of changes:

* Rewrite src/tools Make logic to work like the rest of the tree wrt
"dependall" and "install". The old "make build" hack is gone.

* Remove the MKTOOLS logic. This was linked to the "make build" hack,
and was only needed because TOOLDIR originally had no writable default.

* Redo the GNU configure/make logic to make it fit reasonably in a
BSD make wrapper. Use new ${.ALLTARGETS} variable to scan for
targets in $(srcdir), and mark them with .MADE: to prevent rebuilding.

* Only build cross tools in src/tools; remove some messy logic in
src/usr.* and src/gnu/usr.* that would do target filename rewriting
(improves consistency and readability).

* Add the ability to build cross gdb at tool build time by setting
MKCROSSGDB (default no) to "yes" in mk.conf.

* Add src/tools/groff and set up paths to work with this cross groff.


# 1.2 08-Nov-2001 wiz

Remove mention of BUILDLING.html, and follow rename of BUILDING.txt to
BUILDING.
Noted by Love <lha@stacken.kth.se> on tech-toolchain.


# 1.1 01-Nov-2001 tv

By popular demand, one preformatted version of BUILDING, plaintext, no CRs.


# 1.146 01-Oct-2022 rillig

fix documentation for MKLINT

Since share/mk/bsd.own.mk 1.749 from 2013-08-26, MKLINT defaults to no.


# 1.145 22-Aug-2022 brook

By default, do not install any bootable images.

The previous commit introduced the ability to install a set of
bootable images as a normal part of a release build. While this made
it easy to install bootable images, the contents of a release build
depend on whether or not U-Boot packages are installed in /usr/pkgsrc,
which is the default location searched by installboot(8).

This commit requires users to explicitly list the bootable images to
be installed, which by default is none (i.e., prior behavior).


# 1.144 21-Aug-2022 brook

Create bootable images in ${RELEASEDIR}/${RELEASEMACHINEDIR}/binary/gzimg.

Release builds for arm platforms create compressed images in
${RELEASEDIR}/${RELEASEMACHINEDIR}/binary/gzimg. However, in some
cases, e.g., armv7.img.gz, they are not bootable. Consequently, boot
blocks must be manually installed in the images, which is an extra
barrier for testing systems or adopting NetBSD. This has prompted
creation of external repositories, e.g., armbsd.org, to host a
collection of bootable images. However, this does not ease the burden
on developers compiling their own systems; for them, manual
installation of boot blocks is still required.

For arm platforms, etc/etc.evbarm/Makefile.inc contains the commands
used to create system images. Because installboot(8) can write boot
blocks directly to system images, a loop through possible boards can
create a series of bootable images during the normal build process.

In the case of many arm platforms, installboot(8) uses U-Boot boot
blocks, which are not part of the NetBSD source code. Developers can,
however, install as many U-Boot boot blocks as desired, either in the
default location of /usr/pkg/share/u-boot or in a set of directories
pointed to by the U-Boot search path, the INSTALLBOOT_UBOOT_PATHS
environment variable. For each board with an available boot block, a
board-specific bootable image will be created in
${RELEASEDIR}/${RELEASEMACHINEDIR}/binary/gzimg. If a boot block is
not available, which is the typical situation currently, no additional
image will be created.

This facility creates opportunities to build bootable images for any
number of boards within the scope of a standard release build.
However, that is not required and will not occur without the
intervention of installing U-Boot boot blocks prior to the build.


# 1.143 21-Aug-2022 lukem

BUILDING: regen for removal of extsrc/


# 1.142 28-May-2022 andvar

s/knowlege/knowledge/


# 1.141 20-Dec-2021 christos

Rename:
MKKDEBUG -> MKDEBUGKERNEL
MKTOOLSDEBUG -> MKDEBUGTOOLS
while keeping compatibility with the old names. Add missing documentation.
Now all debugging tunables are prefixed with MKDEBUG.


Revision tags: cjep_sun2x-base1 cjep_sun2x-base cjep_staticlib_x-base1 cjep_staticlib_x-base
# 1.140 10-Nov-2020 kamil

Reintroduce the support of MKCATPAGES

Requested by <mrg>


# 1.139 08-Nov-2020 kamil

Remove the support for MKCATPAGES

It was optional since 1999 and disabled by default since 2012.

Proposed on tech-userlevel@.


# 1.138 13-Oct-2020 thorpej

Document CPUFLAGS here (it's already documented in share/mk/bsd.README).
This will address the initial concern in PR port-alpha/55545.


# 1.137 12-Oct-2020 uwe

Mention HOST_CFLAGS and HOST_CXXFLAGS.


# 1.136 12-Oct-2020 uwe

Bump date and regen for BUILDING.mdoc revision 1.127
that introduced build.sh -c <compiler> option.


Revision tags: netbsd-9-3-RELEASE netbsd-9-2-RELEASE netbsd-9-1-RELEASE phil-wifi-20200421 phil-wifi-20200411 is-mlppp-base phil-wifi-20200406 netbsd-9-0-RELEASE netbsd-9-0-RC2 netbsd-9-0-RC1 phil-wifi-20191119 netbsd-9-base phil-wifi-20190609
# 1.135 08-May-2019 leot

Fix a typo

Reported by Tobias Ulmer via netbsd-docs@ ML, thanks!


Revision tags: pgoyette-compat-20190127 pgoyette-compat-20190118 pgoyette-compat-1226 pgoyette-compat-1126 pgoyette-compat-1020 pgoyette-compat-0930 pgoyette-compat-0906
# 1.134 29-Jul-2018 sevan

regen


Revision tags: pgoyette-compat-0728 phil-wifi-base pgoyette-compat-0625 pgoyette-compat-0521
# 1.133 02-May-2018 pgoyette

branches: 1.133.2;
Re-add files that were accidentally deleted in my previous commit.


# 1.132 02-May-2018 pgoyette

Synch with HEAD


Revision tags: pgoyette-compat-0502 pgoyette-compat-0422 pgoyette-compat-0415 pgoyette-compat-0407 pgoyette-compat-0330 pgoyette-compat-0322 pgoyette-compat-0315 pgoyette-compat-base
# 1.131 16-Feb-2018 leot

branches: 1.131.2;
regen


# 1.130 29-Dec-2017 sevan

regen


# 1.129 21-Oct-2017 sevan

regen


Revision tags: netbsd-8-2-RELEASE netbsd-8-1-RELEASE netbsd-8-1-RC1 netbsd-8-0-RELEASE netbsd-8-0-RC2 netbsd-8-0-RC1 matt-nb8-mediatek-base perseant-stdc-iso10646-base netbsd-8-base
# 1.128 21-May-2017 riastradh

regen


Revision tags: prg-localcount2-base3 prg-localcount2-base2 prg-localcount2-base1 prg-localcount2-base pgoyette-localcount-20170426
# 1.127 22-Apr-2017 plunky

regen


Revision tags: bouyer-socketcan-base1
# 1.126 20-Apr-2017 wiz

regen using regen target in doc.


# 1.125 20-Apr-2017 ozaki-r

Introduce MKSTRIPSYM build option

If it's yes, all local symbols of shared libraries are stripped
(default). If it's no, only temporary local symbols are stripped;
for example, symbols of static functions are kept. Keeping such
symbols is useful on using DTrace for userland libraries and
getting a backtrace from a rump server loading modules (shared
libraries).

Proposed and discussed on tech-kern and tech-toolchain


Revision tags: pgoyette-localcount-20170320
# 1.124 20-Feb-2017 christos

regen


# 1.123 16-Feb-2017 rin

The default values for MKPIC are yes and no for sh3 and m68000, respectively.
Bump date.


Revision tags: bouyer-socketcan-base pgoyette-localcount-20170107 pgoyette-localcount-20161104 localcount-20160914 pgoyette-localcount-20160806 pgoyette-localcount-20160726 pgoyette-localcount-base
# 1.122 29-Jan-2016 wiz

branches: 1.122.2; 1.122.4;
Document MKREPRO_TIMESTAMP.


# 1.121 23-Jul-2015 mrg

remove the xfree86 reachover makefiles and the vast majority of
the support in the rest of the source tree.

X11 sets could use some cleaning up perhaps (just deletion, as
we've never really marked the old X11R6 as obsolete for native
xorg using platforms so far either.)


# 1.120 07-Jun-2015 pgoyette

Update to reflect changes made in rev 1.398 of src/etc/Makefile


# 1.119 08-Apr-2015 wiz

regen


# 1.118 30-Nov-2014 uebayasi

regen


# 1.117 16-Nov-2014 uebayasi

regen


# 1.116 16-Nov-2014 uebayasi

regen


# 1.115 13-Nov-2014 apb

regen from doc/BUILDING.mdoc revision 1.107.
This reinstates documentation for "extsrc" which was lost in 2009.


# 1.114 08-Nov-2014 snj

fourth time's the charm, i guess. when committing a generated file,
it's best to use the latest revision of the source file (hi uebs!)

regen to include changes from revision 1.105 of doc/BUILDING.mdoc


# 1.113 06-Nov-2014 uebayasi

regen


# 1.112 06-Nov-2014 uebayasi

Expand TABs.


# 1.111 06-Nov-2014 uebayasi

Document the new "kernels" operation, prompted by joerg@.


# 1.110 05-Nov-2014 snj

regen


Revision tags: netbsd-7-base tls-earlyentropy-base tls-maxphys-base
# 1.109 07-Aug-2014 apb

branches: 1.109.2;
regen BUILDING from doc/BUILDING.mdoc


# 1.108 03-Aug-2014 apb

BUILDINFO part6: regen BUILDING from doc/BUILDING.mdoc


# 1.107 14-Jun-2014 apb

Regen from doc/BUILDING.mdoc;1.100:
Improve documentation for BUILDID.


# 1.106 21-May-2014 wiz

regen


Revision tags: yamt-pagecache-base9 riastradh-xf86-video-intel-2-7-1-pre-2-21-15 riastradh-drm2-base3 riastradh-drm2-base2 riastradh-drm2-base1 riastradh-drm2-base
# 1.105 29-May-2013 wiz

branches: 1.105.4;
regen using 'make regen' from src/doc.


# 1.104 29-May-2013 wiz

regen (using mandoc doc/BUILDING.mdoc > BUILDING -- let me know
if a different way is preferred, I see that it now contains formatting).


Revision tags: agc-symver-base yamt-pagecache-base8 yamt-pagecache-base7
# 1.103 08-Nov-2012 dholland

regen


Revision tags: yamt-pagecache-base6
# 1.102 19-Sep-2012 abs

regen


# 1.101 25-May-2012 wiz

branches: 1.101.2;
regen using 'make regen' in doc/


# 1.100 25-May-2012 wiz

Document MKREPRO using joerg's wording.


Revision tags: yamt-pagecache-base5 yamt-pagecache-base4
# 1.99 23-Feb-2012 tsutsui

Add a missing period.


Revision tags: netbsd-6-base
# 1.98 14-Feb-2012 apb

branches: 1.98.2;
Regen from revision 1.87 of doc/BUILDING.mdoc.


# 1.97 22-Jan-2012 tsutsui

Add "live-image" and "install-image" target support to build.sh.

"live-image" target builds pre-installed disk images that can be used on
emulators or boot from USB memory sticks to try NetBSD without installation.
Currently amd64, i386, pmax, sparc, sparc64, sun2, sun3, and vax
(which have working emulators and don't require extra tools like preparing
msdosfs or partitioning MD label structures) support this target.

"install-image" target builds an bootable installation disk image that can
be used as an install CD but burned into USB memory sticks etc.
Current only amd64 and i386 (which would support USB boot) have this target.

For more details (and known issue) see following posts on netbsd-bugs@:
http://mail-index.NetBSD.org/netbsd-bugs/2011/08/06/msg023639.html
http://mail-index.NetBSD.org/netbsd-bugs/2011/09/23/msg024207.html
http://mail-index.NetBSD.org/netbsd-bugs/2011/12/07/msg025166.html
http://mail-index.NetBSD.org/netbsd-bugs/2011/12/08/msg025178.html

No particular comments about implementation, and
"go ahead" comments from mrg@, riz@ and christos@.

Closes PR toolchain/45153 and PR misc/45155.


Revision tags: yamt-pagecache-base3 yamt-pagecache-base2 yamt-pagecache-base
# 1.96 09-Sep-2011 apb

branches: 1.96.2;
Add tests for the shell under which build.sh is run. If the
shell fails the tests, then build.sh tries to re-exec itself
under a more suitable shell.


# 1.95 09-Sep-2011 apb

Revisions 1.92 and 1.93 of src/BUILDING were not reflected in
src/doc/BUILDING.mdoc, so those changes were lost when src/BUILDING
was regenerated in revision 1.94.

Now update src/doc/BUILDING.mdoc and regenerate src/BUILDING to
reinstate the lost changes. (I also edited one of the changes, to use
the phrase "space-separated list" for consistency with other parts of
the document.)

The original changes were:


# 1.93 06-Aug-2011 jnemeth

Add description of MKKMOD, part of PR misc/45216


Revision tags: cherry-xenmp-base bouyer-quota2-nbase bouyer-quota2-base
# 1.92 29-Jan-2011 jym

Pass down INSTALLSETS variable to installsets target. Use :Q to escape
shell meta-characters, as the variable contains a list of sets, separated
by spaces.

$ ./build.sh -V INSTALLSETS="base etc" install=idir

should now work as expected.

Reviewed by apb@ on tech-toolchain.


# 1.94 09-Sep-2011 apb

Allow MAKEFLAGS to be set via build.sh -V. Somebody asked for this
in 2008.

Also add comments above a few functions in build.sh, and bump copyright
dates.


# 1.93 06-Aug-2011 jnemeth

Add description of MKKMOD, part of PR misc/45216


Revision tags: cherry-xenmp-base bouyer-quota2-nbase bouyer-quota2-base
# 1.92 29-Jan-2011 jym

Pass down INSTALLSETS variable to installsets target. Use :Q to escape
shell meta-characters, as the variable contains a list of sets, separated
by spaces.

$ ./build.sh -V INSTALLSETS="base etc" install=idir

should now work as expected.

Reviewed by apb@ on tech-toolchain.


Revision tags: matt-mips64-premerge-20101231
# 1.91 25-Jul-2010 mrg

branches: 1.91.2;
remove the MKSUBPIXEL/MKTTINTERP options; they're going away.

regenerate.


Revision tags: matt-premerge-20091211
# 1.90 30-Nov-2009 uebayasi

Support "extsrc", externally added programs and libraries. Users can write
their own reach-overs, cross-build, install, and get set files just like base
and X11 / X.org. (These sets are not included as TNF releases.)


# 1.89 10-Oct-2009 apb

If ${NETBDSRCDIR}/../xsrc exists, then use it as the default value
of X11SRCDIR. If it doesn't exist, then use /usr/xsrc as before.

OK mrg


# 1.88 27-Sep-2009 apb

* Use a more robust method of creating the top level object directory.
Use getmakevar to expand MAKEOBJDIRPREFIX or MAKEOBJDIR, or (if
neither of those variables is set) use a non-recursive "make obj" in
the top level source directory.

* Do not let TOP_objdir default to ${TOP}. It's now set only by the
-M or -O command line options, or after using getmakevar to expand
MAKEOBJDIRPREFIX or MAKEOBJDIR.

* Make try_set_TOOLDIR handle MAKEOBJDIRPERFIX passed from the
environment. It runs too early to use getmakevar, so it will not work
if the value contains embedded '${...}' variable references.

* Use '$TOOLDIR' (with a literal '$') instead of 'nonexistent' in
a message when rebuilding make when TOOLDIR is not yet known.


# 1.87 27-Sep-2009 apb

Allow build.sh "-C cdextra" option to be specified multiple times.


# 1.86 07-Sep-2009 jnemeth

Add a modules operation to build.sh, which builds and installs kernel modules
into DESTDIR.

This is based on the patch provided by tsutsui@ on tech-toolchain@.


# 1.85 12-Jul-2009 hubertf

regen


# 1.84 12-Jul-2009 hubertf

regen


Revision tags: jym-xensuspend-nbase jym-xensuspend-base
# 1.83 01-May-2009 snj

Introduce MKSUBPIXEL, which allows enabling subpixel rendering code
in FreeType.


# 1.82 02-Dec-2008 mrg

branches: 1.82.2;
be explicit about MAKEOBJDIR and MAKEOBJDIRPREFIX not being for
mk.conf or ${MAKECONF}.


# 1.81 15-Nov-2008 mrg

revert sparc back to default of XFree86 at the request of macallan.


# 1.80 13-Nov-2008 apb

Add support for new MAKEVERBOSE levels 3 and 4. The complete list is now:

0 Minimal output ("quiet")
1 Describe what is occurring
2 Describe what is occurring and echo the actual command
3 Ignore the effect of the "@" prefix in make commands
4 Trace shell commands using the shell's -x flag

The default remains MAKEVERBOSE=2.


# 1.79 09-Nov-2008 mrg

- retire MKXORG from public use
- introduce X11FLAVOUR to choose src/x11 vs src/external/mit/xorg
for the X11 to build if MKX11=yes is set. it takes the values
of either Xorg or XFree86.
- default to Xorg on alpha, i386, macppc, shark, sparc and sparc64
- remove MKXORG_WITH_XSRC_XSERVER, unused and never useful


Revision tags: netbsd-5-base matt-mips64-base2
# 1.78 24-Sep-2008 apb

branches: 1.78.2;
regen for recent change to examples and objdir advice,
and for the older MKSTRIPIDENT change.


Revision tags: wrstuden-revivesa-base-3 wrstuden-revivesa-base-2
# 1.77 06-Sep-2008 lukem

regen for MKHTML


# 1.76 28-Aug-2008 lukem

Improve support for MKXORG!=no to enable builds into external/mit/xorg.
This will be mutually exclusive to MKX11!=no.


# 1.75 18-Aug-2008 lukem

Document "build.sh cleandir".
Fix formatting nit.
Remove BUGS; all the in-tree platforms are using build.sh now.


# 1.74 11-Aug-2008 apb

* Suggest a "-j" value between 1+NCPU and 2*NCPU for the fastest builds.
* Remove some duplicated content that appeared in both the section about
make's -j flag and the section about build.sh's -j flag.


# 1.73 05-Aug-2008 apb

* Add more detail for build.sh -M and -O options.
* Mention new default when source is /usr/src but build.sh is run
with neither -M nor -O.


# 1.72 05-Aug-2008 perry

Builds now use "BUILDSEED" so that c++ binaries are reproduceable.
By default BUILDSEED is set to NetBSD-{majorversion} -- a -S flag may
be used to change it.

Discussed on tech-toolchain.


Revision tags: wrstuden-revivesa-base-1 yamt-pf42-base4 yamt-pf42-base3 hpcarm-cleanup-nbase yamt-pf42-baseX yamt-pf42-base2 wrstuden-revivesa-base keiichi-mipv6-nbase yamt-pf42-base keiichi-mipv6-base
# 1.71 29-Mar-2008 dholland

branches: 1.71.4;
Correct/clarify the default setting of USETOOLS in the previous version.
Noted by apb.


# 1.70 28-Mar-2008 dholland

Assorted updates and clarifications, grammar fixes and wording improvements,
and so on. Significant highlights:
- mention src/tests and reference atf;
- provide examples of MACHINE and MACHINE_ARCH;
- mention that MKOBJ=no is not recommended;
- correct the description of the default setting of USETOOLS;
- document the interactions of build.sh -[uo] with various things;
- document the interactions of build.sh tools and kernel=FOO;
- use a lot fewer parentheses.
Discussed on netbsd-docs.


Revision tags: matt-armv6-nbase
# 1.69 18-Mar-2008 lukem

Consistently document RELEASEDIR/RELEASEMACHINEDIR.


# 1.68 08-Mar-2008 reed

Mention that "build" and "distribution" do not build nor install (to DESTDIR)
a kernel.


Revision tags: cube-autoconf-base matt-armv6-base hpcarm-cleanup-base
# 1.67 23-Nov-2007 sborrill

branches: 1.67.4;
Add support for CDBUILDEXTRA which acts like CDEXTRA to add extra items
to the CD-ROM image.
Make CDEXTRA and CDBUILDEXTRA be able to contain lists of files and directories
which are added in turn.
Add support for CDEXTRA_SKIP which contains a list of fnmatch(3) items to
skip during the copy. This is _very_ useful for skipping CVS dirs for example.
CDBUILDEXTRA and CDEXTRA_SKIP are to be used in Makefiles creating the images,
CDEXTRA remains to be used from build.sh.
Update documentation and build.sh help text to show that -C can be used to
specify a list of files and directories rather than just a single dir.


# 1.66 01-Sep-2007 jnemeth

Convert build.sh iso-dir=directory option to -C cddir as per jmmv@ on
source-changes.


# 1.65 01-Sep-2007 jnemeth

Add an iso-dir=directory option. When combined with iso-image or
iso-image-source, it will cause directory to be added to the CD-ROM image.


# 1.64 30-Aug-2007 jnemeth

describe new iso-image-source target


# 1.63 30-Aug-2007 ad

Remove STATUS paragraph which makes it sound like the build system is
half baked.


Revision tags: matt-mips64-base
# 1.62 13-Apr-2007 apb

branches: 1.62.4;
Document recent changes to "make iso-image".


# 1.61 26-Mar-2007 apb

Document the fact that "make installworld" and "build.sh
installworld=..." do not install the etc or xetc sets. Suggest using
etcupdate(8) and postinstall(8) after installworld.


# 1.60 27-Jan-2007 apb

Try to clarify the description of build.sh -m mach.
Document new evbarm-eb and evbarm-el aliases.


Revision tags: netbsd-4-base
# 1.59 08-Oct-2006 apb

branches: 1.59.2;
Clarify that DESTDIR/OBJDIR/etc are absolute paths, but build.sh
-D/-O/etc allows relative paths.

Closes PR 32345 by Andre Luiz de Oliveira.


# 1.58 29-Sep-2006 apb

Use ${HOST_SH} instead of the host system's /bin/sh wherever possible:

* Describe the HOST_SH variable, and the way build.sh attempts to set it.

* Suggest passing HOST_SH in the environment if /bin/sh is not a working
shell.


Revision tags: abandoned-netbsd-4-base
# 1.57 29-Jan-2006 apb

mkisofs is in pkgsrc/sysutils/cdrtools now, not pkgsrc/sysutils/cdrecord.
Reported by Jukka Salmi.


# 1.56 28-Jan-2006 apb

* Add an "iso-image" target in the top level Makefile,
which invokes make iso-image in the etc directory.
* Add an "iso-image" action in build.sh, which
invokes make iso-image.
* Document the above in doc/BUILDING.mdoc.
* Re-generate BUILDING.

Approved by christos


# 1.55 12-Jan-2006 wiz

Bump date for syspkgs.


# 1.54 04-Jan-2006 apb

Document "make syspkgs" and "build.sh syspkgs".

Reviewed by agc


Revision tags: netbsd-3-1-1-RELEASE netbsd-3-0-3-RELEASE netbsd-3-1-RELEASE netbsd-3-0-2-RELEASE netbsd-3-1-RC4 netbsd-3-1-RC3 netbsd-3-1-RC2 netbsd-3-1-RC1 netbsd-3-0-1-RELEASE netbsd-3-0-RELEASE netbsd-3-0-RC6 netbsd-3-0-RC5 netbsd-3-0-RC4 netbsd-3-0-RC3 netbsd-3-0-RC2 netbsd-3-0-RC1 netbsd-3-base
# 1.53 15-Feb-2005 reed

Document the environment variables for if you need to override or
manually select your compilers.
(And regen BUILDING from doc/BUILDING.mdoc.)


# 1.52 12-Oct-2004 jmc

Fix some typo's/bad wording as highlighted in PR#27219


# 1.51 25-Jun-2004 wiz

regen (Document -h. From Karsten Kruse in PR 25974.
While here, remove a duplicate sentence).


Revision tags: netbsd-2-0-3-RELEASE netbsd-2-1-RELEASE netbsd-2-1-RC6 netbsd-2-1-RC5 netbsd-2-1-RC4 netbsd-2-1-RC3 netbsd-2-1-RC2 netbsd-2-1-RC1 netbsd-2-0-2-RELEASE netbsd-2-0-1-RELEASE netbsd-2-base netbsd-2-0-RELEASE netbsd-2-0-RC5 netbsd-2-0-RC4 netbsd-2-0-RC3 netbsd-2-0-RC2 netbsd-2-0-RC1 netbsd-2-0-base
# 1.50 19-Mar-2004 wiz

Document MKTTINTERP.


# 1.49 06-Feb-2004 lukem

* Document build.sh -X and -x
* Document MKX11 and X11SRCDIR
* Remove note warning against cross-building from systems other than NetBSD;
it works on many other platforms.


# 1.48 29-Dec-2003 jmc

Note tools/compat/README as the place to get notes from non-native cross builds


# 1.47 19-Dec-2003 zuntum

Change -v to -V in the following section:

"Print make(1)'s idea of the value of var. Does not build any targets."

To reflect reality.

Found by Tomasz Marciniak <Tomasz.Marciniak@felix.fizyka.amu.edu.pl>, thanks!


# 1.46 26-Oct-2003 lukem

Improve how build.sh -N and MAKEVERBOSE interoperate;
rather than adding '-s' to make's command line in the makewrapper,
use the .SILENT target based on MAKEVERBOSE's value.

This means that you can do:
./build.sh -N 1 makewrapper

$TOOLDIR/bin/nbmake-$MACHINE
# runs at MAKEVERBOSE==1, with command lines suppressed

$TOOLDIR/bin/nbmake-$MACHINE MAKEVERBOSE=2
# runs at MAKEVERBOSE==2 for this invocation, with command lines shown


# 1.45 25-Oct-2003 lukem

Implement build -N noisy, which sets MAKEVERBOSE to noisy and adds
`-s' to MAKEFLAGS for noisy < 2.


# 1.44 29-Sep-2003 lukem

regenerate for "%" prompt update


# 1.43 19-Aug-2003 martti

Backout the previous commit


# 1.42 19-Aug-2003 martti

Remove # from the example.


# 1.41 08-Aug-2003 lukem

fix description of MAKEOBJDIR. from Martin Husemann


# 1.40 29-Jul-2003 lukem

Add build.sh -Z var, to unset a variable and ensure it's unset in makewrapper.
For -M MAKEOBJDIRPREFIX, unset MAKEOBJDIR.
For -O MAKEOBJDIR, unset MAKEOBJDIRPREFIX.


# 1.39 18-Jul-2003 lukem

fix default location of TOOLDIR


# 1.38 18-Jul-2003 lukem

Update for the MKUNPRIVED/MKUPDATE changes.


# 1.37 18-Jul-2003 lukem

rebuild with new groff


# 1.36 03-Jul-2003 lukem

attempt to clarify how MAKEOBJDIR{,PREFIX} may be provided ...
(this document needs a rototill, which i may get to whilst writing a
paper about build.sh)


# 1.35 25-May-2003 lukem

all:
* add "releasekernel=conf", to install a gzipped copy of the kernels
built by "kernel=conf" to RELEASEDIR/MACHINE/binary/kernel

build.sh:
* be more consistent in various status messages
* move the {release,}kernel=conf conf parsing code into getkernelconf()
and use in both buildkernel() and releasekernel()
* only warn once when building multiple kernels without updating the tools


# 1.34 18-May-2003 lukem

For normal builds, MKOBJDIRS default to `no' (not `yes').
It's only build.sh that sets this to `yes' by default.
Noted by OGAWA Takaya in [toolchain/19823]


# 1.33 17-May-2003 lukem

improve description of how "build.sh -m mach" sets the default
MACHINE_ARCH, and list the special cases that this does not occur for.


# 1.32 10-May-2003 lukem

crank date for previous


# 1.31 10-May-2003 lukem

Add "sourcesets" argument/target, which builds source sets into
RELEASEDIR/source/sets


# 1.30 08-May-2003 lukem

build.sh now provides defaults for DESTDIR and RELEASEDIR if not expert mode.
Remove -D and -R from EXAMPLES since they're not necessary any more.


# 1.29 08-Feb-2003 lukem

Fix example 3; the build.sh target is "install" not "installworld".
Improve description.
Noted by Valeriy Ushakov (uwe@) in private email.


# 1.28 02-Feb-2003 lukem

attempt to further improve and clarify the examples...


# 1.27 30-Jan-2003 lukem

Prefix various paths with 'DESTDIR', to highlight that the DESTDIR
is taken into account.


# 1.26 29-Jan-2003 lukem

allow toolprefix to be easily changed


# 1.25 26-Jan-2003 lukem

Various improvements per discussion with Alan Barrett.


# 1.24 26-Jan-2003 lukem

- Add "sets" top-level Makefile target and build.sh operation.
[Latter suggested by Julio Merino in private email]
- Add "help" build.sh operation.


# 1.23 26-Jan-2003 lukem

Change build.sh so that at least one operation is required.
Add "makewrapper" operation to build.sh.
[The above changes were suggested by Alan Barrett on current-users@]

Fail if building as non-root unless: UNPRIVED is set, -U is given, or -E
(expert mode) is given.
[Suggested by James Wetterau in private email]

Improve the examples in BUILDING.


# 1.22 23-Jan-2003 lukem

Rework how build.sh functions, so that command line options set various
parameters, and a list of "operations" defines what to do.
The full usage is show below. Notes:
`-b' has been deprecated (it always occurs now)
`-d' is replaced by "distribution"
`-R rel' onlys sets RELEASEDIR; use "release" to build a release
`-k kern' has been replaced by "kernel=kern"
`-i idir' has been replaced by "install=idir"
-r now occurs before nbmake is rebuilt

Add a copyright (long due!). Rework the code to (a KNF inspired) ShellNF.
Use functions appropriately. Allow `nb' prefix to be easily changed to
something else. Solve world peace (just kidding)

This is part of the (never achievable) goal of attempting to make
NetBSD easier to build...


--8<-- new usage follows --8<--

Usage: build.sh [-EnorUu] [-a arch] [-B buildid] [-D dest] [-j njob] [-M obj]
[-m mach] [-O obj] [-R release] [-T tools] [-V var=[value]]
[-w wrapper] [operation [...] ]

System build operations (all imply "obj" and "tools"):
build Run "make build"
distribution Run "make distribution" (includes etc/ files)
release Run "make release" (includes kernels & distrib media)

Other operations:
obj Run "make obj" (default unless -o)
tools Build and install tools
kernel=conf Build kernel with config file `conf'
install=idir Run "make installworld" to `idir'
(useful after 'distribution' or 'release')

Options:
-a arch Set MACHINE_ARCH to arch (otherwise deduced from MACHINE)
-B buildId Set BUILDID to buildId
-D dest Set DESTDIR to dest
-E Set "expert" mode; disables some DESTDIR checks
-j njob Run up to njob jobs in parallel; see make(1)
-M obj Set obj root directory to obj (sets MAKEOBJDIRPREFIX)
-m mach Set MACHINE to mach (not required if NetBSD native)
-n Show commands that would be executed, but do not execute them
-O obj Set obj root directory to obj (sets a MAKEOBJDIR pattern)
-o Set MKOBJDIRS=no (do not create objdirs at start of build)
-R release Set RELEASEDIR to release
-r Remove contents of TOOLDIR and DESTDIR before building
-T tools Set TOOLDIR to tools. If unset, and TOOLDIR is not set in
the environment, nbmake will be (re)built unconditionally.
-U Set UNPRIVED
-u Set UPDATE
-V v=[val] Set variable `v' to `val'
-w wrapper Create nbmake script as wrapper
(default: ${TOOLDIR}/bin/nbmake-${MACHINE})


# 1.21 04-Jan-2003 lukem

Add "-V var=[value]", for setting arbitrary variables which will also
be added to the nbmake-${MACHINE} wrapper.
Useful for setting RELEASEDIR, without -R's habit of building a release.


Revision tags: fvdl_fs64_base
# 1.20 25-Dec-2002 lukem

Document:
* build.sh -i idir
* top level targets: distribution, buildworld, installworld
* top level variables: INSTALLWORLDDIR


# 1.19 08-Dec-2002 lukem

Add -E - "expert mode". If this is not specified, builds to DESTDIR=/ are
not permitted.
By using this flag, you are taking responsibility for any issues that
may occur because of this...


# 1.18 08-Dec-2002 lukem

- be consistent about option ordering in build.sh usage display
- use Fl and Ar instead of Sy and Em to format options


# 1.17 25-Nov-2002 wiz

Update location of BUILDING.mdoc.


# 1.16 20-Oct-2002 lukem

regen for build.sh -k


# 1.15 21-Sep-2002 lukem

regen for: USE_NEW_TOOLCHAIN was replaced with TOOLCHAIN_MISSING


# 1.14 17-Sep-2002 fredb

Expand on the difference between ``build.sh -d'' and ``make install'',
as requested by Brian Stark in PR toolchain/18228 (which this closes).


# 1.13 22-Jul-2002 wiz

Remove duplicate 'files'. From Ryo HAYASAKA in toolchain/17674.


Revision tags: netbsd-1-6-PATCH002-RC3 netbsd-1-6-PATCH002-RC2 netbsd-1-6-PATCH002-RC1 netbsd-1-6-PATCH001 netbsd-1-6-PATCH001-RELEASE netbsd-1-6-PATCH001-RC3 netbsd-1-6-PATCH001-RC2 netbsd-1-6-PATCH001-RC1 netbsd-1-6-RELEASE netbsd-1-6-RC3 netbsd-1-6-RC2 netbsd-1-6-RC1 netbsd-1-6-base
# 1.12 13-May-2002 lukem

branches: 1.12.2;
add "-M makeobjdirprefix" to build.sh


# 1.11 03-May-2002 lukem

Move the METALOG from ${_SRC_TOP_OBJ_} to ${DESTDIR}.

There were too many synchronisation problems with using the former;
including situations such as a "make clean" performed between two
installs to the same DESTDIR would result in a truncated METALOG and
the resultant sets would be missing stuff such as include files that
don't get reinstalled if they haven't changed, even with !UPDATE.


# 1.10 02-May-2002 sommerfeld

Re-gen.


# 1.9 14-Mar-2002 thorpej

Add a -B option to set the BUILDID for the build. This also causes
the make(1) wrapper script to be named "nbmake-MACHINE-BUILDID".


# 1.8 05-Mar-2002 lukem

document various supported environment variables, including MAKEOBJDIRPREFIX


# 1.7 04-Mar-2002 lukem

document:
- make's UNPRIVED support
- build.sh's -U support
- the build system currently needs to build onto a file system with
long file name and hard link support


# 1.6 25-Nov-2001 thorpej

Document the -d option to build.sh


# 1.5 15-Nov-2001 tv

Note only <bsd.own.mk> as the authority for determining whether the new
BUILDING instructions should be used.


# 1.4 14-Nov-2001 tv

Turn off host-specific objdirs by default. Set MKHOSTOBJ=yes to enable.


# 1.3 12-Nov-2001 tv

Major overhaul of src/tools and host toolchain. Summary of changes:

* Rewrite src/tools Make logic to work like the rest of the tree wrt
"dependall" and "install". The old "make build" hack is gone.

* Remove the MKTOOLS logic. This was linked to the "make build" hack,
and was only needed because TOOLDIR originally had no writable default.

* Redo the GNU configure/make logic to make it fit reasonably in a
BSD make wrapper. Use new ${.ALLTARGETS} variable to scan for
targets in $(srcdir), and mark them with .MADE: to prevent rebuilding.

* Only build cross tools in src/tools; remove some messy logic in
src/usr.* and src/gnu/usr.* that would do target filename rewriting
(improves consistency and readability).

* Add the ability to build cross gdb at tool build time by setting
MKCROSSGDB (default no) to "yes" in mk.conf.

* Add src/tools/groff and set up paths to work with this cross groff.


# 1.2 08-Nov-2001 wiz

Remove mention of BUILDLING.html, and follow rename of BUILDING.txt to
BUILDING.
Noted by Love <lha@stacken.kth.se> on tech-toolchain.


# 1.1 01-Nov-2001 tv

By popular demand, one preformatted version of BUILDING, plaintext, no CRs.


# 1.145 22-Aug-2022 brook

By default, do not install any bootable images.

The previous commit introduced the ability to install a set of
bootable images as a normal part of a release build. While this made
it easy to install bootable images, the contents of a release build
depend on whether or not U-Boot packages are installed in /usr/pkgsrc,
which is the default location searched by installboot(8).

This commit requires users to explicitly list the bootable images to
be installed, which by default is none (i.e., prior behavior).


# 1.144 21-Aug-2022 brook

Create bootable images in ${RELEASEDIR}/${RELEASEMACHINEDIR}/binary/gzimg.

Release builds for arm platforms create compressed images in
${RELEASEDIR}/${RELEASEMACHINEDIR}/binary/gzimg. However, in some
cases, e.g., armv7.img.gz, they are not bootable. Consequently, boot
blocks must be manually installed in the images, which is an extra
barrier for testing systems or adopting NetBSD. This has prompted
creation of external repositories, e.g., armbsd.org, to host a
collection of bootable images. However, this does not ease the burden
on developers compiling their own systems; for them, manual
installation of boot blocks is still required.

For arm platforms, etc/etc.evbarm/Makefile.inc contains the commands
used to create system images. Because installboot(8) can write boot
blocks directly to system images, a loop through possible boards can
create a series of bootable images during the normal build process.

In the case of many arm platforms, installboot(8) uses U-Boot boot
blocks, which are not part of the NetBSD source code. Developers can,
however, install as many U-Boot boot blocks as desired, either in the
default location of /usr/pkg/share/u-boot or in a set of directories
pointed to by the U-Boot search path, the INSTALLBOOT_UBOOT_PATHS
environment variable. For each board with an available boot block, a
board-specific bootable image will be created in
${RELEASEDIR}/${RELEASEMACHINEDIR}/binary/gzimg. If a boot block is
not available, which is the typical situation currently, no additional
image will be created.

This facility creates opportunities to build bootable images for any
number of boards within the scope of a standard release build.
However, that is not required and will not occur without the
intervention of installing U-Boot boot blocks prior to the build.


# 1.143 21-Aug-2022 lukem

BUILDING: regen for removal of extsrc/


# 1.142 28-May-2022 andvar

s/knowlege/knowledge/


# 1.141 20-Dec-2021 christos

Rename:
MKKDEBUG -> MKDEBUGKERNEL
MKTOOLSDEBUG -> MKDEBUGTOOLS
while keeping compatibility with the old names. Add missing documentation.
Now all debugging tunables are prefixed with MKDEBUG.


Revision tags: cjep_sun2x-base1 cjep_sun2x-base cjep_staticlib_x-base1 cjep_staticlib_x-base
# 1.140 10-Nov-2020 kamil

Reintroduce the support of MKCATPAGES

Requested by <mrg>


# 1.139 08-Nov-2020 kamil

Remove the support for MKCATPAGES

It was optional since 1999 and disabled by default since 2012.

Proposed on tech-userlevel@.


# 1.138 13-Oct-2020 thorpej

Document CPUFLAGS here (it's already documented in share/mk/bsd.README).
This will address the initial concern in PR port-alpha/55545.


# 1.137 12-Oct-2020 uwe

Mention HOST_CFLAGS and HOST_CXXFLAGS.


# 1.136 12-Oct-2020 uwe

Bump date and regen for BUILDING.mdoc revision 1.127
that introduced build.sh -c <compiler> option.


Revision tags: netbsd-9-3-RELEASE netbsd-9-2-RELEASE netbsd-9-1-RELEASE phil-wifi-20200421 phil-wifi-20200411 is-mlppp-base phil-wifi-20200406 netbsd-9-0-RELEASE netbsd-9-0-RC2 netbsd-9-0-RC1 phil-wifi-20191119 netbsd-9-base phil-wifi-20190609
# 1.135 08-May-2019 leot

Fix a typo

Reported by Tobias Ulmer via netbsd-docs@ ML, thanks!


Revision tags: pgoyette-compat-20190127 pgoyette-compat-20190118 pgoyette-compat-1226 pgoyette-compat-1126 pgoyette-compat-1020 pgoyette-compat-0930 pgoyette-compat-0906
# 1.134 29-Jul-2018 sevan

regen


Revision tags: pgoyette-compat-0728 phil-wifi-base pgoyette-compat-0625 pgoyette-compat-0521
# 1.133 02-May-2018 pgoyette

branches: 1.133.2;
Re-add files that were accidentally deleted in my previous commit.


# 1.132 02-May-2018 pgoyette

Synch with HEAD


Revision tags: pgoyette-compat-0502 pgoyette-compat-0422 pgoyette-compat-0415 pgoyette-compat-0407 pgoyette-compat-0330 pgoyette-compat-0322 pgoyette-compat-0315 pgoyette-compat-base
# 1.131 16-Feb-2018 leot

branches: 1.131.2;
regen


# 1.130 29-Dec-2017 sevan

regen


# 1.129 21-Oct-2017 sevan

regen


Revision tags: netbsd-8-2-RELEASE netbsd-8-1-RELEASE netbsd-8-1-RC1 netbsd-8-0-RELEASE netbsd-8-0-RC2 netbsd-8-0-RC1 matt-nb8-mediatek-base perseant-stdc-iso10646-base netbsd-8-base
# 1.128 21-May-2017 riastradh

regen


Revision tags: prg-localcount2-base3 prg-localcount2-base2 prg-localcount2-base1 prg-localcount2-base pgoyette-localcount-20170426
# 1.127 22-Apr-2017 plunky

regen


Revision tags: bouyer-socketcan-base1
# 1.126 20-Apr-2017 wiz

regen using regen target in doc.


# 1.125 20-Apr-2017 ozaki-r

Introduce MKSTRIPSYM build option

If it's yes, all local symbols of shared libraries are stripped
(default). If it's no, only temporary local symbols are stripped;
for example, symbols of static functions are kept. Keeping such
symbols is useful on using DTrace for userland libraries and
getting a backtrace from a rump server loading modules (shared
libraries).

Proposed and discussed on tech-kern and tech-toolchain


Revision tags: pgoyette-localcount-20170320
# 1.124 20-Feb-2017 christos

regen


# 1.123 16-Feb-2017 rin

The default values for MKPIC are yes and no for sh3 and m68000, respectively.
Bump date.


Revision tags: bouyer-socketcan-base pgoyette-localcount-20170107 pgoyette-localcount-20161104 localcount-20160914 pgoyette-localcount-20160806 pgoyette-localcount-20160726 pgoyette-localcount-base
# 1.122 29-Jan-2016 wiz

branches: 1.122.2; 1.122.4;
Document MKREPRO_TIMESTAMP.


# 1.121 23-Jul-2015 mrg

remove the xfree86 reachover makefiles and the vast majority of
the support in the rest of the source tree.

X11 sets could use some cleaning up perhaps (just deletion, as
we've never really marked the old X11R6 as obsolete for native
xorg using platforms so far either.)


# 1.120 07-Jun-2015 pgoyette

Update to reflect changes made in rev 1.398 of src/etc/Makefile


# 1.119 08-Apr-2015 wiz

regen


# 1.118 30-Nov-2014 uebayasi

regen


# 1.117 16-Nov-2014 uebayasi

regen


# 1.116 16-Nov-2014 uebayasi

regen


# 1.115 13-Nov-2014 apb

regen from doc/BUILDING.mdoc revision 1.107.
This reinstates documentation for "extsrc" which was lost in 2009.


# 1.114 08-Nov-2014 snj

fourth time's the charm, i guess. when committing a generated file,
it's best to use the latest revision of the source file (hi uebs!)

regen to include changes from revision 1.105 of doc/BUILDING.mdoc


# 1.113 06-Nov-2014 uebayasi

regen


# 1.112 06-Nov-2014 uebayasi

Expand TABs.


# 1.111 06-Nov-2014 uebayasi

Document the new "kernels" operation, prompted by joerg@.


# 1.110 05-Nov-2014 snj

regen


Revision tags: netbsd-7-base tls-earlyentropy-base tls-maxphys-base
# 1.109 07-Aug-2014 apb

branches: 1.109.2;
regen BUILDING from doc/BUILDING.mdoc


# 1.108 03-Aug-2014 apb

BUILDINFO part6: regen BUILDING from doc/BUILDING.mdoc


# 1.107 14-Jun-2014 apb

Regen from doc/BUILDING.mdoc;1.100:
Improve documentation for BUILDID.


# 1.106 21-May-2014 wiz

regen


Revision tags: yamt-pagecache-base9 riastradh-xf86-video-intel-2-7-1-pre-2-21-15 riastradh-drm2-base3 riastradh-drm2-base2 riastradh-drm2-base1 riastradh-drm2-base
# 1.105 29-May-2013 wiz

branches: 1.105.4;
regen using 'make regen' from src/doc.


# 1.104 29-May-2013 wiz

regen (using mandoc doc/BUILDING.mdoc > BUILDING -- let me know
if a different way is preferred, I see that it now contains formatting).


Revision tags: agc-symver-base yamt-pagecache-base8 yamt-pagecache-base7
# 1.103 08-Nov-2012 dholland

regen


Revision tags: yamt-pagecache-base6
# 1.102 19-Sep-2012 abs

regen


# 1.101 25-May-2012 wiz

branches: 1.101.2;
regen using 'make regen' in doc/


# 1.100 25-May-2012 wiz

Document MKREPRO using joerg's wording.


Revision tags: yamt-pagecache-base5 yamt-pagecache-base4
# 1.99 23-Feb-2012 tsutsui

Add a missing period.


Revision tags: netbsd-6-base
# 1.98 14-Feb-2012 apb

branches: 1.98.2;
Regen from revision 1.87 of doc/BUILDING.mdoc.


# 1.97 22-Jan-2012 tsutsui

Add "live-image" and "install-image" target support to build.sh.

"live-image" target builds pre-installed disk images that can be used on
emulators or boot from USB memory sticks to try NetBSD without installation.
Currently amd64, i386, pmax, sparc, sparc64, sun2, sun3, and vax
(which have working emulators and don't require extra tools like preparing
msdosfs or partitioning MD label structures) support this target.

"install-image" target builds an bootable installation disk image that can
be used as an install CD but burned into USB memory sticks etc.
Current only amd64 and i386 (which would support USB boot) have this target.

For more details (and known issue) see following posts on netbsd-bugs@:
http://mail-index.NetBSD.org/netbsd-bugs/2011/08/06/msg023639.html
http://mail-index.NetBSD.org/netbsd-bugs/2011/09/23/msg024207.html
http://mail-index.NetBSD.org/netbsd-bugs/2011/12/07/msg025166.html
http://mail-index.NetBSD.org/netbsd-bugs/2011/12/08/msg025178.html

No particular comments about implementation, and
"go ahead" comments from mrg@, riz@ and christos@.

Closes PR toolchain/45153 and PR misc/45155.


Revision tags: yamt-pagecache-base3 yamt-pagecache-base2 yamt-pagecache-base
# 1.96 09-Sep-2011 apb

branches: 1.96.2;
Add tests for the shell under which build.sh is run. If the
shell fails the tests, then build.sh tries to re-exec itself
under a more suitable shell.


# 1.95 09-Sep-2011 apb

Revisions 1.92 and 1.93 of src/BUILDING were not reflected in
src/doc/BUILDING.mdoc, so those changes were lost when src/BUILDING
was regenerated in revision 1.94.

Now update src/doc/BUILDING.mdoc and regenerate src/BUILDING to
reinstate the lost changes. (I also edited one of the changes, to use
the phrase "space-separated list" for consistency with other parts of
the document.)

The original changes were:


# 1.93 06-Aug-2011 jnemeth

Add description of MKKMOD, part of PR misc/45216


Revision tags: cherry-xenmp-base bouyer-quota2-nbase bouyer-quota2-base
# 1.92 29-Jan-2011 jym

Pass down INSTALLSETS variable to installsets target. Use :Q to escape
shell meta-characters, as the variable contains a list of sets, separated
by spaces.

$ ./build.sh -V INSTALLSETS="base etc" install=idir

should now work as expected.

Reviewed by apb@ on tech-toolchain.


# 1.94 09-Sep-2011 apb

Allow MAKEFLAGS to be set via build.sh -V. Somebody asked for this
in 2008.

Also add comments above a few functions in build.sh, and bump copyright
dates.


# 1.93 06-Aug-2011 jnemeth

Add description of MKKMOD, part of PR misc/45216


Revision tags: cherry-xenmp-base bouyer-quota2-nbase bouyer-quota2-base
# 1.92 29-Jan-2011 jym

Pass down INSTALLSETS variable to installsets target. Use :Q to escape
shell meta-characters, as the variable contains a list of sets, separated
by spaces.

$ ./build.sh -V INSTALLSETS="base etc" install=idir

should now work as expected.

Reviewed by apb@ on tech-toolchain.


Revision tags: matt-mips64-premerge-20101231
# 1.91 25-Jul-2010 mrg

branches: 1.91.2;
remove the MKSUBPIXEL/MKTTINTERP options; they're going away.

regenerate.


Revision tags: matt-premerge-20091211
# 1.90 30-Nov-2009 uebayasi

Support "extsrc", externally added programs and libraries. Users can write
their own reach-overs, cross-build, install, and get set files just like base
and X11 / X.org. (These sets are not included as TNF releases.)


# 1.89 10-Oct-2009 apb

If ${NETBDSRCDIR}/../xsrc exists, then use it as the default value
of X11SRCDIR. If it doesn't exist, then use /usr/xsrc as before.

OK mrg


# 1.88 27-Sep-2009 apb

* Use a more robust method of creating the top level object directory.
Use getmakevar to expand MAKEOBJDIRPREFIX or MAKEOBJDIR, or (if
neither of those variables is set) use a non-recursive "make obj" in
the top level source directory.

* Do not let TOP_objdir default to ${TOP}. It's now set only by the
-M or -O command line options, or after using getmakevar to expand
MAKEOBJDIRPREFIX or MAKEOBJDIR.

* Make try_set_TOOLDIR handle MAKEOBJDIRPERFIX passed from the
environment. It runs too early to use getmakevar, so it will not work
if the value contains embedded '${...}' variable references.

* Use '$TOOLDIR' (with a literal '$') instead of 'nonexistent' in
a message when rebuilding make when TOOLDIR is not yet known.


# 1.87 27-Sep-2009 apb

Allow build.sh "-C cdextra" option to be specified multiple times.


# 1.86 07-Sep-2009 jnemeth

Add a modules operation to build.sh, which builds and installs kernel modules
into DESTDIR.

This is based on the patch provided by tsutsui@ on tech-toolchain@.


# 1.85 12-Jul-2009 hubertf

regen


# 1.84 12-Jul-2009 hubertf

regen


Revision tags: jym-xensuspend-nbase jym-xensuspend-base
# 1.83 01-May-2009 snj

Introduce MKSUBPIXEL, which allows enabling subpixel rendering code
in FreeType.


# 1.82 02-Dec-2008 mrg

branches: 1.82.2;
be explicit about MAKEOBJDIR and MAKEOBJDIRPREFIX not being for
mk.conf or ${MAKECONF}.


# 1.81 15-Nov-2008 mrg

revert sparc back to default of XFree86 at the request of macallan.


# 1.80 13-Nov-2008 apb

Add support for new MAKEVERBOSE levels 3 and 4. The complete list is now:

0 Minimal output ("quiet")
1 Describe what is occurring
2 Describe what is occurring and echo the actual command
3 Ignore the effect of the "@" prefix in make commands
4 Trace shell commands using the shell's -x flag

The default remains MAKEVERBOSE=2.


# 1.79 09-Nov-2008 mrg

- retire MKXORG from public use
- introduce X11FLAVOUR to choose src/x11 vs src/external/mit/xorg
for the X11 to build if MKX11=yes is set. it takes the values
of either Xorg or XFree86.
- default to Xorg on alpha, i386, macppc, shark, sparc and sparc64
- remove MKXORG_WITH_XSRC_XSERVER, unused and never useful


Revision tags: netbsd-5-base matt-mips64-base2
# 1.78 24-Sep-2008 apb

branches: 1.78.2;
regen for recent change to examples and objdir advice,
and for the older MKSTRIPIDENT change.


Revision tags: wrstuden-revivesa-base-3 wrstuden-revivesa-base-2
# 1.77 06-Sep-2008 lukem

regen for MKHTML


# 1.76 28-Aug-2008 lukem

Improve support for MKXORG!=no to enable builds into external/mit/xorg.
This will be mutually exclusive to MKX11!=no.


# 1.75 18-Aug-2008 lukem

Document "build.sh cleandir".
Fix formatting nit.
Remove BUGS; all the in-tree platforms are using build.sh now.


# 1.74 11-Aug-2008 apb

* Suggest a "-j" value between 1+NCPU and 2*NCPU for the fastest builds.
* Remove some duplicated content that appeared in both the section about
make's -j flag and the section about build.sh's -j flag.


# 1.73 05-Aug-2008 apb

* Add more detail for build.sh -M and -O options.
* Mention new default when source is /usr/src but build.sh is run
with neither -M nor -O.


# 1.72 05-Aug-2008 perry

Builds now use "BUILDSEED" so that c++ binaries are reproduceable.
By default BUILDSEED is set to NetBSD-{majorversion} -- a -S flag may
be used to change it.

Discussed on tech-toolchain.


Revision tags: wrstuden-revivesa-base-1 yamt-pf42-base4 yamt-pf42-base3 hpcarm-cleanup-nbase yamt-pf42-baseX yamt-pf42-base2 wrstuden-revivesa-base keiichi-mipv6-nbase yamt-pf42-base keiichi-mipv6-base
# 1.71 29-Mar-2008 dholland

branches: 1.71.4;
Correct/clarify the default setting of USETOOLS in the previous version.
Noted by apb.


# 1.70 28-Mar-2008 dholland

Assorted updates and clarifications, grammar fixes and wording improvements,
and so on. Significant highlights:
- mention src/tests and reference atf;
- provide examples of MACHINE and MACHINE_ARCH;
- mention that MKOBJ=no is not recommended;
- correct the description of the default setting of USETOOLS;
- document the interactions of build.sh -[uo] with various things;
- document the interactions of build.sh tools and kernel=FOO;
- use a lot fewer parentheses.
Discussed on netbsd-docs.


Revision tags: matt-armv6-nbase
# 1.69 18-Mar-2008 lukem

Consistently document RELEASEDIR/RELEASEMACHINEDIR.


# 1.68 08-Mar-2008 reed

Mention that "build" and "distribution" do not build nor install (to DESTDIR)
a kernel.


Revision tags: cube-autoconf-base matt-armv6-base hpcarm-cleanup-base
# 1.67 23-Nov-2007 sborrill

branches: 1.67.4;
Add support for CDBUILDEXTRA which acts like CDEXTRA to add extra items
to the CD-ROM image.
Make CDEXTRA and CDBUILDEXTRA be able to contain lists of files and directories
which are added in turn.
Add support for CDEXTRA_SKIP which contains a list of fnmatch(3) items to
skip during the copy. This is _very_ useful for skipping CVS dirs for example.
CDBUILDEXTRA and CDEXTRA_SKIP are to be used in Makefiles creating the images,
CDEXTRA remains to be used from build.sh.
Update documentation and build.sh help text to show that -C can be used to
specify a list of files and directories rather than just a single dir.


# 1.66 01-Sep-2007 jnemeth

Convert build.sh iso-dir=directory option to -C cddir as per jmmv@ on
source-changes.


# 1.65 01-Sep-2007 jnemeth

Add an iso-dir=directory option. When combined with iso-image or
iso-image-source, it will cause directory to be added to the CD-ROM image.


# 1.64 30-Aug-2007 jnemeth

describe new iso-image-source target


# 1.63 30-Aug-2007 ad

Remove STATUS paragraph which makes it sound like the build system is
half baked.


Revision tags: matt-mips64-base
# 1.62 13-Apr-2007 apb

branches: 1.62.4;
Document recent changes to "make iso-image".


# 1.61 26-Mar-2007 apb

Document the fact that "make installworld" and "build.sh
installworld=..." do not install the etc or xetc sets. Suggest using
etcupdate(8) and postinstall(8) after installworld.


# 1.60 27-Jan-2007 apb

Try to clarify the description of build.sh -m mach.
Document new evbarm-eb and evbarm-el aliases.


Revision tags: netbsd-4-base
# 1.59 08-Oct-2006 apb

branches: 1.59.2;
Clarify that DESTDIR/OBJDIR/etc are absolute paths, but build.sh
-D/-O/etc allows relative paths.

Closes PR 32345 by Andre Luiz de Oliveira.


# 1.58 29-Sep-2006 apb

Use ${HOST_SH} instead of the host system's /bin/sh wherever possible:

* Describe the HOST_SH variable, and the way build.sh attempts to set it.

* Suggest passing HOST_SH in the environment if /bin/sh is not a working
shell.


Revision tags: abandoned-netbsd-4-base
# 1.57 29-Jan-2006 apb

mkisofs is in pkgsrc/sysutils/cdrtools now, not pkgsrc/sysutils/cdrecord.
Reported by Jukka Salmi.


# 1.56 28-Jan-2006 apb

* Add an "iso-image" target in the top level Makefile,
which invokes make iso-image in the etc directory.
* Add an "iso-image" action in build.sh, which
invokes make iso-image.
* Document the above in doc/BUILDING.mdoc.
* Re-generate BUILDING.

Approved by christos


# 1.55 12-Jan-2006 wiz

Bump date for syspkgs.


# 1.54 04-Jan-2006 apb

Document "make syspkgs" and "build.sh syspkgs".

Reviewed by agc


Revision tags: netbsd-3-1-1-RELEASE netbsd-3-0-3-RELEASE netbsd-3-1-RELEASE netbsd-3-0-2-RELEASE netbsd-3-1-RC4 netbsd-3-1-RC3 netbsd-3-1-RC2 netbsd-3-1-RC1 netbsd-3-0-1-RELEASE netbsd-3-0-RELEASE netbsd-3-0-RC6 netbsd-3-0-RC5 netbsd-3-0-RC4 netbsd-3-0-RC3 netbsd-3-0-RC2 netbsd-3-0-RC1 netbsd-3-base
# 1.53 15-Feb-2005 reed

Document the environment variables for if you need to override or
manually select your compilers.
(And regen BUILDING from doc/BUILDING.mdoc.)


# 1.52 12-Oct-2004 jmc

Fix some typo's/bad wording as highlighted in PR#27219


# 1.51 25-Jun-2004 wiz

regen (Document -h. From Karsten Kruse in PR 25974.
While here, remove a duplicate sentence).


Revision tags: netbsd-2-0-3-RELEASE netbsd-2-1-RELEASE netbsd-2-1-RC6 netbsd-2-1-RC5 netbsd-2-1-RC4 netbsd-2-1-RC3 netbsd-2-1-RC2 netbsd-2-1-RC1 netbsd-2-0-2-RELEASE netbsd-2-0-1-RELEASE netbsd-2-base netbsd-2-0-RELEASE netbsd-2-0-RC5 netbsd-2-0-RC4 netbsd-2-0-RC3 netbsd-2-0-RC2 netbsd-2-0-RC1 netbsd-2-0-base
# 1.50 19-Mar-2004 wiz

Document MKTTINTERP.


# 1.49 06-Feb-2004 lukem

* Document build.sh -X and -x
* Document MKX11 and X11SRCDIR
* Remove note warning against cross-building from systems other than NetBSD;
it works on many other platforms.


# 1.48 29-Dec-2003 jmc

Note tools/compat/README as the place to get notes from non-native cross builds


# 1.47 19-Dec-2003 zuntum

Change -v to -V in the following section:

"Print make(1)'s idea of the value of var. Does not build any targets."

To reflect reality.

Found by Tomasz Marciniak <Tomasz.Marciniak@felix.fizyka.amu.edu.pl>, thanks!


# 1.46 26-Oct-2003 lukem

Improve how build.sh -N and MAKEVERBOSE interoperate;
rather than adding '-s' to make's command line in the makewrapper,
use the .SILENT target based on MAKEVERBOSE's value.

This means that you can do:
./build.sh -N 1 makewrapper

$TOOLDIR/bin/nbmake-$MACHINE
# runs at MAKEVERBOSE==1, with command lines suppressed

$TOOLDIR/bin/nbmake-$MACHINE MAKEVERBOSE=2
# runs at MAKEVERBOSE==2 for this invocation, with command lines shown


# 1.45 25-Oct-2003 lukem

Implement build -N noisy, which sets MAKEVERBOSE to noisy and adds
`-s' to MAKEFLAGS for noisy < 2.


# 1.44 29-Sep-2003 lukem

regenerate for "%" prompt update


# 1.43 19-Aug-2003 martti

Backout the previous commit


# 1.42 19-Aug-2003 martti

Remove # from the example.


# 1.41 08-Aug-2003 lukem

fix description of MAKEOBJDIR. from Martin Husemann


# 1.40 29-Jul-2003 lukem

Add build.sh -Z var, to unset a variable and ensure it's unset in makewrapper.
For -M MAKEOBJDIRPREFIX, unset MAKEOBJDIR.
For -O MAKEOBJDIR, unset MAKEOBJDIRPREFIX.


# 1.39 18-Jul-2003 lukem

fix default location of TOOLDIR


# 1.38 18-Jul-2003 lukem

Update for the MKUNPRIVED/MKUPDATE changes.


# 1.37 18-Jul-2003 lukem

rebuild with new groff


# 1.36 03-Jul-2003 lukem

attempt to clarify how MAKEOBJDIR{,PREFIX} may be provided ...
(this document needs a rototill, which i may get to whilst writing a
paper about build.sh)


# 1.35 25-May-2003 lukem

all:
* add "releasekernel=conf", to install a gzipped copy of the kernels
built by "kernel=conf" to RELEASEDIR/MACHINE/binary/kernel

build.sh:
* be more consistent in various status messages
* move the {release,}kernel=conf conf parsing code into getkernelconf()
and use in both buildkernel() and releasekernel()
* only warn once when building multiple kernels without updating the tools


# 1.34 18-May-2003 lukem

For normal builds, MKOBJDIRS default to `no' (not `yes').
It's only build.sh that sets this to `yes' by default.
Noted by OGAWA Takaya in [toolchain/19823]


# 1.33 17-May-2003 lukem

improve description of how "build.sh -m mach" sets the default
MACHINE_ARCH, and list the special cases that this does not occur for.


# 1.32 10-May-2003 lukem

crank date for previous


# 1.31 10-May-2003 lukem

Add "sourcesets" argument/target, which builds source sets into
RELEASEDIR/source/sets


# 1.30 08-May-2003 lukem

build.sh now provides defaults for DESTDIR and RELEASEDIR if not expert mode.
Remove -D and -R from EXAMPLES since they're not necessary any more.


# 1.29 08-Feb-2003 lukem

Fix example 3; the build.sh target is "install" not "installworld".
Improve description.
Noted by Valeriy Ushakov (uwe@) in private email.


# 1.28 02-Feb-2003 lukem

attempt to further improve and clarify the examples...


# 1.27 30-Jan-2003 lukem

Prefix various paths with 'DESTDIR', to highlight that the DESTDIR
is taken into account.


# 1.26 29-Jan-2003 lukem

allow toolprefix to be easily changed


# 1.25 26-Jan-2003 lukem

Various improvements per discussion with Alan Barrett.


# 1.24 26-Jan-2003 lukem

- Add "sets" top-level Makefile target and build.sh operation.
[Latter suggested by Julio Merino in private email]
- Add "help" build.sh operation.


# 1.23 26-Jan-2003 lukem

Change build.sh so that at least one operation is required.
Add "makewrapper" operation to build.sh.
[The above changes were suggested by Alan Barrett on current-users@]

Fail if building as non-root unless: UNPRIVED is set, -U is given, or -E
(expert mode) is given.
[Suggested by James Wetterau in private email]

Improve the examples in BUILDING.


# 1.22 23-Jan-2003 lukem

Rework how build.sh functions, so that command line options set various
parameters, and a list of "operations" defines what to do.
The full usage is show below. Notes:
`-b' has been deprecated (it always occurs now)
`-d' is replaced by "distribution"
`-R rel' onlys sets RELEASEDIR; use "release" to build a release
`-k kern' has been replaced by "kernel=kern"
`-i idir' has been replaced by "install=idir"
-r now occurs before nbmake is rebuilt

Add a copyright (long due!). Rework the code to (a KNF inspired) ShellNF.
Use functions appropriately. Allow `nb' prefix to be easily changed to
something else. Solve world peace (just kidding)

This is part of the (never achievable) goal of attempting to make
NetBSD easier to build...


--8<-- new usage follows --8<--

Usage: build.sh [-EnorUu] [-a arch] [-B buildid] [-D dest] [-j njob] [-M obj]
[-m mach] [-O obj] [-R release] [-T tools] [-V var=[value]]
[-w wrapper] [operation [...] ]

System build operations (all imply "obj" and "tools"):
build Run "make build"
distribution Run "make distribution" (includes etc/ files)
release Run "make release" (includes kernels & distrib media)

Other operations:
obj Run "make obj" (default unless -o)
tools Build and install tools
kernel=conf Build kernel with config file `conf'
install=idir Run "make installworld" to `idir'
(useful after 'distribution' or 'release')

Options:
-a arch Set MACHINE_ARCH to arch (otherwise deduced from MACHINE)
-B buildId Set BUILDID to buildId
-D dest Set DESTDIR to dest
-E Set "expert" mode; disables some DESTDIR checks
-j njob Run up to njob jobs in parallel; see make(1)
-M obj Set obj root directory to obj (sets MAKEOBJDIRPREFIX)
-m mach Set MACHINE to mach (not required if NetBSD native)
-n Show commands that would be executed, but do not execute them
-O obj Set obj root directory to obj (sets a MAKEOBJDIR pattern)
-o Set MKOBJDIRS=no (do not create objdirs at start of build)
-R release Set RELEASEDIR to release
-r Remove contents of TOOLDIR and DESTDIR before building
-T tools Set TOOLDIR to tools. If unset, and TOOLDIR is not set in
the environment, nbmake will be (re)built unconditionally.
-U Set UNPRIVED
-u Set UPDATE
-V v=[val] Set variable `v' to `val'
-w wrapper Create nbmake script as wrapper
(default: ${TOOLDIR}/bin/nbmake-${MACHINE})


# 1.21 04-Jan-2003 lukem

Add "-V var=[value]", for setting arbitrary variables which will also
be added to the nbmake-${MACHINE} wrapper.
Useful for setting RELEASEDIR, without -R's habit of building a release.


Revision tags: fvdl_fs64_base
# 1.20 25-Dec-2002 lukem

Document:
* build.sh -i idir
* top level targets: distribution, buildworld, installworld
* top level variables: INSTALLWORLDDIR


# 1.19 08-Dec-2002 lukem

Add -E - "expert mode". If this is not specified, builds to DESTDIR=/ are
not permitted.
By using this flag, you are taking responsibility for any issues that
may occur because of this...


# 1.18 08-Dec-2002 lukem

- be consistent about option ordering in build.sh usage display
- use Fl and Ar instead of Sy and Em to format options


# 1.17 25-Nov-2002 wiz

Update location of BUILDING.mdoc.


# 1.16 20-Oct-2002 lukem

regen for build.sh -k


# 1.15 21-Sep-2002 lukem

regen for: USE_NEW_TOOLCHAIN was replaced with TOOLCHAIN_MISSING


# 1.14 17-Sep-2002 fredb

Expand on the difference between ``build.sh -d'' and ``make install'',
as requested by Brian Stark in PR toolchain/18228 (which this closes).


# 1.13 22-Jul-2002 wiz

Remove duplicate 'files'. From Ryo HAYASAKA in toolchain/17674.


Revision tags: netbsd-1-6-PATCH002-RC3 netbsd-1-6-PATCH002-RC2 netbsd-1-6-PATCH002-RC1 netbsd-1-6-PATCH001 netbsd-1-6-PATCH001-RELEASE netbsd-1-6-PATCH001-RC3 netbsd-1-6-PATCH001-RC2 netbsd-1-6-PATCH001-RC1 netbsd-1-6-RELEASE netbsd-1-6-RC3 netbsd-1-6-RC2 netbsd-1-6-RC1 netbsd-1-6-base
# 1.12 13-May-2002 lukem

branches: 1.12.2;
add "-M makeobjdirprefix" to build.sh


# 1.11 03-May-2002 lukem

Move the METALOG from ${_SRC_TOP_OBJ_} to ${DESTDIR}.

There were too many synchronisation problems with using the former;
including situations such as a "make clean" performed between two
installs to the same DESTDIR would result in a truncated METALOG and
the resultant sets would be missing stuff such as include files that
don't get reinstalled if they haven't changed, even with !UPDATE.


# 1.10 02-May-2002 sommerfeld

Re-gen.


# 1.9 14-Mar-2002 thorpej

Add a -B option to set the BUILDID for the build. This also causes
the make(1) wrapper script to be named "nbmake-MACHINE-BUILDID".


# 1.8 05-Mar-2002 lukem

document various supported environment variables, including MAKEOBJDIRPREFIX


# 1.7 04-Mar-2002 lukem

document:
- make's UNPRIVED support
- build.sh's -U support
- the build system currently needs to build onto a file system with
long file name and hard link support


# 1.6 25-Nov-2001 thorpej

Document the -d option to build.sh


# 1.5 15-Nov-2001 tv

Note only <bsd.own.mk> as the authority for determining whether the new
BUILDING instructions should be used.


# 1.4 14-Nov-2001 tv

Turn off host-specific objdirs by default. Set MKHOSTOBJ=yes to enable.


# 1.3 12-Nov-2001 tv

Major overhaul of src/tools and host toolchain. Summary of changes:

* Rewrite src/tools Make logic to work like the rest of the tree wrt
"dependall" and "install". The old "make build" hack is gone.

* Remove the MKTOOLS logic. This was linked to the "make build" hack,
and was only needed because TOOLDIR originally had no writable default.

* Redo the GNU configure/make logic to make it fit reasonably in a
BSD make wrapper. Use new ${.ALLTARGETS} variable to scan for
targets in $(srcdir), and mark them with .MADE: to prevent rebuilding.

* Only build cross tools in src/tools; remove some messy logic in
src/usr.* and src/gnu/usr.* that would do target filename rewriting
(improves consistency and readability).

* Add the ability to build cross gdb at tool build time by setting
MKCROSSGDB (default no) to "yes" in mk.conf.

* Add src/tools/groff and set up paths to work with this cross groff.


# 1.2 08-Nov-2001 wiz

Remove mention of BUILDLING.html, and follow rename of BUILDING.txt to
BUILDING.
Noted by Love <lha@stacken.kth.se> on tech-toolchain.


# 1.1 01-Nov-2001 tv

By popular demand, one preformatted version of BUILDING, plaintext, no CRs.


# 1.144 21-Aug-2022 brook

Create bootable images in ${RELEASEDIR}/${RELEASEMACHINEDIR}/binary/gzimg.

Release builds for arm platforms create compressed images in
${RELEASEDIR}/${RELEASEMACHINEDIR}/binary/gzimg. However, in some
cases, e.g., armv7.img.gz, they are not bootable. Consequently, boot
blocks must be manually installed in the images, which is an extra
barrier for testing systems or adopting NetBSD. This has prompted
creation of external repositories, e.g., armbsd.org, to host a
collection of bootable images. However, this does not ease the burden
on developers compiling their own systems; for them, manual
installation of boot blocks is still required.

For arm platforms, etc/etc.evbarm/Makefile.inc contains the commands
used to create system images. Because installboot(8) can write boot
blocks directly to system images, a loop through possible boards can
create a series of bootable images during the normal build process.

In the case of many arm platforms, installboot(8) uses U-Boot boot
blocks, which are not part of the NetBSD source code. Developers can,
however, install as many U-Boot boot blocks as desired, either in the
default location of /usr/pkg/share/u-boot or in a set of directories
pointed to by the U-Boot search path, the INSTALLBOOT_UBOOT_PATHS
environment variable. For each board with an available boot block, a
board-specific bootable image will be created in
${RELEASEDIR}/${RELEASEMACHINEDIR}/binary/gzimg. If a boot block is
not available, which is the typical situation currently, no additional
image will be created.

This facility creates opportunities to build bootable images for any
number of boards within the scope of a standard release build.
However, that is not required and will not occur without the
intervention of installing U-Boot boot blocks prior to the build.


# 1.143 21-Aug-2022 lukem

BUILDING: regen for removal of extsrc/


# 1.142 28-May-2022 andvar

s/knowlege/knowledge/


# 1.141 20-Dec-2021 christos

Rename:
MKKDEBUG -> MKDEBUGKERNEL
MKTOOLSDEBUG -> MKDEBUGTOOLS
while keeping compatibility with the old names. Add missing documentation.
Now all debugging tunables are prefixed with MKDEBUG.


Revision tags: cjep_sun2x-base1 cjep_sun2x-base cjep_staticlib_x-base1 cjep_staticlib_x-base
# 1.140 10-Nov-2020 kamil

Reintroduce the support of MKCATPAGES

Requested by <mrg>


# 1.139 08-Nov-2020 kamil

Remove the support for MKCATPAGES

It was optional since 1999 and disabled by default since 2012.

Proposed on tech-userlevel@.


# 1.138 13-Oct-2020 thorpej

Document CPUFLAGS here (it's already documented in share/mk/bsd.README).
This will address the initial concern in PR port-alpha/55545.


# 1.137 12-Oct-2020 uwe

Mention HOST_CFLAGS and HOST_CXXFLAGS.


# 1.136 12-Oct-2020 uwe

Bump date and regen for BUILDING.mdoc revision 1.127
that introduced build.sh -c <compiler> option.


Revision tags: netbsd-9-3-RELEASE netbsd-9-2-RELEASE netbsd-9-1-RELEASE phil-wifi-20200421 phil-wifi-20200411 is-mlppp-base phil-wifi-20200406 netbsd-9-0-RELEASE netbsd-9-0-RC2 netbsd-9-0-RC1 phil-wifi-20191119 netbsd-9-base phil-wifi-20190609
# 1.135 08-May-2019 leot

Fix a typo

Reported by Tobias Ulmer via netbsd-docs@ ML, thanks!


Revision tags: pgoyette-compat-20190127 pgoyette-compat-20190118 pgoyette-compat-1226 pgoyette-compat-1126 pgoyette-compat-1020 pgoyette-compat-0930 pgoyette-compat-0906
# 1.134 29-Jul-2018 sevan

regen


Revision tags: pgoyette-compat-0728 phil-wifi-base pgoyette-compat-0625 pgoyette-compat-0521
# 1.133 02-May-2018 pgoyette

branches: 1.133.2;
Re-add files that were accidentally deleted in my previous commit.


# 1.132 02-May-2018 pgoyette

Synch with HEAD


Revision tags: pgoyette-compat-0502 pgoyette-compat-0422 pgoyette-compat-0415 pgoyette-compat-0407 pgoyette-compat-0330 pgoyette-compat-0322 pgoyette-compat-0315 pgoyette-compat-base
# 1.131 16-Feb-2018 leot

branches: 1.131.2;
regen


# 1.130 29-Dec-2017 sevan

regen


# 1.129 21-Oct-2017 sevan

regen


Revision tags: netbsd-8-2-RELEASE netbsd-8-1-RELEASE netbsd-8-1-RC1 netbsd-8-0-RELEASE netbsd-8-0-RC2 netbsd-8-0-RC1 matt-nb8-mediatek-base perseant-stdc-iso10646-base netbsd-8-base
# 1.128 21-May-2017 riastradh

regen


Revision tags: prg-localcount2-base3 prg-localcount2-base2 prg-localcount2-base1 prg-localcount2-base pgoyette-localcount-20170426
# 1.127 22-Apr-2017 plunky

regen


Revision tags: bouyer-socketcan-base1
# 1.126 20-Apr-2017 wiz

regen using regen target in doc.


# 1.125 20-Apr-2017 ozaki-r

Introduce MKSTRIPSYM build option

If it's yes, all local symbols of shared libraries are stripped
(default). If it's no, only temporary local symbols are stripped;
for example, symbols of static functions are kept. Keeping such
symbols is useful on using DTrace for userland libraries and
getting a backtrace from a rump server loading modules (shared
libraries).

Proposed and discussed on tech-kern and tech-toolchain


Revision tags: pgoyette-localcount-20170320
# 1.124 20-Feb-2017 christos

regen


# 1.123 16-Feb-2017 rin

The default values for MKPIC are yes and no for sh3 and m68000, respectively.
Bump date.


Revision tags: bouyer-socketcan-base pgoyette-localcount-20170107 pgoyette-localcount-20161104 localcount-20160914 pgoyette-localcount-20160806 pgoyette-localcount-20160726 pgoyette-localcount-base
# 1.122 29-Jan-2016 wiz

branches: 1.122.2; 1.122.4;
Document MKREPRO_TIMESTAMP.


# 1.121 23-Jul-2015 mrg

remove the xfree86 reachover makefiles and the vast majority of
the support in the rest of the source tree.

X11 sets could use some cleaning up perhaps (just deletion, as
we've never really marked the old X11R6 as obsolete for native
xorg using platforms so far either.)


# 1.120 07-Jun-2015 pgoyette

Update to reflect changes made in rev 1.398 of src/etc/Makefile


# 1.119 08-Apr-2015 wiz

regen


# 1.118 30-Nov-2014 uebayasi

regen


# 1.117 16-Nov-2014 uebayasi

regen


# 1.116 16-Nov-2014 uebayasi

regen


# 1.115 13-Nov-2014 apb

regen from doc/BUILDING.mdoc revision 1.107.
This reinstates documentation for "extsrc" which was lost in 2009.


# 1.114 08-Nov-2014 snj

fourth time's the charm, i guess. when committing a generated file,
it's best to use the latest revision of the source file (hi uebs!)

regen to include changes from revision 1.105 of doc/BUILDING.mdoc


# 1.113 06-Nov-2014 uebayasi

regen


# 1.112 06-Nov-2014 uebayasi

Expand TABs.


# 1.111 06-Nov-2014 uebayasi

Document the new "kernels" operation, prompted by joerg@.


# 1.110 05-Nov-2014 snj

regen


Revision tags: netbsd-7-base tls-earlyentropy-base tls-maxphys-base
# 1.109 07-Aug-2014 apb

branches: 1.109.2;
regen BUILDING from doc/BUILDING.mdoc


# 1.108 03-Aug-2014 apb

BUILDINFO part6: regen BUILDING from doc/BUILDING.mdoc


# 1.107 14-Jun-2014 apb

Regen from doc/BUILDING.mdoc;1.100:
Improve documentation for BUILDID.


# 1.106 21-May-2014 wiz

regen


Revision tags: yamt-pagecache-base9 riastradh-xf86-video-intel-2-7-1-pre-2-21-15 riastradh-drm2-base3 riastradh-drm2-base2 riastradh-drm2-base1 riastradh-drm2-base
# 1.105 29-May-2013 wiz

branches: 1.105.4;
regen using 'make regen' from src/doc.


# 1.104 29-May-2013 wiz

regen (using mandoc doc/BUILDING.mdoc > BUILDING -- let me know
if a different way is preferred, I see that it now contains formatting).


Revision tags: agc-symver-base yamt-pagecache-base8 yamt-pagecache-base7
# 1.103 08-Nov-2012 dholland

regen


Revision tags: yamt-pagecache-base6
# 1.102 19-Sep-2012 abs

regen


# 1.101 25-May-2012 wiz

branches: 1.101.2;
regen using 'make regen' in doc/


# 1.100 25-May-2012 wiz

Document MKREPRO using joerg's wording.


Revision tags: yamt-pagecache-base5 yamt-pagecache-base4
# 1.99 23-Feb-2012 tsutsui

Add a missing period.


Revision tags: netbsd-6-base
# 1.98 14-Feb-2012 apb

branches: 1.98.2;
Regen from revision 1.87 of doc/BUILDING.mdoc.


# 1.97 22-Jan-2012 tsutsui

Add "live-image" and "install-image" target support to build.sh.

"live-image" target builds pre-installed disk images that can be used on
emulators or boot from USB memory sticks to try NetBSD without installation.
Currently amd64, i386, pmax, sparc, sparc64, sun2, sun3, and vax
(which have working emulators and don't require extra tools like preparing
msdosfs or partitioning MD label structures) support this target.

"install-image" target builds an bootable installation disk image that can
be used as an install CD but burned into USB memory sticks etc.
Current only amd64 and i386 (which would support USB boot) have this target.

For more details (and known issue) see following posts on netbsd-bugs@:
http://mail-index.NetBSD.org/netbsd-bugs/2011/08/06/msg023639.html
http://mail-index.NetBSD.org/netbsd-bugs/2011/09/23/msg024207.html
http://mail-index.NetBSD.org/netbsd-bugs/2011/12/07/msg025166.html
http://mail-index.NetBSD.org/netbsd-bugs/2011/12/08/msg025178.html

No particular comments about implementation, and
"go ahead" comments from mrg@, riz@ and christos@.

Closes PR toolchain/45153 and PR misc/45155.


Revision tags: yamt-pagecache-base3 yamt-pagecache-base2 yamt-pagecache-base
# 1.96 09-Sep-2011 apb

branches: 1.96.2;
Add tests for the shell under which build.sh is run. If the
shell fails the tests, then build.sh tries to re-exec itself
under a more suitable shell.


# 1.95 09-Sep-2011 apb

Revisions 1.92 and 1.93 of src/BUILDING were not reflected in
src/doc/BUILDING.mdoc, so those changes were lost when src/BUILDING
was regenerated in revision 1.94.

Now update src/doc/BUILDING.mdoc and regenerate src/BUILDING to
reinstate the lost changes. (I also edited one of the changes, to use
the phrase "space-separated list" for consistency with other parts of
the document.)

The original changes were:


# 1.93 06-Aug-2011 jnemeth

Add description of MKKMOD, part of PR misc/45216


Revision tags: cherry-xenmp-base bouyer-quota2-nbase bouyer-quota2-base
# 1.92 29-Jan-2011 jym

Pass down INSTALLSETS variable to installsets target. Use :Q to escape
shell meta-characters, as the variable contains a list of sets, separated
by spaces.

$ ./build.sh -V INSTALLSETS="base etc" install=idir

should now work as expected.

Reviewed by apb@ on tech-toolchain.


# 1.94 09-Sep-2011 apb

Allow MAKEFLAGS to be set via build.sh -V. Somebody asked for this
in 2008.

Also add comments above a few functions in build.sh, and bump copyright
dates.


# 1.93 06-Aug-2011 jnemeth

Add description of MKKMOD, part of PR misc/45216


Revision tags: cherry-xenmp-base bouyer-quota2-nbase bouyer-quota2-base
# 1.92 29-Jan-2011 jym

Pass down INSTALLSETS variable to installsets target. Use :Q to escape
shell meta-characters, as the variable contains a list of sets, separated
by spaces.

$ ./build.sh -V INSTALLSETS="base etc" install=idir

should now work as expected.

Reviewed by apb@ on tech-toolchain.


Revision tags: matt-mips64-premerge-20101231
# 1.91 25-Jul-2010 mrg

branches: 1.91.2;
remove the MKSUBPIXEL/MKTTINTERP options; they're going away.

regenerate.


Revision tags: matt-premerge-20091211
# 1.90 30-Nov-2009 uebayasi

Support "extsrc", externally added programs and libraries. Users can write
their own reach-overs, cross-build, install, and get set files just like base
and X11 / X.org. (These sets are not included as TNF releases.)


# 1.89 10-Oct-2009 apb

If ${NETBDSRCDIR}/../xsrc exists, then use it as the default value
of X11SRCDIR. If it doesn't exist, then use /usr/xsrc as before.

OK mrg


# 1.88 27-Sep-2009 apb

* Use a more robust method of creating the top level object directory.
Use getmakevar to expand MAKEOBJDIRPREFIX or MAKEOBJDIR, or (if
neither of those variables is set) use a non-recursive "make obj" in
the top level source directory.

* Do not let TOP_objdir default to ${TOP}. It's now set only by the
-M or -O command line options, or after using getmakevar to expand
MAKEOBJDIRPREFIX or MAKEOBJDIR.

* Make try_set_TOOLDIR handle MAKEOBJDIRPERFIX passed from the
environment. It runs too early to use getmakevar, so it will not work
if the value contains embedded '${...}' variable references.

* Use '$TOOLDIR' (with a literal '$') instead of 'nonexistent' in
a message when rebuilding make when TOOLDIR is not yet known.


# 1.87 27-Sep-2009 apb

Allow build.sh "-C cdextra" option to be specified multiple times.


# 1.86 07-Sep-2009 jnemeth

Add a modules operation to build.sh, which builds and installs kernel modules
into DESTDIR.

This is based on the patch provided by tsutsui@ on tech-toolchain@.


# 1.85 12-Jul-2009 hubertf

regen


# 1.84 12-Jul-2009 hubertf

regen


Revision tags: jym-xensuspend-nbase jym-xensuspend-base
# 1.83 01-May-2009 snj

Introduce MKSUBPIXEL, which allows enabling subpixel rendering code
in FreeType.


# 1.82 02-Dec-2008 mrg

branches: 1.82.2;
be explicit about MAKEOBJDIR and MAKEOBJDIRPREFIX not being for
mk.conf or ${MAKECONF}.


# 1.81 15-Nov-2008 mrg

revert sparc back to default of XFree86 at the request of macallan.


# 1.80 13-Nov-2008 apb

Add support for new MAKEVERBOSE levels 3 and 4. The complete list is now:

0 Minimal output ("quiet")
1 Describe what is occurring
2 Describe what is occurring and echo the actual command
3 Ignore the effect of the "@" prefix in make commands
4 Trace shell commands using the shell's -x flag

The default remains MAKEVERBOSE=2.


# 1.79 09-Nov-2008 mrg

- retire MKXORG from public use
- introduce X11FLAVOUR to choose src/x11 vs src/external/mit/xorg
for the X11 to build if MKX11=yes is set. it takes the values
of either Xorg or XFree86.
- default to Xorg on alpha, i386, macppc, shark, sparc and sparc64
- remove MKXORG_WITH_XSRC_XSERVER, unused and never useful


Revision tags: netbsd-5-base matt-mips64-base2
# 1.78 24-Sep-2008 apb

branches: 1.78.2;
regen for recent change to examples and objdir advice,
and for the older MKSTRIPIDENT change.


Revision tags: wrstuden-revivesa-base-3 wrstuden-revivesa-base-2
# 1.77 06-Sep-2008 lukem

regen for MKHTML


# 1.76 28-Aug-2008 lukem

Improve support for MKXORG!=no to enable builds into external/mit/xorg.
This will be mutually exclusive to MKX11!=no.


# 1.75 18-Aug-2008 lukem

Document "build.sh cleandir".
Fix formatting nit.
Remove BUGS; all the in-tree platforms are using build.sh now.


# 1.74 11-Aug-2008 apb

* Suggest a "-j" value between 1+NCPU and 2*NCPU for the fastest builds.
* Remove some duplicated content that appeared in both the section about
make's -j flag and the section about build.sh's -j flag.


# 1.73 05-Aug-2008 apb

* Add more detail for build.sh -M and -O options.
* Mention new default when source is /usr/src but build.sh is run
with neither -M nor -O.


# 1.72 05-Aug-2008 perry

Builds now use "BUILDSEED" so that c++ binaries are reproduceable.
By default BUILDSEED is set to NetBSD-{majorversion} -- a -S flag may
be used to change it.

Discussed on tech-toolchain.


Revision tags: wrstuden-revivesa-base-1 yamt-pf42-base4 yamt-pf42-base3 hpcarm-cleanup-nbase yamt-pf42-baseX yamt-pf42-base2 wrstuden-revivesa-base keiichi-mipv6-nbase yamt-pf42-base keiichi-mipv6-base
# 1.71 29-Mar-2008 dholland

branches: 1.71.4;
Correct/clarify the default setting of USETOOLS in the previous version.
Noted by apb.


# 1.70 28-Mar-2008 dholland

Assorted updates and clarifications, grammar fixes and wording improvements,
and so on. Significant highlights:
- mention src/tests and reference atf;
- provide examples of MACHINE and MACHINE_ARCH;
- mention that MKOBJ=no is not recommended;
- correct the description of the default setting of USETOOLS;
- document the interactions of build.sh -[uo] with various things;
- document the interactions of build.sh tools and kernel=FOO;
- use a lot fewer parentheses.
Discussed on netbsd-docs.


Revision tags: matt-armv6-nbase
# 1.69 18-Mar-2008 lukem

Consistently document RELEASEDIR/RELEASEMACHINEDIR.


# 1.68 08-Mar-2008 reed

Mention that "build" and "distribution" do not build nor install (to DESTDIR)
a kernel.


Revision tags: cube-autoconf-base matt-armv6-base hpcarm-cleanup-base
# 1.67 23-Nov-2007 sborrill

branches: 1.67.4;
Add support for CDBUILDEXTRA which acts like CDEXTRA to add extra items
to the CD-ROM image.
Make CDEXTRA and CDBUILDEXTRA be able to contain lists of files and directories
which are added in turn.
Add support for CDEXTRA_SKIP which contains a list of fnmatch(3) items to
skip during the copy. This is _very_ useful for skipping CVS dirs for example.
CDBUILDEXTRA and CDEXTRA_SKIP are to be used in Makefiles creating the images,
CDEXTRA remains to be used from build.sh.
Update documentation and build.sh help text to show that -C can be used to
specify a list of files and directories rather than just a single dir.


# 1.66 01-Sep-2007 jnemeth

Convert build.sh iso-dir=directory option to -C cddir as per jmmv@ on
source-changes.


# 1.65 01-Sep-2007 jnemeth

Add an iso-dir=directory option. When combined with iso-image or
iso-image-source, it will cause directory to be added to the CD-ROM image.


# 1.64 30-Aug-2007 jnemeth

describe new iso-image-source target


# 1.63 30-Aug-2007 ad

Remove STATUS paragraph which makes it sound like the build system is
half baked.


Revision tags: matt-mips64-base
# 1.62 13-Apr-2007 apb

branches: 1.62.4;
Document recent changes to "make iso-image".


# 1.61 26-Mar-2007 apb

Document the fact that "make installworld" and "build.sh
installworld=..." do not install the etc or xetc sets. Suggest using
etcupdate(8) and postinstall(8) after installworld.


# 1.60 27-Jan-2007 apb

Try to clarify the description of build.sh -m mach.
Document new evbarm-eb and evbarm-el aliases.


Revision tags: netbsd-4-base
# 1.59 08-Oct-2006 apb

branches: 1.59.2;
Clarify that DESTDIR/OBJDIR/etc are absolute paths, but build.sh
-D/-O/etc allows relative paths.

Closes PR 32345 by Andre Luiz de Oliveira.


# 1.58 29-Sep-2006 apb

Use ${HOST_SH} instead of the host system's /bin/sh wherever possible:

* Describe the HOST_SH variable, and the way build.sh attempts to set it.

* Suggest passing HOST_SH in the environment if /bin/sh is not a working
shell.


Revision tags: abandoned-netbsd-4-base
# 1.57 29-Jan-2006 apb

mkisofs is in pkgsrc/sysutils/cdrtools now, not pkgsrc/sysutils/cdrecord.
Reported by Jukka Salmi.


# 1.56 28-Jan-2006 apb

* Add an "iso-image" target in the top level Makefile,
which invokes make iso-image in the etc directory.
* Add an "iso-image" action in build.sh, which
invokes make iso-image.
* Document the above in doc/BUILDING.mdoc.
* Re-generate BUILDING.

Approved by christos


# 1.55 12-Jan-2006 wiz

Bump date for syspkgs.


# 1.54 04-Jan-2006 apb

Document "make syspkgs" and "build.sh syspkgs".

Reviewed by agc


Revision tags: netbsd-3-1-1-RELEASE netbsd-3-0-3-RELEASE netbsd-3-1-RELEASE netbsd-3-0-2-RELEASE netbsd-3-1-RC4 netbsd-3-1-RC3 netbsd-3-1-RC2 netbsd-3-1-RC1 netbsd-3-0-1-RELEASE netbsd-3-0-RELEASE netbsd-3-0-RC6 netbsd-3-0-RC5 netbsd-3-0-RC4 netbsd-3-0-RC3 netbsd-3-0-RC2 netbsd-3-0-RC1 netbsd-3-base
# 1.53 15-Feb-2005 reed

Document the environment variables for if you need to override or
manually select your compilers.
(And regen BUILDING from doc/BUILDING.mdoc.)


# 1.52 12-Oct-2004 jmc

Fix some typo's/bad wording as highlighted in PR#27219


# 1.51 25-Jun-2004 wiz

regen (Document -h. From Karsten Kruse in PR 25974.
While here, remove a duplicate sentence).


Revision tags: netbsd-2-0-3-RELEASE netbsd-2-1-RELEASE netbsd-2-1-RC6 netbsd-2-1-RC5 netbsd-2-1-RC4 netbsd-2-1-RC3 netbsd-2-1-RC2 netbsd-2-1-RC1 netbsd-2-0-2-RELEASE netbsd-2-0-1-RELEASE netbsd-2-base netbsd-2-0-RELEASE netbsd-2-0-RC5 netbsd-2-0-RC4 netbsd-2-0-RC3 netbsd-2-0-RC2 netbsd-2-0-RC1 netbsd-2-0-base
# 1.50 19-Mar-2004 wiz

Document MKTTINTERP.


# 1.49 06-Feb-2004 lukem

* Document build.sh -X and -x
* Document MKX11 and X11SRCDIR
* Remove note warning against cross-building from systems other than NetBSD;
it works on many other platforms.


# 1.48 29-Dec-2003 jmc

Note tools/compat/README as the place to get notes from non-native cross builds


# 1.47 19-Dec-2003 zuntum

Change -v to -V in the following section:

"Print make(1)'s idea of the value of var. Does not build any targets."

To reflect reality.

Found by Tomasz Marciniak <Tomasz.Marciniak@felix.fizyka.amu.edu.pl>, thanks!


# 1.46 26-Oct-2003 lukem

Improve how build.sh -N and MAKEVERBOSE interoperate;
rather than adding '-s' to make's command line in the makewrapper,
use the .SILENT target based on MAKEVERBOSE's value.

This means that you can do:
./build.sh -N 1 makewrapper

$TOOLDIR/bin/nbmake-$MACHINE
# runs at MAKEVERBOSE==1, with command lines suppressed

$TOOLDIR/bin/nbmake-$MACHINE MAKEVERBOSE=2
# runs at MAKEVERBOSE==2 for this invocation, with command lines shown


# 1.45 25-Oct-2003 lukem

Implement build -N noisy, which sets MAKEVERBOSE to noisy and adds
`-s' to MAKEFLAGS for noisy < 2.


# 1.44 29-Sep-2003 lukem

regenerate for "%" prompt update


# 1.43 19-Aug-2003 martti

Backout the previous commit


# 1.42 19-Aug-2003 martti

Remove # from the example.


# 1.41 08-Aug-2003 lukem

fix description of MAKEOBJDIR. from Martin Husemann


# 1.40 29-Jul-2003 lukem

Add build.sh -Z var, to unset a variable and ensure it's unset in makewrapper.
For -M MAKEOBJDIRPREFIX, unset MAKEOBJDIR.
For -O MAKEOBJDIR, unset MAKEOBJDIRPREFIX.


# 1.39 18-Jul-2003 lukem

fix default location of TOOLDIR


# 1.38 18-Jul-2003 lukem

Update for the MKUNPRIVED/MKUPDATE changes.


# 1.37 18-Jul-2003 lukem

rebuild with new groff


# 1.36 03-Jul-2003 lukem

attempt to clarify how MAKEOBJDIR{,PREFIX} may be provided ...
(this document needs a rototill, which i may get to whilst writing a
paper about build.sh)


# 1.35 25-May-2003 lukem

all:
* add "releasekernel=conf", to install a gzipped copy of the kernels
built by "kernel=conf" to RELEASEDIR/MACHINE/binary/kernel

build.sh:
* be more consistent in various status messages
* move the {release,}kernel=conf conf parsing code into getkernelconf()
and use in both buildkernel() and releasekernel()
* only warn once when building multiple kernels without updating the tools


# 1.34 18-May-2003 lukem

For normal builds, MKOBJDIRS default to `no' (not `yes').
It's only build.sh that sets this to `yes' by default.
Noted by OGAWA Takaya in [toolchain/19823]


# 1.33 17-May-2003 lukem

improve description of how "build.sh -m mach" sets the default
MACHINE_ARCH, and list the special cases that this does not occur for.


# 1.32 10-May-2003 lukem

crank date for previous


# 1.31 10-May-2003 lukem

Add "sourcesets" argument/target, which builds source sets into
RELEASEDIR/source/sets


# 1.30 08-May-2003 lukem

build.sh now provides defaults for DESTDIR and RELEASEDIR if not expert mode.
Remove -D and -R from EXAMPLES since they're not necessary any more.


# 1.29 08-Feb-2003 lukem

Fix example 3; the build.sh target is "install" not "installworld".
Improve description.
Noted by Valeriy Ushakov (uwe@) in private email.


# 1.28 02-Feb-2003 lukem

attempt to further improve and clarify the examples...


# 1.27 30-Jan-2003 lukem

Prefix various paths with 'DESTDIR', to highlight that the DESTDIR
is taken into account.


# 1.26 29-Jan-2003 lukem

allow toolprefix to be easily changed


# 1.25 26-Jan-2003 lukem

Various improvements per discussion with Alan Barrett.


# 1.24 26-Jan-2003 lukem

- Add "sets" top-level Makefile target and build.sh operation.
[Latter suggested by Julio Merino in private email]
- Add "help" build.sh operation.


# 1.23 26-Jan-2003 lukem

Change build.sh so that at least one operation is required.
Add "makewrapper" operation to build.sh.
[The above changes were suggested by Alan Barrett on current-users@]

Fail if building as non-root unless: UNPRIVED is set, -U is given, or -E
(expert mode) is given.
[Suggested by James Wetterau in private email]

Improve the examples in BUILDING.


# 1.22 23-Jan-2003 lukem

Rework how build.sh functions, so that command line options set various
parameters, and a list of "operations" defines what to do.
The full usage is show below. Notes:
`-b' has been deprecated (it always occurs now)
`-d' is replaced by "distribution"
`-R rel' onlys sets RELEASEDIR; use "release" to build a release
`-k kern' has been replaced by "kernel=kern"
`-i idir' has been replaced by "install=idir"
-r now occurs before nbmake is rebuilt

Add a copyright (long due!). Rework the code to (a KNF inspired) ShellNF.
Use functions appropriately. Allow `nb' prefix to be easily changed to
something else. Solve world peace (just kidding)

This is part of the (never achievable) goal of attempting to make
NetBSD easier to build...


--8<-- new usage follows --8<--

Usage: build.sh [-EnorUu] [-a arch] [-B buildid] [-D dest] [-j njob] [-M obj]
[-m mach] [-O obj] [-R release] [-T tools] [-V var=[value]]
[-w wrapper] [operation [...] ]

System build operations (all imply "obj" and "tools"):
build Run "make build"
distribution Run "make distribution" (includes etc/ files)
release Run "make release" (includes kernels & distrib media)

Other operations:
obj Run "make obj" (default unless -o)
tools Build and install tools
kernel=conf Build kernel with config file `conf'
install=idir Run "make installworld" to `idir'
(useful after 'distribution' or 'release')

Options:
-a arch Set MACHINE_ARCH to arch (otherwise deduced from MACHINE)
-B buildId Set BUILDID to buildId
-D dest Set DESTDIR to dest
-E Set "expert" mode; disables some DESTDIR checks
-j njob Run up to njob jobs in parallel; see make(1)
-M obj Set obj root directory to obj (sets MAKEOBJDIRPREFIX)
-m mach Set MACHINE to mach (not required if NetBSD native)
-n Show commands that would be executed, but do not execute them
-O obj Set obj root directory to obj (sets a MAKEOBJDIR pattern)
-o Set MKOBJDIRS=no (do not create objdirs at start of build)
-R release Set RELEASEDIR to release
-r Remove contents of TOOLDIR and DESTDIR before building
-T tools Set TOOLDIR to tools. If unset, and TOOLDIR is not set in
the environment, nbmake will be (re)built unconditionally.
-U Set UNPRIVED
-u Set UPDATE
-V v=[val] Set variable `v' to `val'
-w wrapper Create nbmake script as wrapper
(default: ${TOOLDIR}/bin/nbmake-${MACHINE})


# 1.21 04-Jan-2003 lukem

Add "-V var=[value]", for setting arbitrary variables which will also
be added to the nbmake-${MACHINE} wrapper.
Useful for setting RELEASEDIR, without -R's habit of building a release.


Revision tags: fvdl_fs64_base
# 1.20 25-Dec-2002 lukem

Document:
* build.sh -i idir
* top level targets: distribution, buildworld, installworld
* top level variables: INSTALLWORLDDIR


# 1.19 08-Dec-2002 lukem

Add -E - "expert mode". If this is not specified, builds to DESTDIR=/ are
not permitted.
By using this flag, you are taking responsibility for any issues that
may occur because of this...


# 1.18 08-Dec-2002 lukem

- be consistent about option ordering in build.sh usage display
- use Fl and Ar instead of Sy and Em to format options


# 1.17 25-Nov-2002 wiz

Update location of BUILDING.mdoc.


# 1.16 20-Oct-2002 lukem

regen for build.sh -k


# 1.15 21-Sep-2002 lukem

regen for: USE_NEW_TOOLCHAIN was replaced with TOOLCHAIN_MISSING


# 1.14 17-Sep-2002 fredb

Expand on the difference between ``build.sh -d'' and ``make install'',
as requested by Brian Stark in PR toolchain/18228 (which this closes).


# 1.13 22-Jul-2002 wiz

Remove duplicate 'files'. From Ryo HAYASAKA in toolchain/17674.


Revision tags: netbsd-1-6-PATCH002-RC3 netbsd-1-6-PATCH002-RC2 netbsd-1-6-PATCH002-RC1 netbsd-1-6-PATCH001 netbsd-1-6-PATCH001-RELEASE netbsd-1-6-PATCH001-RC3 netbsd-1-6-PATCH001-RC2 netbsd-1-6-PATCH001-RC1 netbsd-1-6-RELEASE netbsd-1-6-RC3 netbsd-1-6-RC2 netbsd-1-6-RC1 netbsd-1-6-base
# 1.12 13-May-2002 lukem

branches: 1.12.2;
add "-M makeobjdirprefix" to build.sh


# 1.11 03-May-2002 lukem

Move the METALOG from ${_SRC_TOP_OBJ_} to ${DESTDIR}.

There were too many synchronisation problems with using the former;
including situations such as a "make clean" performed between two
installs to the same DESTDIR would result in a truncated METALOG and
the resultant sets would be missing stuff such as include files that
don't get reinstalled if they haven't changed, even with !UPDATE.


# 1.10 02-May-2002 sommerfeld

Re-gen.


# 1.9 14-Mar-2002 thorpej

Add a -B option to set the BUILDID for the build. This also causes
the make(1) wrapper script to be named "nbmake-MACHINE-BUILDID".


# 1.8 05-Mar-2002 lukem

document various supported environment variables, including MAKEOBJDIRPREFIX


# 1.7 04-Mar-2002 lukem

document:
- make's UNPRIVED support
- build.sh's -U support
- the build system currently needs to build onto a file system with
long file name and hard link support


# 1.6 25-Nov-2001 thorpej

Document the -d option to build.sh


# 1.5 15-Nov-2001 tv

Note only <bsd.own.mk> as the authority for determining whether the new
BUILDING instructions should be used.


# 1.4 14-Nov-2001 tv

Turn off host-specific objdirs by default. Set MKHOSTOBJ=yes to enable.


# 1.3 12-Nov-2001 tv

Major overhaul of src/tools and host toolchain. Summary of changes:

* Rewrite src/tools Make logic to work like the rest of the tree wrt
"dependall" and "install". The old "make build" hack is gone.

* Remove the MKTOOLS logic. This was linked to the "make build" hack,
and was only needed because TOOLDIR originally had no writable default.

* Redo the GNU configure/make logic to make it fit reasonably in a
BSD make wrapper. Use new ${.ALLTARGETS} variable to scan for
targets in $(srcdir), and mark them with .MADE: to prevent rebuilding.

* Only build cross tools in src/tools; remove some messy logic in
src/usr.* and src/gnu/usr.* that would do target filename rewriting
(improves consistency and readability).

* Add the ability to build cross gdb at tool build time by setting
MKCROSSGDB (default no) to "yes" in mk.conf.

* Add src/tools/groff and set up paths to work with this cross groff.


# 1.2 08-Nov-2001 wiz

Remove mention of BUILDLING.html, and follow rename of BUILDING.txt to
BUILDING.
Noted by Love <lha@stacken.kth.se> on tech-toolchain.


# 1.1 01-Nov-2001 tv

By popular demand, one preformatted version of BUILDING, plaintext, no CRs.


# 1.143 21-Aug-2022 lukem

BUILDING: regen for removal of extsrc/


# 1.142 28-May-2022 andvar

s/knowlege/knowledge/


# 1.141 20-Dec-2021 christos

Rename:
MKKDEBUG -> MKDEBUGKERNEL
MKTOOLSDEBUG -> MKDEBUGTOOLS
while keeping compatibility with the old names. Add missing documentation.
Now all debugging tunables are prefixed with MKDEBUG.


Revision tags: cjep_sun2x-base1 cjep_sun2x-base cjep_staticlib_x-base1 cjep_staticlib_x-base
# 1.140 10-Nov-2020 kamil

Reintroduce the support of MKCATPAGES

Requested by <mrg>


# 1.139 08-Nov-2020 kamil

Remove the support for MKCATPAGES

It was optional since 1999 and disabled by default since 2012.

Proposed on tech-userlevel@.


# 1.138 13-Oct-2020 thorpej

Document CPUFLAGS here (it's already documented in share/mk/bsd.README).
This will address the initial concern in PR port-alpha/55545.


# 1.137 12-Oct-2020 uwe

Mention HOST_CFLAGS and HOST_CXXFLAGS.


# 1.136 12-Oct-2020 uwe

Bump date and regen for BUILDING.mdoc revision 1.127
that introduced build.sh -c <compiler> option.


Revision tags: netbsd-9-3-RELEASE netbsd-9-2-RELEASE netbsd-9-1-RELEASE phil-wifi-20200421 phil-wifi-20200411 is-mlppp-base phil-wifi-20200406 netbsd-9-0-RELEASE netbsd-9-0-RC2 netbsd-9-0-RC1 phil-wifi-20191119 netbsd-9-base phil-wifi-20190609
# 1.135 08-May-2019 leot

Fix a typo

Reported by Tobias Ulmer via netbsd-docs@ ML, thanks!


Revision tags: pgoyette-compat-20190127 pgoyette-compat-20190118 pgoyette-compat-1226 pgoyette-compat-1126 pgoyette-compat-1020 pgoyette-compat-0930 pgoyette-compat-0906
# 1.134 29-Jul-2018 sevan

regen


Revision tags: pgoyette-compat-0728 phil-wifi-base pgoyette-compat-0625 pgoyette-compat-0521
# 1.133 02-May-2018 pgoyette

branches: 1.133.2;
Re-add files that were accidentally deleted in my previous commit.


# 1.132 02-May-2018 pgoyette

Synch with HEAD


Revision tags: pgoyette-compat-0502 pgoyette-compat-0422 pgoyette-compat-0415 pgoyette-compat-0407 pgoyette-compat-0330 pgoyette-compat-0322 pgoyette-compat-0315 pgoyette-compat-base
# 1.131 16-Feb-2018 leot

branches: 1.131.2;
regen


# 1.130 29-Dec-2017 sevan

regen


# 1.129 21-Oct-2017 sevan

regen


Revision tags: netbsd-8-2-RELEASE netbsd-8-1-RELEASE netbsd-8-1-RC1 netbsd-8-0-RELEASE netbsd-8-0-RC2 netbsd-8-0-RC1 matt-nb8-mediatek-base perseant-stdc-iso10646-base netbsd-8-base
# 1.128 21-May-2017 riastradh

regen


Revision tags: prg-localcount2-base3 prg-localcount2-base2 prg-localcount2-base1 prg-localcount2-base pgoyette-localcount-20170426
# 1.127 22-Apr-2017 plunky

regen


Revision tags: bouyer-socketcan-base1
# 1.126 20-Apr-2017 wiz

regen using regen target in doc.


# 1.125 20-Apr-2017 ozaki-r

Introduce MKSTRIPSYM build option

If it's yes, all local symbols of shared libraries are stripped
(default). If it's no, only temporary local symbols are stripped;
for example, symbols of static functions are kept. Keeping such
symbols is useful on using DTrace for userland libraries and
getting a backtrace from a rump server loading modules (shared
libraries).

Proposed and discussed on tech-kern and tech-toolchain


Revision tags: pgoyette-localcount-20170320
# 1.124 20-Feb-2017 christos

regen


# 1.123 16-Feb-2017 rin

The default values for MKPIC are yes and no for sh3 and m68000, respectively.
Bump date.


Revision tags: bouyer-socketcan-base pgoyette-localcount-20170107 pgoyette-localcount-20161104 localcount-20160914 pgoyette-localcount-20160806 pgoyette-localcount-20160726 pgoyette-localcount-base
# 1.122 29-Jan-2016 wiz

branches: 1.122.2; 1.122.4;
Document MKREPRO_TIMESTAMP.


# 1.121 23-Jul-2015 mrg

remove the xfree86 reachover makefiles and the vast majority of
the support in the rest of the source tree.

X11 sets could use some cleaning up perhaps (just deletion, as
we've never really marked the old X11R6 as obsolete for native
xorg using platforms so far either.)


# 1.120 07-Jun-2015 pgoyette

Update to reflect changes made in rev 1.398 of src/etc/Makefile


# 1.119 08-Apr-2015 wiz

regen


# 1.118 30-Nov-2014 uebayasi

regen


# 1.117 16-Nov-2014 uebayasi

regen


# 1.116 16-Nov-2014 uebayasi

regen


# 1.115 13-Nov-2014 apb

regen from doc/BUILDING.mdoc revision 1.107.
This reinstates documentation for "extsrc" which was lost in 2009.


# 1.114 08-Nov-2014 snj

fourth time's the charm, i guess. when committing a generated file,
it's best to use the latest revision of the source file (hi uebs!)

regen to include changes from revision 1.105 of doc/BUILDING.mdoc


# 1.113 06-Nov-2014 uebayasi

regen


# 1.112 06-Nov-2014 uebayasi

Expand TABs.


# 1.111 06-Nov-2014 uebayasi

Document the new "kernels" operation, prompted by joerg@.


# 1.110 05-Nov-2014 snj

regen


Revision tags: netbsd-7-base tls-earlyentropy-base tls-maxphys-base
# 1.109 07-Aug-2014 apb

branches: 1.109.2;
regen BUILDING from doc/BUILDING.mdoc


# 1.108 03-Aug-2014 apb

BUILDINFO part6: regen BUILDING from doc/BUILDING.mdoc


# 1.107 14-Jun-2014 apb

Regen from doc/BUILDING.mdoc;1.100:
Improve documentation for BUILDID.


# 1.106 21-May-2014 wiz

regen


Revision tags: yamt-pagecache-base9 riastradh-xf86-video-intel-2-7-1-pre-2-21-15 riastradh-drm2-base3 riastradh-drm2-base2 riastradh-drm2-base1 riastradh-drm2-base
# 1.105 29-May-2013 wiz

branches: 1.105.4;
regen using 'make regen' from src/doc.


# 1.104 29-May-2013 wiz

regen (using mandoc doc/BUILDING.mdoc > BUILDING -- let me know
if a different way is preferred, I see that it now contains formatting).


Revision tags: agc-symver-base yamt-pagecache-base8 yamt-pagecache-base7
# 1.103 08-Nov-2012 dholland

regen


Revision tags: yamt-pagecache-base6
# 1.102 19-Sep-2012 abs

regen


# 1.101 25-May-2012 wiz

branches: 1.101.2;
regen using 'make regen' in doc/


# 1.100 25-May-2012 wiz

Document MKREPRO using joerg's wording.


Revision tags: yamt-pagecache-base5 yamt-pagecache-base4
# 1.99 23-Feb-2012 tsutsui

Add a missing period.


Revision tags: netbsd-6-base
# 1.98 14-Feb-2012 apb

branches: 1.98.2;
Regen from revision 1.87 of doc/BUILDING.mdoc.


# 1.97 22-Jan-2012 tsutsui

Add "live-image" and "install-image" target support to build.sh.

"live-image" target builds pre-installed disk images that can be used on
emulators or boot from USB memory sticks to try NetBSD without installation.
Currently amd64, i386, pmax, sparc, sparc64, sun2, sun3, and vax
(which have working emulators and don't require extra tools like preparing
msdosfs or partitioning MD label structures) support this target.

"install-image" target builds an bootable installation disk image that can
be used as an install CD but burned into USB memory sticks etc.
Current only amd64 and i386 (which would support USB boot) have this target.

For more details (and known issue) see following posts on netbsd-bugs@:
http://mail-index.NetBSD.org/netbsd-bugs/2011/08/06/msg023639.html
http://mail-index.NetBSD.org/netbsd-bugs/2011/09/23/msg024207.html
http://mail-index.NetBSD.org/netbsd-bugs/2011/12/07/msg025166.html
http://mail-index.NetBSD.org/netbsd-bugs/2011/12/08/msg025178.html

No particular comments about implementation, and
"go ahead" comments from mrg@, riz@ and christos@.

Closes PR toolchain/45153 and PR misc/45155.


Revision tags: yamt-pagecache-base3 yamt-pagecache-base2 yamt-pagecache-base
# 1.96 09-Sep-2011 apb

branches: 1.96.2;
Add tests for the shell under which build.sh is run. If the
shell fails the tests, then build.sh tries to re-exec itself
under a more suitable shell.


# 1.95 09-Sep-2011 apb

Revisions 1.92 and 1.93 of src/BUILDING were not reflected in
src/doc/BUILDING.mdoc, so those changes were lost when src/BUILDING
was regenerated in revision 1.94.

Now update src/doc/BUILDING.mdoc and regenerate src/BUILDING to
reinstate the lost changes. (I also edited one of the changes, to use
the phrase "space-separated list" for consistency with other parts of
the document.)

The original changes were:


# 1.93 06-Aug-2011 jnemeth

Add description of MKKMOD, part of PR misc/45216


Revision tags: cherry-xenmp-base bouyer-quota2-nbase bouyer-quota2-base
# 1.92 29-Jan-2011 jym

Pass down INSTALLSETS variable to installsets target. Use :Q to escape
shell meta-characters, as the variable contains a list of sets, separated
by spaces.

$ ./build.sh -V INSTALLSETS="base etc" install=idir

should now work as expected.

Reviewed by apb@ on tech-toolchain.


# 1.94 09-Sep-2011 apb

Allow MAKEFLAGS to be set via build.sh -V. Somebody asked for this
in 2008.

Also add comments above a few functions in build.sh, and bump copyright
dates.


# 1.93 06-Aug-2011 jnemeth

Add description of MKKMOD, part of PR misc/45216


Revision tags: cherry-xenmp-base bouyer-quota2-nbase bouyer-quota2-base
# 1.92 29-Jan-2011 jym

Pass down INSTALLSETS variable to installsets target. Use :Q to escape
shell meta-characters, as the variable contains a list of sets, separated
by spaces.

$ ./build.sh -V INSTALLSETS="base etc" install=idir

should now work as expected.

Reviewed by apb@ on tech-toolchain.


Revision tags: matt-mips64-premerge-20101231
# 1.91 25-Jul-2010 mrg

branches: 1.91.2;
remove the MKSUBPIXEL/MKTTINTERP options; they're going away.

regenerate.


Revision tags: matt-premerge-20091211
# 1.90 30-Nov-2009 uebayasi

Support "extsrc", externally added programs and libraries. Users can write
their own reach-overs, cross-build, install, and get set files just like base
and X11 / X.org. (These sets are not included as TNF releases.)


# 1.89 10-Oct-2009 apb

If ${NETBDSRCDIR}/../xsrc exists, then use it as the default value
of X11SRCDIR. If it doesn't exist, then use /usr/xsrc as before.

OK mrg


# 1.88 27-Sep-2009 apb

* Use a more robust method of creating the top level object directory.
Use getmakevar to expand MAKEOBJDIRPREFIX or MAKEOBJDIR, or (if
neither of those variables is set) use a non-recursive "make obj" in
the top level source directory.

* Do not let TOP_objdir default to ${TOP}. It's now set only by the
-M or -O command line options, or after using getmakevar to expand
MAKEOBJDIRPREFIX or MAKEOBJDIR.

* Make try_set_TOOLDIR handle MAKEOBJDIRPERFIX passed from the
environment. It runs too early to use getmakevar, so it will not work
if the value contains embedded '${...}' variable references.

* Use '$TOOLDIR' (with a literal '$') instead of 'nonexistent' in
a message when rebuilding make when TOOLDIR is not yet known.


# 1.87 27-Sep-2009 apb

Allow build.sh "-C cdextra" option to be specified multiple times.


# 1.86 07-Sep-2009 jnemeth

Add a modules operation to build.sh, which builds and installs kernel modules
into DESTDIR.

This is based on the patch provided by tsutsui@ on tech-toolchain@.


# 1.85 12-Jul-2009 hubertf

regen


# 1.84 12-Jul-2009 hubertf

regen


Revision tags: jym-xensuspend-nbase jym-xensuspend-base
# 1.83 01-May-2009 snj

Introduce MKSUBPIXEL, which allows enabling subpixel rendering code
in FreeType.


# 1.82 02-Dec-2008 mrg

branches: 1.82.2;
be explicit about MAKEOBJDIR and MAKEOBJDIRPREFIX not being for
mk.conf or ${MAKECONF}.


# 1.81 15-Nov-2008 mrg

revert sparc back to default of XFree86 at the request of macallan.


# 1.80 13-Nov-2008 apb

Add support for new MAKEVERBOSE levels 3 and 4. The complete list is now:

0 Minimal output ("quiet")
1 Describe what is occurring
2 Describe what is occurring and echo the actual command
3 Ignore the effect of the "@" prefix in make commands
4 Trace shell commands using the shell's -x flag

The default remains MAKEVERBOSE=2.


# 1.79 09-Nov-2008 mrg

- retire MKXORG from public use
- introduce X11FLAVOUR to choose src/x11 vs src/external/mit/xorg
for the X11 to build if MKX11=yes is set. it takes the values
of either Xorg or XFree86.
- default to Xorg on alpha, i386, macppc, shark, sparc and sparc64
- remove MKXORG_WITH_XSRC_XSERVER, unused and never useful


Revision tags: netbsd-5-base matt-mips64-base2
# 1.78 24-Sep-2008 apb

branches: 1.78.2;
regen for recent change to examples and objdir advice,
and for the older MKSTRIPIDENT change.


Revision tags: wrstuden-revivesa-base-3 wrstuden-revivesa-base-2
# 1.77 06-Sep-2008 lukem

regen for MKHTML


# 1.76 28-Aug-2008 lukem

Improve support for MKXORG!=no to enable builds into external/mit/xorg.
This will be mutually exclusive to MKX11!=no.


# 1.75 18-Aug-2008 lukem

Document "build.sh cleandir".
Fix formatting nit.
Remove BUGS; all the in-tree platforms are using build.sh now.


# 1.74 11-Aug-2008 apb

* Suggest a "-j" value between 1+NCPU and 2*NCPU for the fastest builds.
* Remove some duplicated content that appeared in both the section about
make's -j flag and the section about build.sh's -j flag.


# 1.73 05-Aug-2008 apb

* Add more detail for build.sh -M and -O options.
* Mention new default when source is /usr/src but build.sh is run
with neither -M nor -O.


# 1.72 05-Aug-2008 perry

Builds now use "BUILDSEED" so that c++ binaries are reproduceable.
By default BUILDSEED is set to NetBSD-{majorversion} -- a -S flag may
be used to change it.

Discussed on tech-toolchain.


Revision tags: wrstuden-revivesa-base-1 yamt-pf42-base4 yamt-pf42-base3 hpcarm-cleanup-nbase yamt-pf42-baseX yamt-pf42-base2 wrstuden-revivesa-base keiichi-mipv6-nbase yamt-pf42-base keiichi-mipv6-base
# 1.71 29-Mar-2008 dholland

branches: 1.71.4;
Correct/clarify the default setting of USETOOLS in the previous version.
Noted by apb.


# 1.70 28-Mar-2008 dholland

Assorted updates and clarifications, grammar fixes and wording improvements,
and so on. Significant highlights:
- mention src/tests and reference atf;
- provide examples of MACHINE and MACHINE_ARCH;
- mention that MKOBJ=no is not recommended;
- correct the description of the default setting of USETOOLS;
- document the interactions of build.sh -[uo] with various things;
- document the interactions of build.sh tools and kernel=FOO;
- use a lot fewer parentheses.
Discussed on netbsd-docs.


Revision tags: matt-armv6-nbase
# 1.69 18-Mar-2008 lukem

Consistently document RELEASEDIR/RELEASEMACHINEDIR.


# 1.68 08-Mar-2008 reed

Mention that "build" and "distribution" do not build nor install (to DESTDIR)
a kernel.


Revision tags: cube-autoconf-base matt-armv6-base hpcarm-cleanup-base
# 1.67 23-Nov-2007 sborrill

branches: 1.67.4;
Add support for CDBUILDEXTRA which acts like CDEXTRA to add extra items
to the CD-ROM image.
Make CDEXTRA and CDBUILDEXTRA be able to contain lists of files and directories
which are added in turn.
Add support for CDEXTRA_SKIP which contains a list of fnmatch(3) items to
skip during the copy. This is _very_ useful for skipping CVS dirs for example.
CDBUILDEXTRA and CDEXTRA_SKIP are to be used in Makefiles creating the images,
CDEXTRA remains to be used from build.sh.
Update documentation and build.sh help text to show that -C can be used to
specify a list of files and directories rather than just a single dir.


# 1.66 01-Sep-2007 jnemeth

Convert build.sh iso-dir=directory option to -C cddir as per jmmv@ on
source-changes.


# 1.65 01-Sep-2007 jnemeth

Add an iso-dir=directory option. When combined with iso-image or
iso-image-source, it will cause directory to be added to the CD-ROM image.


# 1.64 30-Aug-2007 jnemeth

describe new iso-image-source target


# 1.63 30-Aug-2007 ad

Remove STATUS paragraph which makes it sound like the build system is
half baked.


Revision tags: matt-mips64-base
# 1.62 13-Apr-2007 apb

branches: 1.62.4;
Document recent changes to "make iso-image".


# 1.61 26-Mar-2007 apb

Document the fact that "make installworld" and "build.sh
installworld=..." do not install the etc or xetc sets. Suggest using
etcupdate(8) and postinstall(8) after installworld.


# 1.60 27-Jan-2007 apb

Try to clarify the description of build.sh -m mach.
Document new evbarm-eb and evbarm-el aliases.


Revision tags: netbsd-4-base
# 1.59 08-Oct-2006 apb

branches: 1.59.2;
Clarify that DESTDIR/OBJDIR/etc are absolute paths, but build.sh
-D/-O/etc allows relative paths.

Closes PR 32345 by Andre Luiz de Oliveira.


# 1.58 29-Sep-2006 apb

Use ${HOST_SH} instead of the host system's /bin/sh wherever possible:

* Describe the HOST_SH variable, and the way build.sh attempts to set it.

* Suggest passing HOST_SH in the environment if /bin/sh is not a working
shell.


Revision tags: abandoned-netbsd-4-base
# 1.57 29-Jan-2006 apb

mkisofs is in pkgsrc/sysutils/cdrtools now, not pkgsrc/sysutils/cdrecord.
Reported by Jukka Salmi.


# 1.56 28-Jan-2006 apb

* Add an "iso-image" target in the top level Makefile,
which invokes make iso-image in the etc directory.
* Add an "iso-image" action in build.sh, which
invokes make iso-image.
* Document the above in doc/BUILDING.mdoc.
* Re-generate BUILDING.

Approved by christos


# 1.55 12-Jan-2006 wiz

Bump date for syspkgs.


# 1.54 04-Jan-2006 apb

Document "make syspkgs" and "build.sh syspkgs".

Reviewed by agc


Revision tags: netbsd-3-1-1-RELEASE netbsd-3-0-3-RELEASE netbsd-3-1-RELEASE netbsd-3-0-2-RELEASE netbsd-3-1-RC4 netbsd-3-1-RC3 netbsd-3-1-RC2 netbsd-3-1-RC1 netbsd-3-0-1-RELEASE netbsd-3-0-RELEASE netbsd-3-0-RC6 netbsd-3-0-RC5 netbsd-3-0-RC4 netbsd-3-0-RC3 netbsd-3-0-RC2 netbsd-3-0-RC1 netbsd-3-base
# 1.53 15-Feb-2005 reed

Document the environment variables for if you need to override or
manually select your compilers.
(And regen BUILDING from doc/BUILDING.mdoc.)


# 1.52 12-Oct-2004 jmc

Fix some typo's/bad wording as highlighted in PR#27219


# 1.51 25-Jun-2004 wiz

regen (Document -h. From Karsten Kruse in PR 25974.
While here, remove a duplicate sentence).


Revision tags: netbsd-2-0-3-RELEASE netbsd-2-1-RELEASE netbsd-2-1-RC6 netbsd-2-1-RC5 netbsd-2-1-RC4 netbsd-2-1-RC3 netbsd-2-1-RC2 netbsd-2-1-RC1 netbsd-2-0-2-RELEASE netbsd-2-0-1-RELEASE netbsd-2-base netbsd-2-0-RELEASE netbsd-2-0-RC5 netbsd-2-0-RC4 netbsd-2-0-RC3 netbsd-2-0-RC2 netbsd-2-0-RC1 netbsd-2-0-base
# 1.50 19-Mar-2004 wiz

Document MKTTINTERP.


# 1.49 06-Feb-2004 lukem

* Document build.sh -X and -x
* Document MKX11 and X11SRCDIR
* Remove note warning against cross-building from systems other than NetBSD;
it works on many other platforms.


# 1.48 29-Dec-2003 jmc

Note tools/compat/README as the place to get notes from non-native cross builds


# 1.47 19-Dec-2003 zuntum

Change -v to -V in the following section:

"Print make(1)'s idea of the value of var. Does not build any targets."

To reflect reality.

Found by Tomasz Marciniak <Tomasz.Marciniak@felix.fizyka.amu.edu.pl>, thanks!


# 1.46 26-Oct-2003 lukem

Improve how build.sh -N and MAKEVERBOSE interoperate;
rather than adding '-s' to make's command line in the makewrapper,
use the .SILENT target based on MAKEVERBOSE's value.

This means that you can do:
./build.sh -N 1 makewrapper

$TOOLDIR/bin/nbmake-$MACHINE
# runs at MAKEVERBOSE==1, with command lines suppressed

$TOOLDIR/bin/nbmake-$MACHINE MAKEVERBOSE=2
# runs at MAKEVERBOSE==2 for this invocation, with command lines shown


# 1.45 25-Oct-2003 lukem

Implement build -N noisy, which sets MAKEVERBOSE to noisy and adds
`-s' to MAKEFLAGS for noisy < 2.


# 1.44 29-Sep-2003 lukem

regenerate for "%" prompt update


# 1.43 19-Aug-2003 martti

Backout the previous commit


# 1.42 19-Aug-2003 martti

Remove # from the example.


# 1.41 08-Aug-2003 lukem

fix description of MAKEOBJDIR. from Martin Husemann


# 1.40 29-Jul-2003 lukem

Add build.sh -Z var, to unset a variable and ensure it's unset in makewrapper.
For -M MAKEOBJDIRPREFIX, unset MAKEOBJDIR.
For -O MAKEOBJDIR, unset MAKEOBJDIRPREFIX.


# 1.39 18-Jul-2003 lukem

fix default location of TOOLDIR


# 1.38 18-Jul-2003 lukem

Update for the MKUNPRIVED/MKUPDATE changes.


# 1.37 18-Jul-2003 lukem

rebuild with new groff


# 1.36 03-Jul-2003 lukem

attempt to clarify how MAKEOBJDIR{,PREFIX} may be provided ...
(this document needs a rototill, which i may get to whilst writing a
paper about build.sh)


# 1.35 25-May-2003 lukem

all:
* add "releasekernel=conf", to install a gzipped copy of the kernels
built by "kernel=conf" to RELEASEDIR/MACHINE/binary/kernel

build.sh:
* be more consistent in various status messages
* move the {release,}kernel=conf conf parsing code into getkernelconf()
and use in both buildkernel() and releasekernel()
* only warn once when building multiple kernels without updating the tools


# 1.34 18-May-2003 lukem

For normal builds, MKOBJDIRS default to `no' (not `yes').
It's only build.sh that sets this to `yes' by default.
Noted by OGAWA Takaya in [toolchain/19823]


# 1.33 17-May-2003 lukem

improve description of how "build.sh -m mach" sets the default
MACHINE_ARCH, and list the special cases that this does not occur for.


# 1.32 10-May-2003 lukem

crank date for previous


# 1.31 10-May-2003 lukem

Add "sourcesets" argument/target, which builds source sets into
RELEASEDIR/source/sets


# 1.30 08-May-2003 lukem

build.sh now provides defaults for DESTDIR and RELEASEDIR if not expert mode.
Remove -D and -R from EXAMPLES since they're not necessary any more.


# 1.29 08-Feb-2003 lukem

Fix example 3; the build.sh target is "install" not "installworld".
Improve description.
Noted by Valeriy Ushakov (uwe@) in private email.


# 1.28 02-Feb-2003 lukem

attempt to further improve and clarify the examples...


# 1.27 30-Jan-2003 lukem

Prefix various paths with 'DESTDIR', to highlight that the DESTDIR
is taken into account.


# 1.26 29-Jan-2003 lukem

allow toolprefix to be easily changed


# 1.25 26-Jan-2003 lukem

Various improvements per discussion with Alan Barrett.


# 1.24 26-Jan-2003 lukem

- Add "sets" top-level Makefile target and build.sh operation.
[Latter suggested by Julio Merino in private email]
- Add "help" build.sh operation.


# 1.23 26-Jan-2003 lukem

Change build.sh so that at least one operation is required.
Add "makewrapper" operation to build.sh.
[The above changes were suggested by Alan Barrett on current-users@]

Fail if building as non-root unless: UNPRIVED is set, -U is given, or -E
(expert mode) is given.
[Suggested by James Wetterau in private email]

Improve the examples in BUILDING.


# 1.22 23-Jan-2003 lukem

Rework how build.sh functions, so that command line options set various
parameters, and a list of "operations" defines what to do.
The full usage is show below. Notes:
`-b' has been deprecated (it always occurs now)
`-d' is replaced by "distribution"
`-R rel' onlys sets RELEASEDIR; use "release" to build a release
`-k kern' has been replaced by "kernel=kern"
`-i idir' has been replaced by "install=idir"
-r now occurs before nbmake is rebuilt

Add a copyright (long due!). Rework the code to (a KNF inspired) ShellNF.
Use functions appropriately. Allow `nb' prefix to be easily changed to
something else. Solve world peace (just kidding)

This is part of the (never achievable) goal of attempting to make
NetBSD easier to build...


--8<-- new usage follows --8<--

Usage: build.sh [-EnorUu] [-a arch] [-B buildid] [-D dest] [-j njob] [-M obj]
[-m mach] [-O obj] [-R release] [-T tools] [-V var=[value]]
[-w wrapper] [operation [...] ]

System build operations (all imply "obj" and "tools"):
build Run "make build"
distribution Run "make distribution" (includes etc/ files)
release Run "make release" (includes kernels & distrib media)

Other operations:
obj Run "make obj" (default unless -o)
tools Build and install tools
kernel=conf Build kernel with config file `conf'
install=idir Run "make installworld" to `idir'
(useful after 'distribution' or 'release')

Options:
-a arch Set MACHINE_ARCH to arch (otherwise deduced from MACHINE)
-B buildId Set BUILDID to buildId
-D dest Set DESTDIR to dest
-E Set "expert" mode; disables some DESTDIR checks
-j njob Run up to njob jobs in parallel; see make(1)
-M obj Set obj root directory to obj (sets MAKEOBJDIRPREFIX)
-m mach Set MACHINE to mach (not required if NetBSD native)
-n Show commands that would be executed, but do not execute them
-O obj Set obj root directory to obj (sets a MAKEOBJDIR pattern)
-o Set MKOBJDIRS=no (do not create objdirs at start of build)
-R release Set RELEASEDIR to release
-r Remove contents of TOOLDIR and DESTDIR before building
-T tools Set TOOLDIR to tools. If unset, and TOOLDIR is not set in
the environment, nbmake will be (re)built unconditionally.
-U Set UNPRIVED
-u Set UPDATE
-V v=[val] Set variable `v' to `val'
-w wrapper Create nbmake script as wrapper
(default: ${TOOLDIR}/bin/nbmake-${MACHINE})


# 1.21 04-Jan-2003 lukem

Add "-V var=[value]", for setting arbitrary variables which will also
be added to the nbmake-${MACHINE} wrapper.
Useful for setting RELEASEDIR, without -R's habit of building a release.


Revision tags: fvdl_fs64_base
# 1.20 25-Dec-2002 lukem

Document:
* build.sh -i idir
* top level targets: distribution, buildworld, installworld
* top level variables: INSTALLWORLDDIR


# 1.19 08-Dec-2002 lukem

Add -E - "expert mode". If this is not specified, builds to DESTDIR=/ are
not permitted.
By using this flag, you are taking responsibility for any issues that
may occur because of this...


# 1.18 08-Dec-2002 lukem

- be consistent about option ordering in build.sh usage display
- use Fl and Ar instead of Sy and Em to format options


# 1.17 25-Nov-2002 wiz

Update location of BUILDING.mdoc.


# 1.16 20-Oct-2002 lukem

regen for build.sh -k


# 1.15 21-Sep-2002 lukem

regen for: USE_NEW_TOOLCHAIN was replaced with TOOLCHAIN_MISSING


# 1.14 17-Sep-2002 fredb

Expand on the difference between ``build.sh -d'' and ``make install'',
as requested by Brian Stark in PR toolchain/18228 (which this closes).


# 1.13 22-Jul-2002 wiz

Remove duplicate 'files'. From Ryo HAYASAKA in toolchain/17674.


Revision tags: netbsd-1-6-PATCH002-RC3 netbsd-1-6-PATCH002-RC2 netbsd-1-6-PATCH002-RC1 netbsd-1-6-PATCH001 netbsd-1-6-PATCH001-RELEASE netbsd-1-6-PATCH001-RC3 netbsd-1-6-PATCH001-RC2 netbsd-1-6-PATCH001-RC1 netbsd-1-6-RELEASE netbsd-1-6-RC3 netbsd-1-6-RC2 netbsd-1-6-RC1 netbsd-1-6-base
# 1.12 13-May-2002 lukem

branches: 1.12.2;
add "-M makeobjdirprefix" to build.sh


# 1.11 03-May-2002 lukem

Move the METALOG from ${_SRC_TOP_OBJ_} to ${DESTDIR}.

There were too many synchronisation problems with using the former;
including situations such as a "make clean" performed between two
installs to the same DESTDIR would result in a truncated METALOG and
the resultant sets would be missing stuff such as include files that
don't get reinstalled if they haven't changed, even with !UPDATE.


# 1.10 02-May-2002 sommerfeld

Re-gen.


# 1.9 14-Mar-2002 thorpej

Add a -B option to set the BUILDID for the build. This also causes
the make(1) wrapper script to be named "nbmake-MACHINE-BUILDID".


# 1.8 05-Mar-2002 lukem

document various supported environment variables, including MAKEOBJDIRPREFIX


# 1.7 04-Mar-2002 lukem

document:
- make's UNPRIVED support
- build.sh's -U support
- the build system currently needs to build onto a file system with
long file name and hard link support


# 1.6 25-Nov-2001 thorpej

Document the -d option to build.sh


# 1.5 15-Nov-2001 tv

Note only <bsd.own.mk> as the authority for determining whether the new
BUILDING instructions should be used.


# 1.4 14-Nov-2001 tv

Turn off host-specific objdirs by default. Set MKHOSTOBJ=yes to enable.


# 1.3 12-Nov-2001 tv

Major overhaul of src/tools and host toolchain. Summary of changes:

* Rewrite src/tools Make logic to work like the rest of the tree wrt
"dependall" and "install". The old "make build" hack is gone.

* Remove the MKTOOLS logic. This was linked to the "make build" hack,
and was only needed because TOOLDIR originally had no writable default.

* Redo the GNU configure/make logic to make it fit reasonably in a
BSD make wrapper. Use new ${.ALLTARGETS} variable to scan for
targets in $(srcdir), and mark them with .MADE: to prevent rebuilding.

* Only build cross tools in src/tools; remove some messy logic in
src/usr.* and src/gnu/usr.* that would do target filename rewriting
(improves consistency and readability).

* Add the ability to build cross gdb at tool build time by setting
MKCROSSGDB (default no) to "yes" in mk.conf.

* Add src/tools/groff and set up paths to work with this cross groff.


# 1.2 08-Nov-2001 wiz

Remove mention of BUILDLING.html, and follow rename of BUILDING.txt to
BUILDING.
Noted by Love <lha@stacken.kth.se> on tech-toolchain.


# 1.1 01-Nov-2001 tv

By popular demand, one preformatted version of BUILDING, plaintext, no CRs.


# 1.142 28-May-2022 andvar

s/knowlege/knowledge/


# 1.141 20-Dec-2021 christos

Rename:
MKKDEBUG -> MKDEBUGKERNEL
MKTOOLSDEBUG -> MKDEBUGTOOLS
while keeping compatibility with the old names. Add missing documentation.
Now all debugging tunables are prefixed with MKDEBUG.


Revision tags: cjep_sun2x-base1 cjep_sun2x-base cjep_staticlib_x-base1 cjep_staticlib_x-base
# 1.140 10-Nov-2020 kamil

Reintroduce the support of MKCATPAGES

Requested by <mrg>


# 1.139 08-Nov-2020 kamil

Remove the support for MKCATPAGES

It was optional since 1999 and disabled by default since 2012.

Proposed on tech-userlevel@.


# 1.138 13-Oct-2020 thorpej

Document CPUFLAGS here (it's already documented in share/mk/bsd.README).
This will address the initial concern in PR port-alpha/55545.


# 1.137 12-Oct-2020 uwe

Mention HOST_CFLAGS and HOST_CXXFLAGS.


# 1.136 12-Oct-2020 uwe

Bump date and regen for BUILDING.mdoc revision 1.127
that introduced build.sh -c <compiler> option.


Revision tags: netbsd-9-2-RELEASE netbsd-9-1-RELEASE phil-wifi-20200421 phil-wifi-20200411 is-mlppp-base phil-wifi-20200406 netbsd-9-0-RELEASE netbsd-9-0-RC2 netbsd-9-0-RC1 phil-wifi-20191119 netbsd-9-base phil-wifi-20190609
# 1.135 08-May-2019 leot

Fix a typo

Reported by Tobias Ulmer via netbsd-docs@ ML, thanks!


Revision tags: pgoyette-compat-20190127 pgoyette-compat-20190118 pgoyette-compat-1226 pgoyette-compat-1126 pgoyette-compat-1020 pgoyette-compat-0930 pgoyette-compat-0906
# 1.134 29-Jul-2018 sevan

regen


Revision tags: pgoyette-compat-0728 phil-wifi-base pgoyette-compat-0625 pgoyette-compat-0521
# 1.133 02-May-2018 pgoyette

branches: 1.133.2;
Re-add files that were accidentally deleted in my previous commit.


# 1.132 02-May-2018 pgoyette

Synch with HEAD


Revision tags: pgoyette-compat-0502 pgoyette-compat-0422 pgoyette-compat-0415 pgoyette-compat-0407 pgoyette-compat-0330 pgoyette-compat-0322 pgoyette-compat-0315 pgoyette-compat-base
# 1.131 16-Feb-2018 leot

branches: 1.131.2;
regen


# 1.130 29-Dec-2017 sevan

regen


# 1.129 21-Oct-2017 sevan

regen


Revision tags: netbsd-8-2-RELEASE netbsd-8-1-RELEASE netbsd-8-1-RC1 netbsd-8-0-RELEASE netbsd-8-0-RC2 netbsd-8-0-RC1 matt-nb8-mediatek-base perseant-stdc-iso10646-base netbsd-8-base
# 1.128 21-May-2017 riastradh

regen


Revision tags: prg-localcount2-base3 prg-localcount2-base2 prg-localcount2-base1 prg-localcount2-base pgoyette-localcount-20170426
# 1.127 22-Apr-2017 plunky

regen


Revision tags: bouyer-socketcan-base1
# 1.126 20-Apr-2017 wiz

regen using regen target in doc.


# 1.125 20-Apr-2017 ozaki-r

Introduce MKSTRIPSYM build option

If it's yes, all local symbols of shared libraries are stripped
(default). If it's no, only temporary local symbols are stripped;
for example, symbols of static functions are kept. Keeping such
symbols is useful on using DTrace for userland libraries and
getting a backtrace from a rump server loading modules (shared
libraries).

Proposed and discussed on tech-kern and tech-toolchain


Revision tags: pgoyette-localcount-20170320
# 1.124 20-Feb-2017 christos

regen


# 1.123 16-Feb-2017 rin

The default values for MKPIC are yes and no for sh3 and m68000, respectively.
Bump date.


Revision tags: bouyer-socketcan-base pgoyette-localcount-20170107 pgoyette-localcount-20161104 localcount-20160914 pgoyette-localcount-20160806 pgoyette-localcount-20160726 pgoyette-localcount-base
# 1.122 29-Jan-2016 wiz

branches: 1.122.2; 1.122.4;
Document MKREPRO_TIMESTAMP.


# 1.121 23-Jul-2015 mrg

remove the xfree86 reachover makefiles and the vast majority of
the support in the rest of the source tree.

X11 sets could use some cleaning up perhaps (just deletion, as
we've never really marked the old X11R6 as obsolete for native
xorg using platforms so far either.)


# 1.120 07-Jun-2015 pgoyette

Update to reflect changes made in rev 1.398 of src/etc/Makefile


# 1.119 08-Apr-2015 wiz

regen


# 1.118 30-Nov-2014 uebayasi

regen


# 1.117 16-Nov-2014 uebayasi

regen


# 1.116 16-Nov-2014 uebayasi

regen


# 1.115 13-Nov-2014 apb

regen from doc/BUILDING.mdoc revision 1.107.
This reinstates documentation for "extsrc" which was lost in 2009.


# 1.114 08-Nov-2014 snj

fourth time's the charm, i guess. when committing a generated file,
it's best to use the latest revision of the source file (hi uebs!)

regen to include changes from revision 1.105 of doc/BUILDING.mdoc


# 1.113 06-Nov-2014 uebayasi

regen


# 1.112 06-Nov-2014 uebayasi

Expand TABs.


# 1.111 06-Nov-2014 uebayasi

Document the new "kernels" operation, prompted by joerg@.


# 1.110 05-Nov-2014 snj

regen


Revision tags: netbsd-7-base tls-earlyentropy-base tls-maxphys-base
# 1.109 07-Aug-2014 apb

branches: 1.109.2;
regen BUILDING from doc/BUILDING.mdoc


# 1.108 03-Aug-2014 apb

BUILDINFO part6: regen BUILDING from doc/BUILDING.mdoc


# 1.107 14-Jun-2014 apb

Regen from doc/BUILDING.mdoc;1.100:
Improve documentation for BUILDID.


# 1.106 21-May-2014 wiz

regen


Revision tags: yamt-pagecache-base9 riastradh-xf86-video-intel-2-7-1-pre-2-21-15 riastradh-drm2-base3 riastradh-drm2-base2 riastradh-drm2-base1 riastradh-drm2-base
# 1.105 29-May-2013 wiz

branches: 1.105.4;
regen using 'make regen' from src/doc.


# 1.104 29-May-2013 wiz

regen (using mandoc doc/BUILDING.mdoc > BUILDING -- let me know
if a different way is preferred, I see that it now contains formatting).


Revision tags: agc-symver-base yamt-pagecache-base8 yamt-pagecache-base7
# 1.103 08-Nov-2012 dholland

regen


Revision tags: yamt-pagecache-base6
# 1.102 19-Sep-2012 abs

regen


# 1.101 25-May-2012 wiz

branches: 1.101.2;
regen using 'make regen' in doc/


# 1.100 25-May-2012 wiz

Document MKREPRO using joerg's wording.


Revision tags: yamt-pagecache-base5 yamt-pagecache-base4
# 1.99 23-Feb-2012 tsutsui

Add a missing period.


Revision tags: netbsd-6-base
# 1.98 14-Feb-2012 apb

branches: 1.98.2;
Regen from revision 1.87 of doc/BUILDING.mdoc.


# 1.97 22-Jan-2012 tsutsui

Add "live-image" and "install-image" target support to build.sh.

"live-image" target builds pre-installed disk images that can be used on
emulators or boot from USB memory sticks to try NetBSD without installation.
Currently amd64, i386, pmax, sparc, sparc64, sun2, sun3, and vax
(which have working emulators and don't require extra tools like preparing
msdosfs or partitioning MD label structures) support this target.

"install-image" target builds an bootable installation disk image that can
be used as an install CD but burned into USB memory sticks etc.
Current only amd64 and i386 (which would support USB boot) have this target.

For more details (and known issue) see following posts on netbsd-bugs@:
http://mail-index.NetBSD.org/netbsd-bugs/2011/08/06/msg023639.html
http://mail-index.NetBSD.org/netbsd-bugs/2011/09/23/msg024207.html
http://mail-index.NetBSD.org/netbsd-bugs/2011/12/07/msg025166.html
http://mail-index.NetBSD.org/netbsd-bugs/2011/12/08/msg025178.html

No particular comments about implementation, and
"go ahead" comments from mrg@, riz@ and christos@.

Closes PR toolchain/45153 and PR misc/45155.


Revision tags: yamt-pagecache-base3 yamt-pagecache-base2 yamt-pagecache-base
# 1.96 09-Sep-2011 apb

branches: 1.96.2;
Add tests for the shell under which build.sh is run. If the
shell fails the tests, then build.sh tries to re-exec itself
under a more suitable shell.


# 1.95 09-Sep-2011 apb

Revisions 1.92 and 1.93 of src/BUILDING were not reflected in
src/doc/BUILDING.mdoc, so those changes were lost when src/BUILDING
was regenerated in revision 1.94.

Now update src/doc/BUILDING.mdoc and regenerate src/BUILDING to
reinstate the lost changes. (I also edited one of the changes, to use
the phrase "space-separated list" for consistency with other parts of
the document.)

The original changes were:


# 1.93 06-Aug-2011 jnemeth

Add description of MKKMOD, part of PR misc/45216


Revision tags: cherry-xenmp-base bouyer-quota2-nbase bouyer-quota2-base
# 1.92 29-Jan-2011 jym

Pass down INSTALLSETS variable to installsets target. Use :Q to escape
shell meta-characters, as the variable contains a list of sets, separated
by spaces.

$ ./build.sh -V INSTALLSETS="base etc" install=idir

should now work as expected.

Reviewed by apb@ on tech-toolchain.


# 1.94 09-Sep-2011 apb

Allow MAKEFLAGS to be set via build.sh -V. Somebody asked for this
in 2008.

Also add comments above a few functions in build.sh, and bump copyright
dates.


# 1.93 06-Aug-2011 jnemeth

Add description of MKKMOD, part of PR misc/45216


Revision tags: cherry-xenmp-base bouyer-quota2-nbase bouyer-quota2-base
# 1.92 29-Jan-2011 jym

Pass down INSTALLSETS variable to installsets target. Use :Q to escape
shell meta-characters, as the variable contains a list of sets, separated
by spaces.

$ ./build.sh -V INSTALLSETS="base etc" install=idir

should now work as expected.

Reviewed by apb@ on tech-toolchain.


Revision tags: matt-mips64-premerge-20101231
# 1.91 25-Jul-2010 mrg

branches: 1.91.2;
remove the MKSUBPIXEL/MKTTINTERP options; they're going away.

regenerate.


Revision tags: matt-premerge-20091211
# 1.90 30-Nov-2009 uebayasi

Support "extsrc", externally added programs and libraries. Users can write
their own reach-overs, cross-build, install, and get set files just like base
and X11 / X.org. (These sets are not included as TNF releases.)


# 1.89 10-Oct-2009 apb

If ${NETBDSRCDIR}/../xsrc exists, then use it as the default value
of X11SRCDIR. If it doesn't exist, then use /usr/xsrc as before.

OK mrg


# 1.88 27-Sep-2009 apb

* Use a more robust method of creating the top level object directory.
Use getmakevar to expand MAKEOBJDIRPREFIX or MAKEOBJDIR, or (if
neither of those variables is set) use a non-recursive "make obj" in
the top level source directory.

* Do not let TOP_objdir default to ${TOP}. It's now set only by the
-M or -O command line options, or after using getmakevar to expand
MAKEOBJDIRPREFIX or MAKEOBJDIR.

* Make try_set_TOOLDIR handle MAKEOBJDIRPERFIX passed from the
environment. It runs too early to use getmakevar, so it will not work
if the value contains embedded '${...}' variable references.

* Use '$TOOLDIR' (with a literal '$') instead of 'nonexistent' in
a message when rebuilding make when TOOLDIR is not yet known.


# 1.87 27-Sep-2009 apb

Allow build.sh "-C cdextra" option to be specified multiple times.


# 1.86 07-Sep-2009 jnemeth

Add a modules operation to build.sh, which builds and installs kernel modules
into DESTDIR.

This is based on the patch provided by tsutsui@ on tech-toolchain@.


# 1.85 12-Jul-2009 hubertf

regen


# 1.84 12-Jul-2009 hubertf

regen


Revision tags: jym-xensuspend-nbase jym-xensuspend-base
# 1.83 01-May-2009 snj

Introduce MKSUBPIXEL, which allows enabling subpixel rendering code
in FreeType.


# 1.82 02-Dec-2008 mrg

branches: 1.82.2;
be explicit about MAKEOBJDIR and MAKEOBJDIRPREFIX not being for
mk.conf or ${MAKECONF}.


# 1.81 15-Nov-2008 mrg

revert sparc back to default of XFree86 at the request of macallan.


# 1.80 13-Nov-2008 apb

Add support for new MAKEVERBOSE levels 3 and 4. The complete list is now:

0 Minimal output ("quiet")
1 Describe what is occurring
2 Describe what is occurring and echo the actual command
3 Ignore the effect of the "@" prefix in make commands
4 Trace shell commands using the shell's -x flag

The default remains MAKEVERBOSE=2.


# 1.79 09-Nov-2008 mrg

- retire MKXORG from public use
- introduce X11FLAVOUR to choose src/x11 vs src/external/mit/xorg
for the X11 to build if MKX11=yes is set. it takes the values
of either Xorg or XFree86.
- default to Xorg on alpha, i386, macppc, shark, sparc and sparc64
- remove MKXORG_WITH_XSRC_XSERVER, unused and never useful


Revision tags: netbsd-5-base matt-mips64-base2
# 1.78 24-Sep-2008 apb

branches: 1.78.2;
regen for recent change to examples and objdir advice,
and for the older MKSTRIPIDENT change.


Revision tags: wrstuden-revivesa-base-3 wrstuden-revivesa-base-2
# 1.77 06-Sep-2008 lukem

regen for MKHTML


# 1.76 28-Aug-2008 lukem

Improve support for MKXORG!=no to enable builds into external/mit/xorg.
This will be mutually exclusive to MKX11!=no.


# 1.75 18-Aug-2008 lukem

Document "build.sh cleandir".
Fix formatting nit.
Remove BUGS; all the in-tree platforms are using build.sh now.


# 1.74 11-Aug-2008 apb

* Suggest a "-j" value between 1+NCPU and 2*NCPU for the fastest builds.
* Remove some duplicated content that appeared in both the section about
make's -j flag and the section about build.sh's -j flag.


# 1.73 05-Aug-2008 apb

* Add more detail for build.sh -M and -O options.
* Mention new default when source is /usr/src but build.sh is run
with neither -M nor -O.


# 1.72 05-Aug-2008 perry

Builds now use "BUILDSEED" so that c++ binaries are reproduceable.
By default BUILDSEED is set to NetBSD-{majorversion} -- a -S flag may
be used to change it.

Discussed on tech-toolchain.


Revision tags: wrstuden-revivesa-base-1 yamt-pf42-base4 yamt-pf42-base3 hpcarm-cleanup-nbase yamt-pf42-baseX yamt-pf42-base2 wrstuden-revivesa-base keiichi-mipv6-nbase yamt-pf42-base keiichi-mipv6-base
# 1.71 29-Mar-2008 dholland

branches: 1.71.4;
Correct/clarify the default setting of USETOOLS in the previous version.
Noted by apb.


# 1.70 28-Mar-2008 dholland

Assorted updates and clarifications, grammar fixes and wording improvements,
and so on. Significant highlights:
- mention src/tests and reference atf;
- provide examples of MACHINE and MACHINE_ARCH;
- mention that MKOBJ=no is not recommended;
- correct the description of the default setting of USETOOLS;
- document the interactions of build.sh -[uo] with various things;
- document the interactions of build.sh tools and kernel=FOO;
- use a lot fewer parentheses.
Discussed on netbsd-docs.


Revision tags: matt-armv6-nbase
# 1.69 18-Mar-2008 lukem

Consistently document RELEASEDIR/RELEASEMACHINEDIR.


# 1.68 08-Mar-2008 reed

Mention that "build" and "distribution" do not build nor install (to DESTDIR)
a kernel.


Revision tags: cube-autoconf-base matt-armv6-base hpcarm-cleanup-base
# 1.67 23-Nov-2007 sborrill

branches: 1.67.4;
Add support for CDBUILDEXTRA which acts like CDEXTRA to add extra items
to the CD-ROM image.
Make CDEXTRA and CDBUILDEXTRA be able to contain lists of files and directories
which are added in turn.
Add support for CDEXTRA_SKIP which contains a list of fnmatch(3) items to
skip during the copy. This is _very_ useful for skipping CVS dirs for example.
CDBUILDEXTRA and CDEXTRA_SKIP are to be used in Makefiles creating the images,
CDEXTRA remains to be used from build.sh.
Update documentation and build.sh help text to show that -C can be used to
specify a list of files and directories rather than just a single dir.


# 1.66 01-Sep-2007 jnemeth

Convert build.sh iso-dir=directory option to -C cddir as per jmmv@ on
source-changes.


# 1.65 01-Sep-2007 jnemeth

Add an iso-dir=directory option. When combined with iso-image or
iso-image-source, it will cause directory to be added to the CD-ROM image.


# 1.64 30-Aug-2007 jnemeth

describe new iso-image-source target


# 1.63 30-Aug-2007 ad

Remove STATUS paragraph which makes it sound like the build system is
half baked.


Revision tags: matt-mips64-base
# 1.62 13-Apr-2007 apb

branches: 1.62.4;
Document recent changes to "make iso-image".


# 1.61 26-Mar-2007 apb

Document the fact that "make installworld" and "build.sh
installworld=..." do not install the etc or xetc sets. Suggest using
etcupdate(8) and postinstall(8) after installworld.


# 1.60 27-Jan-2007 apb

Try to clarify the description of build.sh -m mach.
Document new evbarm-eb and evbarm-el aliases.


Revision tags: netbsd-4-base
# 1.59 08-Oct-2006 apb

branches: 1.59.2;
Clarify that DESTDIR/OBJDIR/etc are absolute paths, but build.sh
-D/-O/etc allows relative paths.

Closes PR 32345 by Andre Luiz de Oliveira.


# 1.58 29-Sep-2006 apb

Use ${HOST_SH} instead of the host system's /bin/sh wherever possible:

* Describe the HOST_SH variable, and the way build.sh attempts to set it.

* Suggest passing HOST_SH in the environment if /bin/sh is not a working
shell.


Revision tags: abandoned-netbsd-4-base
# 1.57 29-Jan-2006 apb

mkisofs is in pkgsrc/sysutils/cdrtools now, not pkgsrc/sysutils/cdrecord.
Reported by Jukka Salmi.


# 1.56 28-Jan-2006 apb

* Add an "iso-image" target in the top level Makefile,
which invokes make iso-image in the etc directory.
* Add an "iso-image" action in build.sh, which
invokes make iso-image.
* Document the above in doc/BUILDING.mdoc.
* Re-generate BUILDING.

Approved by christos


# 1.55 12-Jan-2006 wiz

Bump date for syspkgs.


# 1.54 04-Jan-2006 apb

Document "make syspkgs" and "build.sh syspkgs".

Reviewed by agc


Revision tags: netbsd-3-1-1-RELEASE netbsd-3-0-3-RELEASE netbsd-3-1-RELEASE netbsd-3-0-2-RELEASE netbsd-3-1-RC4 netbsd-3-1-RC3 netbsd-3-1-RC2 netbsd-3-1-RC1 netbsd-3-0-1-RELEASE netbsd-3-0-RELEASE netbsd-3-0-RC6 netbsd-3-0-RC5 netbsd-3-0-RC4 netbsd-3-0-RC3 netbsd-3-0-RC2 netbsd-3-0-RC1 netbsd-3-base
# 1.53 15-Feb-2005 reed

Document the environment variables for if you need to override or
manually select your compilers.
(And regen BUILDING from doc/BUILDING.mdoc.)


# 1.52 12-Oct-2004 jmc

Fix some typo's/bad wording as highlighted in PR#27219


# 1.51 25-Jun-2004 wiz

regen (Document -h. From Karsten Kruse in PR 25974.
While here, remove a duplicate sentence).


Revision tags: netbsd-2-0-3-RELEASE netbsd-2-1-RELEASE netbsd-2-1-RC6 netbsd-2-1-RC5 netbsd-2-1-RC4 netbsd-2-1-RC3 netbsd-2-1-RC2 netbsd-2-1-RC1 netbsd-2-0-2-RELEASE netbsd-2-0-1-RELEASE netbsd-2-base netbsd-2-0-RELEASE netbsd-2-0-RC5 netbsd-2-0-RC4 netbsd-2-0-RC3 netbsd-2-0-RC2 netbsd-2-0-RC1 netbsd-2-0-base
# 1.50 19-Mar-2004 wiz

Document MKTTINTERP.


# 1.49 06-Feb-2004 lukem

* Document build.sh -X and -x
* Document MKX11 and X11SRCDIR
* Remove note warning against cross-building from systems other than NetBSD;
it works on many other platforms.


# 1.48 29-Dec-2003 jmc

Note tools/compat/README as the place to get notes from non-native cross builds


# 1.47 19-Dec-2003 zuntum

Change -v to -V in the following section:

"Print make(1)'s idea of the value of var. Does not build any targets."

To reflect reality.

Found by Tomasz Marciniak <Tomasz.Marciniak@felix.fizyka.amu.edu.pl>, thanks!


# 1.46 26-Oct-2003 lukem

Improve how build.sh -N and MAKEVERBOSE interoperate;
rather than adding '-s' to make's command line in the makewrapper,
use the .SILENT target based on MAKEVERBOSE's value.

This means that you can do:
./build.sh -N 1 makewrapper

$TOOLDIR/bin/nbmake-$MACHINE
# runs at MAKEVERBOSE==1, with command lines suppressed

$TOOLDIR/bin/nbmake-$MACHINE MAKEVERBOSE=2
# runs at MAKEVERBOSE==2 for this invocation, with command lines shown


# 1.45 25-Oct-2003 lukem

Implement build -N noisy, which sets MAKEVERBOSE to noisy and adds
`-s' to MAKEFLAGS for noisy < 2.


# 1.44 29-Sep-2003 lukem

regenerate for "%" prompt update


# 1.43 19-Aug-2003 martti

Backout the previous commit


# 1.42 19-Aug-2003 martti

Remove # from the example.


# 1.41 08-Aug-2003 lukem

fix description of MAKEOBJDIR. from Martin Husemann


# 1.40 29-Jul-2003 lukem

Add build.sh -Z var, to unset a variable and ensure it's unset in makewrapper.
For -M MAKEOBJDIRPREFIX, unset MAKEOBJDIR.
For -O MAKEOBJDIR, unset MAKEOBJDIRPREFIX.


# 1.39 18-Jul-2003 lukem

fix default location of TOOLDIR


# 1.38 18-Jul-2003 lukem

Update for the MKUNPRIVED/MKUPDATE changes.


# 1.37 18-Jul-2003 lukem

rebuild with new groff


# 1.36 03-Jul-2003 lukem

attempt to clarify how MAKEOBJDIR{,PREFIX} may be provided ...
(this document needs a rototill, which i may get to whilst writing a
paper about build.sh)


# 1.35 25-May-2003 lukem

all:
* add "releasekernel=conf", to install a gzipped copy of the kernels
built by "kernel=conf" to RELEASEDIR/MACHINE/binary/kernel

build.sh:
* be more consistent in various status messages
* move the {release,}kernel=conf conf parsing code into getkernelconf()
and use in both buildkernel() and releasekernel()
* only warn once when building multiple kernels without updating the tools


# 1.34 18-May-2003 lukem

For normal builds, MKOBJDIRS default to `no' (not `yes').
It's only build.sh that sets this to `yes' by default.
Noted by OGAWA Takaya in [toolchain/19823]


# 1.33 17-May-2003 lukem

improve description of how "build.sh -m mach" sets the default
MACHINE_ARCH, and list the special cases that this does not occur for.


# 1.32 10-May-2003 lukem

crank date for previous


# 1.31 10-May-2003 lukem

Add "sourcesets" argument/target, which builds source sets into
RELEASEDIR/source/sets


# 1.30 08-May-2003 lukem

build.sh now provides defaults for DESTDIR and RELEASEDIR if not expert mode.
Remove -D and -R from EXAMPLES since they're not necessary any more.


# 1.29 08-Feb-2003 lukem

Fix example 3; the build.sh target is "install" not "installworld".
Improve description.
Noted by Valeriy Ushakov (uwe@) in private email.


# 1.28 02-Feb-2003 lukem

attempt to further improve and clarify the examples...


# 1.27 30-Jan-2003 lukem

Prefix various paths with 'DESTDIR', to highlight that the DESTDIR
is taken into account.


# 1.26 29-Jan-2003 lukem

allow toolprefix to be easily changed


# 1.25 26-Jan-2003 lukem

Various improvements per discussion with Alan Barrett.


# 1.24 26-Jan-2003 lukem

- Add "sets" top-level Makefile target and build.sh operation.
[Latter suggested by Julio Merino in private email]
- Add "help" build.sh operation.


# 1.23 26-Jan-2003 lukem

Change build.sh so that at least one operation is required.
Add "makewrapper" operation to build.sh.
[The above changes were suggested by Alan Barrett on current-users@]

Fail if building as non-root unless: UNPRIVED is set, -U is given, or -E
(expert mode) is given.
[Suggested by James Wetterau in private email]

Improve the examples in BUILDING.


# 1.22 23-Jan-2003 lukem

Rework how build.sh functions, so that command line options set various
parameters, and a list of "operations" defines what to do.
The full usage is show below. Notes:
`-b' has been deprecated (it always occurs now)
`-d' is replaced by "distribution"
`-R rel' onlys sets RELEASEDIR; use "release" to build a release
`-k kern' has been replaced by "kernel=kern"
`-i idir' has been replaced by "install=idir"
-r now occurs before nbmake is rebuilt

Add a copyright (long due!). Rework the code to (a KNF inspired) ShellNF.
Use functions appropriately. Allow `nb' prefix to be easily changed to
something else. Solve world peace (just kidding)

This is part of the (never achievable) goal of attempting to make
NetBSD easier to build...


--8<-- new usage follows --8<--

Usage: build.sh [-EnorUu] [-a arch] [-B buildid] [-D dest] [-j njob] [-M obj]
[-m mach] [-O obj] [-R release] [-T tools] [-V var=[value]]
[-w wrapper] [operation [...] ]

System build operations (all imply "obj" and "tools"):
build Run "make build"
distribution Run "make distribution" (includes etc/ files)
release Run "make release" (includes kernels & distrib media)

Other operations:
obj Run "make obj" (default unless -o)
tools Build and install tools
kernel=conf Build kernel with config file `conf'
install=idir Run "make installworld" to `idir'
(useful after 'distribution' or 'release')

Options:
-a arch Set MACHINE_ARCH to arch (otherwise deduced from MACHINE)
-B buildId Set BUILDID to buildId
-D dest Set DESTDIR to dest
-E Set "expert" mode; disables some DESTDIR checks
-j njob Run up to njob jobs in parallel; see make(1)
-M obj Set obj root directory to obj (sets MAKEOBJDIRPREFIX)
-m mach Set MACHINE to mach (not required if NetBSD native)
-n Show commands that would be executed, but do not execute them
-O obj Set obj root directory to obj (sets a MAKEOBJDIR pattern)
-o Set MKOBJDIRS=no (do not create objdirs at start of build)
-R release Set RELEASEDIR to release
-r Remove contents of TOOLDIR and DESTDIR before building
-T tools Set TOOLDIR to tools. If unset, and TOOLDIR is not set in
the environment, nbmake will be (re)built unconditionally.
-U Set UNPRIVED
-u Set UPDATE
-V v=[val] Set variable `v' to `val'
-w wrapper Create nbmake script as wrapper
(default: ${TOOLDIR}/bin/nbmake-${MACHINE})


# 1.21 04-Jan-2003 lukem

Add "-V var=[value]", for setting arbitrary variables which will also
be added to the nbmake-${MACHINE} wrapper.
Useful for setting RELEASEDIR, without -R's habit of building a release.


Revision tags: fvdl_fs64_base
# 1.20 25-Dec-2002 lukem

Document:
* build.sh -i idir
* top level targets: distribution, buildworld, installworld
* top level variables: INSTALLWORLDDIR


# 1.19 08-Dec-2002 lukem

Add -E - "expert mode". If this is not specified, builds to DESTDIR=/ are
not permitted.
By using this flag, you are taking responsibility for any issues that
may occur because of this...


# 1.18 08-Dec-2002 lukem

- be consistent about option ordering in build.sh usage display
- use Fl and Ar instead of Sy and Em to format options


# 1.17 25-Nov-2002 wiz

Update location of BUILDING.mdoc.


# 1.16 20-Oct-2002 lukem

regen for build.sh -k


# 1.15 21-Sep-2002 lukem

regen for: USE_NEW_TOOLCHAIN was replaced with TOOLCHAIN_MISSING


# 1.14 17-Sep-2002 fredb

Expand on the difference between ``build.sh -d'' and ``make install'',
as requested by Brian Stark in PR toolchain/18228 (which this closes).


# 1.13 22-Jul-2002 wiz

Remove duplicate 'files'. From Ryo HAYASAKA in toolchain/17674.


Revision tags: netbsd-1-6-PATCH002-RC3 netbsd-1-6-PATCH002-RC2 netbsd-1-6-PATCH002-RC1 netbsd-1-6-PATCH001 netbsd-1-6-PATCH001-RELEASE netbsd-1-6-PATCH001-RC3 netbsd-1-6-PATCH001-RC2 netbsd-1-6-PATCH001-RC1 netbsd-1-6-RELEASE netbsd-1-6-RC3 netbsd-1-6-RC2 netbsd-1-6-RC1 netbsd-1-6-base
# 1.12 13-May-2002 lukem

branches: 1.12.2;
add "-M makeobjdirprefix" to build.sh


# 1.11 03-May-2002 lukem

Move the METALOG from ${_SRC_TOP_OBJ_} to ${DESTDIR}.

There were too many synchronisation problems with using the former;
including situations such as a "make clean" performed between two
installs to the same DESTDIR would result in a truncated METALOG and
the resultant sets would be missing stuff such as include files that
don't get reinstalled if they haven't changed, even with !UPDATE.


# 1.10 02-May-2002 sommerfeld

Re-gen.


# 1.9 14-Mar-2002 thorpej

Add a -B option to set the BUILDID for the build. This also causes
the make(1) wrapper script to be named "nbmake-MACHINE-BUILDID".


# 1.8 05-Mar-2002 lukem

document various supported environment variables, including MAKEOBJDIRPREFIX


# 1.7 04-Mar-2002 lukem

document:
- make's UNPRIVED support
- build.sh's -U support
- the build system currently needs to build onto a file system with
long file name and hard link support


# 1.6 25-Nov-2001 thorpej

Document the -d option to build.sh


# 1.5 15-Nov-2001 tv

Note only <bsd.own.mk> as the authority for determining whether the new
BUILDING instructions should be used.


# 1.4 14-Nov-2001 tv

Turn off host-specific objdirs by default. Set MKHOSTOBJ=yes to enable.


# 1.3 12-Nov-2001 tv

Major overhaul of src/tools and host toolchain. Summary of changes:

* Rewrite src/tools Make logic to work like the rest of the tree wrt
"dependall" and "install". The old "make build" hack is gone.

* Remove the MKTOOLS logic. This was linked to the "make build" hack,
and was only needed because TOOLDIR originally had no writable default.

* Redo the GNU configure/make logic to make it fit reasonably in a
BSD make wrapper. Use new ${.ALLTARGETS} variable to scan for
targets in $(srcdir), and mark them with .MADE: to prevent rebuilding.

* Only build cross tools in src/tools; remove some messy logic in
src/usr.* and src/gnu/usr.* that would do target filename rewriting
(improves consistency and readability).

* Add the ability to build cross gdb at tool build time by setting
MKCROSSGDB (default no) to "yes" in mk.conf.

* Add src/tools/groff and set up paths to work with this cross groff.


# 1.2 08-Nov-2001 wiz

Remove mention of BUILDLING.html, and follow rename of BUILDING.txt to
BUILDING.
Noted by Love <lha@stacken.kth.se> on tech-toolchain.


# 1.1 01-Nov-2001 tv

By popular demand, one preformatted version of BUILDING, plaintext, no CRs.


# 1.141 20-Dec-2021 christos

Rename:
MKKDEBUG -> MKDEBUGKERNEL
MKTOOLSDEBUG -> MKDEBUGTOOLS
while keeping compatibility with the old names. Add missing documentation.
Now all debugging tunables are prefixed with MKDEBUG.


Revision tags: cjep_sun2x-base1 cjep_sun2x-base cjep_staticlib_x-base1 cjep_staticlib_x-base
# 1.140 10-Nov-2020 kamil

Reintroduce the support of MKCATPAGES

Requested by <mrg>


# 1.139 08-Nov-2020 kamil

Remove the support for MKCATPAGES

It was optional since 1999 and disabled by default since 2012.

Proposed on tech-userlevel@.


# 1.138 13-Oct-2020 thorpej

Document CPUFLAGS here (it's already documented in share/mk/bsd.README).
This will address the initial concern in PR port-alpha/55545.


# 1.137 12-Oct-2020 uwe

Mention HOST_CFLAGS and HOST_CXXFLAGS.


# 1.136 12-Oct-2020 uwe

Bump date and regen for BUILDING.mdoc revision 1.127
that introduced build.sh -c <compiler> option.


Revision tags: netbsd-9-2-RELEASE netbsd-9-1-RELEASE phil-wifi-20200421 phil-wifi-20200411 is-mlppp-base phil-wifi-20200406 netbsd-9-0-RELEASE netbsd-9-0-RC2 netbsd-9-0-RC1 phil-wifi-20191119 netbsd-9-base phil-wifi-20190609
# 1.135 08-May-2019 leot

Fix a typo

Reported by Tobias Ulmer via netbsd-docs@ ML, thanks!


Revision tags: pgoyette-compat-20190127 pgoyette-compat-20190118 pgoyette-compat-1226 pgoyette-compat-1126 pgoyette-compat-1020 pgoyette-compat-0930 pgoyette-compat-0906
# 1.134 29-Jul-2018 sevan

regen


Revision tags: pgoyette-compat-0728 phil-wifi-base pgoyette-compat-0625 pgoyette-compat-0521
# 1.133 02-May-2018 pgoyette

branches: 1.133.2;
Re-add files that were accidentally deleted in my previous commit.


# 1.132 02-May-2018 pgoyette

Synch with HEAD


Revision tags: pgoyette-compat-0502 pgoyette-compat-0422 pgoyette-compat-0415 pgoyette-compat-0407 pgoyette-compat-0330 pgoyette-compat-0322 pgoyette-compat-0315 pgoyette-compat-base
# 1.131 16-Feb-2018 leot

branches: 1.131.2;
regen


# 1.130 29-Dec-2017 sevan

regen


# 1.129 21-Oct-2017 sevan

regen


Revision tags: netbsd-8-2-RELEASE netbsd-8-1-RELEASE netbsd-8-1-RC1 netbsd-8-0-RELEASE netbsd-8-0-RC2 netbsd-8-0-RC1 matt-nb8-mediatek-base perseant-stdc-iso10646-base netbsd-8-base
# 1.128 21-May-2017 riastradh

regen


Revision tags: prg-localcount2-base3 prg-localcount2-base2 prg-localcount2-base1 prg-localcount2-base pgoyette-localcount-20170426
# 1.127 22-Apr-2017 plunky

regen


Revision tags: bouyer-socketcan-base1
# 1.126 20-Apr-2017 wiz

regen using regen target in doc.


# 1.125 20-Apr-2017 ozaki-r

Introduce MKSTRIPSYM build option

If it's yes, all local symbols of shared libraries are stripped
(default). If it's no, only temporary local symbols are stripped;
for example, symbols of static functions are kept. Keeping such
symbols is useful on using DTrace for userland libraries and
getting a backtrace from a rump server loading modules (shared
libraries).

Proposed and discussed on tech-kern and tech-toolchain


Revision tags: pgoyette-localcount-20170320
# 1.124 20-Feb-2017 christos

regen


# 1.123 16-Feb-2017 rin

The default values for MKPIC are yes and no for sh3 and m68000, respectively.
Bump date.


Revision tags: bouyer-socketcan-base pgoyette-localcount-20170107 pgoyette-localcount-20161104 localcount-20160914 pgoyette-localcount-20160806 pgoyette-localcount-20160726 pgoyette-localcount-base
# 1.122 29-Jan-2016 wiz

branches: 1.122.2; 1.122.4;
Document MKREPRO_TIMESTAMP.


# 1.121 23-Jul-2015 mrg

remove the xfree86 reachover makefiles and the vast majority of
the support in the rest of the source tree.

X11 sets could use some cleaning up perhaps (just deletion, as
we've never really marked the old X11R6 as obsolete for native
xorg using platforms so far either.)


# 1.120 07-Jun-2015 pgoyette

Update to reflect changes made in rev 1.398 of src/etc/Makefile


# 1.119 08-Apr-2015 wiz

regen


# 1.118 30-Nov-2014 uebayasi

regen


# 1.117 16-Nov-2014 uebayasi

regen


# 1.116 16-Nov-2014 uebayasi

regen


# 1.115 13-Nov-2014 apb

regen from doc/BUILDING.mdoc revision 1.107.
This reinstates documentation for "extsrc" which was lost in 2009.


# 1.114 08-Nov-2014 snj

fourth time's the charm, i guess. when committing a generated file,
it's best to use the latest revision of the source file (hi uebs!)

regen to include changes from revision 1.105 of doc/BUILDING.mdoc


# 1.113 06-Nov-2014 uebayasi

regen


# 1.112 06-Nov-2014 uebayasi

Expand TABs.


# 1.111 06-Nov-2014 uebayasi

Document the new "kernels" operation, prompted by joerg@.


# 1.110 05-Nov-2014 snj

regen


Revision tags: netbsd-7-base tls-earlyentropy-base tls-maxphys-base
# 1.109 07-Aug-2014 apb

branches: 1.109.2;
regen BUILDING from doc/BUILDING.mdoc


# 1.108 03-Aug-2014 apb

BUILDINFO part6: regen BUILDING from doc/BUILDING.mdoc


# 1.107 14-Jun-2014 apb

Regen from doc/BUILDING.mdoc;1.100:
Improve documentation for BUILDID.


# 1.106 21-May-2014 wiz

regen


Revision tags: yamt-pagecache-base9 riastradh-xf86-video-intel-2-7-1-pre-2-21-15 riastradh-drm2-base3 riastradh-drm2-base2 riastradh-drm2-base1 riastradh-drm2-base
# 1.105 29-May-2013 wiz

branches: 1.105.4;
regen using 'make regen' from src/doc.


# 1.104 29-May-2013 wiz

regen (using mandoc doc/BUILDING.mdoc > BUILDING -- let me know
if a different way is preferred, I see that it now contains formatting).


Revision tags: agc-symver-base yamt-pagecache-base8 yamt-pagecache-base7
# 1.103 08-Nov-2012 dholland

regen


Revision tags: yamt-pagecache-base6
# 1.102 19-Sep-2012 abs

regen


# 1.101 25-May-2012 wiz

branches: 1.101.2;
regen using 'make regen' in doc/


# 1.100 25-May-2012 wiz

Document MKREPRO using joerg's wording.


Revision tags: yamt-pagecache-base5 yamt-pagecache-base4
# 1.99 23-Feb-2012 tsutsui

Add a missing period.


Revision tags: netbsd-6-base
# 1.98 14-Feb-2012 apb

branches: 1.98.2;
Regen from revision 1.87 of doc/BUILDING.mdoc.


# 1.97 22-Jan-2012 tsutsui

Add "live-image" and "install-image" target support to build.sh.

"live-image" target builds pre-installed disk images that can be used on
emulators or boot from USB memory sticks to try NetBSD without installation.
Currently amd64, i386, pmax, sparc, sparc64, sun2, sun3, and vax
(which have working emulators and don't require extra tools like preparing
msdosfs or partitioning MD label structures) support this target.

"install-image" target builds an bootable installation disk image that can
be used as an install CD but burned into USB memory sticks etc.
Current only amd64 and i386 (which would support USB boot) have this target.

For more details (and known issue) see following posts on netbsd-bugs@:
http://mail-index.NetBSD.org/netbsd-bugs/2011/08/06/msg023639.html
http://mail-index.NetBSD.org/netbsd-bugs/2011/09/23/msg024207.html
http://mail-index.NetBSD.org/netbsd-bugs/2011/12/07/msg025166.html
http://mail-index.NetBSD.org/netbsd-bugs/2011/12/08/msg025178.html

No particular comments about implementation, and
"go ahead" comments from mrg@, riz@ and christos@.

Closes PR toolchain/45153 and PR misc/45155.


Revision tags: yamt-pagecache-base3 yamt-pagecache-base2 yamt-pagecache-base
# 1.96 09-Sep-2011 apb

branches: 1.96.2;
Add tests for the shell under which build.sh is run. If the
shell fails the tests, then build.sh tries to re-exec itself
under a more suitable shell.


# 1.95 09-Sep-2011 apb

Revisions 1.92 and 1.93 of src/BUILDING were not reflected in
src/doc/BUILDING.mdoc, so those changes were lost when src/BUILDING
was regenerated in revision 1.94.

Now update src/doc/BUILDING.mdoc and regenerate src/BUILDING to
reinstate the lost changes. (I also edited one of the changes, to use
the phrase "space-separated list" for consistency with other parts of
the document.)

The original changes were:


# 1.93 06-Aug-2011 jnemeth

Add description of MKKMOD, part of PR misc/45216


Revision tags: cherry-xenmp-base bouyer-quota2-nbase bouyer-quota2-base
# 1.92 29-Jan-2011 jym

Pass down INSTALLSETS variable to installsets target. Use :Q to escape
shell meta-characters, as the variable contains a list of sets, separated
by spaces.

$ ./build.sh -V INSTALLSETS="base etc" install=idir

should now work as expected.

Reviewed by apb@ on tech-toolchain.


# 1.94 09-Sep-2011 apb

Allow MAKEFLAGS to be set via build.sh -V. Somebody asked for this
in 2008.

Also add comments above a few functions in build.sh, and bump copyright
dates.


# 1.93 06-Aug-2011 jnemeth

Add description of MKKMOD, part of PR misc/45216


Revision tags: cherry-xenmp-base bouyer-quota2-nbase bouyer-quota2-base
# 1.92 29-Jan-2011 jym

Pass down INSTALLSETS variable to installsets target. Use :Q to escape
shell meta-characters, as the variable contains a list of sets, separated
by spaces.

$ ./build.sh -V INSTALLSETS="base etc" install=idir

should now work as expected.

Reviewed by apb@ on tech-toolchain.


Revision tags: matt-mips64-premerge-20101231
# 1.91 25-Jul-2010 mrg

branches: 1.91.2;
remove the MKSUBPIXEL/MKTTINTERP options; they're going away.

regenerate.


Revision tags: matt-premerge-20091211
# 1.90 30-Nov-2009 uebayasi

Support "extsrc", externally added programs and libraries. Users can write
their own reach-overs, cross-build, install, and get set files just like base
and X11 / X.org. (These sets are not included as TNF releases.)


# 1.89 10-Oct-2009 apb

If ${NETBDSRCDIR}/../xsrc exists, then use it as the default value
of X11SRCDIR. If it doesn't exist, then use /usr/xsrc as before.

OK mrg


# 1.88 27-Sep-2009 apb

* Use a more robust method of creating the top level object directory.
Use getmakevar to expand MAKEOBJDIRPREFIX or MAKEOBJDIR, or (if
neither of those variables is set) use a non-recursive "make obj" in
the top level source directory.

* Do not let TOP_objdir default to ${TOP}. It's now set only by the
-M or -O command line options, or after using getmakevar to expand
MAKEOBJDIRPREFIX or MAKEOBJDIR.

* Make try_set_TOOLDIR handle MAKEOBJDIRPERFIX passed from the
environment. It runs too early to use getmakevar, so it will not work
if the value contains embedded '${...}' variable references.

* Use '$TOOLDIR' (with a literal '$') instead of 'nonexistent' in
a message when rebuilding make when TOOLDIR is not yet known.


# 1.87 27-Sep-2009 apb

Allow build.sh "-C cdextra" option to be specified multiple times.


# 1.86 07-Sep-2009 jnemeth

Add a modules operation to build.sh, which builds and installs kernel modules
into DESTDIR.

This is based on the patch provided by tsutsui@ on tech-toolchain@.


# 1.85 12-Jul-2009 hubertf

regen


# 1.84 12-Jul-2009 hubertf

regen


Revision tags: jym-xensuspend-nbase jym-xensuspend-base
# 1.83 01-May-2009 snj

Introduce MKSUBPIXEL, which allows enabling subpixel rendering code
in FreeType.


# 1.82 02-Dec-2008 mrg

branches: 1.82.2;
be explicit about MAKEOBJDIR and MAKEOBJDIRPREFIX not being for
mk.conf or ${MAKECONF}.


# 1.81 15-Nov-2008 mrg

revert sparc back to default of XFree86 at the request of macallan.


# 1.80 13-Nov-2008 apb

Add support for new MAKEVERBOSE levels 3 and 4. The complete list is now:

0 Minimal output ("quiet")
1 Describe what is occurring
2 Describe what is occurring and echo the actual command
3 Ignore the effect of the "@" prefix in make commands
4 Trace shell commands using the shell's -x flag

The default remains MAKEVERBOSE=2.


# 1.79 09-Nov-2008 mrg

- retire MKXORG from public use
- introduce X11FLAVOUR to choose src/x11 vs src/external/mit/xorg
for the X11 to build if MKX11=yes is set. it takes the values
of either Xorg or XFree86.
- default to Xorg on alpha, i386, macppc, shark, sparc and sparc64
- remove MKXORG_WITH_XSRC_XSERVER, unused and never useful


Revision tags: netbsd-5-base matt-mips64-base2
# 1.78 24-Sep-2008 apb

branches: 1.78.2;
regen for recent change to examples and objdir advice,
and for the older MKSTRIPIDENT change.


Revision tags: wrstuden-revivesa-base-3 wrstuden-revivesa-base-2
# 1.77 06-Sep-2008 lukem

regen for MKHTML


# 1.76 28-Aug-2008 lukem

Improve support for MKXORG!=no to enable builds into external/mit/xorg.
This will be mutually exclusive to MKX11!=no.


# 1.75 18-Aug-2008 lukem

Document "build.sh cleandir".
Fix formatting nit.
Remove BUGS; all the in-tree platforms are using build.sh now.


# 1.74 11-Aug-2008 apb

* Suggest a "-j" value between 1+NCPU and 2*NCPU for the fastest builds.
* Remove some duplicated content that appeared in both the section about
make's -j flag and the section about build.sh's -j flag.


# 1.73 05-Aug-2008 apb

* Add more detail for build.sh -M and -O options.
* Mention new default when source is /usr/src but build.sh is run
with neither -M nor -O.


# 1.72 05-Aug-2008 perry

Builds now use "BUILDSEED" so that c++ binaries are reproduceable.
By default BUILDSEED is set to NetBSD-{majorversion} -- a -S flag may
be used to change it.

Discussed on tech-toolchain.


Revision tags: wrstuden-revivesa-base-1 yamt-pf42-base4 yamt-pf42-base3 hpcarm-cleanup-nbase yamt-pf42-baseX yamt-pf42-base2 wrstuden-revivesa-base keiichi-mipv6-nbase yamt-pf42-base keiichi-mipv6-base
# 1.71 29-Mar-2008 dholland

branches: 1.71.4;
Correct/clarify the default setting of USETOOLS in the previous version.
Noted by apb.


# 1.70 28-Mar-2008 dholland

Assorted updates and clarifications, grammar fixes and wording improvements,
and so on. Significant highlights:
- mention src/tests and reference atf;
- provide examples of MACHINE and MACHINE_ARCH;
- mention that MKOBJ=no is not recommended;
- correct the description of the default setting of USETOOLS;
- document the interactions of build.sh -[uo] with various things;
- document the interactions of build.sh tools and kernel=FOO;
- use a lot fewer parentheses.
Discussed on netbsd-docs.


Revision tags: matt-armv6-nbase
# 1.69 18-Mar-2008 lukem

Consistently document RELEASEDIR/RELEASEMACHINEDIR.


# 1.68 08-Mar-2008 reed

Mention that "build" and "distribution" do not build nor install (to DESTDIR)
a kernel.


Revision tags: cube-autoconf-base matt-armv6-base hpcarm-cleanup-base
# 1.67 23-Nov-2007 sborrill

branches: 1.67.4;
Add support for CDBUILDEXTRA which acts like CDEXTRA to add extra items
to the CD-ROM image.
Make CDEXTRA and CDBUILDEXTRA be able to contain lists of files and directories
which are added in turn.
Add support for CDEXTRA_SKIP which contains a list of fnmatch(3) items to
skip during the copy. This is _very_ useful for skipping CVS dirs for example.
CDBUILDEXTRA and CDEXTRA_SKIP are to be used in Makefiles creating the images,
CDEXTRA remains to be used from build.sh.
Update documentation and build.sh help text to show that -C can be used to
specify a list of files and directories rather than just a single dir.


# 1.66 01-Sep-2007 jnemeth

Convert build.sh iso-dir=directory option to -C cddir as per jmmv@ on
source-changes.


# 1.65 01-Sep-2007 jnemeth

Add an iso-dir=directory option. When combined with iso-image or
iso-image-source, it will cause directory to be added to the CD-ROM image.


# 1.64 30-Aug-2007 jnemeth

describe new iso-image-source target


# 1.63 30-Aug-2007 ad

Remove STATUS paragraph which makes it sound like the build system is
half baked.


Revision tags: matt-mips64-base
# 1.62 13-Apr-2007 apb

branches: 1.62.4;
Document recent changes to "make iso-image".


# 1.61 26-Mar-2007 apb

Document the fact that "make installworld" and "build.sh
installworld=..." do not install the etc or xetc sets. Suggest using
etcupdate(8) and postinstall(8) after installworld.


# 1.60 27-Jan-2007 apb

Try to clarify the description of build.sh -m mach.
Document new evbarm-eb and evbarm-el aliases.


Revision tags: netbsd-4-base
# 1.59 08-Oct-2006 apb

branches: 1.59.2;
Clarify that DESTDIR/OBJDIR/etc are absolute paths, but build.sh
-D/-O/etc allows relative paths.

Closes PR 32345 by Andre Luiz de Oliveira.


# 1.58 29-Sep-2006 apb

Use ${HOST_SH} instead of the host system's /bin/sh wherever possible:

* Describe the HOST_SH variable, and the way build.sh attempts to set it.

* Suggest passing HOST_SH in the environment if /bin/sh is not a working
shell.


Revision tags: abandoned-netbsd-4-base
# 1.57 29-Jan-2006 apb

mkisofs is in pkgsrc/sysutils/cdrtools now, not pkgsrc/sysutils/cdrecord.
Reported by Jukka Salmi.


# 1.56 28-Jan-2006 apb

* Add an "iso-image" target in the top level Makefile,
which invokes make iso-image in the etc directory.
* Add an "iso-image" action in build.sh, which
invokes make iso-image.
* Document the above in doc/BUILDING.mdoc.
* Re-generate BUILDING.

Approved by christos


# 1.55 12-Jan-2006 wiz

Bump date for syspkgs.


# 1.54 04-Jan-2006 apb

Document "make syspkgs" and "build.sh syspkgs".

Reviewed by agc


Revision tags: netbsd-3-1-1-RELEASE netbsd-3-0-3-RELEASE netbsd-3-1-RELEASE netbsd-3-0-2-RELEASE netbsd-3-1-RC4 netbsd-3-1-RC3 netbsd-3-1-RC2 netbsd-3-1-RC1 netbsd-3-0-1-RELEASE netbsd-3-0-RELEASE netbsd-3-0-RC6 netbsd-3-0-RC5 netbsd-3-0-RC4 netbsd-3-0-RC3 netbsd-3-0-RC2 netbsd-3-0-RC1 netbsd-3-base
# 1.53 15-Feb-2005 reed

Document the environment variables for if you need to override or
manually select your compilers.
(And regen BUILDING from doc/BUILDING.mdoc.)


# 1.52 12-Oct-2004 jmc

Fix some typo's/bad wording as highlighted in PR#27219


# 1.51 25-Jun-2004 wiz

regen (Document -h. From Karsten Kruse in PR 25974.
While here, remove a duplicate sentence).


Revision tags: netbsd-2-0-3-RELEASE netbsd-2-1-RELEASE netbsd-2-1-RC6 netbsd-2-1-RC5 netbsd-2-1-RC4 netbsd-2-1-RC3 netbsd-2-1-RC2 netbsd-2-1-RC1 netbsd-2-0-2-RELEASE netbsd-2-0-1-RELEASE netbsd-2-base netbsd-2-0-RELEASE netbsd-2-0-RC5 netbsd-2-0-RC4 netbsd-2-0-RC3 netbsd-2-0-RC2 netbsd-2-0-RC1 netbsd-2-0-base
# 1.50 19-Mar-2004 wiz

Document MKTTINTERP.


# 1.49 06-Feb-2004 lukem

* Document build.sh -X and -x
* Document MKX11 and X11SRCDIR
* Remove note warning against cross-building from systems other than NetBSD;
it works on many other platforms.


# 1.48 29-Dec-2003 jmc

Note tools/compat/README as the place to get notes from non-native cross builds


# 1.47 19-Dec-2003 zuntum

Change -v to -V in the following section:

"Print make(1)'s idea of the value of var. Does not build any targets."

To reflect reality.

Found by Tomasz Marciniak <Tomasz.Marciniak@felix.fizyka.amu.edu.pl>, thanks!


# 1.46 26-Oct-2003 lukem

Improve how build.sh -N and MAKEVERBOSE interoperate;
rather than adding '-s' to make's command line in the makewrapper,
use the .SILENT target based on MAKEVERBOSE's value.

This means that you can do:
./build.sh -N 1 makewrapper

$TOOLDIR/bin/nbmake-$MACHINE
# runs at MAKEVERBOSE==1, with command lines suppressed

$TOOLDIR/bin/nbmake-$MACHINE MAKEVERBOSE=2
# runs at MAKEVERBOSE==2 for this invocation, with command lines shown


# 1.45 25-Oct-2003 lukem

Implement build -N noisy, which sets MAKEVERBOSE to noisy and adds
`-s' to MAKEFLAGS for noisy < 2.


# 1.44 29-Sep-2003 lukem

regenerate for "%" prompt update


# 1.43 19-Aug-2003 martti

Backout the previous commit


# 1.42 19-Aug-2003 martti

Remove # from the example.


# 1.41 08-Aug-2003 lukem

fix description of MAKEOBJDIR. from Martin Husemann


# 1.40 29-Jul-2003 lukem

Add build.sh -Z var, to unset a variable and ensure it's unset in makewrapper.
For -M MAKEOBJDIRPREFIX, unset MAKEOBJDIR.
For -O MAKEOBJDIR, unset MAKEOBJDIRPREFIX.


# 1.39 18-Jul-2003 lukem

fix default location of TOOLDIR


# 1.38 18-Jul-2003 lukem

Update for the MKUNPRIVED/MKUPDATE changes.


# 1.37 18-Jul-2003 lukem

rebuild with new groff


# 1.36 03-Jul-2003 lukem

attempt to clarify how MAKEOBJDIR{,PREFIX} may be provided ...
(this document needs a rototill, which i may get to whilst writing a
paper about build.sh)


# 1.35 25-May-2003 lukem

all:
* add "releasekernel=conf", to install a gzipped copy of the kernels
built by "kernel=conf" to RELEASEDIR/MACHINE/binary/kernel

build.sh:
* be more consistent in various status messages
* move the {release,}kernel=conf conf parsing code into getkernelconf()
and use in both buildkernel() and releasekernel()
* only warn once when building multiple kernels without updating the tools


# 1.34 18-May-2003 lukem

For normal builds, MKOBJDIRS default to `no' (not `yes').
It's only build.sh that sets this to `yes' by default.
Noted by OGAWA Takaya in [toolchain/19823]


# 1.33 17-May-2003 lukem

improve description of how "build.sh -m mach" sets the default
MACHINE_ARCH, and list the special cases that this does not occur for.


# 1.32 10-May-2003 lukem

crank date for previous


# 1.31 10-May-2003 lukem

Add "sourcesets" argument/target, which builds source sets into
RELEASEDIR/source/sets


# 1.30 08-May-2003 lukem

build.sh now provides defaults for DESTDIR and RELEASEDIR if not expert mode.
Remove -D and -R from EXAMPLES since they're not necessary any more.


# 1.29 08-Feb-2003 lukem

Fix example 3; the build.sh target is "install" not "installworld".
Improve description.
Noted by Valeriy Ushakov (uwe@) in private email.


# 1.28 02-Feb-2003 lukem

attempt to further improve and clarify the examples...


# 1.27 30-Jan-2003 lukem

Prefix various paths with 'DESTDIR', to highlight that the DESTDIR
is taken into account.


# 1.26 29-Jan-2003 lukem

allow toolprefix to be easily changed


# 1.25 26-Jan-2003 lukem

Various improvements per discussion with Alan Barrett.


# 1.24 26-Jan-2003 lukem

- Add "sets" top-level Makefile target and build.sh operation.
[Latter suggested by Julio Merino in private email]
- Add "help" build.sh operation.


# 1.23 26-Jan-2003 lukem

Change build.sh so that at least one operation is required.
Add "makewrapper" operation to build.sh.
[The above changes were suggested by Alan Barrett on current-users@]

Fail if building as non-root unless: UNPRIVED is set, -U is given, or -E
(expert mode) is given.
[Suggested by James Wetterau in private email]

Improve the examples in BUILDING.


# 1.22 23-Jan-2003 lukem

Rework how build.sh functions, so that command line options set various
parameters, and a list of "operations" defines what to do.
The full usage is show below. Notes:
`-b' has been deprecated (it always occurs now)
`-d' is replaced by "distribution"
`-R rel' onlys sets RELEASEDIR; use "release" to build a release
`-k kern' has been replaced by "kernel=kern"
`-i idir' has been replaced by "install=idir"
-r now occurs before nbmake is rebuilt

Add a copyright (long due!). Rework the code to (a KNF inspired) ShellNF.
Use functions appropriately. Allow `nb' prefix to be easily changed to
something else. Solve world peace (just kidding)

This is part of the (never achievable) goal of attempting to make
NetBSD easier to build...


--8<-- new usage follows --8<--

Usage: build.sh [-EnorUu] [-a arch] [-B buildid] [-D dest] [-j njob] [-M obj]
[-m mach] [-O obj] [-R release] [-T tools] [-V var=[value]]
[-w wrapper] [operation [...] ]

System build operations (all imply "obj" and "tools"):
build Run "make build"
distribution Run "make distribution" (includes etc/ files)
release Run "make release" (includes kernels & distrib media)

Other operations:
obj Run "make obj" (default unless -o)
tools Build and install tools
kernel=conf Build kernel with config file `conf'
install=idir Run "make installworld" to `idir'
(useful after 'distribution' or 'release')

Options:
-a arch Set MACHINE_ARCH to arch (otherwise deduced from MACHINE)
-B buildId Set BUILDID to buildId
-D dest Set DESTDIR to dest
-E Set "expert" mode; disables some DESTDIR checks
-j njob Run up to njob jobs in parallel; see make(1)
-M obj Set obj root directory to obj (sets MAKEOBJDIRPREFIX)
-m mach Set MACHINE to mach (not required if NetBSD native)
-n Show commands that would be executed, but do not execute them
-O obj Set obj root directory to obj (sets a MAKEOBJDIR pattern)
-o Set MKOBJDIRS=no (do not create objdirs at start of build)
-R release Set RELEASEDIR to release
-r Remove contents of TOOLDIR and DESTDIR before building
-T tools Set TOOLDIR to tools. If unset, and TOOLDIR is not set in
the environment, nbmake will be (re)built unconditionally.
-U Set UNPRIVED
-u Set UPDATE
-V v=[val] Set variable `v' to `val'
-w wrapper Create nbmake script as wrapper
(default: ${TOOLDIR}/bin/nbmake-${MACHINE})


# 1.21 04-Jan-2003 lukem

Add "-V var=[value]", for setting arbitrary variables which will also
be added to the nbmake-${MACHINE} wrapper.
Useful for setting RELEASEDIR, without -R's habit of building a release.


Revision tags: fvdl_fs64_base
# 1.20 25-Dec-2002 lukem

Document:
* build.sh -i idir
* top level targets: distribution, buildworld, installworld
* top level variables: INSTALLWORLDDIR


# 1.19 08-Dec-2002 lukem

Add -E - "expert mode". If this is not specified, builds to DESTDIR=/ are
not permitted.
By using this flag, you are taking responsibility for any issues that
may occur because of this...


# 1.18 08-Dec-2002 lukem

- be consistent about option ordering in build.sh usage display
- use Fl and Ar instead of Sy and Em to format options


# 1.17 25-Nov-2002 wiz

Update location of BUILDING.mdoc.


# 1.16 20-Oct-2002 lukem

regen for build.sh -k


# 1.15 21-Sep-2002 lukem

regen for: USE_NEW_TOOLCHAIN was replaced with TOOLCHAIN_MISSING


# 1.14 17-Sep-2002 fredb

Expand on the difference between ``build.sh -d'' and ``make install'',
as requested by Brian Stark in PR toolchain/18228 (which this closes).


# 1.13 22-Jul-2002 wiz

Remove duplicate 'files'. From Ryo HAYASAKA in toolchain/17674.


Revision tags: netbsd-1-6-PATCH002-RC3 netbsd-1-6-PATCH002-RC2 netbsd-1-6-PATCH002-RC1 netbsd-1-6-PATCH001 netbsd-1-6-PATCH001-RELEASE netbsd-1-6-PATCH001-RC3 netbsd-1-6-PATCH001-RC2 netbsd-1-6-PATCH001-RC1 netbsd-1-6-RELEASE netbsd-1-6-RC3 netbsd-1-6-RC2 netbsd-1-6-RC1 netbsd-1-6-base
# 1.12 13-May-2002 lukem

branches: 1.12.2;
add "-M makeobjdirprefix" to build.sh


# 1.11 03-May-2002 lukem

Move the METALOG from ${_SRC_TOP_OBJ_} to ${DESTDIR}.

There were too many synchronisation problems with using the former;
including situations such as a "make clean" performed between two
installs to the same DESTDIR would result in a truncated METALOG and
the resultant sets would be missing stuff such as include files that
don't get reinstalled if they haven't changed, even with !UPDATE.


# 1.10 02-May-2002 sommerfeld

Re-gen.


# 1.9 14-Mar-2002 thorpej

Add a -B option to set the BUILDID for the build. This also causes
the make(1) wrapper script to be named "nbmake-MACHINE-BUILDID".


# 1.8 05-Mar-2002 lukem

document various supported environment variables, including MAKEOBJDIRPREFIX


# 1.7 04-Mar-2002 lukem

document:
- make's UNPRIVED support
- build.sh's -U support
- the build system currently needs to build onto a file system with
long file name and hard link support


# 1.6 25-Nov-2001 thorpej

Document the -d option to build.sh


# 1.5 15-Nov-2001 tv

Note only <bsd.own.mk> as the authority for determining whether the new
BUILDING instructions should be used.


# 1.4 14-Nov-2001 tv

Turn off host-specific objdirs by default. Set MKHOSTOBJ=yes to enable.


# 1.3 12-Nov-2001 tv

Major overhaul of src/tools and host toolchain. Summary of changes:

* Rewrite src/tools Make logic to work like the rest of the tree wrt
"dependall" and "install". The old "make build" hack is gone.

* Remove the MKTOOLS logic. This was linked to the "make build" hack,
and was only needed because TOOLDIR originally had no writable default.

* Redo the GNU configure/make logic to make it fit reasonably in a
BSD make wrapper. Use new ${.ALLTARGETS} variable to scan for
targets in $(srcdir), and mark them with .MADE: to prevent rebuilding.

* Only build cross tools in src/tools; remove some messy logic in
src/usr.* and src/gnu/usr.* that would do target filename rewriting
(improves consistency and readability).

* Add the ability to build cross gdb at tool build time by setting
MKCROSSGDB (default no) to "yes" in mk.conf.

* Add src/tools/groff and set up paths to work with this cross groff.


# 1.2 08-Nov-2001 wiz

Remove mention of BUILDLING.html, and follow rename of BUILDING.txt to
BUILDING.
Noted by Love <lha@stacken.kth.se> on tech-toolchain.


# 1.1 01-Nov-2001 tv

By popular demand, one preformatted version of BUILDING, plaintext, no CRs.


# 1.140 10-Nov-2020 kamil

Reintroduce the support of MKCATPAGES

Requested by <mrg>


# 1.139 08-Nov-2020 kamil

Remove the support for MKCATPAGES

It was optional since 1999 and disabled by default since 2012.

Proposed on tech-userlevel@.


# 1.138 13-Oct-2020 thorpej

Document CPUFLAGS here (it's already documented in share/mk/bsd.README).
This will address the initial concern in PR port-alpha/55545.


# 1.137 12-Oct-2020 uwe

Mention HOST_CFLAGS and HOST_CXXFLAGS.


# 1.136 12-Oct-2020 uwe

Bump date and regen for BUILDING.mdoc revision 1.127
that introduced build.sh -c <compiler> option.


Revision tags: netbsd-9-1-RELEASE phil-wifi-20200421 phil-wifi-20200411 is-mlppp-base phil-wifi-20200406 netbsd-9-0-RELEASE netbsd-9-0-RC2 netbsd-9-0-RC1 phil-wifi-20191119 netbsd-9-base phil-wifi-20190609
# 1.135 08-May-2019 leot

Fix a typo

Reported by Tobias Ulmer via netbsd-docs@ ML, thanks!


Revision tags: pgoyette-compat-20190127 pgoyette-compat-20190118 pgoyette-compat-1226 pgoyette-compat-1126 pgoyette-compat-1020 pgoyette-compat-0930 pgoyette-compat-0906
# 1.134 29-Jul-2018 sevan

regen


Revision tags: pgoyette-compat-0728 phil-wifi-base pgoyette-compat-0625 pgoyette-compat-0521
# 1.133 02-May-2018 pgoyette

branches: 1.133.2;
Re-add files that were accidentally deleted in my previous commit.


# 1.132 02-May-2018 pgoyette

Synch with HEAD


Revision tags: pgoyette-compat-0502 pgoyette-compat-0422 pgoyette-compat-0415 pgoyette-compat-0407 pgoyette-compat-0330 pgoyette-compat-0322 pgoyette-compat-0315 pgoyette-compat-base
# 1.131 16-Feb-2018 leot

branches: 1.131.2;
regen


# 1.130 29-Dec-2017 sevan

regen


# 1.129 21-Oct-2017 sevan

regen


Revision tags: netbsd-8-2-RELEASE netbsd-8-1-RELEASE netbsd-8-1-RC1 netbsd-8-0-RELEASE netbsd-8-0-RC2 netbsd-8-0-RC1 matt-nb8-mediatek-base perseant-stdc-iso10646-base netbsd-8-base
# 1.128 21-May-2017 riastradh

regen


Revision tags: prg-localcount2-base3 prg-localcount2-base2 prg-localcount2-base1 prg-localcount2-base pgoyette-localcount-20170426
# 1.127 22-Apr-2017 plunky

regen


Revision tags: bouyer-socketcan-base1
# 1.126 20-Apr-2017 wiz

regen using regen target in doc.


# 1.125 20-Apr-2017 ozaki-r

Introduce MKSTRIPSYM build option

If it's yes, all local symbols of shared libraries are stripped
(default). If it's no, only temporary local symbols are stripped;
for example, symbols of static functions are kept. Keeping such
symbols is useful on using DTrace for userland libraries and
getting a backtrace from a rump server loading modules (shared
libraries).

Proposed and discussed on tech-kern and tech-toolchain


Revision tags: pgoyette-localcount-20170320
# 1.124 20-Feb-2017 christos

regen


# 1.123 16-Feb-2017 rin

The default values for MKPIC are yes and no for sh3 and m68000, respectively.
Bump date.


Revision tags: bouyer-socketcan-base pgoyette-localcount-20170107 pgoyette-localcount-20161104 localcount-20160914 pgoyette-localcount-20160806 pgoyette-localcount-20160726 pgoyette-localcount-base
# 1.122 29-Jan-2016 wiz

branches: 1.122.2; 1.122.4;
Document MKREPRO_TIMESTAMP.


# 1.121 23-Jul-2015 mrg

remove the xfree86 reachover makefiles and the vast majority of
the support in the rest of the source tree.

X11 sets could use some cleaning up perhaps (just deletion, as
we've never really marked the old X11R6 as obsolete for native
xorg using platforms so far either.)


# 1.120 07-Jun-2015 pgoyette

Update to reflect changes made in rev 1.398 of src/etc/Makefile


# 1.119 08-Apr-2015 wiz

regen


# 1.118 30-Nov-2014 uebayasi

regen


# 1.117 16-Nov-2014 uebayasi

regen


# 1.116 16-Nov-2014 uebayasi

regen


# 1.115 13-Nov-2014 apb

regen from doc/BUILDING.mdoc revision 1.107.
This reinstates documentation for "extsrc" which was lost in 2009.


# 1.114 08-Nov-2014 snj

fourth time's the charm, i guess. when committing a generated file,
it's best to use the latest revision of the source file (hi uebs!)

regen to include changes from revision 1.105 of doc/BUILDING.mdoc


# 1.113 06-Nov-2014 uebayasi

regen


# 1.112 06-Nov-2014 uebayasi

Expand TABs.


# 1.111 06-Nov-2014 uebayasi

Document the new "kernels" operation, prompted by joerg@.


# 1.110 05-Nov-2014 snj

regen


Revision tags: netbsd-7-base tls-earlyentropy-base tls-maxphys-base
# 1.109 07-Aug-2014 apb

branches: 1.109.2;
regen BUILDING from doc/BUILDING.mdoc


# 1.108 03-Aug-2014 apb

BUILDINFO part6: regen BUILDING from doc/BUILDING.mdoc


# 1.107 14-Jun-2014 apb

Regen from doc/BUILDING.mdoc;1.100:
Improve documentation for BUILDID.


# 1.106 21-May-2014 wiz

regen


Revision tags: yamt-pagecache-base9 riastradh-xf86-video-intel-2-7-1-pre-2-21-15 riastradh-drm2-base3 riastradh-drm2-base2 riastradh-drm2-base1 riastradh-drm2-base
# 1.105 29-May-2013 wiz

branches: 1.105.4;
regen using 'make regen' from src/doc.


# 1.104 29-May-2013 wiz

regen (using mandoc doc/BUILDING.mdoc > BUILDING -- let me know
if a different way is preferred, I see that it now contains formatting).


Revision tags: agc-symver-base yamt-pagecache-base8 yamt-pagecache-base7
# 1.103 08-Nov-2012 dholland

regen


Revision tags: yamt-pagecache-base6
# 1.102 19-Sep-2012 abs

regen


# 1.101 25-May-2012 wiz

branches: 1.101.2;
regen using 'make regen' in doc/


# 1.100 25-May-2012 wiz

Document MKREPRO using joerg's wording.


Revision tags: yamt-pagecache-base5 yamt-pagecache-base4
# 1.99 23-Feb-2012 tsutsui

Add a missing period.


Revision tags: netbsd-6-base
# 1.98 14-Feb-2012 apb

branches: 1.98.2;
Regen from revision 1.87 of doc/BUILDING.mdoc.


# 1.97 22-Jan-2012 tsutsui

Add "live-image" and "install-image" target support to build.sh.

"live-image" target builds pre-installed disk images that can be used on
emulators or boot from USB memory sticks to try NetBSD without installation.
Currently amd64, i386, pmax, sparc, sparc64, sun2, sun3, and vax
(which have working emulators and don't require extra tools like preparing
msdosfs or partitioning MD label structures) support this target.

"install-image" target builds an bootable installation disk image that can
be used as an install CD but burned into USB memory sticks etc.
Current only amd64 and i386 (which would support USB boot) have this target.

For more details (and known issue) see following posts on netbsd-bugs@:
http://mail-index.NetBSD.org/netbsd-bugs/2011/08/06/msg023639.html
http://mail-index.NetBSD.org/netbsd-bugs/2011/09/23/msg024207.html
http://mail-index.NetBSD.org/netbsd-bugs/2011/12/07/msg025166.html
http://mail-index.NetBSD.org/netbsd-bugs/2011/12/08/msg025178.html

No particular comments about implementation, and
"go ahead" comments from mrg@, riz@ and christos@.

Closes PR toolchain/45153 and PR misc/45155.


Revision tags: yamt-pagecache-base3 yamt-pagecache-base2 yamt-pagecache-base
# 1.96 09-Sep-2011 apb

branches: 1.96.2;
Add tests for the shell under which build.sh is run. If the
shell fails the tests, then build.sh tries to re-exec itself
under a more suitable shell.


# 1.95 09-Sep-2011 apb

Revisions 1.92 and 1.93 of src/BUILDING were not reflected in
src/doc/BUILDING.mdoc, so those changes were lost when src/BUILDING
was regenerated in revision 1.94.

Now update src/doc/BUILDING.mdoc and regenerate src/BUILDING to
reinstate the lost changes. (I also edited one of the changes, to use
the phrase "space-separated list" for consistency with other parts of
the document.)

The original changes were:


# 1.93 06-Aug-2011 jnemeth

Add description of MKKMOD, part of PR misc/45216


Revision tags: cherry-xenmp-base bouyer-quota2-nbase bouyer-quota2-base
# 1.92 29-Jan-2011 jym

Pass down INSTALLSETS variable to installsets target. Use :Q to escape
shell meta-characters, as the variable contains a list of sets, separated
by spaces.

$ ./build.sh -V INSTALLSETS="base etc" install=idir

should now work as expected.

Reviewed by apb@ on tech-toolchain.


# 1.94 09-Sep-2011 apb

Allow MAKEFLAGS to be set via build.sh -V. Somebody asked for this
in 2008.

Also add comments above a few functions in build.sh, and bump copyright
dates.


# 1.93 06-Aug-2011 jnemeth

Add description of MKKMOD, part of PR misc/45216


Revision tags: cherry-xenmp-base bouyer-quota2-nbase bouyer-quota2-base
# 1.92 29-Jan-2011 jym

Pass down INSTALLSETS variable to installsets target. Use :Q to escape
shell meta-characters, as the variable contains a list of sets, separated
by spaces.

$ ./build.sh -V INSTALLSETS="base etc" install=idir

should now work as expected.

Reviewed by apb@ on tech-toolchain.


Revision tags: matt-mips64-premerge-20101231
# 1.91 25-Jul-2010 mrg

branches: 1.91.2;
remove the MKSUBPIXEL/MKTTINTERP options; they're going away.

regenerate.


Revision tags: matt-premerge-20091211
# 1.90 30-Nov-2009 uebayasi

Support "extsrc", externally added programs and libraries. Users can write
their own reach-overs, cross-build, install, and get set files just like base
and X11 / X.org. (These sets are not included as TNF releases.)


# 1.89 10-Oct-2009 apb

If ${NETBDSRCDIR}/../xsrc exists, then use it as the default value
of X11SRCDIR. If it doesn't exist, then use /usr/xsrc as before.

OK mrg


# 1.88 27-Sep-2009 apb

* Use a more robust method of creating the top level object directory.
Use getmakevar to expand MAKEOBJDIRPREFIX or MAKEOBJDIR, or (if
neither of those variables is set) use a non-recursive "make obj" in
the top level source directory.

* Do not let TOP_objdir default to ${TOP}. It's now set only by the
-M or -O command line options, or after using getmakevar to expand
MAKEOBJDIRPREFIX or MAKEOBJDIR.

* Make try_set_TOOLDIR handle MAKEOBJDIRPERFIX passed from the
environment. It runs too early to use getmakevar, so it will not work
if the value contains embedded '${...}' variable references.

* Use '$TOOLDIR' (with a literal '$') instead of 'nonexistent' in
a message when rebuilding make when TOOLDIR is not yet known.


# 1.87 27-Sep-2009 apb

Allow build.sh "-C cdextra" option to be specified multiple times.


# 1.86 07-Sep-2009 jnemeth

Add a modules operation to build.sh, which builds and installs kernel modules
into DESTDIR.

This is based on the patch provided by tsutsui@ on tech-toolchain@.


# 1.85 12-Jul-2009 hubertf

regen


# 1.84 12-Jul-2009 hubertf

regen


Revision tags: jym-xensuspend-nbase jym-xensuspend-base
# 1.83 01-May-2009 snj

Introduce MKSUBPIXEL, which allows enabling subpixel rendering code
in FreeType.


# 1.82 02-Dec-2008 mrg

branches: 1.82.2;
be explicit about MAKEOBJDIR and MAKEOBJDIRPREFIX not being for
mk.conf or ${MAKECONF}.


# 1.81 15-Nov-2008 mrg

revert sparc back to default of XFree86 at the request of macallan.


# 1.80 13-Nov-2008 apb

Add support for new MAKEVERBOSE levels 3 and 4. The complete list is now:

0 Minimal output ("quiet")
1 Describe what is occurring
2 Describe what is occurring and echo the actual command
3 Ignore the effect of the "@" prefix in make commands
4 Trace shell commands using the shell's -x flag

The default remains MAKEVERBOSE=2.


# 1.79 09-Nov-2008 mrg

- retire MKXORG from public use
- introduce X11FLAVOUR to choose src/x11 vs src/external/mit/xorg
for the X11 to build if MKX11=yes is set. it takes the values
of either Xorg or XFree86.
- default to Xorg on alpha, i386, macppc, shark, sparc and sparc64
- remove MKXORG_WITH_XSRC_XSERVER, unused and never useful


Revision tags: netbsd-5-base matt-mips64-base2
# 1.78 24-Sep-2008 apb

branches: 1.78.2;
regen for recent change to examples and objdir advice,
and for the older MKSTRIPIDENT change.


Revision tags: wrstuden-revivesa-base-3 wrstuden-revivesa-base-2
# 1.77 06-Sep-2008 lukem

regen for MKHTML


# 1.76 28-Aug-2008 lukem

Improve support for MKXORG!=no to enable builds into external/mit/xorg.
This will be mutually exclusive to MKX11!=no.


# 1.75 18-Aug-2008 lukem

Document "build.sh cleandir".
Fix formatting nit.
Remove BUGS; all the in-tree platforms are using build.sh now.


# 1.74 11-Aug-2008 apb

* Suggest a "-j" value between 1+NCPU and 2*NCPU for the fastest builds.
* Remove some duplicated content that appeared in both the section about
make's -j flag and the section about build.sh's -j flag.


# 1.73 05-Aug-2008 apb

* Add more detail for build.sh -M and -O options.
* Mention new default when source is /usr/src but build.sh is run
with neither -M nor -O.


# 1.72 05-Aug-2008 perry

Builds now use "BUILDSEED" so that c++ binaries are reproduceable.
By default BUILDSEED is set to NetBSD-{majorversion} -- a -S flag may
be used to change it.

Discussed on tech-toolchain.


Revision tags: wrstuden-revivesa-base-1 yamt-pf42-base4 yamt-pf42-base3 hpcarm-cleanup-nbase yamt-pf42-baseX yamt-pf42-base2 wrstuden-revivesa-base keiichi-mipv6-nbase yamt-pf42-base keiichi-mipv6-base
# 1.71 29-Mar-2008 dholland

branches: 1.71.4;
Correct/clarify the default setting of USETOOLS in the previous version.
Noted by apb.


# 1.70 28-Mar-2008 dholland

Assorted updates and clarifications, grammar fixes and wording improvements,
and so on. Significant highlights:
- mention src/tests and reference atf;
- provide examples of MACHINE and MACHINE_ARCH;
- mention that MKOBJ=no is not recommended;
- correct the description of the default setting of USETOOLS;
- document the interactions of build.sh -[uo] with various things;
- document the interactions of build.sh tools and kernel=FOO;
- use a lot fewer parentheses.
Discussed on netbsd-docs.


Revision tags: matt-armv6-nbase
# 1.69 18-Mar-2008 lukem

Consistently document RELEASEDIR/RELEASEMACHINEDIR.


# 1.68 08-Mar-2008 reed

Mention that "build" and "distribution" do not build nor install (to DESTDIR)
a kernel.


Revision tags: cube-autoconf-base matt-armv6-base hpcarm-cleanup-base
# 1.67 23-Nov-2007 sborrill

branches: 1.67.4;
Add support for CDBUILDEXTRA which acts like CDEXTRA to add extra items
to the CD-ROM image.
Make CDEXTRA and CDBUILDEXTRA be able to contain lists of files and directories
which are added in turn.
Add support for CDEXTRA_SKIP which contains a list of fnmatch(3) items to
skip during the copy. This is _very_ useful for skipping CVS dirs for example.
CDBUILDEXTRA and CDEXTRA_SKIP are to be used in Makefiles creating the images,
CDEXTRA remains to be used from build.sh.
Update documentation and build.sh help text to show that -C can be used to
specify a list of files and directories rather than just a single dir.


# 1.66 01-Sep-2007 jnemeth

Convert build.sh iso-dir=directory option to -C cddir as per jmmv@ on
source-changes.


# 1.65 01-Sep-2007 jnemeth

Add an iso-dir=directory option. When combined with iso-image or
iso-image-source, it will cause directory to be added to the CD-ROM image.


# 1.64 30-Aug-2007 jnemeth

describe new iso-image-source target


# 1.63 30-Aug-2007 ad

Remove STATUS paragraph which makes it sound like the build system is
half baked.


Revision tags: matt-mips64-base
# 1.62 13-Apr-2007 apb

branches: 1.62.4;
Document recent changes to "make iso-image".


# 1.61 26-Mar-2007 apb

Document the fact that "make installworld" and "build.sh
installworld=..." do not install the etc or xetc sets. Suggest using
etcupdate(8) and postinstall(8) after installworld.


# 1.60 27-Jan-2007 apb

Try to clarify the description of build.sh -m mach.
Document new evbarm-eb and evbarm-el aliases.


Revision tags: netbsd-4-base
# 1.59 08-Oct-2006 apb

branches: 1.59.2;
Clarify that DESTDIR/OBJDIR/etc are absolute paths, but build.sh
-D/-O/etc allows relative paths.

Closes PR 32345 by Andre Luiz de Oliveira.


# 1.58 29-Sep-2006 apb

Use ${HOST_SH} instead of the host system's /bin/sh wherever possible:

* Describe the HOST_SH variable, and the way build.sh attempts to set it.

* Suggest passing HOST_SH in the environment if /bin/sh is not a working
shell.


Revision tags: abandoned-netbsd-4-base
# 1.57 29-Jan-2006 apb

mkisofs is in pkgsrc/sysutils/cdrtools now, not pkgsrc/sysutils/cdrecord.
Reported by Jukka Salmi.


# 1.56 28-Jan-2006 apb

* Add an "iso-image" target in the top level Makefile,
which invokes make iso-image in the etc directory.
* Add an "iso-image" action in build.sh, which
invokes make iso-image.
* Document the above in doc/BUILDING.mdoc.
* Re-generate BUILDING.

Approved by christos


# 1.55 12-Jan-2006 wiz

Bump date for syspkgs.


# 1.54 04-Jan-2006 apb

Document "make syspkgs" and "build.sh syspkgs".

Reviewed by agc


Revision tags: netbsd-3-1-1-RELEASE netbsd-3-0-3-RELEASE netbsd-3-1-RELEASE netbsd-3-0-2-RELEASE netbsd-3-1-RC4 netbsd-3-1-RC3 netbsd-3-1-RC2 netbsd-3-1-RC1 netbsd-3-0-1-RELEASE netbsd-3-0-RELEASE netbsd-3-0-RC6 netbsd-3-0-RC5 netbsd-3-0-RC4 netbsd-3-0-RC3 netbsd-3-0-RC2 netbsd-3-0-RC1 netbsd-3-base
# 1.53 15-Feb-2005 reed

Document the environment variables for if you need to override or
manually select your compilers.
(And regen BUILDING from doc/BUILDING.mdoc.)


# 1.52 12-Oct-2004 jmc

Fix some typo's/bad wording as highlighted in PR#27219


# 1.51 25-Jun-2004 wiz

regen (Document -h. From Karsten Kruse in PR 25974.
While here, remove a duplicate sentence).


Revision tags: netbsd-2-0-3-RELEASE netbsd-2-1-RELEASE netbsd-2-1-RC6 netbsd-2-1-RC5 netbsd-2-1-RC4 netbsd-2-1-RC3 netbsd-2-1-RC2 netbsd-2-1-RC1 netbsd-2-0-2-RELEASE netbsd-2-0-1-RELEASE netbsd-2-base netbsd-2-0-RELEASE netbsd-2-0-RC5 netbsd-2-0-RC4 netbsd-2-0-RC3 netbsd-2-0-RC2 netbsd-2-0-RC1 netbsd-2-0-base
# 1.50 19-Mar-2004 wiz

Document MKTTINTERP.


# 1.49 06-Feb-2004 lukem

* Document build.sh -X and -x
* Document MKX11 and X11SRCDIR
* Remove note warning against cross-building from systems other than NetBSD;
it works on many other platforms.


# 1.48 29-Dec-2003 jmc

Note tools/compat/README as the place to get notes from non-native cross builds


# 1.47 19-Dec-2003 zuntum

Change -v to -V in the following section:

"Print make(1)'s idea of the value of var. Does not build any targets."

To reflect reality.

Found by Tomasz Marciniak <Tomasz.Marciniak@felix.fizyka.amu.edu.pl>, thanks!


# 1.46 26-Oct-2003 lukem

Improve how build.sh -N and MAKEVERBOSE interoperate;
rather than adding '-s' to make's command line in the makewrapper,
use the .SILENT target based on MAKEVERBOSE's value.

This means that you can do:
./build.sh -N 1 makewrapper

$TOOLDIR/bin/nbmake-$MACHINE
# runs at MAKEVERBOSE==1, with command lines suppressed

$TOOLDIR/bin/nbmake-$MACHINE MAKEVERBOSE=2
# runs at MAKEVERBOSE==2 for this invocation, with command lines shown


# 1.45 25-Oct-2003 lukem

Implement build -N noisy, which sets MAKEVERBOSE to noisy and adds
`-s' to MAKEFLAGS for noisy < 2.


# 1.44 29-Sep-2003 lukem

regenerate for "%" prompt update


# 1.43 19-Aug-2003 martti

Backout the previous commit


# 1.42 19-Aug-2003 martti

Remove # from the example.


# 1.41 08-Aug-2003 lukem

fix description of MAKEOBJDIR. from Martin Husemann


# 1.40 29-Jul-2003 lukem

Add build.sh -Z var, to unset a variable and ensure it's unset in makewrapper.
For -M MAKEOBJDIRPREFIX, unset MAKEOBJDIR.
For -O MAKEOBJDIR, unset MAKEOBJDIRPREFIX.


# 1.39 18-Jul-2003 lukem

fix default location of TOOLDIR


# 1.38 18-Jul-2003 lukem

Update for the MKUNPRIVED/MKUPDATE changes.


# 1.37 18-Jul-2003 lukem

rebuild with new groff


# 1.36 03-Jul-2003 lukem

attempt to clarify how MAKEOBJDIR{,PREFIX} may be provided ...
(this document needs a rototill, which i may get to whilst writing a
paper about build.sh)


# 1.35 25-May-2003 lukem

all:
* add "releasekernel=conf", to install a gzipped copy of the kernels
built by "kernel=conf" to RELEASEDIR/MACHINE/binary/kernel

build.sh:
* be more consistent in various status messages
* move the {release,}kernel=conf conf parsing code into getkernelconf()
and use in both buildkernel() and releasekernel()
* only warn once when building multiple kernels without updating the tools


# 1.34 18-May-2003 lukem

For normal builds, MKOBJDIRS default to `no' (not `yes').
It's only build.sh that sets this to `yes' by default.
Noted by OGAWA Takaya in [toolchain/19823]


# 1.33 17-May-2003 lukem

improve description of how "build.sh -m mach" sets the default
MACHINE_ARCH, and list the special cases that this does not occur for.


# 1.32 10-May-2003 lukem

crank date for previous


# 1.31 10-May-2003 lukem

Add "sourcesets" argument/target, which builds source sets into
RELEASEDIR/source/sets


# 1.30 08-May-2003 lukem

build.sh now provides defaults for DESTDIR and RELEASEDIR if not expert mode.
Remove -D and -R from EXAMPLES since they're not necessary any more.


# 1.29 08-Feb-2003 lukem

Fix example 3; the build.sh target is "install" not "installworld".
Improve description.
Noted by Valeriy Ushakov (uwe@) in private email.


# 1.28 02-Feb-2003 lukem

attempt to further improve and clarify the examples...


# 1.27 30-Jan-2003 lukem

Prefix various paths with 'DESTDIR', to highlight that the DESTDIR
is taken into account.


# 1.26 29-Jan-2003 lukem

allow toolprefix to be easily changed


# 1.25 26-Jan-2003 lukem

Various improvements per discussion with Alan Barrett.


# 1.24 26-Jan-2003 lukem

- Add "sets" top-level Makefile target and build.sh operation.
[Latter suggested by Julio Merino in private email]
- Add "help" build.sh operation.


# 1.23 26-Jan-2003 lukem

Change build.sh so that at least one operation is required.
Add "makewrapper" operation to build.sh.
[The above changes were suggested by Alan Barrett on current-users@]

Fail if building as non-root unless: UNPRIVED is set, -U is given, or -E
(expert mode) is given.
[Suggested by James Wetterau in private email]

Improve the examples in BUILDING.


# 1.22 23-Jan-2003 lukem

Rework how build.sh functions, so that command line options set various
parameters, and a list of "operations" defines what to do.
The full usage is show below. Notes:
`-b' has been deprecated (it always occurs now)
`-d' is replaced by "distribution"
`-R rel' onlys sets RELEASEDIR; use "release" to build a release
`-k kern' has been replaced by "kernel=kern"
`-i idir' has been replaced by "install=idir"
-r now occurs before nbmake is rebuilt

Add a copyright (long due!). Rework the code to (a KNF inspired) ShellNF.
Use functions appropriately. Allow `nb' prefix to be easily changed to
something else. Solve world peace (just kidding)

This is part of the (never achievable) goal of attempting to make
NetBSD easier to build...


--8<-- new usage follows --8<--

Usage: build.sh [-EnorUu] [-a arch] [-B buildid] [-D dest] [-j njob] [-M obj]
[-m mach] [-O obj] [-R release] [-T tools] [-V var=[value]]
[-w wrapper] [operation [...] ]

System build operations (all imply "obj" and "tools"):
build Run "make build"
distribution Run "make distribution" (includes etc/ files)
release Run "make release" (includes kernels & distrib media)

Other operations:
obj Run "make obj" (default unless -o)
tools Build and install tools
kernel=conf Build kernel with config file `conf'
install=idir Run "make installworld" to `idir'
(useful after 'distribution' or 'release')

Options:
-a arch Set MACHINE_ARCH to arch (otherwise deduced from MACHINE)
-B buildId Set BUILDID to buildId
-D dest Set DESTDIR to dest
-E Set "expert" mode; disables some DESTDIR checks
-j njob Run up to njob jobs in parallel; see make(1)
-M obj Set obj root directory to obj (sets MAKEOBJDIRPREFIX)
-m mach Set MACHINE to mach (not required if NetBSD native)
-n Show commands that would be executed, but do not execute them
-O obj Set obj root directory to obj (sets a MAKEOBJDIR pattern)
-o Set MKOBJDIRS=no (do not create objdirs at start of build)
-R release Set RELEASEDIR to release
-r Remove contents of TOOLDIR and DESTDIR before building
-T tools Set TOOLDIR to tools. If unset, and TOOLDIR is not set in
the environment, nbmake will be (re)built unconditionally.
-U Set UNPRIVED
-u Set UPDATE
-V v=[val] Set variable `v' to `val'
-w wrapper Create nbmake script as wrapper
(default: ${TOOLDIR}/bin/nbmake-${MACHINE})


# 1.21 04-Jan-2003 lukem

Add "-V var=[value]", for setting arbitrary variables which will also
be added to the nbmake-${MACHINE} wrapper.
Useful for setting RELEASEDIR, without -R's habit of building a release.


Revision tags: fvdl_fs64_base
# 1.20 25-Dec-2002 lukem

Document:
* build.sh -i idir
* top level targets: distribution, buildworld, installworld
* top level variables: INSTALLWORLDDIR


# 1.19 08-Dec-2002 lukem

Add -E - "expert mode". If this is not specified, builds to DESTDIR=/ are
not permitted.
By using this flag, you are taking responsibility for any issues that
may occur because of this...


# 1.18 08-Dec-2002 lukem

- be consistent about option ordering in build.sh usage display
- use Fl and Ar instead of Sy and Em to format options


# 1.17 25-Nov-2002 wiz

Update location of BUILDING.mdoc.


# 1.16 20-Oct-2002 lukem

regen for build.sh -k


# 1.15 21-Sep-2002 lukem

regen for: USE_NEW_TOOLCHAIN was replaced with TOOLCHAIN_MISSING


# 1.14 17-Sep-2002 fredb

Expand on the difference between ``build.sh -d'' and ``make install'',
as requested by Brian Stark in PR toolchain/18228 (which this closes).


# 1.13 22-Jul-2002 wiz

Remove duplicate 'files'. From Ryo HAYASAKA in toolchain/17674.


Revision tags: netbsd-1-6-PATCH002-RC3 netbsd-1-6-PATCH002-RC2 netbsd-1-6-PATCH002-RC1 netbsd-1-6-PATCH001 netbsd-1-6-PATCH001-RELEASE netbsd-1-6-PATCH001-RC3 netbsd-1-6-PATCH001-RC2 netbsd-1-6-PATCH001-RC1 netbsd-1-6-RELEASE netbsd-1-6-RC3 netbsd-1-6-RC2 netbsd-1-6-RC1 netbsd-1-6-base
# 1.12 13-May-2002 lukem

branches: 1.12.2;
add "-M makeobjdirprefix" to build.sh


# 1.11 03-May-2002 lukem

Move the METALOG from ${_SRC_TOP_OBJ_} to ${DESTDIR}.

There were too many synchronisation problems with using the former;
including situations such as a "make clean" performed between two
installs to the same DESTDIR would result in a truncated METALOG and
the resultant sets would be missing stuff such as include files that
don't get reinstalled if they haven't changed, even with !UPDATE.


# 1.10 02-May-2002 sommerfeld

Re-gen.


# 1.9 14-Mar-2002 thorpej

Add a -B option to set the BUILDID for the build. This also causes
the make(1) wrapper script to be named "nbmake-MACHINE-BUILDID".


# 1.8 05-Mar-2002 lukem

document various supported environment variables, including MAKEOBJDIRPREFIX


# 1.7 04-Mar-2002 lukem

document:
- make's UNPRIVED support
- build.sh's -U support
- the build system currently needs to build onto a file system with
long file name and hard link support


# 1.6 25-Nov-2001 thorpej

Document the -d option to build.sh


# 1.5 15-Nov-2001 tv

Note only <bsd.own.mk> as the authority for determining whether the new
BUILDING instructions should be used.


# 1.4 14-Nov-2001 tv

Turn off host-specific objdirs by default. Set MKHOSTOBJ=yes to enable.


# 1.3 12-Nov-2001 tv

Major overhaul of src/tools and host toolchain. Summary of changes:

* Rewrite src/tools Make logic to work like the rest of the tree wrt
"dependall" and "install". The old "make build" hack is gone.

* Remove the MKTOOLS logic. This was linked to the "make build" hack,
and was only needed because TOOLDIR originally had no writable default.

* Redo the GNU configure/make logic to make it fit reasonably in a
BSD make wrapper. Use new ${.ALLTARGETS} variable to scan for
targets in $(srcdir), and mark them with .MADE: to prevent rebuilding.

* Only build cross tools in src/tools; remove some messy logic in
src/usr.* and src/gnu/usr.* that would do target filename rewriting
(improves consistency and readability).

* Add the ability to build cross gdb at tool build time by setting
MKCROSSGDB (default no) to "yes" in mk.conf.

* Add src/tools/groff and set up paths to work with this cross groff.


# 1.2 08-Nov-2001 wiz

Remove mention of BUILDLING.html, and follow rename of BUILDING.txt to
BUILDING.
Noted by Love <lha@stacken.kth.se> on tech-toolchain.


# 1.1 01-Nov-2001 tv

By popular demand, one preformatted version of BUILDING, plaintext, no CRs.


# 1.138 13-Oct-2020 thorpej

Document CPUFLAGS here (it's already documented in share/mk/bsd.README).
This will address the initial concern in PR port-alpha/55545.


# 1.137 12-Oct-2020 uwe

Mention HOST_CFLAGS and HOST_CXXFLAGS.


# 1.136 12-Oct-2020 uwe

Bump date and regen for BUILDING.mdoc revision 1.127
that introduced build.sh -c <compiler> option.


Revision tags: netbsd-9-1-RELEASE phil-wifi-20200421 phil-wifi-20200411 is-mlppp-base phil-wifi-20200406 netbsd-9-0-RELEASE netbsd-9-0-RC2 netbsd-9-0-RC1 phil-wifi-20191119 netbsd-9-base phil-wifi-20190609
# 1.135 08-May-2019 leot

Fix a typo

Reported by Tobias Ulmer via netbsd-docs@ ML, thanks!


Revision tags: pgoyette-compat-20190127 pgoyette-compat-20190118 pgoyette-compat-1226 pgoyette-compat-1126 pgoyette-compat-1020 pgoyette-compat-0930 pgoyette-compat-0906
# 1.134 29-Jul-2018 sevan

regen


Revision tags: pgoyette-compat-0728 phil-wifi-base pgoyette-compat-0625 pgoyette-compat-0521
# 1.133 02-May-2018 pgoyette

branches: 1.133.2;
Re-add files that were accidentally deleted in my previous commit.


# 1.132 02-May-2018 pgoyette

Synch with HEAD


Revision tags: pgoyette-compat-0502 pgoyette-compat-0422 pgoyette-compat-0415 pgoyette-compat-0407 pgoyette-compat-0330 pgoyette-compat-0322 pgoyette-compat-0315 pgoyette-compat-base
# 1.131 16-Feb-2018 leot

branches: 1.131.2;
regen


# 1.130 29-Dec-2017 sevan

regen


# 1.129 21-Oct-2017 sevan

regen


Revision tags: netbsd-8-2-RELEASE netbsd-8-1-RELEASE netbsd-8-1-RC1 netbsd-8-0-RELEASE netbsd-8-0-RC2 netbsd-8-0-RC1 matt-nb8-mediatek-base perseant-stdc-iso10646-base netbsd-8-base
# 1.128 21-May-2017 riastradh

regen


Revision tags: prg-localcount2-base3 prg-localcount2-base2 prg-localcount2-base1 prg-localcount2-base pgoyette-localcount-20170426
# 1.127 22-Apr-2017 plunky

regen


Revision tags: bouyer-socketcan-base1
# 1.126 20-Apr-2017 wiz

regen using regen target in doc.


# 1.125 20-Apr-2017 ozaki-r

Introduce MKSTRIPSYM build option

If it's yes, all local symbols of shared libraries are stripped
(default). If it's no, only temporary local symbols are stripped;
for example, symbols of static functions are kept. Keeping such
symbols is useful on using DTrace for userland libraries and
getting a backtrace from a rump server loading modules (shared
libraries).

Proposed and discussed on tech-kern and tech-toolchain


Revision tags: pgoyette-localcount-20170320
# 1.124 20-Feb-2017 christos

regen


# 1.123 16-Feb-2017 rin

The default values for MKPIC are yes and no for sh3 and m68000, respectively.
Bump date.


Revision tags: bouyer-socketcan-base pgoyette-localcount-20170107 pgoyette-localcount-20161104 localcount-20160914 pgoyette-localcount-20160806 pgoyette-localcount-20160726 pgoyette-localcount-base
# 1.122 29-Jan-2016 wiz

branches: 1.122.2; 1.122.4;
Document MKREPRO_TIMESTAMP.


# 1.121 23-Jul-2015 mrg

remove the xfree86 reachover makefiles and the vast majority of
the support in the rest of the source tree.

X11 sets could use some cleaning up perhaps (just deletion, as
we've never really marked the old X11R6 as obsolete for native
xorg using platforms so far either.)


# 1.120 07-Jun-2015 pgoyette

Update to reflect changes made in rev 1.398 of src/etc/Makefile


# 1.119 08-Apr-2015 wiz

regen


# 1.118 30-Nov-2014 uebayasi

regen


# 1.117 16-Nov-2014 uebayasi

regen


# 1.116 16-Nov-2014 uebayasi

regen


# 1.115 13-Nov-2014 apb

regen from doc/BUILDING.mdoc revision 1.107.
This reinstates documentation for "extsrc" which was lost in 2009.


# 1.114 08-Nov-2014 snj

fourth time's the charm, i guess. when committing a generated file,
it's best to use the latest revision of the source file (hi uebs!)

regen to include changes from revision 1.105 of doc/BUILDING.mdoc


# 1.113 06-Nov-2014 uebayasi

regen


# 1.112 06-Nov-2014 uebayasi

Expand TABs.


# 1.111 06-Nov-2014 uebayasi

Document the new "kernels" operation, prompted by joerg@.


# 1.110 05-Nov-2014 snj

regen


Revision tags: netbsd-7-base tls-earlyentropy-base tls-maxphys-base
# 1.109 07-Aug-2014 apb

branches: 1.109.2;
regen BUILDING from doc/BUILDING.mdoc


# 1.108 03-Aug-2014 apb

BUILDINFO part6: regen BUILDING from doc/BUILDING.mdoc


# 1.107 14-Jun-2014 apb

Regen from doc/BUILDING.mdoc;1.100:
Improve documentation for BUILDID.


# 1.106 21-May-2014 wiz

regen


Revision tags: yamt-pagecache-base9 riastradh-xf86-video-intel-2-7-1-pre-2-21-15 riastradh-drm2-base3 riastradh-drm2-base2 riastradh-drm2-base1 riastradh-drm2-base
# 1.105 29-May-2013 wiz

branches: 1.105.4;
regen using 'make regen' from src/doc.


# 1.104 29-May-2013 wiz

regen (using mandoc doc/BUILDING.mdoc > BUILDING -- let me know
if a different way is preferred, I see that it now contains formatting).


Revision tags: agc-symver-base yamt-pagecache-base8 yamt-pagecache-base7
# 1.103 08-Nov-2012 dholland

regen


Revision tags: yamt-pagecache-base6
# 1.102 19-Sep-2012 abs

regen


# 1.101 25-May-2012 wiz

branches: 1.101.2;
regen using 'make regen' in doc/


# 1.100 25-May-2012 wiz

Document MKREPRO using joerg's wording.


Revision tags: yamt-pagecache-base5 yamt-pagecache-base4
# 1.99 23-Feb-2012 tsutsui

Add a missing period.


Revision tags: netbsd-6-base
# 1.98 14-Feb-2012 apb

branches: 1.98.2;
Regen from revision 1.87 of doc/BUILDING.mdoc.


# 1.97 22-Jan-2012 tsutsui

Add "live-image" and "install-image" target support to build.sh.

"live-image" target builds pre-installed disk images that can be used on
emulators or boot from USB memory sticks to try NetBSD without installation.
Currently amd64, i386, pmax, sparc, sparc64, sun2, sun3, and vax
(which have working emulators and don't require extra tools like preparing
msdosfs or partitioning MD label structures) support this target.

"install-image" target builds an bootable installation disk image that can
be used as an install CD but burned into USB memory sticks etc.
Current only amd64 and i386 (which would support USB boot) have this target.

For more details (and known issue) see following posts on netbsd-bugs@:
http://mail-index.NetBSD.org/netbsd-bugs/2011/08/06/msg023639.html
http://mail-index.NetBSD.org/netbsd-bugs/2011/09/23/msg024207.html
http://mail-index.NetBSD.org/netbsd-bugs/2011/12/07/msg025166.html
http://mail-index.NetBSD.org/netbsd-bugs/2011/12/08/msg025178.html

No particular comments about implementation, and
"go ahead" comments from mrg@, riz@ and christos@.

Closes PR toolchain/45153 and PR misc/45155.


Revision tags: yamt-pagecache-base3 yamt-pagecache-base2 yamt-pagecache-base
# 1.96 09-Sep-2011 apb

branches: 1.96.2;
Add tests for the shell under which build.sh is run. If the
shell fails the tests, then build.sh tries to re-exec itself
under a more suitable shell.


# 1.95 09-Sep-2011 apb

Revisions 1.92 and 1.93 of src/BUILDING were not reflected in
src/doc/BUILDING.mdoc, so those changes were lost when src/BUILDING
was regenerated in revision 1.94.

Now update src/doc/BUILDING.mdoc and regenerate src/BUILDING to
reinstate the lost changes. (I also edited one of the changes, to use
the phrase "space-separated list" for consistency with other parts of
the document.)

The original changes were:


# 1.93 06-Aug-2011 jnemeth

Add description of MKKMOD, part of PR misc/45216


Revision tags: cherry-xenmp-base bouyer-quota2-nbase bouyer-quota2-base
# 1.92 29-Jan-2011 jym

Pass down INSTALLSETS variable to installsets target. Use :Q to escape
shell meta-characters, as the variable contains a list of sets, separated
by spaces.

$ ./build.sh -V INSTALLSETS="base etc" install=idir

should now work as expected.

Reviewed by apb@ on tech-toolchain.


# 1.94 09-Sep-2011 apb

Allow MAKEFLAGS to be set via build.sh -V. Somebody asked for this
in 2008.

Also add comments above a few functions in build.sh, and bump copyright
dates.


# 1.93 06-Aug-2011 jnemeth

Add description of MKKMOD, part of PR misc/45216


Revision tags: cherry-xenmp-base bouyer-quota2-nbase bouyer-quota2-base
# 1.92 29-Jan-2011 jym

Pass down INSTALLSETS variable to installsets target. Use :Q to escape
shell meta-characters, as the variable contains a list of sets, separated
by spaces.

$ ./build.sh -V INSTALLSETS="base etc" install=idir

should now work as expected.

Reviewed by apb@ on tech-toolchain.


Revision tags: matt-mips64-premerge-20101231
# 1.91 25-Jul-2010 mrg

branches: 1.91.2;
remove the MKSUBPIXEL/MKTTINTERP options; they're going away.

regenerate.


Revision tags: matt-premerge-20091211
# 1.90 30-Nov-2009 uebayasi

Support "extsrc", externally added programs and libraries. Users can write
their own reach-overs, cross-build, install, and get set files just like base
and X11 / X.org. (These sets are not included as TNF releases.)


# 1.89 10-Oct-2009 apb

If ${NETBDSRCDIR}/../xsrc exists, then use it as the default value
of X11SRCDIR. If it doesn't exist, then use /usr/xsrc as before.

OK mrg


# 1.88 27-Sep-2009 apb

* Use a more robust method of creating the top level object directory.
Use getmakevar to expand MAKEOBJDIRPREFIX or MAKEOBJDIR, or (if
neither of those variables is set) use a non-recursive "make obj" in
the top level source directory.

* Do not let TOP_objdir default to ${TOP}. It's now set only by the
-M or -O command line options, or after using getmakevar to expand
MAKEOBJDIRPREFIX or MAKEOBJDIR.

* Make try_set_TOOLDIR handle MAKEOBJDIRPERFIX passed from the
environment. It runs too early to use getmakevar, so it will not work
if the value contains embedded '${...}' variable references.

* Use '$TOOLDIR' (with a literal '$') instead of 'nonexistent' in
a message when rebuilding make when TOOLDIR is not yet known.


# 1.87 27-Sep-2009 apb

Allow build.sh "-C cdextra" option to be specified multiple times.


# 1.86 07-Sep-2009 jnemeth

Add a modules operation to build.sh, which builds and installs kernel modules
into DESTDIR.

This is based on the patch provided by tsutsui@ on tech-toolchain@.


# 1.85 12-Jul-2009 hubertf

regen


# 1.84 12-Jul-2009 hubertf

regen


Revision tags: jym-xensuspend-nbase jym-xensuspend-base
# 1.83 01-May-2009 snj

Introduce MKSUBPIXEL, which allows enabling subpixel rendering code
in FreeType.


# 1.82 02-Dec-2008 mrg

branches: 1.82.2;
be explicit about MAKEOBJDIR and MAKEOBJDIRPREFIX not being for
mk.conf or ${MAKECONF}.


# 1.81 15-Nov-2008 mrg

revert sparc back to default of XFree86 at the request of macallan.


# 1.80 13-Nov-2008 apb

Add support for new MAKEVERBOSE levels 3 and 4. The complete list is now:

0 Minimal output ("quiet")
1 Describe what is occurring
2 Describe what is occurring and echo the actual command
3 Ignore the effect of the "@" prefix in make commands
4 Trace shell commands using the shell's -x flag

The default remains MAKEVERBOSE=2.


# 1.79 09-Nov-2008 mrg

- retire MKXORG from public use
- introduce X11FLAVOUR to choose src/x11 vs src/external/mit/xorg
for the X11 to build if MKX11=yes is set. it takes the values
of either Xorg or XFree86.
- default to Xorg on alpha, i386, macppc, shark, sparc and sparc64
- remove MKXORG_WITH_XSRC_XSERVER, unused and never useful


Revision tags: netbsd-5-base matt-mips64-base2
# 1.78 24-Sep-2008 apb

branches: 1.78.2;
regen for recent change to examples and objdir advice,
and for the older MKSTRIPIDENT change.


Revision tags: wrstuden-revivesa-base-3 wrstuden-revivesa-base-2
# 1.77 06-Sep-2008 lukem

regen for MKHTML


# 1.76 28-Aug-2008 lukem

Improve support for MKXORG!=no to enable builds into external/mit/xorg.
This will be mutually exclusive to MKX11!=no.


# 1.75 18-Aug-2008 lukem

Document "build.sh cleandir".
Fix formatting nit.
Remove BUGS; all the in-tree platforms are using build.sh now.


# 1.74 11-Aug-2008 apb

* Suggest a "-j" value between 1+NCPU and 2*NCPU for the fastest builds.
* Remove some duplicated content that appeared in both the section about
make's -j flag and the section about build.sh's -j flag.


# 1.73 05-Aug-2008 apb

* Add more detail for build.sh -M and -O options.
* Mention new default when source is /usr/src but build.sh is run
with neither -M nor -O.


# 1.72 05-Aug-2008 perry

Builds now use "BUILDSEED" so that c++ binaries are reproduceable.
By default BUILDSEED is set to NetBSD-{majorversion} -- a -S flag may
be used to change it.

Discussed on tech-toolchain.


Revision tags: wrstuden-revivesa-base-1 yamt-pf42-base4 yamt-pf42-base3 hpcarm-cleanup-nbase yamt-pf42-baseX yamt-pf42-base2 wrstuden-revivesa-base keiichi-mipv6-nbase yamt-pf42-base keiichi-mipv6-base
# 1.71 29-Mar-2008 dholland

branches: 1.71.4;
Correct/clarify the default setting of USETOOLS in the previous version.
Noted by apb.


# 1.70 28-Mar-2008 dholland

Assorted updates and clarifications, grammar fixes and wording improvements,
and so on. Significant highlights:
- mention src/tests and reference atf;
- provide examples of MACHINE and MACHINE_ARCH;
- mention that MKOBJ=no is not recommended;
- correct the description of the default setting of USETOOLS;
- document the interactions of build.sh -[uo] with various things;
- document the interactions of build.sh tools and kernel=FOO;
- use a lot fewer parentheses.
Discussed on netbsd-docs.


Revision tags: matt-armv6-nbase
# 1.69 18-Mar-2008 lukem

Consistently document RELEASEDIR/RELEASEMACHINEDIR.


# 1.68 08-Mar-2008 reed

Mention that "build" and "distribution" do not build nor install (to DESTDIR)
a kernel.


Revision tags: cube-autoconf-base matt-armv6-base hpcarm-cleanup-base
# 1.67 23-Nov-2007 sborrill

branches: 1.67.4;
Add support for CDBUILDEXTRA which acts like CDEXTRA to add extra items
to the CD-ROM image.
Make CDEXTRA and CDBUILDEXTRA be able to contain lists of files and directories
which are added in turn.
Add support for CDEXTRA_SKIP which contains a list of fnmatch(3) items to
skip during the copy. This is _very_ useful for skipping CVS dirs for example.
CDBUILDEXTRA and CDEXTRA_SKIP are to be used in Makefiles creating the images,
CDEXTRA remains to be used from build.sh.
Update documentation and build.sh help text to show that -C can be used to
specify a list of files and directories rather than just a single dir.


# 1.66 01-Sep-2007 jnemeth

Convert build.sh iso-dir=directory option to -C cddir as per jmmv@ on
source-changes.


# 1.65 01-Sep-2007 jnemeth

Add an iso-dir=directory option. When combined with iso-image or
iso-image-source, it will cause directory to be added to the CD-ROM image.


# 1.64 30-Aug-2007 jnemeth

describe new iso-image-source target


# 1.63 30-Aug-2007 ad

Remove STATUS paragraph which makes it sound like the build system is
half baked.


Revision tags: matt-mips64-base
# 1.62 13-Apr-2007 apb

branches: 1.62.4;
Document recent changes to "make iso-image".


# 1.61 26-Mar-2007 apb

Document the fact that "make installworld" and "build.sh
installworld=..." do not install the etc or xetc sets. Suggest using
etcupdate(8) and postinstall(8) after installworld.


# 1.60 27-Jan-2007 apb

Try to clarify the description of build.sh -m mach.
Document new evbarm-eb and evbarm-el aliases.


Revision tags: netbsd-4-base
# 1.59 08-Oct-2006 apb

branches: 1.59.2;
Clarify that DESTDIR/OBJDIR/etc are absolute paths, but build.sh
-D/-O/etc allows relative paths.

Closes PR 32345 by Andre Luiz de Oliveira.


# 1.58 29-Sep-2006 apb

Use ${HOST_SH} instead of the host system's /bin/sh wherever possible:

* Describe the HOST_SH variable, and the way build.sh attempts to set it.

* Suggest passing HOST_SH in the environment if /bin/sh is not a working
shell.


Revision tags: abandoned-netbsd-4-base
# 1.57 29-Jan-2006 apb

mkisofs is in pkgsrc/sysutils/cdrtools now, not pkgsrc/sysutils/cdrecord.
Reported by Jukka Salmi.


# 1.56 28-Jan-2006 apb

* Add an "iso-image" target in the top level Makefile,
which invokes make iso-image in the etc directory.
* Add an "iso-image" action in build.sh, which
invokes make iso-image.
* Document the above in doc/BUILDING.mdoc.
* Re-generate BUILDING.

Approved by christos


# 1.55 12-Jan-2006 wiz

Bump date for syspkgs.


# 1.54 04-Jan-2006 apb

Document "make syspkgs" and "build.sh syspkgs".

Reviewed by agc


Revision tags: netbsd-3-1-1-RELEASE netbsd-3-0-3-RELEASE netbsd-3-1-RELEASE netbsd-3-0-2-RELEASE netbsd-3-1-RC4 netbsd-3-1-RC3 netbsd-3-1-RC2 netbsd-3-1-RC1 netbsd-3-0-1-RELEASE netbsd-3-0-RELEASE netbsd-3-0-RC6 netbsd-3-0-RC5 netbsd-3-0-RC4 netbsd-3-0-RC3 netbsd-3-0-RC2 netbsd-3-0-RC1 netbsd-3-base
# 1.53 15-Feb-2005 reed

Document the environment variables for if you need to override or
manually select your compilers.
(And regen BUILDING from doc/BUILDING.mdoc.)


# 1.52 12-Oct-2004 jmc

Fix some typo's/bad wording as highlighted in PR#27219


# 1.51 25-Jun-2004 wiz

regen (Document -h. From Karsten Kruse in PR 25974.
While here, remove a duplicate sentence).


Revision tags: netbsd-2-0-3-RELEASE netbsd-2-1-RELEASE netbsd-2-1-RC6 netbsd-2-1-RC5 netbsd-2-1-RC4 netbsd-2-1-RC3 netbsd-2-1-RC2 netbsd-2-1-RC1 netbsd-2-0-2-RELEASE netbsd-2-0-1-RELEASE netbsd-2-base netbsd-2-0-RELEASE netbsd-2-0-RC5 netbsd-2-0-RC4 netbsd-2-0-RC3 netbsd-2-0-RC2 netbsd-2-0-RC1 netbsd-2-0-base
# 1.50 19-Mar-2004 wiz

Document MKTTINTERP.


# 1.49 06-Feb-2004 lukem

* Document build.sh -X and -x
* Document MKX11 and X11SRCDIR
* Remove note warning against cross-building from systems other than NetBSD;
it works on many other platforms.


# 1.48 29-Dec-2003 jmc

Note tools/compat/README as the place to get notes from non-native cross builds


# 1.47 19-Dec-2003 zuntum

Change -v to -V in the following section:

"Print make(1)'s idea of the value of var. Does not build any targets."

To reflect reality.

Found by Tomasz Marciniak <Tomasz.Marciniak@felix.fizyka.amu.edu.pl>, thanks!


# 1.46 26-Oct-2003 lukem

Improve how build.sh -N and MAKEVERBOSE interoperate;
rather than adding '-s' to make's command line in the makewrapper,
use the .SILENT target based on MAKEVERBOSE's value.

This means that you can do:
./build.sh -N 1 makewrapper

$TOOLDIR/bin/nbmake-$MACHINE
# runs at MAKEVERBOSE==1, with command lines suppressed

$TOOLDIR/bin/nbmake-$MACHINE MAKEVERBOSE=2
# runs at MAKEVERBOSE==2 for this invocation, with command lines shown


# 1.45 25-Oct-2003 lukem

Implement build -N noisy, which sets MAKEVERBOSE to noisy and adds
`-s' to MAKEFLAGS for noisy < 2.


# 1.44 29-Sep-2003 lukem

regenerate for "%" prompt update


# 1.43 19-Aug-2003 martti

Backout the previous commit


# 1.42 19-Aug-2003 martti

Remove # from the example.


# 1.41 08-Aug-2003 lukem

fix description of MAKEOBJDIR. from Martin Husemann


# 1.40 29-Jul-2003 lukem

Add build.sh -Z var, to unset a variable and ensure it's unset in makewrapper.
For -M MAKEOBJDIRPREFIX, unset MAKEOBJDIR.
For -O MAKEOBJDIR, unset MAKEOBJDIRPREFIX.


# 1.39 18-Jul-2003 lukem

fix default location of TOOLDIR


# 1.38 18-Jul-2003 lukem

Update for the MKUNPRIVED/MKUPDATE changes.


# 1.37 18-Jul-2003 lukem

rebuild with new groff


# 1.36 03-Jul-2003 lukem

attempt to clarify how MAKEOBJDIR{,PREFIX} may be provided ...
(this document needs a rototill, which i may get to whilst writing a
paper about build.sh)


# 1.35 25-May-2003 lukem

all:
* add "releasekernel=conf", to install a gzipped copy of the kernels
built by "kernel=conf" to RELEASEDIR/MACHINE/binary/kernel

build.sh:
* be more consistent in various status messages
* move the {release,}kernel=conf conf parsing code into getkernelconf()
and use in both buildkernel() and releasekernel()
* only warn once when building multiple kernels without updating the tools


# 1.34 18-May-2003 lukem

For normal builds, MKOBJDIRS default to `no' (not `yes').
It's only build.sh that sets this to `yes' by default.
Noted by OGAWA Takaya in [toolchain/19823]


# 1.33 17-May-2003 lukem

improve description of how "build.sh -m mach" sets the default
MACHINE_ARCH, and list the special cases that this does not occur for.


# 1.32 10-May-2003 lukem

crank date for previous


# 1.31 10-May-2003 lukem

Add "sourcesets" argument/target, which builds source sets into
RELEASEDIR/source/sets


# 1.30 08-May-2003 lukem

build.sh now provides defaults for DESTDIR and RELEASEDIR if not expert mode.
Remove -D and -R from EXAMPLES since they're not necessary any more.


# 1.29 08-Feb-2003 lukem

Fix example 3; the build.sh target is "install" not "installworld".
Improve description.
Noted by Valeriy Ushakov (uwe@) in private email.


# 1.28 02-Feb-2003 lukem

attempt to further improve and clarify the examples...


# 1.27 30-Jan-2003 lukem

Prefix various paths with 'DESTDIR', to highlight that the DESTDIR
is taken into account.


# 1.26 29-Jan-2003 lukem

allow toolprefix to be easily changed


# 1.25 26-Jan-2003 lukem

Various improvements per discussion with Alan Barrett.


# 1.24 26-Jan-2003 lukem

- Add "sets" top-level Makefile target and build.sh operation.
[Latter suggested by Julio Merino in private email]
- Add "help" build.sh operation.


# 1.23 26-Jan-2003 lukem

Change build.sh so that at least one operation is required.
Add "makewrapper" operation to build.sh.
[The above changes were suggested by Alan Barrett on current-users@]

Fail if building as non-root unless: UNPRIVED is set, -U is given, or -E
(expert mode) is given.
[Suggested by James Wetterau in private email]

Improve the examples in BUILDING.


# 1.22 23-Jan-2003 lukem

Rework how build.sh functions, so that command line options set various
parameters, and a list of "operations" defines what to do.
The full usage is show below. Notes:
`-b' has been deprecated (it always occurs now)
`-d' is replaced by "distribution"
`-R rel' onlys sets RELEASEDIR; use "release" to build a release
`-k kern' has been replaced by "kernel=kern"
`-i idir' has been replaced by "install=idir"
-r now occurs before nbmake is rebuilt

Add a copyright (long due!). Rework the code to (a KNF inspired) ShellNF.
Use functions appropriately. Allow `nb' prefix to be easily changed to
something else. Solve world peace (just kidding)

This is part of the (never achievable) goal of attempting to make
NetBSD easier to build...


--8<-- new usage follows --8<--

Usage: build.sh [-EnorUu] [-a arch] [-B buildid] [-D dest] [-j njob] [-M obj]
[-m mach] [-O obj] [-R release] [-T tools] [-V var=[value]]
[-w wrapper] [operation [...] ]

System build operations (all imply "obj" and "tools"):
build Run "make build"
distribution Run "make distribution" (includes etc/ files)
release Run "make release" (includes kernels & distrib media)

Other operations:
obj Run "make obj" (default unless -o)
tools Build and install tools
kernel=conf Build kernel with config file `conf'
install=idir Run "make installworld" to `idir'
(useful after 'distribution' or 'release')

Options:
-a arch Set MACHINE_ARCH to arch (otherwise deduced from MACHINE)
-B buildId Set BUILDID to buildId
-D dest Set DESTDIR to dest
-E Set "expert" mode; disables some DESTDIR checks
-j njob Run up to njob jobs in parallel; see make(1)
-M obj Set obj root directory to obj (sets MAKEOBJDIRPREFIX)
-m mach Set MACHINE to mach (not required if NetBSD native)
-n Show commands that would be executed, but do not execute them
-O obj Set obj root directory to obj (sets a MAKEOBJDIR pattern)
-o Set MKOBJDIRS=no (do not create objdirs at start of build)
-R release Set RELEASEDIR to release
-r Remove contents of TOOLDIR and DESTDIR before building
-T tools Set TOOLDIR to tools. If unset, and TOOLDIR is not set in
the environment, nbmake will be (re)built unconditionally.
-U Set UNPRIVED
-u Set UPDATE
-V v=[val] Set variable `v' to `val'
-w wrapper Create nbmake script as wrapper
(default: ${TOOLDIR}/bin/nbmake-${MACHINE})


# 1.21 04-Jan-2003 lukem

Add "-V var=[value]", for setting arbitrary variables which will also
be added to the nbmake-${MACHINE} wrapper.
Useful for setting RELEASEDIR, without -R's habit of building a release.


Revision tags: fvdl_fs64_base
# 1.20 25-Dec-2002 lukem

Document:
* build.sh -i idir
* top level targets: distribution, buildworld, installworld
* top level variables: INSTALLWORLDDIR


# 1.19 08-Dec-2002 lukem

Add -E - "expert mode". If this is not specified, builds to DESTDIR=/ are
not permitted.
By using this flag, you are taking responsibility for any issues that
may occur because of this...


# 1.18 08-Dec-2002 lukem

- be consistent about option ordering in build.sh usage display
- use Fl and Ar instead of Sy and Em to format options


# 1.17 25-Nov-2002 wiz

Update location of BUILDING.mdoc.


# 1.16 20-Oct-2002 lukem

regen for build.sh -k


# 1.15 21-Sep-2002 lukem

regen for: USE_NEW_TOOLCHAIN was replaced with TOOLCHAIN_MISSING


# 1.14 17-Sep-2002 fredb

Expand on the difference between ``build.sh -d'' and ``make install'',
as requested by Brian Stark in PR toolchain/18228 (which this closes).


# 1.13 22-Jul-2002 wiz

Remove duplicate 'files'. From Ryo HAYASAKA in toolchain/17674.


Revision tags: netbsd-1-6-PATCH002-RC3 netbsd-1-6-PATCH002-RC2 netbsd-1-6-PATCH002-RC1 netbsd-1-6-PATCH001 netbsd-1-6-PATCH001-RELEASE netbsd-1-6-PATCH001-RC3 netbsd-1-6-PATCH001-RC2 netbsd-1-6-PATCH001-RC1 netbsd-1-6-RELEASE netbsd-1-6-RC3 netbsd-1-6-RC2 netbsd-1-6-RC1 netbsd-1-6-base
# 1.12 13-May-2002 lukem

branches: 1.12.2;
add "-M makeobjdirprefix" to build.sh


# 1.11 03-May-2002 lukem

Move the METALOG from ${_SRC_TOP_OBJ_} to ${DESTDIR}.

There were too many synchronisation problems with using the former;
including situations such as a "make clean" performed between two
installs to the same DESTDIR would result in a truncated METALOG and
the resultant sets would be missing stuff such as include files that
don't get reinstalled if they haven't changed, even with !UPDATE.


# 1.10 02-May-2002 sommerfeld

Re-gen.


# 1.9 14-Mar-2002 thorpej

Add a -B option to set the BUILDID for the build. This also causes
the make(1) wrapper script to be named "nbmake-MACHINE-BUILDID".


# 1.8 05-Mar-2002 lukem

document various supported environment variables, including MAKEOBJDIRPREFIX


# 1.7 04-Mar-2002 lukem

document:
- make's UNPRIVED support
- build.sh's -U support
- the build system currently needs to build onto a file system with
long file name and hard link support


# 1.6 25-Nov-2001 thorpej

Document the -d option to build.sh


# 1.5 15-Nov-2001 tv

Note only <bsd.own.mk> as the authority for determining whether the new
BUILDING instructions should be used.


# 1.4 14-Nov-2001 tv

Turn off host-specific objdirs by default. Set MKHOSTOBJ=yes to enable.


# 1.3 12-Nov-2001 tv

Major overhaul of src/tools and host toolchain. Summary of changes:

* Rewrite src/tools Make logic to work like the rest of the tree wrt
"dependall" and "install". The old "make build" hack is gone.

* Remove the MKTOOLS logic. This was linked to the "make build" hack,
and was only needed because TOOLDIR originally had no writable default.

* Redo the GNU configure/make logic to make it fit reasonably in a
BSD make wrapper. Use new ${.ALLTARGETS} variable to scan for
targets in $(srcdir), and mark them with .MADE: to prevent rebuilding.

* Only build cross tools in src/tools; remove some messy logic in
src/usr.* and src/gnu/usr.* that would do target filename rewriting
(improves consistency and readability).

* Add the ability to build cross gdb at tool build time by setting
MKCROSSGDB (default no) to "yes" in mk.conf.

* Add src/tools/groff and set up paths to work with this cross groff.


# 1.2 08-Nov-2001 wiz

Remove mention of BUILDLING.html, and follow rename of BUILDING.txt to
BUILDING.
Noted by Love <lha@stacken.kth.se> on tech-toolchain.


# 1.1 01-Nov-2001 tv

By popular demand, one preformatted version of BUILDING, plaintext, no CRs.


# 1.135 08-May-2019 leot

Fix a typo

Reported by Tobias Ulmer via netbsd-docs@ ML, thanks!


Revision tags: pgoyette-compat-20190127 pgoyette-compat-20190118 pgoyette-compat-1226 pgoyette-compat-1126 pgoyette-compat-1020 pgoyette-compat-0930 pgoyette-compat-0906
# 1.134 29-Jul-2018 sevan

regen


Revision tags: pgoyette-compat-0728 phil-wifi-base pgoyette-compat-0625 pgoyette-compat-0521
# 1.133 02-May-2018 pgoyette

Re-add files that were accidentally deleted in my previous commit.


# 1.132 02-May-2018 pgoyette

Synch with HEAD


Revision tags: pgoyette-compat-0502 pgoyette-compat-0422 pgoyette-compat-0415 pgoyette-compat-0407 pgoyette-compat-0330 pgoyette-compat-0322 pgoyette-compat-0315 pgoyette-compat-base
# 1.131 16-Feb-2018 leot

branches: 1.131.2;
regen


# 1.130 29-Dec-2017 sevan

regen


# 1.129 21-Oct-2017 sevan

regen


Revision tags: netbsd-8-0-RELEASE netbsd-8-0-RC2 netbsd-8-0-RC1 matt-nb8-mediatek-base perseant-stdc-iso10646-base netbsd-8-base
# 1.128 21-May-2017 riastradh

regen


Revision tags: prg-localcount2-base3 prg-localcount2-base2 prg-localcount2-base1 prg-localcount2-base pgoyette-localcount-20170426
# 1.127 22-Apr-2017 plunky

regen


Revision tags: bouyer-socketcan-base1
# 1.126 20-Apr-2017 wiz

regen using regen target in doc.


# 1.125 20-Apr-2017 ozaki-r

Introduce MKSTRIPSYM build option

If it's yes, all local symbols of shared libraries are stripped
(default). If it's no, only temporary local symbols are stripped;
for example, symbols of static functions are kept. Keeping such
symbols is useful on using DTrace for userland libraries and
getting a backtrace from a rump server loading modules (shared
libraries).

Proposed and discussed on tech-kern and tech-toolchain


Revision tags: pgoyette-localcount-20170320
# 1.124 20-Feb-2017 christos

regen


# 1.123 16-Feb-2017 rin

The default values for MKPIC are yes and no for sh3 and m68000, respectively.
Bump date.


Revision tags: bouyer-socketcan-base pgoyette-localcount-20170107 pgoyette-localcount-20161104 localcount-20160914 pgoyette-localcount-20160806 pgoyette-localcount-20160726 pgoyette-localcount-base
# 1.122 29-Jan-2016 wiz

branches: 1.122.2; 1.122.4;
Document MKREPRO_TIMESTAMP.


# 1.121 23-Jul-2015 mrg

remove the xfree86 reachover makefiles and the vast majority of
the support in the rest of the source tree.

X11 sets could use some cleaning up perhaps (just deletion, as
we've never really marked the old X11R6 as obsolete for native
xorg using platforms so far either.)


# 1.120 07-Jun-2015 pgoyette

Update to reflect changes made in rev 1.398 of src/etc/Makefile


# 1.119 08-Apr-2015 wiz

regen


# 1.118 30-Nov-2014 uebayasi

regen


# 1.117 16-Nov-2014 uebayasi

regen


# 1.116 16-Nov-2014 uebayasi

regen


# 1.115 13-Nov-2014 apb

regen from doc/BUILDING.mdoc revision 1.107.
This reinstates documentation for "extsrc" which was lost in 2009.


# 1.114 08-Nov-2014 snj

fourth time's the charm, i guess. when committing a generated file,
it's best to use the latest revision of the source file (hi uebs!)

regen to include changes from revision 1.105 of doc/BUILDING.mdoc


# 1.113 06-Nov-2014 uebayasi

regen


# 1.112 06-Nov-2014 uebayasi

Expand TABs.


# 1.111 06-Nov-2014 uebayasi

Document the new "kernels" operation, prompted by joerg@.


# 1.110 05-Nov-2014 snj

regen


Revision tags: netbsd-7-base tls-earlyentropy-base tls-maxphys-base
# 1.109 07-Aug-2014 apb

branches: 1.109.2;
regen BUILDING from doc/BUILDING.mdoc


# 1.108 03-Aug-2014 apb

BUILDINFO part6: regen BUILDING from doc/BUILDING.mdoc


# 1.107 14-Jun-2014 apb

Regen from doc/BUILDING.mdoc;1.100:
Improve documentation for BUILDID.


# 1.106 21-May-2014 wiz

regen


Revision tags: yamt-pagecache-base9 riastradh-xf86-video-intel-2-7-1-pre-2-21-15 riastradh-drm2-base3 riastradh-drm2-base2 riastradh-drm2-base1 riastradh-drm2-base
# 1.105 29-May-2013 wiz

branches: 1.105.4;
regen using 'make regen' from src/doc.


# 1.104 29-May-2013 wiz

regen (using mandoc doc/BUILDING.mdoc > BUILDING -- let me know
if a different way is preferred, I see that it now contains formatting).


Revision tags: agc-symver-base yamt-pagecache-base8 yamt-pagecache-base7
# 1.103 08-Nov-2012 dholland

regen


Revision tags: yamt-pagecache-base6
# 1.102 19-Sep-2012 abs

regen


# 1.101 25-May-2012 wiz

branches: 1.101.2;
regen using 'make regen' in doc/


# 1.100 25-May-2012 wiz

Document MKREPRO using joerg's wording.


Revision tags: yamt-pagecache-base5 yamt-pagecache-base4
# 1.99 23-Feb-2012 tsutsui

Add a missing period.


Revision tags: netbsd-6-base
# 1.98 14-Feb-2012 apb

branches: 1.98.2;
Regen from revision 1.87 of doc/BUILDING.mdoc.


# 1.97 22-Jan-2012 tsutsui

Add "live-image" and "install-image" target support to build.sh.

"live-image" target builds pre-installed disk images that can be used on
emulators or boot from USB memory sticks to try NetBSD without installation.
Currently amd64, i386, pmax, sparc, sparc64, sun2, sun3, and vax
(which have working emulators and don't require extra tools like preparing
msdosfs or partitioning MD label structures) support this target.

"install-image" target builds an bootable installation disk image that can
be used as an install CD but burned into USB memory sticks etc.
Current only amd64 and i386 (which would support USB boot) have this target.

For more details (and known issue) see following posts on netbsd-bugs@:
http://mail-index.NetBSD.org/netbsd-bugs/2011/08/06/msg023639.html
http://mail-index.NetBSD.org/netbsd-bugs/2011/09/23/msg024207.html
http://mail-index.NetBSD.org/netbsd-bugs/2011/12/07/msg025166.html
http://mail-index.NetBSD.org/netbsd-bugs/2011/12/08/msg025178.html

No particular comments about implementation, and
"go ahead" comments from mrg@, riz@ and christos@.

Closes PR toolchain/45153 and PR misc/45155.


Revision tags: yamt-pagecache-base3 yamt-pagecache-base2 yamt-pagecache-base
# 1.96 09-Sep-2011 apb

branches: 1.96.2;
Add tests for the shell under which build.sh is run. If the
shell fails the tests, then build.sh tries to re-exec itself
under a more suitable shell.


# 1.95 09-Sep-2011 apb

Revisions 1.92 and 1.93 of src/BUILDING were not reflected in
src/doc/BUILDING.mdoc, so those changes were lost when src/BUILDING
was regenerated in revision 1.94.

Now update src/doc/BUILDING.mdoc and regenerate src/BUILDING to
reinstate the lost changes. (I also edited one of the changes, to use
the phrase "space-separated list" for consistency with other parts of
the document.)

The original changes were:


# 1.93 06-Aug-2011 jnemeth

Add description of MKKMOD, part of PR misc/45216


Revision tags: cherry-xenmp-base bouyer-quota2-nbase bouyer-quota2-base
# 1.92 29-Jan-2011 jym

Pass down INSTALLSETS variable to installsets target. Use :Q to escape
shell meta-characters, as the variable contains a list of sets, separated
by spaces.

$ ./build.sh -V INSTALLSETS="base etc" install=idir

should now work as expected.

Reviewed by apb@ on tech-toolchain.


# 1.94 09-Sep-2011 apb

Allow MAKEFLAGS to be set via build.sh -V. Somebody asked for this
in 2008.

Also add comments above a few functions in build.sh, and bump copyright
dates.


# 1.93 06-Aug-2011 jnemeth

Add description of MKKMOD, part of PR misc/45216


Revision tags: cherry-xenmp-base bouyer-quota2-nbase bouyer-quota2-base
# 1.92 29-Jan-2011 jym

Pass down INSTALLSETS variable to installsets target. Use :Q to escape
shell meta-characters, as the variable contains a list of sets, separated
by spaces.

$ ./build.sh -V INSTALLSETS="base etc" install=idir

should now work as expected.

Reviewed by apb@ on tech-toolchain.


Revision tags: matt-mips64-premerge-20101231
# 1.91 25-Jul-2010 mrg

branches: 1.91.2;
remove the MKSUBPIXEL/MKTTINTERP options; they're going away.

regenerate.


Revision tags: matt-premerge-20091211
# 1.90 30-Nov-2009 uebayasi

Support "extsrc", externally added programs and libraries. Users can write
their own reach-overs, cross-build, install, and get set files just like base
and X11 / X.org. (These sets are not included as TNF releases.)


# 1.89 10-Oct-2009 apb

If ${NETBDSRCDIR}/../xsrc exists, then use it as the default value
of X11SRCDIR. If it doesn't exist, then use /usr/xsrc as before.

OK mrg


# 1.88 27-Sep-2009 apb

* Use a more robust method of creating the top level object directory.
Use getmakevar to expand MAKEOBJDIRPREFIX or MAKEOBJDIR, or (if
neither of those variables is set) use a non-recursive "make obj" in
the top level source directory.

* Do not let TOP_objdir default to ${TOP}. It's now set only by the
-M or -O command line options, or after using getmakevar to expand
MAKEOBJDIRPREFIX or MAKEOBJDIR.

* Make try_set_TOOLDIR handle MAKEOBJDIRPERFIX passed from the
environment. It runs too early to use getmakevar, so it will not work
if the value contains embedded '${...}' variable references.

* Use '$TOOLDIR' (with a literal '$') instead of 'nonexistent' in
a message when rebuilding make when TOOLDIR is not yet known.


# 1.87 27-Sep-2009 apb

Allow build.sh "-C cdextra" option to be specified multiple times.


# 1.86 07-Sep-2009 jnemeth

Add a modules operation to build.sh, which builds and installs kernel modules
into DESTDIR.

This is based on the patch provided by tsutsui@ on tech-toolchain@.


# 1.85 12-Jul-2009 hubertf

regen


# 1.84 12-Jul-2009 hubertf

regen


Revision tags: jym-xensuspend-nbase jym-xensuspend-base
# 1.83 01-May-2009 snj

Introduce MKSUBPIXEL, which allows enabling subpixel rendering code
in FreeType.


# 1.82 02-Dec-2008 mrg

branches: 1.82.2;
be explicit about MAKEOBJDIR and MAKEOBJDIRPREFIX not being for
mk.conf or ${MAKECONF}.


# 1.81 15-Nov-2008 mrg

revert sparc back to default of XFree86 at the request of macallan.


# 1.80 13-Nov-2008 apb

Add support for new MAKEVERBOSE levels 3 and 4. The complete list is now:

0 Minimal output ("quiet")
1 Describe what is occurring
2 Describe what is occurring and echo the actual command
3 Ignore the effect of the "@" prefix in make commands
4 Trace shell commands using the shell's -x flag

The default remains MAKEVERBOSE=2.


# 1.79 09-Nov-2008 mrg

- retire MKXORG from public use
- introduce X11FLAVOUR to choose src/x11 vs src/external/mit/xorg
for the X11 to build if MKX11=yes is set. it takes the values
of either Xorg or XFree86.
- default to Xorg on alpha, i386, macppc, shark, sparc and sparc64
- remove MKXORG_WITH_XSRC_XSERVER, unused and never useful


Revision tags: netbsd-5-base matt-mips64-base2
# 1.78 24-Sep-2008 apb

branches: 1.78.2;
regen for recent change to examples and objdir advice,
and for the older MKSTRIPIDENT change.


Revision tags: wrstuden-revivesa-base-3 wrstuden-revivesa-base-2
# 1.77 06-Sep-2008 lukem

regen for MKHTML


# 1.76 28-Aug-2008 lukem

Improve support for MKXORG!=no to enable builds into external/mit/xorg.
This will be mutually exclusive to MKX11!=no.


# 1.75 18-Aug-2008 lukem

Document "build.sh cleandir".
Fix formatting nit.
Remove BUGS; all the in-tree platforms are using build.sh now.


# 1.74 11-Aug-2008 apb

* Suggest a "-j" value between 1+NCPU and 2*NCPU for the fastest builds.
* Remove some duplicated content that appeared in both the section about
make's -j flag and the section about build.sh's -j flag.


# 1.73 05-Aug-2008 apb

* Add more detail for build.sh -M and -O options.
* Mention new default when source is /usr/src but build.sh is run
with neither -M nor -O.


# 1.72 05-Aug-2008 perry

Builds now use "BUILDSEED" so that c++ binaries are reproduceable.
By default BUILDSEED is set to NetBSD-{majorversion} -- a -S flag may
be used to change it.

Discussed on tech-toolchain.


Revision tags: wrstuden-revivesa-base-1 yamt-pf42-base4 yamt-pf42-base3 hpcarm-cleanup-nbase yamt-pf42-baseX yamt-pf42-base2 wrstuden-revivesa-base keiichi-mipv6-nbase yamt-pf42-base keiichi-mipv6-base
# 1.71 29-Mar-2008 dholland

branches: 1.71.4;
Correct/clarify the default setting of USETOOLS in the previous version.
Noted by apb.


# 1.70 28-Mar-2008 dholland

Assorted updates and clarifications, grammar fixes and wording improvements,
and so on. Significant highlights:
- mention src/tests and reference atf;
- provide examples of MACHINE and MACHINE_ARCH;
- mention that MKOBJ=no is not recommended;
- correct the description of the default setting of USETOOLS;
- document the interactions of build.sh -[uo] with various things;
- document the interactions of build.sh tools and kernel=FOO;
- use a lot fewer parentheses.
Discussed on netbsd-docs.


Revision tags: matt-armv6-nbase
# 1.69 18-Mar-2008 lukem

Consistently document RELEASEDIR/RELEASEMACHINEDIR.


# 1.68 08-Mar-2008 reed

Mention that "build" and "distribution" do not build nor install (to DESTDIR)
a kernel.


Revision tags: cube-autoconf-base matt-armv6-base hpcarm-cleanup-base
# 1.67 23-Nov-2007 sborrill

branches: 1.67.4;
Add support for CDBUILDEXTRA which acts like CDEXTRA to add extra items
to the CD-ROM image.
Make CDEXTRA and CDBUILDEXTRA be able to contain lists of files and directories
which are added in turn.
Add support for CDEXTRA_SKIP which contains a list of fnmatch(3) items to
skip during the copy. This is _very_ useful for skipping CVS dirs for example.
CDBUILDEXTRA and CDEXTRA_SKIP are to be used in Makefiles creating the images,
CDEXTRA remains to be used from build.sh.
Update documentation and build.sh help text to show that -C can be used to
specify a list of files and directories rather than just a single dir.


# 1.66 01-Sep-2007 jnemeth

Convert build.sh iso-dir=directory option to -C cddir as per jmmv@ on
source-changes.


# 1.65 01-Sep-2007 jnemeth

Add an iso-dir=directory option. When combined with iso-image or
iso-image-source, it will cause directory to be added to the CD-ROM image.


# 1.64 30-Aug-2007 jnemeth

describe new iso-image-source target


# 1.63 30-Aug-2007 ad

Remove STATUS paragraph which makes it sound like the build system is
half baked.


Revision tags: matt-mips64-base
# 1.62 13-Apr-2007 apb

branches: 1.62.4;
Document recent changes to "make iso-image".


# 1.61 26-Mar-2007 apb

Document the fact that "make installworld" and "build.sh
installworld=..." do not install the etc or xetc sets. Suggest using
etcupdate(8) and postinstall(8) after installworld.


# 1.60 27-Jan-2007 apb

Try to clarify the description of build.sh -m mach.
Document new evbarm-eb and evbarm-el aliases.


Revision tags: netbsd-4-base
# 1.59 08-Oct-2006 apb

branches: 1.59.2;
Clarify that DESTDIR/OBJDIR/etc are absolute paths, but build.sh
-D/-O/etc allows relative paths.

Closes PR 32345 by Andre Luiz de Oliveira.


# 1.58 29-Sep-2006 apb

Use ${HOST_SH} instead of the host system's /bin/sh wherever possible:

* Describe the HOST_SH variable, and the way build.sh attempts to set it.

* Suggest passing HOST_SH in the environment if /bin/sh is not a working
shell.


Revision tags: abandoned-netbsd-4-base
# 1.57 29-Jan-2006 apb

mkisofs is in pkgsrc/sysutils/cdrtools now, not pkgsrc/sysutils/cdrecord.
Reported by Jukka Salmi.


# 1.56 28-Jan-2006 apb

* Add an "iso-image" target in the top level Makefile,
which invokes make iso-image in the etc directory.
* Add an "iso-image" action in build.sh, which
invokes make iso-image.
* Document the above in doc/BUILDING.mdoc.
* Re-generate BUILDING.

Approved by christos


# 1.55 12-Jan-2006 wiz

Bump date for syspkgs.


# 1.54 04-Jan-2006 apb

Document "make syspkgs" and "build.sh syspkgs".

Reviewed by agc


Revision tags: netbsd-3-1-1-RELEASE netbsd-3-0-3-RELEASE netbsd-3-1-RELEASE netbsd-3-0-2-RELEASE netbsd-3-1-RC4 netbsd-3-1-RC3 netbsd-3-1-RC2 netbsd-3-1-RC1 netbsd-3-0-1-RELEASE netbsd-3-0-RELEASE netbsd-3-0-RC6 netbsd-3-0-RC5 netbsd-3-0-RC4 netbsd-3-0-RC3 netbsd-3-0-RC2 netbsd-3-0-RC1 netbsd-3-base
# 1.53 15-Feb-2005 reed

Document the environment variables for if you need to override or
manually select your compilers.
(And regen BUILDING from doc/BUILDING.mdoc.)


# 1.52 12-Oct-2004 jmc

Fix some typo's/bad wording as highlighted in PR#27219


# 1.51 25-Jun-2004 wiz

regen (Document -h. From Karsten Kruse in PR 25974.
While here, remove a duplicate sentence).


Revision tags: netbsd-2-0-3-RELEASE netbsd-2-1-RELEASE netbsd-2-1-RC6 netbsd-2-1-RC5 netbsd-2-1-RC4 netbsd-2-1-RC3 netbsd-2-1-RC2 netbsd-2-1-RC1 netbsd-2-0-2-RELEASE netbsd-2-0-1-RELEASE netbsd-2-base netbsd-2-0-RELEASE netbsd-2-0-RC5 netbsd-2-0-RC4 netbsd-2-0-RC3 netbsd-2-0-RC2 netbsd-2-0-RC1 netbsd-2-0-base
# 1.50 19-Mar-2004 wiz

Document MKTTINTERP.


# 1.49 06-Feb-2004 lukem

* Document build.sh -X and -x
* Document MKX11 and X11SRCDIR
* Remove note warning against cross-building from systems other than NetBSD;
it works on many other platforms.


# 1.48 29-Dec-2003 jmc

Note tools/compat/README as the place to get notes from non-native cross builds


# 1.47 19-Dec-2003 zuntum

Change -v to -V in the following section:

"Print make(1)'s idea of the value of var. Does not build any targets."

To reflect reality.

Found by Tomasz Marciniak <Tomasz.Marciniak@felix.fizyka.amu.edu.pl>, thanks!


# 1.46 26-Oct-2003 lukem

Improve how build.sh -N and MAKEVERBOSE interoperate;
rather than adding '-s' to make's command line in the makewrapper,
use the .SILENT target based on MAKEVERBOSE's value.

This means that you can do:
./build.sh -N 1 makewrapper

$TOOLDIR/bin/nbmake-$MACHINE
# runs at MAKEVERBOSE==1, with command lines suppressed

$TOOLDIR/bin/nbmake-$MACHINE MAKEVERBOSE=2
# runs at MAKEVERBOSE==2 for this invocation, with command lines shown


# 1.45 25-Oct-2003 lukem

Implement build -N noisy, which sets MAKEVERBOSE to noisy and adds
`-s' to MAKEFLAGS for noisy < 2.


# 1.44 29-Sep-2003 lukem

regenerate for "%" prompt update


# 1.43 19-Aug-2003 martti

Backout the previous commit


# 1.42 19-Aug-2003 martti

Remove # from the example.


# 1.41 08-Aug-2003 lukem

fix description of MAKEOBJDIR. from Martin Husemann


# 1.40 29-Jul-2003 lukem

Add build.sh -Z var, to unset a variable and ensure it's unset in makewrapper.
For -M MAKEOBJDIRPREFIX, unset MAKEOBJDIR.
For -O MAKEOBJDIR, unset MAKEOBJDIRPREFIX.


# 1.39 18-Jul-2003 lukem

fix default location of TOOLDIR


# 1.38 18-Jul-2003 lukem

Update for the MKUNPRIVED/MKUPDATE changes.


# 1.37 18-Jul-2003 lukem

rebuild with new groff


# 1.36 03-Jul-2003 lukem

attempt to clarify how MAKEOBJDIR{,PREFIX} may be provided ...
(this document needs a rototill, which i may get to whilst writing a
paper about build.sh)


# 1.35 25-May-2003 lukem

all:
* add "releasekernel=conf", to install a gzipped copy of the kernels
built by "kernel=conf" to RELEASEDIR/MACHINE/binary/kernel

build.sh:
* be more consistent in various status messages
* move the {release,}kernel=conf conf parsing code into getkernelconf()
and use in both buildkernel() and releasekernel()
* only warn once when building multiple kernels without updating the tools


# 1.34 18-May-2003 lukem

For normal builds, MKOBJDIRS default to `no' (not `yes').
It's only build.sh that sets this to `yes' by default.
Noted by OGAWA Takaya in [toolchain/19823]


# 1.33 17-May-2003 lukem

improve description of how "build.sh -m mach" sets the default
MACHINE_ARCH, and list the special cases that this does not occur for.


# 1.32 10-May-2003 lukem

crank date for previous


# 1.31 10-May-2003 lukem

Add "sourcesets" argument/target, which builds source sets into
RELEASEDIR/source/sets


# 1.30 08-May-2003 lukem

build.sh now provides defaults for DESTDIR and RELEASEDIR if not expert mode.
Remove -D and -R from EXAMPLES since they're not necessary any more.


# 1.29 08-Feb-2003 lukem

Fix example 3; the build.sh target is "install" not "installworld".
Improve description.
Noted by Valeriy Ushakov (uwe@) in private email.


# 1.28 02-Feb-2003 lukem

attempt to further improve and clarify the examples...


# 1.27 30-Jan-2003 lukem

Prefix various paths with 'DESTDIR', to highlight that the DESTDIR
is taken into account.


# 1.26 29-Jan-2003 lukem

allow toolprefix to be easily changed


# 1.25 26-Jan-2003 lukem

Various improvements per discussion with Alan Barrett.


# 1.24 26-Jan-2003 lukem

- Add "sets" top-level Makefile target and build.sh operation.
[Latter suggested by Julio Merino in private email]
- Add "help" build.sh operation.


# 1.23 26-Jan-2003 lukem

Change build.sh so that at least one operation is required.
Add "makewrapper" operation to build.sh.
[The above changes were suggested by Alan Barrett on current-users@]

Fail if building as non-root unless: UNPRIVED is set, -U is given, or -E
(expert mode) is given.
[Suggested by James Wetterau in private email]

Improve the examples in BUILDING.


# 1.22 23-Jan-2003 lukem

Rework how build.sh functions, so that command line options set various
parameters, and a list of "operations" defines what to do.
The full usage is show below. Notes:
`-b' has been deprecated (it always occurs now)
`-d' is replaced by "distribution"
`-R rel' onlys sets RELEASEDIR; use "release" to build a release
`-k kern' has been replaced by "kernel=kern"
`-i idir' has been replaced by "install=idir"
-r now occurs before nbmake is rebuilt

Add a copyright (long due!). Rework the code to (a KNF inspired) ShellNF.
Use functions appropriately. Allow `nb' prefix to be easily changed to
something else. Solve world peace (just kidding)

This is part of the (never achievable) goal of attempting to make
NetBSD easier to build...


--8<-- new usage follows --8<--

Usage: build.sh [-EnorUu] [-a arch] [-B buildid] [-D dest] [-j njob] [-M obj]
[-m mach] [-O obj] [-R release] [-T tools] [-V var=[value]]
[-w wrapper] [operation [...] ]

System build operations (all imply "obj" and "tools"):
build Run "make build"
distribution Run "make distribution" (includes etc/ files)
release Run "make release" (includes kernels & distrib media)

Other operations:
obj Run "make obj" (default unless -o)
tools Build and install tools
kernel=conf Build kernel with config file `conf'
install=idir Run "make installworld" to `idir'
(useful after 'distribution' or 'release')

Options:
-a arch Set MACHINE_ARCH to arch (otherwise deduced from MACHINE)
-B buildId Set BUILDID to buildId
-D dest Set DESTDIR to dest
-E Set "expert" mode; disables some DESTDIR checks
-j njob Run up to njob jobs in parallel; see make(1)
-M obj Set obj root directory to obj (sets MAKEOBJDIRPREFIX)
-m mach Set MACHINE to mach (not required if NetBSD native)
-n Show commands that would be executed, but do not execute them
-O obj Set obj root directory to obj (sets a MAKEOBJDIR pattern)
-o Set MKOBJDIRS=no (do not create objdirs at start of build)
-R release Set RELEASEDIR to release
-r Remove contents of TOOLDIR and DESTDIR before building
-T tools Set TOOLDIR to tools. If unset, and TOOLDIR is not set in
the environment, nbmake will be (re)built unconditionally.
-U Set UNPRIVED
-u Set UPDATE
-V v=[val] Set variable `v' to `val'
-w wrapper Create nbmake script as wrapper
(default: ${TOOLDIR}/bin/nbmake-${MACHINE})


# 1.21 04-Jan-2003 lukem

Add "-V var=[value]", for setting arbitrary variables which will also
be added to the nbmake-${MACHINE} wrapper.
Useful for setting RELEASEDIR, without -R's habit of building a release.


Revision tags: fvdl_fs64_base
# 1.20 25-Dec-2002 lukem

Document:
* build.sh -i idir
* top level targets: distribution, buildworld, installworld
* top level variables: INSTALLWORLDDIR


# 1.19 08-Dec-2002 lukem

Add -E - "expert mode". If this is not specified, builds to DESTDIR=/ are
not permitted.
By using this flag, you are taking responsibility for any issues that
may occur because of this...


# 1.18 08-Dec-2002 lukem

- be consistent about option ordering in build.sh usage display
- use Fl and Ar instead of Sy and Em to format options


# 1.17 25-Nov-2002 wiz

Update location of BUILDING.mdoc.


# 1.16 20-Oct-2002 lukem

regen for build.sh -k


# 1.15 21-Sep-2002 lukem

regen for: USE_NEW_TOOLCHAIN was replaced with TOOLCHAIN_MISSING


# 1.14 17-Sep-2002 fredb

Expand on the difference between ``build.sh -d'' and ``make install'',
as requested by Brian Stark in PR toolchain/18228 (which this closes).


# 1.13 22-Jul-2002 wiz

Remove duplicate 'files'. From Ryo HAYASAKA in toolchain/17674.


Revision tags: netbsd-1-6-PATCH002-RC3 netbsd-1-6-PATCH002-RC2 netbsd-1-6-PATCH002-RC1 netbsd-1-6-PATCH001 netbsd-1-6-PATCH001-RELEASE netbsd-1-6-PATCH001-RC3 netbsd-1-6-PATCH001-RC2 netbsd-1-6-PATCH001-RC1 netbsd-1-6-RELEASE netbsd-1-6-RC3 netbsd-1-6-RC2 netbsd-1-6-RC1 netbsd-1-6-base
# 1.12 13-May-2002 lukem

branches: 1.12.2;
add "-M makeobjdirprefix" to build.sh


# 1.11 03-May-2002 lukem

Move the METALOG from ${_SRC_TOP_OBJ_} to ${DESTDIR}.

There were too many synchronisation problems with using the former;
including situations such as a "make clean" performed between two
installs to the same DESTDIR would result in a truncated METALOG and
the resultant sets would be missing stuff such as include files that
don't get reinstalled if they haven't changed, even with !UPDATE.


# 1.10 02-May-2002 sommerfeld

Re-gen.


# 1.9 14-Mar-2002 thorpej

Add a -B option to set the BUILDID for the build. This also causes
the make(1) wrapper script to be named "nbmake-MACHINE-BUILDID".


# 1.8 05-Mar-2002 lukem

document various supported environment variables, including MAKEOBJDIRPREFIX


# 1.7 04-Mar-2002 lukem

document:
- make's UNPRIVED support
- build.sh's -U support
- the build system currently needs to build onto a file system with
long file name and hard link support


# 1.6 25-Nov-2001 thorpej

Document the -d option to build.sh


# 1.5 15-Nov-2001 tv

Note only <bsd.own.mk> as the authority for determining whether the new
BUILDING instructions should be used.


# 1.4 14-Nov-2001 tv

Turn off host-specific objdirs by default. Set MKHOSTOBJ=yes to enable.


# 1.3 12-Nov-2001 tv

Major overhaul of src/tools and host toolchain. Summary of changes:

* Rewrite src/tools Make logic to work like the rest of the tree wrt
"dependall" and "install". The old "make build" hack is gone.

* Remove the MKTOOLS logic. This was linked to the "make build" hack,
and was only needed because TOOLDIR originally had no writable default.

* Redo the GNU configure/make logic to make it fit reasonably in a
BSD make wrapper. Use new ${.ALLTARGETS} variable to scan for
targets in $(srcdir), and mark them with .MADE: to prevent rebuilding.

* Only build cross tools in src/tools; remove some messy logic in
src/usr.* and src/gnu/usr.* that would do target filename rewriting
(improves consistency and readability).

* Add the ability to build cross gdb at tool build time by setting
MKCROSSGDB (default no) to "yes" in mk.conf.

* Add src/tools/groff and set up paths to work with this cross groff.


# 1.2 08-Nov-2001 wiz

Remove mention of BUILDLING.html, and follow rename of BUILDING.txt to
BUILDING.
Noted by Love <lha@stacken.kth.se> on tech-toolchain.


# 1.1 01-Nov-2001 tv

By popular demand, one preformatted version of BUILDING, plaintext, no CRs.


Revision tags: pgoyette-compat-20190127 pgoyette-compat-20190118 pgoyette-compat-1226 pgoyette-compat-1126 pgoyette-compat-1020 pgoyette-compat-0930 pgoyette-compat-0906
# 1.134 29-Jul-2018 sevan

regen


Revision tags: pgoyette-compat-0728 phil-wifi-base pgoyette-compat-0625 pgoyette-compat-0521
# 1.133 02-May-2018 pgoyette

Re-add files that were accidentally deleted in my previous commit.


# 1.132 02-May-2018 pgoyette

Synch with HEAD


Revision tags: pgoyette-compat-0502 pgoyette-compat-0422 pgoyette-compat-0415 pgoyette-compat-0407 pgoyette-compat-0330 pgoyette-compat-0322 pgoyette-compat-0315 pgoyette-compat-base
# 1.131 16-Feb-2018 leot

branches: 1.131.2;
regen


# 1.130 29-Dec-2017 sevan

regen


# 1.129 21-Oct-2017 sevan

regen


Revision tags: netbsd-8-0-RELEASE netbsd-8-0-RC2 netbsd-8-0-RC1 matt-nb8-mediatek-base perseant-stdc-iso10646-base netbsd-8-base
# 1.128 21-May-2017 riastradh

regen


Revision tags: prg-localcount2-base3 prg-localcount2-base2 prg-localcount2-base1 prg-localcount2-base pgoyette-localcount-20170426
# 1.127 22-Apr-2017 plunky

regen


Revision tags: bouyer-socketcan-base1
# 1.126 20-Apr-2017 wiz

regen using regen target in doc.


# 1.125 20-Apr-2017 ozaki-r

Introduce MKSTRIPSYM build option

If it's yes, all local symbols of shared libraries are stripped
(default). If it's no, only temporary local symbols are stripped;
for example, symbols of static functions are kept. Keeping such
symbols is useful on using DTrace for userland libraries and
getting a backtrace from a rump server loading modules (shared
libraries).

Proposed and discussed on tech-kern and tech-toolchain


Revision tags: pgoyette-localcount-20170320
# 1.124 20-Feb-2017 christos

regen


# 1.123 16-Feb-2017 rin

The default values for MKPIC are yes and no for sh3 and m68000, respectively.
Bump date.


Revision tags: bouyer-socketcan-base pgoyette-localcount-20170107 pgoyette-localcount-20161104 localcount-20160914 pgoyette-localcount-20160806 pgoyette-localcount-20160726 pgoyette-localcount-base
# 1.122 29-Jan-2016 wiz

branches: 1.122.2; 1.122.4;
Document MKREPRO_TIMESTAMP.


# 1.121 23-Jul-2015 mrg

remove the xfree86 reachover makefiles and the vast majority of
the support in the rest of the source tree.

X11 sets could use some cleaning up perhaps (just deletion, as
we've never really marked the old X11R6 as obsolete for native
xorg using platforms so far either.)


# 1.120 07-Jun-2015 pgoyette

Update to reflect changes made in rev 1.398 of src/etc/Makefile


# 1.119 08-Apr-2015 wiz

regen


# 1.118 30-Nov-2014 uebayasi

regen


# 1.117 16-Nov-2014 uebayasi

regen


# 1.116 16-Nov-2014 uebayasi

regen


# 1.115 13-Nov-2014 apb

regen from doc/BUILDING.mdoc revision 1.107.
This reinstates documentation for "extsrc" which was lost in 2009.


# 1.114 08-Nov-2014 snj

fourth time's the charm, i guess. when committing a generated file,
it's best to use the latest revision of the source file (hi uebs!)

regen to include changes from revision 1.105 of doc/BUILDING.mdoc


# 1.113 06-Nov-2014 uebayasi

regen


# 1.112 06-Nov-2014 uebayasi

Expand TABs.


# 1.111 06-Nov-2014 uebayasi

Document the new "kernels" operation, prompted by joerg@.


# 1.110 05-Nov-2014 snj

regen


Revision tags: netbsd-7-base tls-earlyentropy-base tls-maxphys-base
# 1.109 07-Aug-2014 apb

branches: 1.109.2;
regen BUILDING from doc/BUILDING.mdoc


# 1.108 03-Aug-2014 apb

BUILDINFO part6: regen BUILDING from doc/BUILDING.mdoc


# 1.107 14-Jun-2014 apb

Regen from doc/BUILDING.mdoc;1.100:
Improve documentation for BUILDID.


# 1.106 21-May-2014 wiz

regen


Revision tags: yamt-pagecache-base9 riastradh-xf86-video-intel-2-7-1-pre-2-21-15 riastradh-drm2-base3 riastradh-drm2-base2 riastradh-drm2-base1 riastradh-drm2-base
# 1.105 29-May-2013 wiz

branches: 1.105.4;
regen using 'make regen' from src/doc.


# 1.104 29-May-2013 wiz

regen (using mandoc doc/BUILDING.mdoc > BUILDING -- let me know
if a different way is preferred, I see that it now contains formatting).


Revision tags: agc-symver-base yamt-pagecache-base8 yamt-pagecache-base7
# 1.103 08-Nov-2012 dholland

regen


Revision tags: yamt-pagecache-base6
# 1.102 19-Sep-2012 abs

regen


# 1.101 25-May-2012 wiz

branches: 1.101.2;
regen using 'make regen' in doc/


# 1.100 25-May-2012 wiz

Document MKREPRO using joerg's wording.


Revision tags: yamt-pagecache-base5 yamt-pagecache-base4
# 1.99 23-Feb-2012 tsutsui

Add a missing period.


Revision tags: netbsd-6-base
# 1.98 14-Feb-2012 apb

branches: 1.98.2;
Regen from revision 1.87 of doc/BUILDING.mdoc.


# 1.97 22-Jan-2012 tsutsui

Add "live-image" and "install-image" target support to build.sh.

"live-image" target builds pre-installed disk images that can be used on
emulators or boot from USB memory sticks to try NetBSD without installation.
Currently amd64, i386, pmax, sparc, sparc64, sun2, sun3, and vax
(which have working emulators and don't require extra tools like preparing
msdosfs or partitioning MD label structures) support this target.

"install-image" target builds an bootable installation disk image that can
be used as an install CD but burned into USB memory sticks etc.
Current only amd64 and i386 (which would support USB boot) have this target.

For more details (and known issue) see following posts on netbsd-bugs@:
http://mail-index.NetBSD.org/netbsd-bugs/2011/08/06/msg023639.html
http://mail-index.NetBSD.org/netbsd-bugs/2011/09/23/msg024207.html
http://mail-index.NetBSD.org/netbsd-bugs/2011/12/07/msg025166.html
http://mail-index.NetBSD.org/netbsd-bugs/2011/12/08/msg025178.html

No particular comments about implementation, and
"go ahead" comments from mrg@, riz@ and christos@.

Closes PR toolchain/45153 and PR misc/45155.


Revision tags: yamt-pagecache-base3 yamt-pagecache-base2 yamt-pagecache-base
# 1.96 09-Sep-2011 apb

branches: 1.96.2;
Add tests for the shell under which build.sh is run. If the
shell fails the tests, then build.sh tries to re-exec itself
under a more suitable shell.


# 1.95 09-Sep-2011 apb

Revisions 1.92 and 1.93 of src/BUILDING were not reflected in
src/doc/BUILDING.mdoc, so those changes were lost when src/BUILDING
was regenerated in revision 1.94.

Now update src/doc/BUILDING.mdoc and regenerate src/BUILDING to
reinstate the lost changes. (I also edited one of the changes, to use
the phrase "space-separated list" for consistency with other parts of
the document.)

The original changes were:


# 1.93 06-Aug-2011 jnemeth

Add description of MKKMOD, part of PR misc/45216


Revision tags: cherry-xenmp-base bouyer-quota2-nbase bouyer-quota2-base
# 1.92 29-Jan-2011 jym

Pass down INSTALLSETS variable to installsets target. Use :Q to escape
shell meta-characters, as the variable contains a list of sets, separated
by spaces.

$ ./build.sh -V INSTALLSETS="base etc" install=idir

should now work as expected.

Reviewed by apb@ on tech-toolchain.


# 1.94 09-Sep-2011 apb

Allow MAKEFLAGS to be set via build.sh -V. Somebody asked for this
in 2008.

Also add comments above a few functions in build.sh, and bump copyright
dates.


# 1.93 06-Aug-2011 jnemeth

Add description of MKKMOD, part of PR misc/45216


Revision tags: cherry-xenmp-base bouyer-quota2-nbase bouyer-quota2-base
# 1.92 29-Jan-2011 jym

Pass down INSTALLSETS variable to installsets target. Use :Q to escape
shell meta-characters, as the variable contains a list of sets, separated
by spaces.

$ ./build.sh -V INSTALLSETS="base etc" install=idir

should now work as expected.

Reviewed by apb@ on tech-toolchain.


Revision tags: matt-mips64-premerge-20101231
# 1.91 25-Jul-2010 mrg

branches: 1.91.2;
remove the MKSUBPIXEL/MKTTINTERP options; they're going away.

regenerate.


Revision tags: matt-premerge-20091211
# 1.90 30-Nov-2009 uebayasi

Support "extsrc", externally added programs and libraries. Users can write
their own reach-overs, cross-build, install, and get set files just like base
and X11 / X.org. (These sets are not included as TNF releases.)


# 1.89 10-Oct-2009 apb

If ${NETBDSRCDIR}/../xsrc exists, then use it as the default value
of X11SRCDIR. If it doesn't exist, then use /usr/xsrc as before.

OK mrg


# 1.88 27-Sep-2009 apb

* Use a more robust method of creating the top level object directory.
Use getmakevar to expand MAKEOBJDIRPREFIX or MAKEOBJDIR, or (if
neither of those variables is set) use a non-recursive "make obj" in
the top level source directory.

* Do not let TOP_objdir default to ${TOP}. It's now set only by the
-M or -O command line options, or after using getmakevar to expand
MAKEOBJDIRPREFIX or MAKEOBJDIR.

* Make try_set_TOOLDIR handle MAKEOBJDIRPERFIX passed from the
environment. It runs too early to use getmakevar, so it will not work
if the value contains embedded '${...}' variable references.

* Use '$TOOLDIR' (with a literal '$') instead of 'nonexistent' in
a message when rebuilding make when TOOLDIR is not yet known.


# 1.87 27-Sep-2009 apb

Allow build.sh "-C cdextra" option to be specified multiple times.


# 1.86 07-Sep-2009 jnemeth

Add a modules operation to build.sh, which builds and installs kernel modules
into DESTDIR.

This is based on the patch provided by tsutsui@ on tech-toolchain@.


# 1.85 12-Jul-2009 hubertf

regen


# 1.84 12-Jul-2009 hubertf

regen


Revision tags: jym-xensuspend-nbase jym-xensuspend-base
# 1.83 01-May-2009 snj

Introduce MKSUBPIXEL, which allows enabling subpixel rendering code
in FreeType.


# 1.82 02-Dec-2008 mrg

branches: 1.82.2;
be explicit about MAKEOBJDIR and MAKEOBJDIRPREFIX not being for
mk.conf or ${MAKECONF}.


# 1.81 15-Nov-2008 mrg

revert sparc back to default of XFree86 at the request of macallan.


# 1.80 13-Nov-2008 apb

Add support for new MAKEVERBOSE levels 3 and 4. The complete list is now:

0 Minimal output ("quiet")
1 Describe what is occurring
2 Describe what is occurring and echo the actual command
3 Ignore the effect of the "@" prefix in make commands
4 Trace shell commands using the shell's -x flag

The default remains MAKEVERBOSE=2.


# 1.79 09-Nov-2008 mrg

- retire MKXORG from public use
- introduce X11FLAVOUR to choose src/x11 vs src/external/mit/xorg
for the X11 to build if MKX11=yes is set. it takes the values
of either Xorg or XFree86.
- default to Xorg on alpha, i386, macppc, shark, sparc and sparc64
- remove MKXORG_WITH_XSRC_XSERVER, unused and never useful


Revision tags: netbsd-5-base matt-mips64-base2
# 1.78 24-Sep-2008 apb

branches: 1.78.2;
regen for recent change to examples and objdir advice,
and for the older MKSTRIPIDENT change.


Revision tags: wrstuden-revivesa-base-3 wrstuden-revivesa-base-2
# 1.77 06-Sep-2008 lukem

regen for MKHTML


# 1.76 28-Aug-2008 lukem

Improve support for MKXORG!=no to enable builds into external/mit/xorg.
This will be mutually exclusive to MKX11!=no.


# 1.75 18-Aug-2008 lukem

Document "build.sh cleandir".
Fix formatting nit.
Remove BUGS; all the in-tree platforms are using build.sh now.


# 1.74 11-Aug-2008 apb

* Suggest a "-j" value between 1+NCPU and 2*NCPU for the fastest builds.
* Remove some duplicated content that appeared in both the section about
make's -j flag and the section about build.sh's -j flag.


# 1.73 05-Aug-2008 apb

* Add more detail for build.sh -M and -O options.
* Mention new default when source is /usr/src but build.sh is run
with neither -M nor -O.


# 1.72 05-Aug-2008 perry

Builds now use "BUILDSEED" so that c++ binaries are reproduceable.
By default BUILDSEED is set to NetBSD-{majorversion} -- a -S flag may
be used to change it.

Discussed on tech-toolchain.


Revision tags: wrstuden-revivesa-base-1 yamt-pf42-base4 yamt-pf42-base3 hpcarm-cleanup-nbase yamt-pf42-baseX yamt-pf42-base2 wrstuden-revivesa-base keiichi-mipv6-nbase yamt-pf42-base keiichi-mipv6-base
# 1.71 29-Mar-2008 dholland

branches: 1.71.4;
Correct/clarify the default setting of USETOOLS in the previous version.
Noted by apb.


# 1.70 28-Mar-2008 dholland

Assorted updates and clarifications, grammar fixes and wording improvements,
and so on. Significant highlights:
- mention src/tests and reference atf;
- provide examples of MACHINE and MACHINE_ARCH;
- mention that MKOBJ=no is not recommended;
- correct the description of the default setting of USETOOLS;
- document the interactions of build.sh -[uo] with various things;
- document the interactions of build.sh tools and kernel=FOO;
- use a lot fewer parentheses.
Discussed on netbsd-docs.


Revision tags: matt-armv6-nbase
# 1.69 18-Mar-2008 lukem

Consistently document RELEASEDIR/RELEASEMACHINEDIR.


# 1.68 08-Mar-2008 reed

Mention that "build" and "distribution" do not build nor install (to DESTDIR)
a kernel.


Revision tags: cube-autoconf-base matt-armv6-base hpcarm-cleanup-base
# 1.67 23-Nov-2007 sborrill

branches: 1.67.4;
Add support for CDBUILDEXTRA which acts like CDEXTRA to add extra items
to the CD-ROM image.
Make CDEXTRA and CDBUILDEXTRA be able to contain lists of files and directories
which are added in turn.
Add support for CDEXTRA_SKIP which contains a list of fnmatch(3) items to
skip during the copy. This is _very_ useful for skipping CVS dirs for example.
CDBUILDEXTRA and CDEXTRA_SKIP are to be used in Makefiles creating the images,
CDEXTRA remains to be used from build.sh.
Update documentation and build.sh help text to show that -C can be used to
specify a list of files and directories rather than just a single dir.


# 1.66 01-Sep-2007 jnemeth

Convert build.sh iso-dir=directory option to -C cddir as per jmmv@ on
source-changes.


# 1.65 01-Sep-2007 jnemeth

Add an iso-dir=directory option. When combined with iso-image or
iso-image-source, it will cause directory to be added to the CD-ROM image.


# 1.64 30-Aug-2007 jnemeth

describe new iso-image-source target


# 1.63 30-Aug-2007 ad

Remove STATUS paragraph which makes it sound like the build system is
half baked.


Revision tags: matt-mips64-base
# 1.62 13-Apr-2007 apb

branches: 1.62.4;
Document recent changes to "make iso-image".


# 1.61 26-Mar-2007 apb

Document the fact that "make installworld" and "build.sh
installworld=..." do not install the etc or xetc sets. Suggest using
etcupdate(8) and postinstall(8) after installworld.


# 1.60 27-Jan-2007 apb

Try to clarify the description of build.sh -m mach.
Document new evbarm-eb and evbarm-el aliases.


Revision tags: netbsd-4-base
# 1.59 08-Oct-2006 apb

branches: 1.59.2;
Clarify that DESTDIR/OBJDIR/etc are absolute paths, but build.sh
-D/-O/etc allows relative paths.

Closes PR 32345 by Andre Luiz de Oliveira.


# 1.58 29-Sep-2006 apb

Use ${HOST_SH} instead of the host system's /bin/sh wherever possible:

* Describe the HOST_SH variable, and the way build.sh attempts to set it.

* Suggest passing HOST_SH in the environment if /bin/sh is not a working
shell.


Revision tags: abandoned-netbsd-4-base
# 1.57 29-Jan-2006 apb

mkisofs is in pkgsrc/sysutils/cdrtools now, not pkgsrc/sysutils/cdrecord.
Reported by Jukka Salmi.


# 1.56 28-Jan-2006 apb

* Add an "iso-image" target in the top level Makefile,
which invokes make iso-image in the etc directory.
* Add an "iso-image" action in build.sh, which
invokes make iso-image.
* Document the above in doc/BUILDING.mdoc.
* Re-generate BUILDING.

Approved by christos


# 1.55 12-Jan-2006 wiz

Bump date for syspkgs.


# 1.54 04-Jan-2006 apb

Document "make syspkgs" and "build.sh syspkgs".

Reviewed by agc


Revision tags: netbsd-3-1-1-RELEASE netbsd-3-0-3-RELEASE netbsd-3-1-RELEASE netbsd-3-0-2-RELEASE netbsd-3-1-RC4 netbsd-3-1-RC3 netbsd-3-1-RC2 netbsd-3-1-RC1 netbsd-3-0-1-RELEASE netbsd-3-0-RELEASE netbsd-3-0-RC6 netbsd-3-0-RC5 netbsd-3-0-RC4 netbsd-3-0-RC3 netbsd-3-0-RC2 netbsd-3-0-RC1 netbsd-3-base
# 1.53 15-Feb-2005 reed

Document the environment variables for if you need to override or
manually select your compilers.
(And regen BUILDING from doc/BUILDING.mdoc.)


# 1.52 12-Oct-2004 jmc

Fix some typo's/bad wording as highlighted in PR#27219


# 1.51 25-Jun-2004 wiz

regen (Document -h. From Karsten Kruse in PR 25974.
While here, remove a duplicate sentence).


Revision tags: netbsd-2-0-3-RELEASE netbsd-2-1-RELEASE netbsd-2-1-RC6 netbsd-2-1-RC5 netbsd-2-1-RC4 netbsd-2-1-RC3 netbsd-2-1-RC2 netbsd-2-1-RC1 netbsd-2-0-2-RELEASE netbsd-2-0-1-RELEASE netbsd-2-base netbsd-2-0-RELEASE netbsd-2-0-RC5 netbsd-2-0-RC4 netbsd-2-0-RC3 netbsd-2-0-RC2 netbsd-2-0-RC1 netbsd-2-0-base
# 1.50 19-Mar-2004 wiz

Document MKTTINTERP.


# 1.49 06-Feb-2004 lukem

* Document build.sh -X and -x
* Document MKX11 and X11SRCDIR
* Remove note warning against cross-building from systems other than NetBSD;
it works on many other platforms.


# 1.48 29-Dec-2003 jmc

Note tools/compat/README as the place to get notes from non-native cross builds


# 1.47 19-Dec-2003 zuntum

Change -v to -V in the following section:

"Print make(1)'s idea of the value of var. Does not build any targets."

To reflect reality.

Found by Tomasz Marciniak <Tomasz.Marciniak@felix.fizyka.amu.edu.pl>, thanks!


# 1.46 26-Oct-2003 lukem

Improve how build.sh -N and MAKEVERBOSE interoperate;
rather than adding '-s' to make's command line in the makewrapper,
use the .SILENT target based on MAKEVERBOSE's value.

This means that you can do:
./build.sh -N 1 makewrapper

$TOOLDIR/bin/nbmake-$MACHINE
# runs at MAKEVERBOSE==1, with command lines suppressed

$TOOLDIR/bin/nbmake-$MACHINE MAKEVERBOSE=2
# runs at MAKEVERBOSE==2 for this invocation, with command lines shown


# 1.45 25-Oct-2003 lukem

Implement build -N noisy, which sets MAKEVERBOSE to noisy and adds
`-s' to MAKEFLAGS for noisy < 2.


# 1.44 29-Sep-2003 lukem

regenerate for "%" prompt update


# 1.43 19-Aug-2003 martti

Backout the previous commit


# 1.42 19-Aug-2003 martti

Remove # from the example.


# 1.41 08-Aug-2003 lukem

fix description of MAKEOBJDIR. from Martin Husemann


# 1.40 29-Jul-2003 lukem

Add build.sh -Z var, to unset a variable and ensure it's unset in makewrapper.
For -M MAKEOBJDIRPREFIX, unset MAKEOBJDIR.
For -O MAKEOBJDIR, unset MAKEOBJDIRPREFIX.


# 1.39 18-Jul-2003 lukem

fix default location of TOOLDIR


# 1.38 18-Jul-2003 lukem

Update for the MKUNPRIVED/MKUPDATE changes.


# 1.37 18-Jul-2003 lukem

rebuild with new groff


# 1.36 03-Jul-2003 lukem

attempt to clarify how MAKEOBJDIR{,PREFIX} may be provided ...
(this document needs a rototill, which i may get to whilst writing a
paper about build.sh)


# 1.35 25-May-2003 lukem

all:
* add "releasekernel=conf", to install a gzipped copy of the kernels
built by "kernel=conf" to RELEASEDIR/MACHINE/binary/kernel

build.sh:
* be more consistent in various status messages
* move the {release,}kernel=conf conf parsing code into getkernelconf()
and use in both buildkernel() and releasekernel()
* only warn once when building multiple kernels without updating the tools


# 1.34 18-May-2003 lukem

For normal builds, MKOBJDIRS default to `no' (not `yes').
It's only build.sh that sets this to `yes' by default.
Noted by OGAWA Takaya in [toolchain/19823]


# 1.33 17-May-2003 lukem

improve description of how "build.sh -m mach" sets the default
MACHINE_ARCH, and list the special cases that this does not occur for.


# 1.32 10-May-2003 lukem

crank date for previous


# 1.31 10-May-2003 lukem

Add "sourcesets" argument/target, which builds source sets into
RELEASEDIR/source/sets


# 1.30 08-May-2003 lukem

build.sh now provides defaults for DESTDIR and RELEASEDIR if not expert mode.
Remove -D and -R from EXAMPLES since they're not necessary any more.


# 1.29 08-Feb-2003 lukem

Fix example 3; the build.sh target is "install" not "installworld".
Improve description.
Noted by Valeriy Ushakov (uwe@) in private email.


# 1.28 02-Feb-2003 lukem

attempt to further improve and clarify the examples...


# 1.27 30-Jan-2003 lukem

Prefix various paths with 'DESTDIR', to highlight that the DESTDIR
is taken into account.


# 1.26 29-Jan-2003 lukem

allow toolprefix to be easily changed


# 1.25 26-Jan-2003 lukem

Various improvements per discussion with Alan Barrett.


# 1.24 26-Jan-2003 lukem

- Add "sets" top-level Makefile target and build.sh operation.
[Latter suggested by Julio Merino in private email]
- Add "help" build.sh operation.


# 1.23 26-Jan-2003 lukem

Change build.sh so that at least one operation is required.
Add "makewrapper" operation to build.sh.
[The above changes were suggested by Alan Barrett on current-users@]

Fail if building as non-root unless: UNPRIVED is set, -U is given, or -E
(expert mode) is given.
[Suggested by James Wetterau in private email]

Improve the examples in BUILDING.


# 1.22 23-Jan-2003 lukem

Rework how build.sh functions, so that command line options set various
parameters, and a list of "operations" defines what to do.
The full usage is show below. Notes:
`-b' has been deprecated (it always occurs now)
`-d' is replaced by "distribution"
`-R rel' onlys sets RELEASEDIR; use "release" to build a release
`-k kern' has been replaced by "kernel=kern"
`-i idir' has been replaced by "install=idir"
-r now occurs before nbmake is rebuilt

Add a copyright (long due!). Rework the code to (a KNF inspired) ShellNF.
Use functions appropriately. Allow `nb' prefix to be easily changed to
something else. Solve world peace (just kidding)

This is part of the (never achievable) goal of attempting to make
NetBSD easier to build...


--8<-- new usage follows --8<--

Usage: build.sh [-EnorUu] [-a arch] [-B buildid] [-D dest] [-j njob] [-M obj]
[-m mach] [-O obj] [-R release] [-T tools] [-V var=[value]]
[-w wrapper] [operation [...] ]

System build operations (all imply "obj" and "tools"):
build Run "make build"
distribution Run "make distribution" (includes etc/ files)
release Run "make release" (includes kernels & distrib media)

Other operations:
obj Run "make obj" (default unless -o)
tools Build and install tools
kernel=conf Build kernel with config file `conf'
install=idir Run "make installworld" to `idir'
(useful after 'distribution' or 'release')

Options:
-a arch Set MACHINE_ARCH to arch (otherwise deduced from MACHINE)
-B buildId Set BUILDID to buildId
-D dest Set DESTDIR to dest
-E Set "expert" mode; disables some DESTDIR checks
-j njob Run up to njob jobs in parallel; see make(1)
-M obj Set obj root directory to obj (sets MAKEOBJDIRPREFIX)
-m mach Set MACHINE to mach (not required if NetBSD native)
-n Show commands that would be executed, but do not execute them
-O obj Set obj root directory to obj (sets a MAKEOBJDIR pattern)
-o Set MKOBJDIRS=no (do not create objdirs at start of build)
-R release Set RELEASEDIR to release
-r Remove contents of TOOLDIR and DESTDIR before building
-T tools Set TOOLDIR to tools. If unset, and TOOLDIR is not set in
the environment, nbmake will be (re)built unconditionally.
-U Set UNPRIVED
-u Set UPDATE
-V v=[val] Set variable `v' to `val'
-w wrapper Create nbmake script as wrapper
(default: ${TOOLDIR}/bin/nbmake-${MACHINE})


# 1.21 04-Jan-2003 lukem

Add "-V var=[value]", for setting arbitrary variables which will also
be added to the nbmake-${MACHINE} wrapper.
Useful for setting RELEASEDIR, without -R's habit of building a release.


Revision tags: fvdl_fs64_base
# 1.20 25-Dec-2002 lukem

Document:
* build.sh -i idir
* top level targets: distribution, buildworld, installworld
* top level variables: INSTALLWORLDDIR


# 1.19 08-Dec-2002 lukem

Add -E - "expert mode". If this is not specified, builds to DESTDIR=/ are
not permitted.
By using this flag, you are taking responsibility for any issues that
may occur because of this...


# 1.18 08-Dec-2002 lukem

- be consistent about option ordering in build.sh usage display
- use Fl and Ar instead of Sy and Em to format options


# 1.17 25-Nov-2002 wiz

Update location of BUILDING.mdoc.


# 1.16 20-Oct-2002 lukem

regen for build.sh -k


# 1.15 21-Sep-2002 lukem

regen for: USE_NEW_TOOLCHAIN was replaced with TOOLCHAIN_MISSING


# 1.14 17-Sep-2002 fredb

Expand on the difference between ``build.sh -d'' and ``make install'',
as requested by Brian Stark in PR toolchain/18228 (which this closes).


# 1.13 22-Jul-2002 wiz

Remove duplicate 'files'. From Ryo HAYASAKA in toolchain/17674.


Revision tags: netbsd-1-6-PATCH002-RC3 netbsd-1-6-PATCH002-RC2 netbsd-1-6-PATCH002-RC1 netbsd-1-6-PATCH001 netbsd-1-6-PATCH001-RELEASE netbsd-1-6-PATCH001-RC3 netbsd-1-6-PATCH001-RC2 netbsd-1-6-PATCH001-RC1 netbsd-1-6-RELEASE netbsd-1-6-RC3 netbsd-1-6-RC2 netbsd-1-6-RC1 netbsd-1-6-base
# 1.12 13-May-2002 lukem

branches: 1.12.2;
add "-M makeobjdirprefix" to build.sh


# 1.11 03-May-2002 lukem

Move the METALOG from ${_SRC_TOP_OBJ_} to ${DESTDIR}.

There were too many synchronisation problems with using the former;
including situations such as a "make clean" performed between two
installs to the same DESTDIR would result in a truncated METALOG and
the resultant sets would be missing stuff such as include files that
don't get reinstalled if they haven't changed, even with !UPDATE.


# 1.10 02-May-2002 sommerfeld

Re-gen.


# 1.9 14-Mar-2002 thorpej

Add a -B option to set the BUILDID for the build. This also causes
the make(1) wrapper script to be named "nbmake-MACHINE-BUILDID".


# 1.8 05-Mar-2002 lukem

document various supported environment variables, including MAKEOBJDIRPREFIX


# 1.7 04-Mar-2002 lukem

document:
- make's UNPRIVED support
- build.sh's -U support
- the build system currently needs to build onto a file system with
long file name and hard link support


# 1.6 25-Nov-2001 thorpej

Document the -d option to build.sh


# 1.5 15-Nov-2001 tv

Note only <bsd.own.mk> as the authority for determining whether the new
BUILDING instructions should be used.


# 1.4 14-Nov-2001 tv

Turn off host-specific objdirs by default. Set MKHOSTOBJ=yes to enable.


# 1.3 12-Nov-2001 tv

Major overhaul of src/tools and host toolchain. Summary of changes:

* Rewrite src/tools Make logic to work like the rest of the tree wrt
"dependall" and "install". The old "make build" hack is gone.

* Remove the MKTOOLS logic. This was linked to the "make build" hack,
and was only needed because TOOLDIR originally had no writable default.

* Redo the GNU configure/make logic to make it fit reasonably in a
BSD make wrapper. Use new ${.ALLTARGETS} variable to scan for
targets in $(srcdir), and mark them with .MADE: to prevent rebuilding.

* Only build cross tools in src/tools; remove some messy logic in
src/usr.* and src/gnu/usr.* that would do target filename rewriting
(improves consistency and readability).

* Add the ability to build cross gdb at tool build time by setting
MKCROSSGDB (default no) to "yes" in mk.conf.

* Add src/tools/groff and set up paths to work with this cross groff.


# 1.2 08-Nov-2001 wiz

Remove mention of BUILDLING.html, and follow rename of BUILDING.txt to
BUILDING.
Noted by Love <lha@stacken.kth.se> on tech-toolchain.


# 1.1 01-Nov-2001 tv

By popular demand, one preformatted version of BUILDING, plaintext, no CRs.


# 1.130 29-Dec-2017 sevan

regen


# 1.129 21-Oct-2017 sevan

regen


Revision tags: matt-nb8-mediatek-base perseant-stdc-iso10646-base netbsd-8-base
# 1.128 21-May-2017 riastradh

regen


Revision tags: prg-localcount2-base3 prg-localcount2-base2 prg-localcount2-base1 prg-localcount2-base pgoyette-localcount-20170426
# 1.127 22-Apr-2017 plunky

regen


Revision tags: bouyer-socketcan-base1
# 1.126 20-Apr-2017 wiz

regen using regen target in doc.


# 1.125 20-Apr-2017 ozaki-r

Introduce MKSTRIPSYM build option

If it's yes, all local symbols of shared libraries are stripped
(default). If it's no, only temporary local symbols are stripped;
for example, symbols of static functions are kept. Keeping such
symbols is useful on using DTrace for userland libraries and
getting a backtrace from a rump server loading modules (shared
libraries).

Proposed and discussed on tech-kern and tech-toolchain


Revision tags: pgoyette-localcount-20170320
# 1.124 20-Feb-2017 christos

regen


# 1.123 16-Feb-2017 rin

The default values for MKPIC are yes and no for sh3 and m68000, respectively.
Bump date.


Revision tags: bouyer-socketcan-base pgoyette-localcount-20170107 pgoyette-localcount-20161104 localcount-20160914 pgoyette-localcount-20160806 pgoyette-localcount-20160726 pgoyette-localcount-base
# 1.122 29-Jan-2016 wiz

branches: 1.122.2; 1.122.4;
Document MKREPRO_TIMESTAMP.


# 1.121 23-Jul-2015 mrg

remove the xfree86 reachover makefiles and the vast majority of
the support in the rest of the source tree.

X11 sets could use some cleaning up perhaps (just deletion, as
we've never really marked the old X11R6 as obsolete for native
xorg using platforms so far either.)


# 1.120 07-Jun-2015 pgoyette

Update to reflect changes made in rev 1.398 of src/etc/Makefile


# 1.119 08-Apr-2015 wiz

regen


# 1.118 30-Nov-2014 uebayasi

regen


# 1.117 16-Nov-2014 uebayasi

regen


# 1.116 16-Nov-2014 uebayasi

regen


# 1.115 13-Nov-2014 apb

regen from doc/BUILDING.mdoc revision 1.107.
This reinstates documentation for "extsrc" which was lost in 2009.


# 1.114 08-Nov-2014 snj

fourth time's the charm, i guess. when committing a generated file,
it's best to use the latest revision of the source file (hi uebs!)

regen to include changes from revision 1.105 of doc/BUILDING.mdoc


# 1.113 06-Nov-2014 uebayasi

regen


# 1.112 06-Nov-2014 uebayasi

Expand TABs.


# 1.111 06-Nov-2014 uebayasi

Document the new "kernels" operation, prompted by joerg@.


# 1.110 05-Nov-2014 snj

regen


Revision tags: netbsd-7-base tls-earlyentropy-base tls-maxphys-base
# 1.109 07-Aug-2014 apb

branches: 1.109.2;
regen BUILDING from doc/BUILDING.mdoc


# 1.108 03-Aug-2014 apb

BUILDINFO part6: regen BUILDING from doc/BUILDING.mdoc


# 1.107 14-Jun-2014 apb

Regen from doc/BUILDING.mdoc;1.100:
Improve documentation for BUILDID.


# 1.106 21-May-2014 wiz

regen


Revision tags: yamt-pagecache-base9 riastradh-xf86-video-intel-2-7-1-pre-2-21-15 riastradh-drm2-base3 riastradh-drm2-base2 riastradh-drm2-base1 riastradh-drm2-base
# 1.105 29-May-2013 wiz

branches: 1.105.4;
regen using 'make regen' from src/doc.


# 1.104 29-May-2013 wiz

regen (using mandoc doc/BUILDING.mdoc > BUILDING -- let me know
if a different way is preferred, I see that it now contains formatting).


Revision tags: agc-symver-base yamt-pagecache-base8 yamt-pagecache-base7
# 1.103 08-Nov-2012 dholland

regen


Revision tags: yamt-pagecache-base6
# 1.102 19-Sep-2012 abs

regen


# 1.101 25-May-2012 wiz

branches: 1.101.2;
regen using 'make regen' in doc/


# 1.100 25-May-2012 wiz

Document MKREPRO using joerg's wording.


Revision tags: yamt-pagecache-base5 yamt-pagecache-base4
# 1.99 23-Feb-2012 tsutsui

Add a missing period.


Revision tags: netbsd-6-base
# 1.98 14-Feb-2012 apb

branches: 1.98.2;
Regen from revision 1.87 of doc/BUILDING.mdoc.


# 1.97 22-Jan-2012 tsutsui

Add "live-image" and "install-image" target support to build.sh.

"live-image" target builds pre-installed disk images that can be used on
emulators or boot from USB memory sticks to try NetBSD without installation.
Currently amd64, i386, pmax, sparc, sparc64, sun2, sun3, and vax
(which have working emulators and don't require extra tools like preparing
msdosfs or partitioning MD label structures) support this target.

"install-image" target builds an bootable installation disk image that can
be used as an install CD but burned into USB memory sticks etc.
Current only amd64 and i386 (which would support USB boot) have this target.

For more details (and known issue) see following posts on netbsd-bugs@:
http://mail-index.NetBSD.org/netbsd-bugs/2011/08/06/msg023639.html
http://mail-index.NetBSD.org/netbsd-bugs/2011/09/23/msg024207.html
http://mail-index.NetBSD.org/netbsd-bugs/2011/12/07/msg025166.html
http://mail-index.NetBSD.org/netbsd-bugs/2011/12/08/msg025178.html

No particular comments about implementation, and
"go ahead" comments from mrg@, riz@ and christos@.

Closes PR toolchain/45153 and PR misc/45155.


Revision tags: yamt-pagecache-base3 yamt-pagecache-base2 yamt-pagecache-base
# 1.96 09-Sep-2011 apb

branches: 1.96.2;
Add tests for the shell under which build.sh is run. If the
shell fails the tests, then build.sh tries to re-exec itself
under a more suitable shell.


# 1.95 09-Sep-2011 apb

Revisions 1.92 and 1.93 of src/BUILDING were not reflected in
src/doc/BUILDING.mdoc, so those changes were lost when src/BUILDING
was regenerated in revision 1.94.

Now update src/doc/BUILDING.mdoc and regenerate src/BUILDING to
reinstate the lost changes. (I also edited one of the changes, to use
the phrase "space-separated list" for consistency with other parts of
the document.)

The original changes were:


# 1.93 06-Aug-2011 jnemeth

Add description of MKKMOD, part of PR misc/45216


Revision tags: cherry-xenmp-base bouyer-quota2-nbase bouyer-quota2-base
# 1.92 29-Jan-2011 jym

Pass down INSTALLSETS variable to installsets target. Use :Q to escape
shell meta-characters, as the variable contains a list of sets, separated
by spaces.

$ ./build.sh -V INSTALLSETS="base etc" install=idir

should now work as expected.

Reviewed by apb@ on tech-toolchain.


# 1.94 09-Sep-2011 apb

Allow MAKEFLAGS to be set via build.sh -V. Somebody asked for this
in 2008.

Also add comments above a few functions in build.sh, and bump copyright
dates.


# 1.93 06-Aug-2011 jnemeth

Add description of MKKMOD, part of PR misc/45216


Revision tags: cherry-xenmp-base bouyer-quota2-nbase bouyer-quota2-base
# 1.92 29-Jan-2011 jym

Pass down INSTALLSETS variable to installsets target. Use :Q to escape
shell meta-characters, as the variable contains a list of sets, separated
by spaces.

$ ./build.sh -V INSTALLSETS="base etc" install=idir

should now work as expected.

Reviewed by apb@ on tech-toolchain.


Revision tags: matt-mips64-premerge-20101231
# 1.91 25-Jul-2010 mrg

branches: 1.91.2;
remove the MKSUBPIXEL/MKTTINTERP options; they're going away.

regenerate.


Revision tags: matt-premerge-20091211
# 1.90 30-Nov-2009 uebayasi

Support "extsrc", externally added programs and libraries. Users can write
their own reach-overs, cross-build, install, and get set files just like base
and X11 / X.org. (These sets are not included as TNF releases.)


# 1.89 10-Oct-2009 apb

If ${NETBDSRCDIR}/../xsrc exists, then use it as the default value
of X11SRCDIR. If it doesn't exist, then use /usr/xsrc as before.

OK mrg


# 1.88 27-Sep-2009 apb

* Use a more robust method of creating the top level object directory.
Use getmakevar to expand MAKEOBJDIRPREFIX or MAKEOBJDIR, or (if
neither of those variables is set) use a non-recursive "make obj" in
the top level source directory.

* Do not let TOP_objdir default to ${TOP}. It's now set only by the
-M or -O command line options, or after using getmakevar to expand
MAKEOBJDIRPREFIX or MAKEOBJDIR.

* Make try_set_TOOLDIR handle MAKEOBJDIRPERFIX passed from the
environment. It runs too early to use getmakevar, so it will not work
if the value contains embedded '${...}' variable references.

* Use '$TOOLDIR' (with a literal '$') instead of 'nonexistent' in
a message when rebuilding make when TOOLDIR is not yet known.


# 1.87 27-Sep-2009 apb

Allow build.sh "-C cdextra" option to be specified multiple times.


# 1.86 07-Sep-2009 jnemeth

Add a modules operation to build.sh, which builds and installs kernel modules
into DESTDIR.

This is based on the patch provided by tsutsui@ on tech-toolchain@.


# 1.85 12-Jul-2009 hubertf

regen


# 1.84 12-Jul-2009 hubertf

regen


Revision tags: jym-xensuspend-nbase jym-xensuspend-base
# 1.83 01-May-2009 snj

Introduce MKSUBPIXEL, which allows enabling subpixel rendering code
in FreeType.


# 1.82 02-Dec-2008 mrg

branches: 1.82.2;
be explicit about MAKEOBJDIR and MAKEOBJDIRPREFIX not being for
mk.conf or ${MAKECONF}.


# 1.81 15-Nov-2008 mrg

revert sparc back to default of XFree86 at the request of macallan.


# 1.80 13-Nov-2008 apb

Add support for new MAKEVERBOSE levels 3 and 4. The complete list is now:

0 Minimal output ("quiet")
1 Describe what is occurring
2 Describe what is occurring and echo the actual command
3 Ignore the effect of the "@" prefix in make commands
4 Trace shell commands using the shell's -x flag

The default remains MAKEVERBOSE=2.


# 1.79 09-Nov-2008 mrg

- retire MKXORG from public use
- introduce X11FLAVOUR to choose src/x11 vs src/external/mit/xorg
for the X11 to build if MKX11=yes is set. it takes the values
of either Xorg or XFree86.
- default to Xorg on alpha, i386, macppc, shark, sparc and sparc64
- remove MKXORG_WITH_XSRC_XSERVER, unused and never useful


Revision tags: netbsd-5-base matt-mips64-base2
# 1.78 24-Sep-2008 apb

branches: 1.78.2;
regen for recent change to examples and objdir advice,
and for the older MKSTRIPIDENT change.


Revision tags: wrstuden-revivesa-base-3 wrstuden-revivesa-base-2
# 1.77 06-Sep-2008 lukem

regen for MKHTML


# 1.76 28-Aug-2008 lukem

Improve support for MKXORG!=no to enable builds into external/mit/xorg.
This will be mutually exclusive to MKX11!=no.


# 1.75 18-Aug-2008 lukem

Document "build.sh cleandir".
Fix formatting nit.
Remove BUGS; all the in-tree platforms are using build.sh now.


# 1.74 11-Aug-2008 apb

* Suggest a "-j" value between 1+NCPU and 2*NCPU for the fastest builds.
* Remove some duplicated content that appeared in both the section about
make's -j flag and the section about build.sh's -j flag.


# 1.73 05-Aug-2008 apb

* Add more detail for build.sh -M and -O options.
* Mention new default when source is /usr/src but build.sh is run
with neither -M nor -O.


# 1.72 05-Aug-2008 perry

Builds now use "BUILDSEED" so that c++ binaries are reproduceable.
By default BUILDSEED is set to NetBSD-{majorversion} -- a -S flag may
be used to change it.

Discussed on tech-toolchain.


Revision tags: wrstuden-revivesa-base-1 yamt-pf42-base4 yamt-pf42-base3 hpcarm-cleanup-nbase yamt-pf42-baseX yamt-pf42-base2 wrstuden-revivesa-base keiichi-mipv6-nbase yamt-pf42-base keiichi-mipv6-base
# 1.71 29-Mar-2008 dholland

branches: 1.71.4;
Correct/clarify the default setting of USETOOLS in the previous version.
Noted by apb.


# 1.70 28-Mar-2008 dholland

Assorted updates and clarifications, grammar fixes and wording improvements,
and so on. Significant highlights:
- mention src/tests and reference atf;
- provide examples of MACHINE and MACHINE_ARCH;
- mention that MKOBJ=no is not recommended;
- correct the description of the default setting of USETOOLS;
- document the interactions of build.sh -[uo] with various things;
- document the interactions of build.sh tools and kernel=FOO;
- use a lot fewer parentheses.
Discussed on netbsd-docs.


Revision tags: matt-armv6-nbase
# 1.69 18-Mar-2008 lukem

Consistently document RELEASEDIR/RELEASEMACHINEDIR.


# 1.68 08-Mar-2008 reed

Mention that "build" and "distribution" do not build nor install (to DESTDIR)
a kernel.


Revision tags: cube-autoconf-base matt-armv6-base hpcarm-cleanup-base
# 1.67 23-Nov-2007 sborrill

branches: 1.67.4;
Add support for CDBUILDEXTRA which acts like CDEXTRA to add extra items
to the CD-ROM image.
Make CDEXTRA and CDBUILDEXTRA be able to contain lists of files and directories
which are added in turn.
Add support for CDEXTRA_SKIP which contains a list of fnmatch(3) items to
skip during the copy. This is _very_ useful for skipping CVS dirs for example.
CDBUILDEXTRA and CDEXTRA_SKIP are to be used in Makefiles creating the images,
CDEXTRA remains to be used from build.sh.
Update documentation and build.sh help text to show that -C can be used to
specify a list of files and directories rather than just a single dir.


# 1.66 01-Sep-2007 jnemeth

Convert build.sh iso-dir=directory option to -C cddir as per jmmv@ on
source-changes.


# 1.65 01-Sep-2007 jnemeth

Add an iso-dir=directory option. When combined with iso-image or
iso-image-source, it will cause directory to be added to the CD-ROM image.


# 1.64 30-Aug-2007 jnemeth

describe new iso-image-source target


# 1.63 30-Aug-2007 ad

Remove STATUS paragraph which makes it sound like the build system is
half baked.


Revision tags: matt-mips64-base
# 1.62 13-Apr-2007 apb

branches: 1.62.4;
Document recent changes to "make iso-image".


# 1.61 26-Mar-2007 apb

Document the fact that "make installworld" and "build.sh
installworld=..." do not install the etc or xetc sets. Suggest using
etcupdate(8) and postinstall(8) after installworld.


# 1.60 27-Jan-2007 apb

Try to clarify the description of build.sh -m mach.
Document new evbarm-eb and evbarm-el aliases.


Revision tags: netbsd-4-base
# 1.59 08-Oct-2006 apb

branches: 1.59.2;
Clarify that DESTDIR/OBJDIR/etc are absolute paths, but build.sh
-D/-O/etc allows relative paths.

Closes PR 32345 by Andre Luiz de Oliveira.


# 1.58 29-Sep-2006 apb

Use ${HOST_SH} instead of the host system's /bin/sh wherever possible:

* Describe the HOST_SH variable, and the way build.sh attempts to set it.

* Suggest passing HOST_SH in the environment if /bin/sh is not a working
shell.


Revision tags: abandoned-netbsd-4-base
# 1.57 29-Jan-2006 apb

mkisofs is in pkgsrc/sysutils/cdrtools now, not pkgsrc/sysutils/cdrecord.
Reported by Jukka Salmi.


# 1.56 28-Jan-2006 apb

* Add an "iso-image" target in the top level Makefile,
which invokes make iso-image in the etc directory.
* Add an "iso-image" action in build.sh, which
invokes make iso-image.
* Document the above in doc/BUILDING.mdoc.
* Re-generate BUILDING.

Approved by christos


# 1.55 12-Jan-2006 wiz

Bump date for syspkgs.


# 1.54 04-Jan-2006 apb

Document "make syspkgs" and "build.sh syspkgs".

Reviewed by agc


Revision tags: netbsd-3-1-1-RELEASE netbsd-3-0-3-RELEASE netbsd-3-1-RELEASE netbsd-3-0-2-RELEASE netbsd-3-1-RC4 netbsd-3-1-RC3 netbsd-3-1-RC2 netbsd-3-1-RC1 netbsd-3-0-1-RELEASE netbsd-3-0-RELEASE netbsd-3-0-RC6 netbsd-3-0-RC5 netbsd-3-0-RC4 netbsd-3-0-RC3 netbsd-3-0-RC2 netbsd-3-0-RC1 netbsd-3-base
# 1.53 15-Feb-2005 reed

Document the environment variables for if you need to override or
manually select your compilers.
(And regen BUILDING from doc/BUILDING.mdoc.)


# 1.52 12-Oct-2004 jmc

Fix some typo's/bad wording as highlighted in PR#27219


# 1.51 25-Jun-2004 wiz

regen (Document -h. From Karsten Kruse in PR 25974.
While here, remove a duplicate sentence).


Revision tags: netbsd-2-0-3-RELEASE netbsd-2-1-RELEASE netbsd-2-1-RC6 netbsd-2-1-RC5 netbsd-2-1-RC4 netbsd-2-1-RC3 netbsd-2-1-RC2 netbsd-2-1-RC1 netbsd-2-0-2-RELEASE netbsd-2-0-1-RELEASE netbsd-2-base netbsd-2-0-RELEASE netbsd-2-0-RC5 netbsd-2-0-RC4 netbsd-2-0-RC3 netbsd-2-0-RC2 netbsd-2-0-RC1 netbsd-2-0-base
# 1.50 19-Mar-2004 wiz

Document MKTTINTERP.


# 1.49 06-Feb-2004 lukem

* Document build.sh -X and -x
* Document MKX11 and X11SRCDIR
* Remove note warning against cross-building from systems other than NetBSD;
it works on many other platforms.


# 1.48 29-Dec-2003 jmc

Note tools/compat/README as the place to get notes from non-native cross builds


# 1.47 19-Dec-2003 zuntum

Change -v to -V in the following section:

"Print make(1)'s idea of the value of var. Does not build any targets."

To reflect reality.

Found by Tomasz Marciniak <Tomasz.Marciniak@felix.fizyka.amu.edu.pl>, thanks!


# 1.46 26-Oct-2003 lukem

Improve how build.sh -N and MAKEVERBOSE interoperate;
rather than adding '-s' to make's command line in the makewrapper,
use the .SILENT target based on MAKEVERBOSE's value.

This means that you can do:
./build.sh -N 1 makewrapper

$TOOLDIR/bin/nbmake-$MACHINE
# runs at MAKEVERBOSE==1, with command lines suppressed

$TOOLDIR/bin/nbmake-$MACHINE MAKEVERBOSE=2
# runs at MAKEVERBOSE==2 for this invocation, with command lines shown


# 1.45 25-Oct-2003 lukem

Implement build -N noisy, which sets MAKEVERBOSE to noisy and adds
`-s' to MAKEFLAGS for noisy < 2.


# 1.44 29-Sep-2003 lukem

regenerate for "%" prompt update


# 1.43 19-Aug-2003 martti

Backout the previous commit


# 1.42 19-Aug-2003 martti

Remove # from the example.


# 1.41 08-Aug-2003 lukem

fix description of MAKEOBJDIR. from Martin Husemann


# 1.40 29-Jul-2003 lukem

Add build.sh -Z var, to unset a variable and ensure it's unset in makewrapper.
For -M MAKEOBJDIRPREFIX, unset MAKEOBJDIR.
For -O MAKEOBJDIR, unset MAKEOBJDIRPREFIX.


# 1.39 18-Jul-2003 lukem

fix default location of TOOLDIR


# 1.38 18-Jul-2003 lukem

Update for the MKUNPRIVED/MKUPDATE changes.


# 1.37 18-Jul-2003 lukem

rebuild with new groff


# 1.36 03-Jul-2003 lukem

attempt to clarify how MAKEOBJDIR{,PREFIX} may be provided ...
(this document needs a rototill, which i may get to whilst writing a
paper about build.sh)


# 1.35 25-May-2003 lukem

all:
* add "releasekernel=conf", to install a gzipped copy of the kernels
built by "kernel=conf" to RELEASEDIR/MACHINE/binary/kernel

build.sh:
* be more consistent in various status messages
* move the {release,}kernel=conf conf parsing code into getkernelconf()
and use in both buildkernel() and releasekernel()
* only warn once when building multiple kernels without updating the tools


# 1.34 18-May-2003 lukem

For normal builds, MKOBJDIRS default to `no' (not `yes').
It's only build.sh that sets this to `yes' by default.
Noted by OGAWA Takaya in [toolchain/19823]


# 1.33 17-May-2003 lukem

improve description of how "build.sh -m mach" sets the default
MACHINE_ARCH, and list the special cases that this does not occur for.


# 1.32 10-May-2003 lukem

crank date for previous


# 1.31 10-May-2003 lukem

Add "sourcesets" argument/target, which builds source sets into
RELEASEDIR/source/sets


# 1.30 08-May-2003 lukem

build.sh now provides defaults for DESTDIR and RELEASEDIR if not expert mode.
Remove -D and -R from EXAMPLES since they're not necessary any more.


# 1.29 08-Feb-2003 lukem

Fix example 3; the build.sh target is "install" not "installworld".
Improve description.
Noted by Valeriy Ushakov (uwe@) in private email.


# 1.28 02-Feb-2003 lukem

attempt to further improve and clarify the examples...


# 1.27 30-Jan-2003 lukem

Prefix various paths with 'DESTDIR', to highlight that the DESTDIR
is taken into account.


# 1.26 29-Jan-2003 lukem

allow toolprefix to be easily changed


# 1.25 26-Jan-2003 lukem

Various improvements per discussion with Alan Barrett.


# 1.24 26-Jan-2003 lukem

- Add "sets" top-level Makefile target and build.sh operation.
[Latter suggested by Julio Merino in private email]
- Add "help" build.sh operation.


# 1.23 26-Jan-2003 lukem

Change build.sh so that at least one operation is required.
Add "makewrapper" operation to build.sh.
[The above changes were suggested by Alan Barrett on current-users@]

Fail if building as non-root unless: UNPRIVED is set, -U is given, or -E
(expert mode) is given.
[Suggested by James Wetterau in private email]

Improve the examples in BUILDING.


# 1.22 23-Jan-2003 lukem

Rework how build.sh functions, so that command line options set various
parameters, and a list of "operations" defines what to do.
The full usage is show below. Notes:
`-b' has been deprecated (it always occurs now)
`-d' is replaced by "distribution"
`-R rel' onlys sets RELEASEDIR; use "release" to build a release
`-k kern' has been replaced by "kernel=kern"
`-i idir' has been replaced by "install=idir"
-r now occurs before nbmake is rebuilt

Add a copyright (long due!). Rework the code to (a KNF inspired) ShellNF.
Use functions appropriately. Allow `nb' prefix to be easily changed to
something else. Solve world peace (just kidding)

This is part of the (never achievable) goal of attempting to make
NetBSD easier to build...


--8<-- new usage follows --8<--

Usage: build.sh [-EnorUu] [-a arch] [-B buildid] [-D dest] [-j njob] [-M obj]
[-m mach] [-O obj] [-R release] [-T tools] [-V var=[value]]
[-w wrapper] [operation [...] ]

System build operations (all imply "obj" and "tools"):
build Run "make build"
distribution Run "make distribution" (includes etc/ files)
release Run "make release" (includes kernels & distrib media)

Other operations:
obj Run "make obj" (default unless -o)
tools Build and install tools
kernel=conf Build kernel with config file `conf'
install=idir Run "make installworld" to `idir'
(useful after 'distribution' or 'release')

Options:
-a arch Set MACHINE_ARCH to arch (otherwise deduced from MACHINE)
-B buildId Set BUILDID to buildId
-D dest Set DESTDIR to dest
-E Set "expert" mode; disables some DESTDIR checks
-j njob Run up to njob jobs in parallel; see make(1)
-M obj Set obj root directory to obj (sets MAKEOBJDIRPREFIX)
-m mach Set MACHINE to mach (not required if NetBSD native)
-n Show commands that would be executed, but do not execute them
-O obj Set obj root directory to obj (sets a MAKEOBJDIR pattern)
-o Set MKOBJDIRS=no (do not create objdirs at start of build)
-R release Set RELEASEDIR to release
-r Remove contents of TOOLDIR and DESTDIR before building
-T tools Set TOOLDIR to tools. If unset, and TOOLDIR is not set in
the environment, nbmake will be (re)built unconditionally.
-U Set UNPRIVED
-u Set UPDATE
-V v=[val] Set variable `v' to `val'
-w wrapper Create nbmake script as wrapper
(default: ${TOOLDIR}/bin/nbmake-${MACHINE})


# 1.21 04-Jan-2003 lukem

Add "-V var=[value]", for setting arbitrary variables which will also
be added to the nbmake-${MACHINE} wrapper.
Useful for setting RELEASEDIR, without -R's habit of building a release.


Revision tags: fvdl_fs64_base
# 1.20 25-Dec-2002 lukem

Document:
* build.sh -i idir
* top level targets: distribution, buildworld, installworld
* top level variables: INSTALLWORLDDIR


# 1.19 08-Dec-2002 lukem

Add -E - "expert mode". If this is not specified, builds to DESTDIR=/ are
not permitted.
By using this flag, you are taking responsibility for any issues that
may occur because of this...


# 1.18 08-Dec-2002 lukem

- be consistent about option ordering in build.sh usage display
- use Fl and Ar instead of Sy and Em to format options


# 1.17 25-Nov-2002 wiz

Update location of BUILDING.mdoc.


# 1.16 20-Oct-2002 lukem

regen for build.sh -k


# 1.15 21-Sep-2002 lukem

regen for: USE_NEW_TOOLCHAIN was replaced with TOOLCHAIN_MISSING


# 1.14 17-Sep-2002 fredb

Expand on the difference between ``build.sh -d'' and ``make install'',
as requested by Brian Stark in PR toolchain/18228 (which this closes).


# 1.13 22-Jul-2002 wiz

Remove duplicate 'files'. From Ryo HAYASAKA in toolchain/17674.


Revision tags: netbsd-1-6-PATCH002-RC3 netbsd-1-6-PATCH002-RC2 netbsd-1-6-PATCH002-RC1 netbsd-1-6-PATCH001 netbsd-1-6-PATCH001-RELEASE netbsd-1-6-PATCH001-RC3 netbsd-1-6-PATCH001-RC2 netbsd-1-6-PATCH001-RC1 netbsd-1-6-RELEASE netbsd-1-6-RC3 netbsd-1-6-RC2 netbsd-1-6-RC1 netbsd-1-6-base
# 1.12 13-May-2002 lukem

branches: 1.12.2;
add "-M makeobjdirprefix" to build.sh


# 1.11 03-May-2002 lukem

Move the METALOG from ${_SRC_TOP_OBJ_} to ${DESTDIR}.

There were too many synchronisation problems with using the former;
including situations such as a "make clean" performed between two
installs to the same DESTDIR would result in a truncated METALOG and
the resultant sets would be missing stuff such as include files that
don't get reinstalled if they haven't changed, even with !UPDATE.


# 1.10 02-May-2002 sommerfeld

Re-gen.


# 1.9 14-Mar-2002 thorpej

Add a -B option to set the BUILDID for the build. This also causes
the make(1) wrapper script to be named "nbmake-MACHINE-BUILDID".


# 1.8 05-Mar-2002 lukem

document various supported environment variables, including MAKEOBJDIRPREFIX


# 1.7 04-Mar-2002 lukem

document:
- make's UNPRIVED support
- build.sh's -U support
- the build system currently needs to build onto a file system with
long file name and hard link support


# 1.6 25-Nov-2001 thorpej

Document the -d option to build.sh


# 1.5 15-Nov-2001 tv

Note only <bsd.own.mk> as the authority for determining whether the new
BUILDING instructions should be used.


# 1.4 14-Nov-2001 tv

Turn off host-specific objdirs by default. Set MKHOSTOBJ=yes to enable.


# 1.3 12-Nov-2001 tv

Major overhaul of src/tools and host toolchain. Summary of changes:

* Rewrite src/tools Make logic to work like the rest of the tree wrt
"dependall" and "install". The old "make build" hack is gone.

* Remove the MKTOOLS logic. This was linked to the "make build" hack,
and was only needed because TOOLDIR originally had no writable default.

* Redo the GNU configure/make logic to make it fit reasonably in a
BSD make wrapper. Use new ${.ALLTARGETS} variable to scan for
targets in $(srcdir), and mark them with .MADE: to prevent rebuilding.

* Only build cross tools in src/tools; remove some messy logic in
src/usr.* and src/gnu/usr.* that would do target filename rewriting
(improves consistency and readability).

* Add the ability to build cross gdb at tool build time by setting
MKCROSSGDB (default no) to "yes" in mk.conf.

* Add src/tools/groff and set up paths to work with this cross groff.


# 1.2 08-Nov-2001 wiz

Remove mention of BUILDLING.html, and follow rename of BUILDING.txt to
BUILDING.
Noted by Love <lha@stacken.kth.se> on tech-toolchain.


# 1.1 01-Nov-2001 tv

By popular demand, one preformatted version of BUILDING, plaintext, no CRs.


# 1.129 21-Oct-2017 sevan

regen


Revision tags: perseant-stdc-iso10646-base netbsd-8-base
# 1.128 21-May-2017 riastradh

regen


Revision tags: prg-localcount2-base3 prg-localcount2-base2 prg-localcount2-base1 prg-localcount2-base pgoyette-localcount-20170426
# 1.127 22-Apr-2017 plunky

regen


Revision tags: bouyer-socketcan-base1
# 1.126 20-Apr-2017 wiz

regen using regen target in doc.


# 1.125 20-Apr-2017 ozaki-r

Introduce MKSTRIPSYM build option

If it's yes, all local symbols of shared libraries are stripped
(default). If it's no, only temporary local symbols are stripped;
for example, symbols of static functions are kept. Keeping such
symbols is useful on using DTrace for userland libraries and
getting a backtrace from a rump server loading modules (shared
libraries).

Proposed and discussed on tech-kern and tech-toolchain


Revision tags: pgoyette-localcount-20170320
# 1.124 20-Feb-2017 christos

regen


# 1.123 16-Feb-2017 rin

The default values for MKPIC are yes and no for sh3 and m68000, respectively.
Bump date.


Revision tags: bouyer-socketcan-base pgoyette-localcount-20170107 pgoyette-localcount-20161104 localcount-20160914 pgoyette-localcount-20160806 pgoyette-localcount-20160726 pgoyette-localcount-base
# 1.122 29-Jan-2016 wiz

branches: 1.122.2; 1.122.4;
Document MKREPRO_TIMESTAMP.


# 1.121 23-Jul-2015 mrg

remove the xfree86 reachover makefiles and the vast majority of
the support in the rest of the source tree.

X11 sets could use some cleaning up perhaps (just deletion, as
we've never really marked the old X11R6 as obsolete for native
xorg using platforms so far either.)


# 1.120 07-Jun-2015 pgoyette

Update to reflect changes made in rev 1.398 of src/etc/Makefile


# 1.119 08-Apr-2015 wiz

regen


# 1.118 30-Nov-2014 uebayasi

regen


# 1.117 16-Nov-2014 uebayasi

regen


# 1.116 16-Nov-2014 uebayasi

regen


# 1.115 13-Nov-2014 apb

regen from doc/BUILDING.mdoc revision 1.107.
This reinstates documentation for "extsrc" which was lost in 2009.


# 1.114 08-Nov-2014 snj

fourth time's the charm, i guess. when committing a generated file,
it's best to use the latest revision of the source file (hi uebs!)

regen to include changes from revision 1.105 of doc/BUILDING.mdoc


# 1.113 06-Nov-2014 uebayasi

regen


# 1.112 06-Nov-2014 uebayasi

Expand TABs.


# 1.111 06-Nov-2014 uebayasi

Document the new "kernels" operation, prompted by joerg@.


# 1.110 05-Nov-2014 snj

regen


Revision tags: netbsd-7-base tls-earlyentropy-base tls-maxphys-base
# 1.109 07-Aug-2014 apb

branches: 1.109.2;
regen BUILDING from doc/BUILDING.mdoc


# 1.108 03-Aug-2014 apb

BUILDINFO part6: regen BUILDING from doc/BUILDING.mdoc


# 1.107 14-Jun-2014 apb

Regen from doc/BUILDING.mdoc;1.100:
Improve documentation for BUILDID.


# 1.106 21-May-2014 wiz

regen


Revision tags: yamt-pagecache-base9 riastradh-xf86-video-intel-2-7-1-pre-2-21-15 riastradh-drm2-base3 riastradh-drm2-base2 riastradh-drm2-base1 riastradh-drm2-base
# 1.105 29-May-2013 wiz

branches: 1.105.4;
regen using 'make regen' from src/doc.


# 1.104 29-May-2013 wiz

regen (using mandoc doc/BUILDING.mdoc > BUILDING -- let me know
if a different way is preferred, I see that it now contains formatting).


Revision tags: agc-symver-base yamt-pagecache-base8 yamt-pagecache-base7
# 1.103 08-Nov-2012 dholland

regen


Revision tags: yamt-pagecache-base6
# 1.102 19-Sep-2012 abs

regen


# 1.101 25-May-2012 wiz

branches: 1.101.2;
regen using 'make regen' in doc/


# 1.100 25-May-2012 wiz

Document MKREPRO using joerg's wording.


Revision tags: yamt-pagecache-base5 yamt-pagecache-base4
# 1.99 23-Feb-2012 tsutsui

Add a missing period.


Revision tags: netbsd-6-base
# 1.98 14-Feb-2012 apb

branches: 1.98.2;
Regen from revision 1.87 of doc/BUILDING.mdoc.


# 1.97 22-Jan-2012 tsutsui

Add "live-image" and "install-image" target support to build.sh.

"live-image" target builds pre-installed disk images that can be used on
emulators or boot from USB memory sticks to try NetBSD without installation.
Currently amd64, i386, pmax, sparc, sparc64, sun2, sun3, and vax
(which have working emulators and don't require extra tools like preparing
msdosfs or partitioning MD label structures) support this target.

"install-image" target builds an bootable installation disk image that can
be used as an install CD but burned into USB memory sticks etc.
Current only amd64 and i386 (which would support USB boot) have this target.

For more details (and known issue) see following posts on netbsd-bugs@:
http://mail-index.NetBSD.org/netbsd-bugs/2011/08/06/msg023639.html
http://mail-index.NetBSD.org/netbsd-bugs/2011/09/23/msg024207.html
http://mail-index.NetBSD.org/netbsd-bugs/2011/12/07/msg025166.html
http://mail-index.NetBSD.org/netbsd-bugs/2011/12/08/msg025178.html

No particular comments about implementation, and
"go ahead" comments from mrg@, riz@ and christos@.

Closes PR toolchain/45153 and PR misc/45155.


Revision tags: yamt-pagecache-base3 yamt-pagecache-base2 yamt-pagecache-base
# 1.96 09-Sep-2011 apb

branches: 1.96.2;
Add tests for the shell under which build.sh is run. If the
shell fails the tests, then build.sh tries to re-exec itself
under a more suitable shell.


# 1.95 09-Sep-2011 apb

Revisions 1.92 and 1.93 of src/BUILDING were not reflected in
src/doc/BUILDING.mdoc, so those changes were lost when src/BUILDING
was regenerated in revision 1.94.

Now update src/doc/BUILDING.mdoc and regenerate src/BUILDING to
reinstate the lost changes. (I also edited one of the changes, to use
the phrase "space-separated list" for consistency with other parts of
the document.)

The original changes were:


# 1.93 06-Aug-2011 jnemeth

Add description of MKKMOD, part of PR misc/45216


Revision tags: cherry-xenmp-base bouyer-quota2-nbase bouyer-quota2-base
# 1.92 29-Jan-2011 jym

Pass down INSTALLSETS variable to installsets target. Use :Q to escape
shell meta-characters, as the variable contains a list of sets, separated
by spaces.

$ ./build.sh -V INSTALLSETS="base etc" install=idir

should now work as expected.

Reviewed by apb@ on tech-toolchain.


# 1.94 09-Sep-2011 apb

Allow MAKEFLAGS to be set via build.sh -V. Somebody asked for this
in 2008.

Also add comments above a few functions in build.sh, and bump copyright
dates.


# 1.93 06-Aug-2011 jnemeth

Add description of MKKMOD, part of PR misc/45216


Revision tags: cherry-xenmp-base bouyer-quota2-nbase bouyer-quota2-base
# 1.92 29-Jan-2011 jym

Pass down INSTALLSETS variable to installsets target. Use :Q to escape
shell meta-characters, as the variable contains a list of sets, separated
by spaces.

$ ./build.sh -V INSTALLSETS="base etc" install=idir

should now work as expected.

Reviewed by apb@ on tech-toolchain.


Revision tags: matt-mips64-premerge-20101231
# 1.91 25-Jul-2010 mrg

branches: 1.91.2;
remove the MKSUBPIXEL/MKTTINTERP options; they're going away.

regenerate.


Revision tags: matt-premerge-20091211
# 1.90 30-Nov-2009 uebayasi

Support "extsrc", externally added programs and libraries. Users can write
their own reach-overs, cross-build, install, and get set files just like base
and X11 / X.org. (These sets are not included as TNF releases.)


# 1.89 10-Oct-2009 apb

If ${NETBDSRCDIR}/../xsrc exists, then use it as the default value
of X11SRCDIR. If it doesn't exist, then use /usr/xsrc as before.

OK mrg


# 1.88 27-Sep-2009 apb

* Use a more robust method of creating the top level object directory.
Use getmakevar to expand MAKEOBJDIRPREFIX or MAKEOBJDIR, or (if
neither of those variables is set) use a non-recursive "make obj" in
the top level source directory.

* Do not let TOP_objdir default to ${TOP}. It's now set only by the
-M or -O command line options, or after using getmakevar to expand
MAKEOBJDIRPREFIX or MAKEOBJDIR.

* Make try_set_TOOLDIR handle MAKEOBJDIRPERFIX passed from the
environment. It runs too early to use getmakevar, so it will not work
if the value contains embedded '${...}' variable references.

* Use '$TOOLDIR' (with a literal '$') instead of 'nonexistent' in
a message when rebuilding make when TOOLDIR is not yet known.


# 1.87 27-Sep-2009 apb

Allow build.sh "-C cdextra" option to be specified multiple times.


# 1.86 07-Sep-2009 jnemeth

Add a modules operation to build.sh, which builds and installs kernel modules
into DESTDIR.

This is based on the patch provided by tsutsui@ on tech-toolchain@.


# 1.85 12-Jul-2009 hubertf

regen


# 1.84 12-Jul-2009 hubertf

regen


Revision tags: jym-xensuspend-nbase jym-xensuspend-base
# 1.83 01-May-2009 snj

Introduce MKSUBPIXEL, which allows enabling subpixel rendering code
in FreeType.


# 1.82 02-Dec-2008 mrg

branches: 1.82.2;
be explicit about MAKEOBJDIR and MAKEOBJDIRPREFIX not being for
mk.conf or ${MAKECONF}.


# 1.81 15-Nov-2008 mrg

revert sparc back to default of XFree86 at the request of macallan.


# 1.80 13-Nov-2008 apb

Add support for new MAKEVERBOSE levels 3 and 4. The complete list is now:

0 Minimal output ("quiet")
1 Describe what is occurring
2 Describe what is occurring and echo the actual command
3 Ignore the effect of the "@" prefix in make commands
4 Trace shell commands using the shell's -x flag

The default remains MAKEVERBOSE=2.


# 1.79 09-Nov-2008 mrg

- retire MKXORG from public use
- introduce X11FLAVOUR to choose src/x11 vs src/external/mit/xorg
for the X11 to build if MKX11=yes is set. it takes the values
of either Xorg or XFree86.
- default to Xorg on alpha, i386, macppc, shark, sparc and sparc64
- remove MKXORG_WITH_XSRC_XSERVER, unused and never useful


Revision tags: netbsd-5-base matt-mips64-base2
# 1.78 24-Sep-2008 apb

branches: 1.78.2;
regen for recent change to examples and objdir advice,
and for the older MKSTRIPIDENT change.


Revision tags: wrstuden-revivesa-base-3 wrstuden-revivesa-base-2
# 1.77 06-Sep-2008 lukem

regen for MKHTML


# 1.76 28-Aug-2008 lukem

Improve support for MKXORG!=no to enable builds into external/mit/xorg.
This will be mutually exclusive to MKX11!=no.


# 1.75 18-Aug-2008 lukem

Document "build.sh cleandir".
Fix formatting nit.
Remove BUGS; all the in-tree platforms are using build.sh now.


# 1.74 11-Aug-2008 apb

* Suggest a "-j" value between 1+NCPU and 2*NCPU for the fastest builds.
* Remove some duplicated content that appeared in both the section about
make's -j flag and the section about build.sh's -j flag.


# 1.73 05-Aug-2008 apb

* Add more detail for build.sh -M and -O options.
* Mention new default when source is /usr/src but build.sh is run
with neither -M nor -O.


# 1.72 05-Aug-2008 perry

Builds now use "BUILDSEED" so that c++ binaries are reproduceable.
By default BUILDSEED is set to NetBSD-{majorversion} -- a -S flag may
be used to change it.

Discussed on tech-toolchain.


Revision tags: wrstuden-revivesa-base-1 yamt-pf42-base4 yamt-pf42-base3 hpcarm-cleanup-nbase yamt-pf42-baseX yamt-pf42-base2 wrstuden-revivesa-base keiichi-mipv6-nbase yamt-pf42-base keiichi-mipv6-base
# 1.71 29-Mar-2008 dholland

branches: 1.71.4;
Correct/clarify the default setting of USETOOLS in the previous version.
Noted by apb.


# 1.70 28-Mar-2008 dholland

Assorted updates and clarifications, grammar fixes and wording improvements,
and so on. Significant highlights:
- mention src/tests and reference atf;
- provide examples of MACHINE and MACHINE_ARCH;
- mention that MKOBJ=no is not recommended;
- correct the description of the default setting of USETOOLS;
- document the interactions of build.sh -[uo] with various things;
- document the interactions of build.sh tools and kernel=FOO;
- use a lot fewer parentheses.
Discussed on netbsd-docs.


Revision tags: matt-armv6-nbase
# 1.69 18-Mar-2008 lukem

Consistently document RELEASEDIR/RELEASEMACHINEDIR.


# 1.68 08-Mar-2008 reed

Mention that "build" and "distribution" do not build nor install (to DESTDIR)
a kernel.


Revision tags: cube-autoconf-base matt-armv6-base hpcarm-cleanup-base
# 1.67 23-Nov-2007 sborrill

branches: 1.67.4;
Add support for CDBUILDEXTRA which acts like CDEXTRA to add extra items
to the CD-ROM image.
Make CDEXTRA and CDBUILDEXTRA be able to contain lists of files and directories
which are added in turn.
Add support for CDEXTRA_SKIP which contains a list of fnmatch(3) items to
skip during the copy. This is _very_ useful for skipping CVS dirs for example.
CDBUILDEXTRA and CDEXTRA_SKIP are to be used in Makefiles creating the images,
CDEXTRA remains to be used from build.sh.
Update documentation and build.sh help text to show that -C can be used to
specify a list of files and directories rather than just a single dir.


# 1.66 01-Sep-2007 jnemeth

Convert build.sh iso-dir=directory option to -C cddir as per jmmv@ on
source-changes.


# 1.65 01-Sep-2007 jnemeth

Add an iso-dir=directory option. When combined with iso-image or
iso-image-source, it will cause directory to be added to the CD-ROM image.


# 1.64 30-Aug-2007 jnemeth

describe new iso-image-source target


# 1.63 30-Aug-2007 ad

Remove STATUS paragraph which makes it sound like the build system is
half baked.


Revision tags: matt-mips64-base
# 1.62 13-Apr-2007 apb

branches: 1.62.4;
Document recent changes to "make iso-image".


# 1.61 26-Mar-2007 apb

Document the fact that "make installworld" and "build.sh
installworld=..." do not install the etc or xetc sets. Suggest using
etcupdate(8) and postinstall(8) after installworld.


# 1.60 27-Jan-2007 apb

Try to clarify the description of build.sh -m mach.
Document new evbarm-eb and evbarm-el aliases.


Revision tags: netbsd-4-base
# 1.59 08-Oct-2006 apb

branches: 1.59.2;
Clarify that DESTDIR/OBJDIR/etc are absolute paths, but build.sh
-D/-O/etc allows relative paths.

Closes PR 32345 by Andre Luiz de Oliveira.


# 1.58 29-Sep-2006 apb

Use ${HOST_SH} instead of the host system's /bin/sh wherever possible:

* Describe the HOST_SH variable, and the way build.sh attempts to set it.

* Suggest passing HOST_SH in the environment if /bin/sh is not a working
shell.


Revision tags: abandoned-netbsd-4-base
# 1.57 29-Jan-2006 apb

mkisofs is in pkgsrc/sysutils/cdrtools now, not pkgsrc/sysutils/cdrecord.
Reported by Jukka Salmi.


# 1.56 28-Jan-2006 apb

* Add an "iso-image" target in the top level Makefile,
which invokes make iso-image in the etc directory.
* Add an "iso-image" action in build.sh, which
invokes make iso-image.
* Document the above in doc/BUILDING.mdoc.
* Re-generate BUILDING.

Approved by christos


# 1.55 12-Jan-2006 wiz

Bump date for syspkgs.


# 1.54 04-Jan-2006 apb

Document "make syspkgs" and "build.sh syspkgs".

Reviewed by agc


Revision tags: netbsd-3-1-1-RELEASE netbsd-3-0-3-RELEASE netbsd-3-1-RELEASE netbsd-3-0-2-RELEASE netbsd-3-1-RC4 netbsd-3-1-RC3 netbsd-3-1-RC2 netbsd-3-1-RC1 netbsd-3-0-1-RELEASE netbsd-3-0-RELEASE netbsd-3-0-RC6 netbsd-3-0-RC5 netbsd-3-0-RC4 netbsd-3-0-RC3 netbsd-3-0-RC2 netbsd-3-0-RC1 netbsd-3-base
# 1.53 15-Feb-2005 reed

Document the environment variables for if you need to override or
manually select your compilers.
(And regen BUILDING from doc/BUILDING.mdoc.)


# 1.52 12-Oct-2004 jmc

Fix some typo's/bad wording as highlighted in PR#27219


# 1.51 25-Jun-2004 wiz

regen (Document -h. From Karsten Kruse in PR 25974.
While here, remove a duplicate sentence).


Revision tags: netbsd-2-0-3-RELEASE netbsd-2-1-RELEASE netbsd-2-1-RC6 netbsd-2-1-RC5 netbsd-2-1-RC4 netbsd-2-1-RC3 netbsd-2-1-RC2 netbsd-2-1-RC1 netbsd-2-0-2-RELEASE netbsd-2-0-1-RELEASE netbsd-2-base netbsd-2-0-RELEASE netbsd-2-0-RC5 netbsd-2-0-RC4 netbsd-2-0-RC3 netbsd-2-0-RC2 netbsd-2-0-RC1 netbsd-2-0-base
# 1.50 19-Mar-2004 wiz

Document MKTTINTERP.


# 1.49 06-Feb-2004 lukem

* Document build.sh -X and -x
* Document MKX11 and X11SRCDIR
* Remove note warning against cross-building from systems other than NetBSD;
it works on many other platforms.


# 1.48 29-Dec-2003 jmc

Note tools/compat/README as the place to get notes from non-native cross builds


# 1.47 19-Dec-2003 zuntum

Change -v to -V in the following section:

"Print make(1)'s idea of the value of var. Does not build any targets."

To reflect reality.

Found by Tomasz Marciniak <Tomasz.Marciniak@felix.fizyka.amu.edu.pl>, thanks!


# 1.46 26-Oct-2003 lukem

Improve how build.sh -N and MAKEVERBOSE interoperate;
rather than adding '-s' to make's command line in the makewrapper,
use the .SILENT target based on MAKEVERBOSE's value.

This means that you can do:
./build.sh -N 1 makewrapper

$TOOLDIR/bin/nbmake-$MACHINE
# runs at MAKEVERBOSE==1, with command lines suppressed

$TOOLDIR/bin/nbmake-$MACHINE MAKEVERBOSE=2
# runs at MAKEVERBOSE==2 for this invocation, with command lines shown


# 1.45 25-Oct-2003 lukem

Implement build -N noisy, which sets MAKEVERBOSE to noisy and adds
`-s' to MAKEFLAGS for noisy < 2.


# 1.44 29-Sep-2003 lukem

regenerate for "%" prompt update


# 1.43 19-Aug-2003 martti

Backout the previous commit


# 1.42 19-Aug-2003 martti

Remove # from the example.


# 1.41 08-Aug-2003 lukem

fix description of MAKEOBJDIR. from Martin Husemann


# 1.40 29-Jul-2003 lukem

Add build.sh -Z var, to unset a variable and ensure it's unset in makewrapper.
For -M MAKEOBJDIRPREFIX, unset MAKEOBJDIR.
For -O MAKEOBJDIR, unset MAKEOBJDIRPREFIX.


# 1.39 18-Jul-2003 lukem

fix default location of TOOLDIR


# 1.38 18-Jul-2003 lukem

Update for the MKUNPRIVED/MKUPDATE changes.


# 1.37 18-Jul-2003 lukem

rebuild with new groff


# 1.36 03-Jul-2003 lukem

attempt to clarify how MAKEOBJDIR{,PREFIX} may be provided ...
(this document needs a rototill, which i may get to whilst writing a
paper about build.sh)


# 1.35 25-May-2003 lukem

all:
* add "releasekernel=conf", to install a gzipped copy of the kernels
built by "kernel=conf" to RELEASEDIR/MACHINE/binary/kernel

build.sh:
* be more consistent in various status messages
* move the {release,}kernel=conf conf parsing code into getkernelconf()
and use in both buildkernel() and releasekernel()
* only warn once when building multiple kernels without updating the tools


# 1.34 18-May-2003 lukem

For normal builds, MKOBJDIRS default to `no' (not `yes').
It's only build.sh that sets this to `yes' by default.
Noted by OGAWA Takaya in [toolchain/19823]


# 1.33 17-May-2003 lukem

improve description of how "build.sh -m mach" sets the default
MACHINE_ARCH, and list the special cases that this does not occur for.


# 1.32 10-May-2003 lukem

crank date for previous


# 1.31 10-May-2003 lukem

Add "sourcesets" argument/target, which builds source sets into
RELEASEDIR/source/sets


# 1.30 08-May-2003 lukem

build.sh now provides defaults for DESTDIR and RELEASEDIR if not expert mode.
Remove -D and -R from EXAMPLES since they're not necessary any more.


# 1.29 08-Feb-2003 lukem

Fix example 3; the build.sh target is "install" not "installworld".
Improve description.
Noted by Valeriy Ushakov (uwe@) in private email.


# 1.28 02-Feb-2003 lukem

attempt to further improve and clarify the examples...


# 1.27 30-Jan-2003 lukem

Prefix various paths with 'DESTDIR', to highlight that the DESTDIR
is taken into account.


# 1.26 29-Jan-2003 lukem

allow toolprefix to be easily changed


# 1.25 26-Jan-2003 lukem

Various improvements per discussion with Alan Barrett.


# 1.24 26-Jan-2003 lukem

- Add "sets" top-level Makefile target and build.sh operation.
[Latter suggested by Julio Merino in private email]
- Add "help" build.sh operation.


# 1.23 26-Jan-2003 lukem

Change build.sh so that at least one operation is required.
Add "makewrapper" operation to build.sh.
[The above changes were suggested by Alan Barrett on current-users@]

Fail if building as non-root unless: UNPRIVED is set, -U is given, or -E
(expert mode) is given.
[Suggested by James Wetterau in private email]

Improve the examples in BUILDING.


# 1.22 23-Jan-2003 lukem

Rework how build.sh functions, so that command line options set various
parameters, and a list of "operations" defines what to do.
The full usage is show below. Notes:
`-b' has been deprecated (it always occurs now)
`-d' is replaced by "distribution"
`-R rel' onlys sets RELEASEDIR; use "release" to build a release
`-k kern' has been replaced by "kernel=kern"
`-i idir' has been replaced by "install=idir"
-r now occurs before nbmake is rebuilt

Add a copyright (long due!). Rework the code to (a KNF inspired) ShellNF.
Use functions appropriately. Allow `nb' prefix to be easily changed to
something else. Solve world peace (just kidding)

This is part of the (never achievable) goal of attempting to make
NetBSD easier to build...


--8<-- new usage follows --8<--

Usage: build.sh [-EnorUu] [-a arch] [-B buildid] [-D dest] [-j njob] [-M obj]
[-m mach] [-O obj] [-R release] [-T tools] [-V var=[value]]
[-w wrapper] [operation [...] ]

System build operations (all imply "obj" and "tools"):
build Run "make build"
distribution Run "make distribution" (includes etc/ files)
release Run "make release" (includes kernels & distrib media)

Other operations:
obj Run "make obj" (default unless -o)
tools Build and install tools
kernel=conf Build kernel with config file `conf'
install=idir Run "make installworld" to `idir'
(useful after 'distribution' or 'release')

Options:
-a arch Set MACHINE_ARCH to arch (otherwise deduced from MACHINE)
-B buildId Set BUILDID to buildId
-D dest Set DESTDIR to dest
-E Set "expert" mode; disables some DESTDIR checks
-j njob Run up to njob jobs in parallel; see make(1)
-M obj Set obj root directory to obj (sets MAKEOBJDIRPREFIX)
-m mach Set MACHINE to mach (not required if NetBSD native)
-n Show commands that would be executed, but do not execute them
-O obj Set obj root directory to obj (sets a MAKEOBJDIR pattern)
-o Set MKOBJDIRS=no (do not create objdirs at start of build)
-R release Set RELEASEDIR to release
-r Remove contents of TOOLDIR and DESTDIR before building
-T tools Set TOOLDIR to tools. If unset, and TOOLDIR is not set in
the environment, nbmake will be (re)built unconditionally.
-U Set UNPRIVED
-u Set UPDATE
-V v=[val] Set variable `v' to `val'
-w wrapper Create nbmake script as wrapper
(default: ${TOOLDIR}/bin/nbmake-${MACHINE})


# 1.21 04-Jan-2003 lukem

Add "-V var=[value]", for setting arbitrary variables which will also
be added to the nbmake-${MACHINE} wrapper.
Useful for setting RELEASEDIR, without -R's habit of building a release.


Revision tags: fvdl_fs64_base
# 1.20 25-Dec-2002 lukem

Document:
* build.sh -i idir
* top level targets: distribution, buildworld, installworld
* top level variables: INSTALLWORLDDIR


# 1.19 08-Dec-2002 lukem

Add -E - "expert mode". If this is not specified, builds to DESTDIR=/ are
not permitted.
By using this flag, you are taking responsibility for any issues that
may occur because of this...


# 1.18 08-Dec-2002 lukem

- be consistent about option ordering in build.sh usage display
- use Fl and Ar instead of Sy and Em to format options


# 1.17 25-Nov-2002 wiz

Update location of BUILDING.mdoc.


# 1.16 20-Oct-2002 lukem

regen for build.sh -k


# 1.15 21-Sep-2002 lukem

regen for: USE_NEW_TOOLCHAIN was replaced with TOOLCHAIN_MISSING


# 1.14 17-Sep-2002 fredb

Expand on the difference between ``build.sh -d'' and ``make install'',
as requested by Brian Stark in PR toolchain/18228 (which this closes).


# 1.13 22-Jul-2002 wiz

Remove duplicate 'files'. From Ryo HAYASAKA in toolchain/17674.


Revision tags: netbsd-1-6-PATCH002-RC3 netbsd-1-6-PATCH002-RC2 netbsd-1-6-PATCH002-RC1 netbsd-1-6-PATCH001 netbsd-1-6-PATCH001-RELEASE netbsd-1-6-PATCH001-RC3 netbsd-1-6-PATCH001-RC2 netbsd-1-6-PATCH001-RC1 netbsd-1-6-RELEASE netbsd-1-6-RC3 netbsd-1-6-RC2 netbsd-1-6-RC1 netbsd-1-6-base
# 1.12 13-May-2002 lukem

branches: 1.12.2;
add "-M makeobjdirprefix" to build.sh


# 1.11 03-May-2002 lukem

Move the METALOG from ${_SRC_TOP_OBJ_} to ${DESTDIR}.

There were too many synchronisation problems with using the former;
including situations such as a "make clean" performed between two
installs to the same DESTDIR would result in a truncated METALOG and
the resultant sets would be missing stuff such as include files that
don't get reinstalled if they haven't changed, even with !UPDATE.


# 1.10 02-May-2002 sommerfeld

Re-gen.


# 1.9 14-Mar-2002 thorpej

Add a -B option to set the BUILDID for the build. This also causes
the make(1) wrapper script to be named "nbmake-MACHINE-BUILDID".


# 1.8 05-Mar-2002 lukem

document various supported environment variables, including MAKEOBJDIRPREFIX


# 1.7 04-Mar-2002 lukem

document:
- make's UNPRIVED support
- build.sh's -U support
- the build system currently needs to build onto a file system with
long file name and hard link support


# 1.6 25-Nov-2001 thorpej

Document the -d option to build.sh


# 1.5 15-Nov-2001 tv

Note only <bsd.own.mk> as the authority for determining whether the new
BUILDING instructions should be used.


# 1.4 14-Nov-2001 tv

Turn off host-specific objdirs by default. Set MKHOSTOBJ=yes to enable.


# 1.3 12-Nov-2001 tv

Major overhaul of src/tools and host toolchain. Summary of changes:

* Rewrite src/tools Make logic to work like the rest of the tree wrt
"dependall" and "install". The old "make build" hack is gone.

* Remove the MKTOOLS logic. This was linked to the "make build" hack,
and was only needed because TOOLDIR originally had no writable default.

* Redo the GNU configure/make logic to make it fit reasonably in a
BSD make wrapper. Use new ${.ALLTARGETS} variable to scan for
targets in $(srcdir), and mark them with .MADE: to prevent rebuilding.

* Only build cross tools in src/tools; remove some messy logic in
src/usr.* and src/gnu/usr.* that would do target filename rewriting
(improves consistency and readability).

* Add the ability to build cross gdb at tool build time by setting
MKCROSSGDB (default no) to "yes" in mk.conf.

* Add src/tools/groff and set up paths to work with this cross groff.


# 1.2 08-Nov-2001 wiz

Remove mention of BUILDLING.html, and follow rename of BUILDING.txt to
BUILDING.
Noted by Love <lha@stacken.kth.se> on tech-toolchain.


# 1.1 01-Nov-2001 tv

By popular demand, one preformatted version of BUILDING, plaintext, no CRs.


# 1.128 21-May-2017 riastradh

regen


Revision tags: prg-localcount2-base3 prg-localcount2-base2 prg-localcount2-base1 prg-localcount2-base pgoyette-localcount-20170426
# 1.127 22-Apr-2017 plunky

regen


Revision tags: bouyer-socketcan-base1
# 1.126 20-Apr-2017 wiz

regen using regen target in doc.


# 1.125 20-Apr-2017 ozaki-r

Introduce MKSTRIPSYM build option

If it's yes, all local symbols of shared libraries are stripped
(default). If it's no, only temporary local symbols are stripped;
for example, symbols of static functions are kept. Keeping such
symbols is useful on using DTrace for userland libraries and
getting a backtrace from a rump server loading modules (shared
libraries).

Proposed and discussed on tech-kern and tech-toolchain


Revision tags: pgoyette-localcount-20170320
# 1.124 20-Feb-2017 christos

regen


# 1.123 16-Feb-2017 rin

The default values for MKPIC are yes and no for sh3 and m68000, respectively.
Bump date.


Revision tags: bouyer-socketcan-base pgoyette-localcount-20170107 pgoyette-localcount-20161104 localcount-20160914 pgoyette-localcount-20160806 pgoyette-localcount-20160726 pgoyette-localcount-base
# 1.122 29-Jan-2016 wiz

branches: 1.122.2; 1.122.4;
Document MKREPRO_TIMESTAMP.


# 1.121 23-Jul-2015 mrg

remove the xfree86 reachover makefiles and the vast majority of
the support in the rest of the source tree.

X11 sets could use some cleaning up perhaps (just deletion, as
we've never really marked the old X11R6 as obsolete for native
xorg using platforms so far either.)


# 1.120 07-Jun-2015 pgoyette

Update to reflect changes made in rev 1.398 of src/etc/Makefile


# 1.119 08-Apr-2015 wiz

regen


# 1.118 30-Nov-2014 uebayasi

regen


# 1.117 16-Nov-2014 uebayasi

regen


# 1.116 16-Nov-2014 uebayasi

regen


# 1.115 13-Nov-2014 apb

regen from doc/BUILDING.mdoc revision 1.107.
This reinstates documentation for "extsrc" which was lost in 2009.


# 1.114 08-Nov-2014 snj

fourth time's the charm, i guess. when committing a generated file,
it's best to use the latest revision of the source file (hi uebs!)

regen to include changes from revision 1.105 of doc/BUILDING.mdoc


# 1.113 06-Nov-2014 uebayasi

regen


# 1.112 06-Nov-2014 uebayasi

Expand TABs.


# 1.111 06-Nov-2014 uebayasi

Document the new "kernels" operation, prompted by joerg@.


# 1.110 05-Nov-2014 snj

regen


Revision tags: netbsd-7-base tls-earlyentropy-base tls-maxphys-base
# 1.109 07-Aug-2014 apb

branches: 1.109.2;
regen BUILDING from doc/BUILDING.mdoc


# 1.108 03-Aug-2014 apb

BUILDINFO part6: regen BUILDING from doc/BUILDING.mdoc


# 1.107 14-Jun-2014 apb

Regen from doc/BUILDING.mdoc;1.100:
Improve documentation for BUILDID.


# 1.106 21-May-2014 wiz

regen


Revision tags: yamt-pagecache-base9 riastradh-xf86-video-intel-2-7-1-pre-2-21-15 riastradh-drm2-base3 riastradh-drm2-base2 riastradh-drm2-base1 riastradh-drm2-base
# 1.105 29-May-2013 wiz

branches: 1.105.4;
regen using 'make regen' from src/doc.


# 1.104 29-May-2013 wiz

regen (using mandoc doc/BUILDING.mdoc > BUILDING -- let me know
if a different way is preferred, I see that it now contains formatting).


Revision tags: agc-symver-base yamt-pagecache-base8 yamt-pagecache-base7
# 1.103 08-Nov-2012 dholland

regen


Revision tags: yamt-pagecache-base6
# 1.102 19-Sep-2012 abs

regen


# 1.101 25-May-2012 wiz

branches: 1.101.2;
regen using 'make regen' in doc/


# 1.100 25-May-2012 wiz

Document MKREPRO using joerg's wording.


Revision tags: yamt-pagecache-base5 yamt-pagecache-base4
# 1.99 23-Feb-2012 tsutsui

Add a missing period.


Revision tags: netbsd-6-base
# 1.98 14-Feb-2012 apb

branches: 1.98.2;
Regen from revision 1.87 of doc/BUILDING.mdoc.


# 1.97 22-Jan-2012 tsutsui

Add "live-image" and "install-image" target support to build.sh.

"live-image" target builds pre-installed disk images that can be used on
emulators or boot from USB memory sticks to try NetBSD without installation.
Currently amd64, i386, pmax, sparc, sparc64, sun2, sun3, and vax
(which have working emulators and don't require extra tools like preparing
msdosfs or partitioning MD label structures) support this target.

"install-image" target builds an bootable installation disk image that can
be used as an install CD but burned into USB memory sticks etc.
Current only amd64 and i386 (which would support USB boot) have this target.

For more details (and known issue) see following posts on netbsd-bugs@:
http://mail-index.NetBSD.org/netbsd-bugs/2011/08/06/msg023639.html
http://mail-index.NetBSD.org/netbsd-bugs/2011/09/23/msg024207.html
http://mail-index.NetBSD.org/netbsd-bugs/2011/12/07/msg025166.html
http://mail-index.NetBSD.org/netbsd-bugs/2011/12/08/msg025178.html

No particular comments about implementation, and
"go ahead" comments from mrg@, riz@ and christos@.

Closes PR toolchain/45153 and PR misc/45155.


Revision tags: yamt-pagecache-base3 yamt-pagecache-base2 yamt-pagecache-base
# 1.96 09-Sep-2011 apb

branches: 1.96.2;
Add tests for the shell under which build.sh is run. If the
shell fails the tests, then build.sh tries to re-exec itself
under a more suitable shell.


# 1.95 09-Sep-2011 apb

Revisions 1.92 and 1.93 of src/BUILDING were not reflected in
src/doc/BUILDING.mdoc, so those changes were lost when src/BUILDING
was regenerated in revision 1.94.

Now update src/doc/BUILDING.mdoc and regenerate src/BUILDING to
reinstate the lost changes. (I also edited one of the changes, to use
the phrase "space-separated list" for consistency with other parts of
the document.)

The original changes were:


# 1.93 06-Aug-2011 jnemeth

Add description of MKKMOD, part of PR misc/45216


Revision tags: cherry-xenmp-base bouyer-quota2-nbase bouyer-quota2-base
# 1.92 29-Jan-2011 jym

Pass down INSTALLSETS variable to installsets target. Use :Q to escape
shell meta-characters, as the variable contains a list of sets, separated
by spaces.

$ ./build.sh -V INSTALLSETS="base etc" install=idir

should now work as expected.

Reviewed by apb@ on tech-toolchain.


# 1.94 09-Sep-2011 apb

Allow MAKEFLAGS to be set via build.sh -V. Somebody asked for this
in 2008.

Also add comments above a few functions in build.sh, and bump copyright
dates.


# 1.93 06-Aug-2011 jnemeth

Add description of MKKMOD, part of PR misc/45216


Revision tags: cherry-xenmp-base bouyer-quota2-nbase bouyer-quota2-base
# 1.92 29-Jan-2011 jym

Pass down INSTALLSETS variable to installsets target. Use :Q to escape
shell meta-characters, as the variable contains a list of sets, separated
by spaces.

$ ./build.sh -V INSTALLSETS="base etc" install=idir

should now work as expected.

Reviewed by apb@ on tech-toolchain.


Revision tags: matt-mips64-premerge-20101231
# 1.91 25-Jul-2010 mrg

branches: 1.91.2;
remove the MKSUBPIXEL/MKTTINTERP options; they're going away.

regenerate.


Revision tags: matt-premerge-20091211
# 1.90 30-Nov-2009 uebayasi

Support "extsrc", externally added programs and libraries. Users can write
their own reach-overs, cross-build, install, and get set files just like base
and X11 / X.org. (These sets are not included as TNF releases.)


# 1.89 10-Oct-2009 apb

If ${NETBDSRCDIR}/../xsrc exists, then use it as the default value
of X11SRCDIR. If it doesn't exist, then use /usr/xsrc as before.

OK mrg


# 1.88 27-Sep-2009 apb

* Use a more robust method of creating the top level object directory.
Use getmakevar to expand MAKEOBJDIRPREFIX or MAKEOBJDIR, or (if
neither of those variables is set) use a non-recursive "make obj" in
the top level source directory.

* Do not let TOP_objdir default to ${TOP}. It's now set only by the
-M or -O command line options, or after using getmakevar to expand
MAKEOBJDIRPREFIX or MAKEOBJDIR.

* Make try_set_TOOLDIR handle MAKEOBJDIRPERFIX passed from the
environment. It runs too early to use getmakevar, so it will not work
if the value contains embedded '${...}' variable references.

* Use '$TOOLDIR' (with a literal '$') instead of 'nonexistent' in
a message when rebuilding make when TOOLDIR is not yet known.


# 1.87 27-Sep-2009 apb

Allow build.sh "-C cdextra" option to be specified multiple times.


# 1.86 07-Sep-2009 jnemeth

Add a modules operation to build.sh, which builds and installs kernel modules
into DESTDIR.

This is based on the patch provided by tsutsui@ on tech-toolchain@.


# 1.85 12-Jul-2009 hubertf

regen


# 1.84 12-Jul-2009 hubertf

regen


Revision tags: jym-xensuspend-nbase jym-xensuspend-base
# 1.83 01-May-2009 snj

Introduce MKSUBPIXEL, which allows enabling subpixel rendering code
in FreeType.


# 1.82 02-Dec-2008 mrg

branches: 1.82.2;
be explicit about MAKEOBJDIR and MAKEOBJDIRPREFIX not being for
mk.conf or ${MAKECONF}.


# 1.81 15-Nov-2008 mrg

revert sparc back to default of XFree86 at the request of macallan.


# 1.80 13-Nov-2008 apb

Add support for new MAKEVERBOSE levels 3 and 4. The complete list is now:

0 Minimal output ("quiet")
1 Describe what is occurring
2 Describe what is occurring and echo the actual command
3 Ignore the effect of the "@" prefix in make commands
4 Trace shell commands using the shell's -x flag

The default remains MAKEVERBOSE=2.


# 1.79 09-Nov-2008 mrg

- retire MKXORG from public use
- introduce X11FLAVOUR to choose src/x11 vs src/external/mit/xorg
for the X11 to build if MKX11=yes is set. it takes the values
of either Xorg or XFree86.
- default to Xorg on alpha, i386, macppc, shark, sparc and sparc64
- remove MKXORG_WITH_XSRC_XSERVER, unused and never useful


Revision tags: netbsd-5-base matt-mips64-base2
# 1.78 24-Sep-2008 apb

branches: 1.78.2;
regen for recent change to examples and objdir advice,
and for the older MKSTRIPIDENT change.


Revision tags: wrstuden-revivesa-base-3 wrstuden-revivesa-base-2
# 1.77 06-Sep-2008 lukem

regen for MKHTML


# 1.76 28-Aug-2008 lukem

Improve support for MKXORG!=no to enable builds into external/mit/xorg.
This will be mutually exclusive to MKX11!=no.


# 1.75 18-Aug-2008 lukem

Document "build.sh cleandir".
Fix formatting nit.
Remove BUGS; all the in-tree platforms are using build.sh now.


# 1.74 11-Aug-2008 apb

* Suggest a "-j" value between 1+NCPU and 2*NCPU for the fastest builds.
* Remove some duplicated content that appeared in both the section about
make's -j flag and the section about build.sh's -j flag.


# 1.73 05-Aug-2008 apb

* Add more detail for build.sh -M and -O options.
* Mention new default when source is /usr/src but build.sh is run
with neither -M nor -O.


# 1.72 05-Aug-2008 perry

Builds now use "BUILDSEED" so that c++ binaries are reproduceable.
By default BUILDSEED is set to NetBSD-{majorversion} -- a -S flag may
be used to change it.

Discussed on tech-toolchain.


Revision tags: wrstuden-revivesa-base-1 yamt-pf42-base4 yamt-pf42-base3 hpcarm-cleanup-nbase yamt-pf42-baseX yamt-pf42-base2 wrstuden-revivesa-base keiichi-mipv6-nbase yamt-pf42-base keiichi-mipv6-base
# 1.71 29-Mar-2008 dholland

branches: 1.71.4;
Correct/clarify the default setting of USETOOLS in the previous version.
Noted by apb.


# 1.70 28-Mar-2008 dholland

Assorted updates and clarifications, grammar fixes and wording improvements,
and so on. Significant highlights:
- mention src/tests and reference atf;
- provide examples of MACHINE and MACHINE_ARCH;
- mention that MKOBJ=no is not recommended;
- correct the description of the default setting of USETOOLS;
- document the interactions of build.sh -[uo] with various things;
- document the interactions of build.sh tools and kernel=FOO;
- use a lot fewer parentheses.
Discussed on netbsd-docs.


Revision tags: matt-armv6-nbase
# 1.69 18-Mar-2008 lukem

Consistently document RELEASEDIR/RELEASEMACHINEDIR.


# 1.68 08-Mar-2008 reed

Mention that "build" and "distribution" do not build nor install (to DESTDIR)
a kernel.


Revision tags: cube-autoconf-base matt-armv6-base hpcarm-cleanup-base
# 1.67 23-Nov-2007 sborrill

branches: 1.67.4;
Add support for CDBUILDEXTRA which acts like CDEXTRA to add extra items
to the CD-ROM image.
Make CDEXTRA and CDBUILDEXTRA be able to contain lists of files and directories
which are added in turn.
Add support for CDEXTRA_SKIP which contains a list of fnmatch(3) items to
skip during the copy. This is _very_ useful for skipping CVS dirs for example.
CDBUILDEXTRA and CDEXTRA_SKIP are to be used in Makefiles creating the images,
CDEXTRA remains to be used from build.sh.
Update documentation and build.sh help text to show that -C can be used to
specify a list of files and directories rather than just a single dir.


# 1.66 01-Sep-2007 jnemeth

Convert build.sh iso-dir=directory option to -C cddir as per jmmv@ on
source-changes.


# 1.65 01-Sep-2007 jnemeth

Add an iso-dir=directory option. When combined with iso-image or
iso-image-source, it will cause directory to be added to the CD-ROM image.


# 1.64 30-Aug-2007 jnemeth

describe new iso-image-source target


# 1.63 30-Aug-2007 ad

Remove STATUS paragraph which makes it sound like the build system is
half baked.


Revision tags: matt-mips64-base
# 1.62 13-Apr-2007 apb

branches: 1.62.4;
Document recent changes to "make iso-image".


# 1.61 26-Mar-2007 apb

Document the fact that "make installworld" and "build.sh
installworld=..." do not install the etc or xetc sets. Suggest using
etcupdate(8) and postinstall(8) after installworld.


# 1.60 27-Jan-2007 apb

Try to clarify the description of build.sh -m mach.
Document new evbarm-eb and evbarm-el aliases.


Revision tags: netbsd-4-base
# 1.59 08-Oct-2006 apb

branches: 1.59.2;
Clarify that DESTDIR/OBJDIR/etc are absolute paths, but build.sh
-D/-O/etc allows relative paths.

Closes PR 32345 by Andre Luiz de Oliveira.


# 1.58 29-Sep-2006 apb

Use ${HOST_SH} instead of the host system's /bin/sh wherever possible:

* Describe the HOST_SH variable, and the way build.sh attempts to set it.

* Suggest passing HOST_SH in the environment if /bin/sh is not a working
shell.


Revision tags: abandoned-netbsd-4-base
# 1.57 29-Jan-2006 apb

mkisofs is in pkgsrc/sysutils/cdrtools now, not pkgsrc/sysutils/cdrecord.
Reported by Jukka Salmi.


# 1.56 28-Jan-2006 apb

* Add an "iso-image" target in the top level Makefile,
which invokes make iso-image in the etc directory.
* Add an "iso-image" action in build.sh, which
invokes make iso-image.
* Document the above in doc/BUILDING.mdoc.
* Re-generate BUILDING.

Approved by christos


# 1.55 12-Jan-2006 wiz

Bump date for syspkgs.


# 1.54 04-Jan-2006 apb

Document "make syspkgs" and "build.sh syspkgs".

Reviewed by agc


Revision tags: netbsd-3-1-1-RELEASE netbsd-3-0-3-RELEASE netbsd-3-1-RELEASE netbsd-3-0-2-RELEASE netbsd-3-1-RC4 netbsd-3-1-RC3 netbsd-3-1-RC2 netbsd-3-1-RC1 netbsd-3-0-1-RELEASE netbsd-3-0-RELEASE netbsd-3-0-RC6 netbsd-3-0-RC5 netbsd-3-0-RC4 netbsd-3-0-RC3 netbsd-3-0-RC2 netbsd-3-0-RC1 netbsd-3-base
# 1.53 15-Feb-2005 reed

Document the environment variables for if you need to override or
manually select your compilers.
(And regen BUILDING from doc/BUILDING.mdoc.)


# 1.52 12-Oct-2004 jmc

Fix some typo's/bad wording as highlighted in PR#27219


# 1.51 25-Jun-2004 wiz

regen (Document -h. From Karsten Kruse in PR 25974.
While here, remove a duplicate sentence).


Revision tags: netbsd-2-0-3-RELEASE netbsd-2-1-RELEASE netbsd-2-1-RC6 netbsd-2-1-RC5 netbsd-2-1-RC4 netbsd-2-1-RC3 netbsd-2-1-RC2 netbsd-2-1-RC1 netbsd-2-0-2-RELEASE netbsd-2-0-1-RELEASE netbsd-2-base netbsd-2-0-RELEASE netbsd-2-0-RC5 netbsd-2-0-RC4 netbsd-2-0-RC3 netbsd-2-0-RC2 netbsd-2-0-RC1 netbsd-2-0-base
# 1.50 19-Mar-2004 wiz

Document MKTTINTERP.


# 1.49 06-Feb-2004 lukem

* Document build.sh -X and -x
* Document MKX11 and X11SRCDIR
* Remove note warning against cross-building from systems other than NetBSD;
it works on many other platforms.


# 1.48 29-Dec-2003 jmc

Note tools/compat/README as the place to get notes from non-native cross builds


# 1.47 19-Dec-2003 zuntum

Change -v to -V in the following section:

"Print make(1)'s idea of the value of var. Does not build any targets."

To reflect reality.

Found by Tomasz Marciniak <Tomasz.Marciniak@felix.fizyka.amu.edu.pl>, thanks!


# 1.46 26-Oct-2003 lukem

Improve how build.sh -N and MAKEVERBOSE interoperate;
rather than adding '-s' to make's command line in the makewrapper,
use the .SILENT target based on MAKEVERBOSE's value.

This means that you can do:
./build.sh -N 1 makewrapper

$TOOLDIR/bin/nbmake-$MACHINE
# runs at MAKEVERBOSE==1, with command lines suppressed

$TOOLDIR/bin/nbmake-$MACHINE MAKEVERBOSE=2
# runs at MAKEVERBOSE==2 for this invocation, with command lines shown


# 1.45 25-Oct-2003 lukem

Implement build -N noisy, which sets MAKEVERBOSE to noisy and adds
`-s' to MAKEFLAGS for noisy < 2.


# 1.44 29-Sep-2003 lukem

regenerate for "%" prompt update


# 1.43 19-Aug-2003 martti

Backout the previous commit


# 1.42 19-Aug-2003 martti

Remove # from the example.


# 1.41 08-Aug-2003 lukem

fix description of MAKEOBJDIR. from Martin Husemann


# 1.40 29-Jul-2003 lukem

Add build.sh -Z var, to unset a variable and ensure it's unset in makewrapper.
For -M MAKEOBJDIRPREFIX, unset MAKEOBJDIR.
For -O MAKEOBJDIR, unset MAKEOBJDIRPREFIX.


# 1.39 18-Jul-2003 lukem

fix default location of TOOLDIR


# 1.38 18-Jul-2003 lukem

Update for the MKUNPRIVED/MKUPDATE changes.


# 1.37 18-Jul-2003 lukem

rebuild with new groff


# 1.36 03-Jul-2003 lukem

attempt to clarify how MAKEOBJDIR{,PREFIX} may be provided ...
(this document needs a rototill, which i may get to whilst writing a
paper about build.sh)


# 1.35 25-May-2003 lukem

all:
* add "releasekernel=conf", to install a gzipped copy of the kernels
built by "kernel=conf" to RELEASEDIR/MACHINE/binary/kernel

build.sh:
* be more consistent in various status messages
* move the {release,}kernel=conf conf parsing code into getkernelconf()
and use in both buildkernel() and releasekernel()
* only warn once when building multiple kernels without updating the tools


# 1.34 18-May-2003 lukem

For normal builds, MKOBJDIRS default to `no' (not `yes').
It's only build.sh that sets this to `yes' by default.
Noted by OGAWA Takaya in [toolchain/19823]


# 1.33 17-May-2003 lukem

improve description of how "build.sh -m mach" sets the default
MACHINE_ARCH, and list the special cases that this does not occur for.


# 1.32 10-May-2003 lukem

crank date for previous


# 1.31 10-May-2003 lukem

Add "sourcesets" argument/target, which builds source sets into
RELEASEDIR/source/sets


# 1.30 08-May-2003 lukem

build.sh now provides defaults for DESTDIR and RELEASEDIR if not expert mode.
Remove -D and -R from EXAMPLES since they're not necessary any more.


# 1.29 08-Feb-2003 lukem

Fix example 3; the build.sh target is "install" not "installworld".
Improve description.
Noted by Valeriy Ushakov (uwe@) in private email.


# 1.28 02-Feb-2003 lukem

attempt to further improve and clarify the examples...


# 1.27 30-Jan-2003 lukem

Prefix various paths with 'DESTDIR', to highlight that the DESTDIR
is taken into account.


# 1.26 29-Jan-2003 lukem

allow toolprefix to be easily changed


# 1.25 26-Jan-2003 lukem

Various improvements per discussion with Alan Barrett.


# 1.24 26-Jan-2003 lukem

- Add "sets" top-level Makefile target and build.sh operation.
[Latter suggested by Julio Merino in private email]
- Add "help" build.sh operation.


# 1.23 26-Jan-2003 lukem

Change build.sh so that at least one operation is required.
Add "makewrapper" operation to build.sh.
[The above changes were suggested by Alan Barrett on current-users@]

Fail if building as non-root unless: UNPRIVED is set, -U is given, or -E
(expert mode) is given.
[Suggested by James Wetterau in private email]

Improve the examples in BUILDING.


# 1.22 23-Jan-2003 lukem

Rework how build.sh functions, so that command line options set various
parameters, and a list of "operations" defines what to do.
The full usage is show below. Notes:
`-b' has been deprecated (it always occurs now)
`-d' is replaced by "distribution"
`-R rel' onlys sets RELEASEDIR; use "release" to build a release
`-k kern' has been replaced by "kernel=kern"
`-i idir' has been replaced by "install=idir"
-r now occurs before nbmake is rebuilt

Add a copyright (long due!). Rework the code to (a KNF inspired) ShellNF.
Use functions appropriately. Allow `nb' prefix to be easily changed to
something else. Solve world peace (just kidding)

This is part of the (never achievable) goal of attempting to make
NetBSD easier to build...


--8<-- new usage follows --8<--

Usage: build.sh [-EnorUu] [-a arch] [-B buildid] [-D dest] [-j njob] [-M obj]
[-m mach] [-O obj] [-R release] [-T tools] [-V var=[value]]
[-w wrapper] [operation [...] ]

System build operations (all imply "obj" and "tools"):
build Run "make build"
distribution Run "make distribution" (includes etc/ files)
release Run "make release" (includes kernels & distrib media)

Other operations:
obj Run "make obj" (default unless -o)
tools Build and install tools
kernel=conf Build kernel with config file `conf'
install=idir Run "make installworld" to `idir'
(useful after 'distribution' or 'release')

Options:
-a arch Set MACHINE_ARCH to arch (otherwise deduced from MACHINE)
-B buildId Set BUILDID to buildId
-D dest Set DESTDIR to dest
-E Set "expert" mode; disables some DESTDIR checks
-j njob Run up to njob jobs in parallel; see make(1)
-M obj Set obj root directory to obj (sets MAKEOBJDIRPREFIX)
-m mach Set MACHINE to mach (not required if NetBSD native)
-n Show commands that would be executed, but do not execute them
-O obj Set obj root directory to obj (sets a MAKEOBJDIR pattern)
-o Set MKOBJDIRS=no (do not create objdirs at start of build)
-R release Set RELEASEDIR to release
-r Remove contents of TOOLDIR and DESTDIR before building
-T tools Set TOOLDIR to tools. If unset, and TOOLDIR is not set in
the environment, nbmake will be (re)built unconditionally.
-U Set UNPRIVED
-u Set UPDATE
-V v=[val] Set variable `v' to `val'
-w wrapper Create nbmake script as wrapper
(default: ${TOOLDIR}/bin/nbmake-${MACHINE})


# 1.21 04-Jan-2003 lukem

Add "-V var=[value]", for setting arbitrary variables which will also
be added to the nbmake-${MACHINE} wrapper.
Useful for setting RELEASEDIR, without -R's habit of building a release.


Revision tags: fvdl_fs64_base
# 1.20 25-Dec-2002 lukem

Document:
* build.sh -i idir
* top level targets: distribution, buildworld, installworld
* top level variables: INSTALLWORLDDIR


# 1.19 08-Dec-2002 lukem

Add -E - "expert mode". If this is not specified, builds to DESTDIR=/ are
not permitted.
By using this flag, you are taking responsibility for any issues that
may occur because of this...


# 1.18 08-Dec-2002 lukem

- be consistent about option ordering in build.sh usage display
- use Fl and Ar instead of Sy and Em to format options


# 1.17 25-Nov-2002 wiz

Update location of BUILDING.mdoc.


# 1.16 20-Oct-2002 lukem

regen for build.sh -k


# 1.15 21-Sep-2002 lukem

regen for: USE_NEW_TOOLCHAIN was replaced with TOOLCHAIN_MISSING


# 1.14 17-Sep-2002 fredb

Expand on the difference between ``build.sh -d'' and ``make install'',
as requested by Brian Stark in PR toolchain/18228 (which this closes).


# 1.13 22-Jul-2002 wiz

Remove duplicate 'files'. From Ryo HAYASAKA in toolchain/17674.


Revision tags: netbsd-1-6-PATCH002-RC3 netbsd-1-6-PATCH002-RC2 netbsd-1-6-PATCH002-RC1 netbsd-1-6-PATCH001 netbsd-1-6-PATCH001-RELEASE netbsd-1-6-PATCH001-RC3 netbsd-1-6-PATCH001-RC2 netbsd-1-6-PATCH001-RC1 netbsd-1-6-RELEASE netbsd-1-6-RC3 netbsd-1-6-RC2 netbsd-1-6-RC1 netbsd-1-6-base
# 1.12 13-May-2002 lukem

branches: 1.12.2;
add "-M makeobjdirprefix" to build.sh


# 1.11 03-May-2002 lukem

Move the METALOG from ${_SRC_TOP_OBJ_} to ${DESTDIR}.

There were too many synchronisation problems with using the former;
including situations such as a "make clean" performed between two
installs to the same DESTDIR would result in a truncated METALOG and
the resultant sets would be missing stuff such as include files that
don't get reinstalled if they haven't changed, even with !UPDATE.


# 1.10 02-May-2002 sommerfeld

Re-gen.


# 1.9 14-Mar-2002 thorpej

Add a -B option to set the BUILDID for the build. This also causes
the make(1) wrapper script to be named "nbmake-MACHINE-BUILDID".


# 1.8 05-Mar-2002 lukem

document various supported environment variables, including MAKEOBJDIRPREFIX


# 1.7 04-Mar-2002 lukem

document:
- make's UNPRIVED support
- build.sh's -U support
- the build system currently needs to build onto a file system with
long file name and hard link support


# 1.6 25-Nov-2001 thorpej

Document the -d option to build.sh


# 1.5 15-Nov-2001 tv

Note only <bsd.own.mk> as the authority for determining whether the new
BUILDING instructions should be used.


# 1.4 14-Nov-2001 tv

Turn off host-specific objdirs by default. Set MKHOSTOBJ=yes to enable.


# 1.3 12-Nov-2001 tv

Major overhaul of src/tools and host toolchain. Summary of changes:

* Rewrite src/tools Make logic to work like the rest of the tree wrt
"dependall" and "install". The old "make build" hack is gone.

* Remove the MKTOOLS logic. This was linked to the "make build" hack,
and was only needed because TOOLDIR originally had no writable default.

* Redo the GNU configure/make logic to make it fit reasonably in a
BSD make wrapper. Use new ${.ALLTARGETS} variable to scan for
targets in $(srcdir), and mark them with .MADE: to prevent rebuilding.

* Only build cross tools in src/tools; remove some messy logic in
src/usr.* and src/gnu/usr.* that would do target filename rewriting
(improves consistency and readability).

* Add the ability to build cross gdb at tool build time by setting
MKCROSSGDB (default no) to "yes" in mk.conf.

* Add src/tools/groff and set up paths to work with this cross groff.


# 1.2 08-Nov-2001 wiz

Remove mention of BUILDLING.html, and follow rename of BUILDING.txt to
BUILDING.
Noted by Love <lha@stacken.kth.se> on tech-toolchain.


# 1.1 01-Nov-2001 tv

By popular demand, one preformatted version of BUILDING, plaintext, no CRs.


Revision tags: prg-localcount2-base pgoyette-localcount-20170426
# 1.127 22-Apr-2017 plunky

regen


Revision tags: bouyer-socketcan-base1
# 1.126 20-Apr-2017 wiz

regen using regen target in doc.


# 1.125 20-Apr-2017 ozaki-r

Introduce MKSTRIPSYM build option

If it's yes, all local symbols of shared libraries are stripped
(default). If it's no, only temporary local symbols are stripped;
for example, symbols of static functions are kept. Keeping such
symbols is useful on using DTrace for userland libraries and
getting a backtrace from a rump server loading modules (shared
libraries).

Proposed and discussed on tech-kern and tech-toolchain


Revision tags: pgoyette-localcount-20170320
# 1.124 20-Feb-2017 christos

regen


# 1.123 16-Feb-2017 rin

The default values for MKPIC are yes and no for sh3 and m68000, respectively.
Bump date.


Revision tags: bouyer-socketcan-base pgoyette-localcount-20170107 pgoyette-localcount-20161104 localcount-20160914 pgoyette-localcount-20160806 pgoyette-localcount-20160726 pgoyette-localcount-base
# 1.122 29-Jan-2016 wiz

branches: 1.122.2; 1.122.4;
Document MKREPRO_TIMESTAMP.


# 1.121 23-Jul-2015 mrg

remove the xfree86 reachover makefiles and the vast majority of
the support in the rest of the source tree.

X11 sets could use some cleaning up perhaps (just deletion, as
we've never really marked the old X11R6 as obsolete for native
xorg using platforms so far either.)


# 1.120 07-Jun-2015 pgoyette

Update to reflect changes made in rev 1.398 of src/etc/Makefile


# 1.119 08-Apr-2015 wiz

regen


# 1.118 30-Nov-2014 uebayasi

regen


# 1.117 16-Nov-2014 uebayasi

regen


# 1.116 16-Nov-2014 uebayasi

regen


# 1.115 13-Nov-2014 apb

regen from doc/BUILDING.mdoc revision 1.107.
This reinstates documentation for "extsrc" which was lost in 2009.


# 1.114 08-Nov-2014 snj

fourth time's the charm, i guess. when committing a generated file,
it's best to use the latest revision of the source file (hi uebs!)

regen to include changes from revision 1.105 of doc/BUILDING.mdoc


# 1.113 06-Nov-2014 uebayasi

regen


# 1.112 06-Nov-2014 uebayasi

Expand TABs.


# 1.111 06-Nov-2014 uebayasi

Document the new "kernels" operation, prompted by joerg@.


# 1.110 05-Nov-2014 snj

regen


Revision tags: netbsd-7-base tls-earlyentropy-base tls-maxphys-base
# 1.109 07-Aug-2014 apb

branches: 1.109.2;
regen BUILDING from doc/BUILDING.mdoc


# 1.108 03-Aug-2014 apb

BUILDINFO part6: regen BUILDING from doc/BUILDING.mdoc


# 1.107 14-Jun-2014 apb

Regen from doc/BUILDING.mdoc;1.100:
Improve documentation for BUILDID.


# 1.106 21-May-2014 wiz

regen


Revision tags: yamt-pagecache-base9 riastradh-xf86-video-intel-2-7-1-pre-2-21-15 riastradh-drm2-base3 riastradh-drm2-base2 riastradh-drm2-base1 riastradh-drm2-base
# 1.105 29-May-2013 wiz

branches: 1.105.4;
regen using 'make regen' from src/doc.


# 1.104 29-May-2013 wiz

regen (using mandoc doc/BUILDING.mdoc > BUILDING -- let me know
if a different way is preferred, I see that it now contains formatting).


Revision tags: agc-symver-base yamt-pagecache-base8 yamt-pagecache-base7
# 1.103 08-Nov-2012 dholland

regen


Revision tags: yamt-pagecache-base6
# 1.102 19-Sep-2012 abs

regen


# 1.101 25-May-2012 wiz

branches: 1.101.2;
regen using 'make regen' in doc/


# 1.100 25-May-2012 wiz

Document MKREPRO using joerg's wording.


Revision tags: yamt-pagecache-base5 yamt-pagecache-base4
# 1.99 23-Feb-2012 tsutsui

Add a missing period.


Revision tags: netbsd-6-base
# 1.98 14-Feb-2012 apb

branches: 1.98.2;
Regen from revision 1.87 of doc/BUILDING.mdoc.


# 1.97 22-Jan-2012 tsutsui

Add "live-image" and "install-image" target support to build.sh.

"live-image" target builds pre-installed disk images that can be used on
emulators or boot from USB memory sticks to try NetBSD without installation.
Currently amd64, i386, pmax, sparc, sparc64, sun2, sun3, and vax
(which have working emulators and don't require extra tools like preparing
msdosfs or partitioning MD label structures) support this target.

"install-image" target builds an bootable installation disk image that can
be used as an install CD but burned into USB memory sticks etc.
Current only amd64 and i386 (which would support USB boot) have this target.

For more details (and known issue) see following posts on netbsd-bugs@:
http://mail-index.NetBSD.org/netbsd-bugs/2011/08/06/msg023639.html
http://mail-index.NetBSD.org/netbsd-bugs/2011/09/23/msg024207.html
http://mail-index.NetBSD.org/netbsd-bugs/2011/12/07/msg025166.html
http://mail-index.NetBSD.org/netbsd-bugs/2011/12/08/msg025178.html

No particular comments about implementation, and
"go ahead" comments from mrg@, riz@ and christos@.

Closes PR toolchain/45153 and PR misc/45155.


Revision tags: yamt-pagecache-base3 yamt-pagecache-base2 yamt-pagecache-base
# 1.96 09-Sep-2011 apb

branches: 1.96.2;
Add tests for the shell under which build.sh is run. If the
shell fails the tests, then build.sh tries to re-exec itself
under a more suitable shell.


# 1.95 09-Sep-2011 apb

Revisions 1.92 and 1.93 of src/BUILDING were not reflected in
src/doc/BUILDING.mdoc, so those changes were lost when src/BUILDING
was regenerated in revision 1.94.

Now update src/doc/BUILDING.mdoc and regenerate src/BUILDING to
reinstate the lost changes. (I also edited one of the changes, to use
the phrase "space-separated list" for consistency with other parts of
the document.)

The original changes were:


# 1.93 06-Aug-2011 jnemeth

Add description of MKKMOD, part of PR misc/45216


Revision tags: cherry-xenmp-base bouyer-quota2-nbase bouyer-quota2-base
# 1.92 29-Jan-2011 jym

Pass down INSTALLSETS variable to installsets target. Use :Q to escape
shell meta-characters, as the variable contains a list of sets, separated
by spaces.

$ ./build.sh -V INSTALLSETS="base etc" install=idir

should now work as expected.

Reviewed by apb@ on tech-toolchain.


# 1.94 09-Sep-2011 apb

Allow MAKEFLAGS to be set via build.sh -V. Somebody asked for this
in 2008.

Also add comments above a few functions in build.sh, and bump copyright
dates.


# 1.93 06-Aug-2011 jnemeth

Add description of MKKMOD, part of PR misc/45216


Revision tags: cherry-xenmp-base bouyer-quota2-nbase bouyer-quota2-base
# 1.92 29-Jan-2011 jym

Pass down INSTALLSETS variable to installsets target. Use :Q to escape
shell meta-characters, as the variable contains a list of sets, separated
by spaces.

$ ./build.sh -V INSTALLSETS="base etc" install=idir

should now work as expected.

Reviewed by apb@ on tech-toolchain.


Revision tags: matt-mips64-premerge-20101231
# 1.91 25-Jul-2010 mrg

branches: 1.91.2;
remove the MKSUBPIXEL/MKTTINTERP options; they're going away.

regenerate.


Revision tags: matt-premerge-20091211
# 1.90 30-Nov-2009 uebayasi

Support "extsrc", externally added programs and libraries. Users can write
their own reach-overs, cross-build, install, and get set files just like base
and X11 / X.org. (These sets are not included as TNF releases.)


# 1.89 10-Oct-2009 apb

If ${NETBDSRCDIR}/../xsrc exists, then use it as the default value
of X11SRCDIR. If it doesn't exist, then use /usr/xsrc as before.

OK mrg


# 1.88 27-Sep-2009 apb

* Use a more robust method of creating the top level object directory.
Use getmakevar to expand MAKEOBJDIRPREFIX or MAKEOBJDIR, or (if
neither of those variables is set) use a non-recursive "make obj" in
the top level source directory.

* Do not let TOP_objdir default to ${TOP}. It's now set only by the
-M or -O command line options, or after using getmakevar to expand
MAKEOBJDIRPREFIX or MAKEOBJDIR.

* Make try_set_TOOLDIR handle MAKEOBJDIRPERFIX passed from the
environment. It runs too early to use getmakevar, so it will not work
if the value contains embedded '${...}' variable references.

* Use '$TOOLDIR' (with a literal '$') instead of 'nonexistent' in
a message when rebuilding make when TOOLDIR is not yet known.


# 1.87 27-Sep-2009 apb

Allow build.sh "-C cdextra" option to be specified multiple times.


# 1.86 07-Sep-2009 jnemeth

Add a modules operation to build.sh, which builds and installs kernel modules
into DESTDIR.

This is based on the patch provided by tsutsui@ on tech-toolchain@.


# 1.85 12-Jul-2009 hubertf

regen


# 1.84 12-Jul-2009 hubertf

regen


Revision tags: jym-xensuspend-nbase jym-xensuspend-base
# 1.83 01-May-2009 snj

Introduce MKSUBPIXEL, which allows enabling subpixel rendering code
in FreeType.


# 1.82 02-Dec-2008 mrg

branches: 1.82.2;
be explicit about MAKEOBJDIR and MAKEOBJDIRPREFIX not being for
mk.conf or ${MAKECONF}.


# 1.81 15-Nov-2008 mrg

revert sparc back to default of XFree86 at the request of macallan.


# 1.80 13-Nov-2008 apb

Add support for new MAKEVERBOSE levels 3 and 4. The complete list is now:

0 Minimal output ("quiet")
1 Describe what is occurring
2 Describe what is occurring and echo the actual command
3 Ignore the effect of the "@" prefix in make commands
4 Trace shell commands using the shell's -x flag

The default remains MAKEVERBOSE=2.


# 1.79 09-Nov-2008 mrg

- retire MKXORG from public use
- introduce X11FLAVOUR to choose src/x11 vs src/external/mit/xorg
for the X11 to build if MKX11=yes is set. it takes the values
of either Xorg or XFree86.
- default to Xorg on alpha, i386, macppc, shark, sparc and sparc64
- remove MKXORG_WITH_XSRC_XSERVER, unused and never useful


Revision tags: netbsd-5-base matt-mips64-base2
# 1.78 24-Sep-2008 apb

branches: 1.78.2;
regen for recent change to examples and objdir advice,
and for the older MKSTRIPIDENT change.


Revision tags: wrstuden-revivesa-base-3 wrstuden-revivesa-base-2
# 1.77 06-Sep-2008 lukem

regen for MKHTML


# 1.76 28-Aug-2008 lukem

Improve support for MKXORG!=no to enable builds into external/mit/xorg.
This will be mutually exclusive to MKX11!=no.


# 1.75 18-Aug-2008 lukem

Document "build.sh cleandir".
Fix formatting nit.
Remove BUGS; all the in-tree platforms are using build.sh now.


# 1.74 11-Aug-2008 apb

* Suggest a "-j" value between 1+NCPU and 2*NCPU for the fastest builds.
* Remove some duplicated content that appeared in both the section about
make's -j flag and the section about build.sh's -j flag.


# 1.73 05-Aug-2008 apb

* Add more detail for build.sh -M and -O options.
* Mention new default when source is /usr/src but build.sh is run
with neither -M nor -O.


# 1.72 05-Aug-2008 perry

Builds now use "BUILDSEED" so that c++ binaries are reproduceable.
By default BUILDSEED is set to NetBSD-{majorversion} -- a -S flag may
be used to change it.

Discussed on tech-toolchain.


Revision tags: wrstuden-revivesa-base-1 yamt-pf42-base4 yamt-pf42-base3 hpcarm-cleanup-nbase yamt-pf42-baseX yamt-pf42-base2 wrstuden-revivesa-base keiichi-mipv6-nbase yamt-pf42-base keiichi-mipv6-base
# 1.71 29-Mar-2008 dholland

branches: 1.71.4;
Correct/clarify the default setting of USETOOLS in the previous version.
Noted by apb.


# 1.70 28-Mar-2008 dholland

Assorted updates and clarifications, grammar fixes and wording improvements,
and so on. Significant highlights:
- mention src/tests and reference atf;
- provide examples of MACHINE and MACHINE_ARCH;
- mention that MKOBJ=no is not recommended;
- correct the description of the default setting of USETOOLS;
- document the interactions of build.sh -[uo] with various things;
- document the interactions of build.sh tools and kernel=FOO;
- use a lot fewer parentheses.
Discussed on netbsd-docs.


Revision tags: matt-armv6-nbase
# 1.69 18-Mar-2008 lukem

Consistently document RELEASEDIR/RELEASEMACHINEDIR.


# 1.68 08-Mar-2008 reed

Mention that "build" and "distribution" do not build nor install (to DESTDIR)
a kernel.


Revision tags: cube-autoconf-base matt-armv6-base hpcarm-cleanup-base
# 1.67 23-Nov-2007 sborrill

branches: 1.67.4;
Add support for CDBUILDEXTRA which acts like CDEXTRA to add extra items
to the CD-ROM image.
Make CDEXTRA and CDBUILDEXTRA be able to contain lists of files and directories
which are added in turn.
Add support for CDEXTRA_SKIP which contains a list of fnmatch(3) items to
skip during the copy. This is _very_ useful for skipping CVS dirs for example.
CDBUILDEXTRA and CDEXTRA_SKIP are to be used in Makefiles creating the images,
CDEXTRA remains to be used from build.sh.
Update documentation and build.sh help text to show that -C can be used to
specify a list of files and directories rather than just a single dir.


# 1.66 01-Sep-2007 jnemeth

Convert build.sh iso-dir=directory option to -C cddir as per jmmv@ on
source-changes.


# 1.65 01-Sep-2007 jnemeth

Add an iso-dir=directory option. When combined with iso-image or
iso-image-source, it will cause directory to be added to the CD-ROM image.


# 1.64 30-Aug-2007 jnemeth

describe new iso-image-source target


# 1.63 30-Aug-2007 ad

Remove STATUS paragraph which makes it sound like the build system is
half baked.


Revision tags: matt-mips64-base
# 1.62 13-Apr-2007 apb

branches: 1.62.4;
Document recent changes to "make iso-image".


# 1.61 26-Mar-2007 apb

Document the fact that "make installworld" and "build.sh
installworld=..." do not install the etc or xetc sets. Suggest using
etcupdate(8) and postinstall(8) after installworld.


# 1.60 27-Jan-2007 apb

Try to clarify the description of build.sh -m mach.
Document new evbarm-eb and evbarm-el aliases.


Revision tags: netbsd-4-base
# 1.59 08-Oct-2006 apb

branches: 1.59.2;
Clarify that DESTDIR/OBJDIR/etc are absolute paths, but build.sh
-D/-O/etc allows relative paths.

Closes PR 32345 by Andre Luiz de Oliveira.


# 1.58 29-Sep-2006 apb

Use ${HOST_SH} instead of the host system's /bin/sh wherever possible:

* Describe the HOST_SH variable, and the way build.sh attempts to set it.

* Suggest passing HOST_SH in the environment if /bin/sh is not a working
shell.


Revision tags: abandoned-netbsd-4-base
# 1.57 29-Jan-2006 apb

mkisofs is in pkgsrc/sysutils/cdrtools now, not pkgsrc/sysutils/cdrecord.
Reported by Jukka Salmi.


# 1.56 28-Jan-2006 apb

* Add an "iso-image" target in the top level Makefile,
which invokes make iso-image in the etc directory.
* Add an "iso-image" action in build.sh, which
invokes make iso-image.
* Document the above in doc/BUILDING.mdoc.
* Re-generate BUILDING.

Approved by christos


# 1.55 12-Jan-2006 wiz

Bump date for syspkgs.


# 1.54 04-Jan-2006 apb

Document "make syspkgs" and "build.sh syspkgs".

Reviewed by agc


Revision tags: netbsd-3-1-1-RELEASE netbsd-3-0-3-RELEASE netbsd-3-1-RELEASE netbsd-3-0-2-RELEASE netbsd-3-1-RC4 netbsd-3-1-RC3 netbsd-3-1-RC2 netbsd-3-1-RC1 netbsd-3-0-1-RELEASE netbsd-3-0-RELEASE netbsd-3-0-RC6 netbsd-3-0-RC5 netbsd-3-0-RC4 netbsd-3-0-RC3 netbsd-3-0-RC2 netbsd-3-0-RC1 netbsd-3-base
# 1.53 15-Feb-2005 reed

Document the environment variables for if you need to override or
manually select your compilers.
(And regen BUILDING from doc/BUILDING.mdoc.)


# 1.52 12-Oct-2004 jmc

Fix some typo's/bad wording as highlighted in PR#27219


# 1.51 25-Jun-2004 wiz

regen (Document -h. From Karsten Kruse in PR 25974.
While here, remove a duplicate sentence).


Revision tags: netbsd-2-0-3-RELEASE netbsd-2-1-RELEASE netbsd-2-1-RC6 netbsd-2-1-RC5 netbsd-2-1-RC4 netbsd-2-1-RC3 netbsd-2-1-RC2 netbsd-2-1-RC1 netbsd-2-0-2-RELEASE netbsd-2-0-1-RELEASE netbsd-2-base netbsd-2-0-RELEASE netbsd-2-0-RC5 netbsd-2-0-RC4 netbsd-2-0-RC3 netbsd-2-0-RC2 netbsd-2-0-RC1 netbsd-2-0-base
# 1.50 19-Mar-2004 wiz

Document MKTTINTERP.


# 1.49 06-Feb-2004 lukem

* Document build.sh -X and -x
* Document MKX11 and X11SRCDIR
* Remove note warning against cross-building from systems other than NetBSD;
it works on many other platforms.


# 1.48 29-Dec-2003 jmc

Note tools/compat/README as the place to get notes from non-native cross builds


# 1.47 19-Dec-2003 zuntum

Change -v to -V in the following section:

"Print make(1)'s idea of the value of var. Does not build any targets."

To reflect reality.

Found by Tomasz Marciniak <Tomasz.Marciniak@felix.fizyka.amu.edu.pl>, thanks!


# 1.46 26-Oct-2003 lukem

Improve how build.sh -N and MAKEVERBOSE interoperate;
rather than adding '-s' to make's command line in the makewrapper,
use the .SILENT target based on MAKEVERBOSE's value.

This means that you can do:
./build.sh -N 1 makewrapper

$TOOLDIR/bin/nbmake-$MACHINE
# runs at MAKEVERBOSE==1, with command lines suppressed

$TOOLDIR/bin/nbmake-$MACHINE MAKEVERBOSE=2
# runs at MAKEVERBOSE==2 for this invocation, with command lines shown


# 1.45 25-Oct-2003 lukem

Implement build -N noisy, which sets MAKEVERBOSE to noisy and adds
`-s' to MAKEFLAGS for noisy < 2.


# 1.44 29-Sep-2003 lukem

regenerate for "%" prompt update


# 1.43 19-Aug-2003 martti

Backout the previous commit


# 1.42 19-Aug-2003 martti

Remove # from the example.


# 1.41 08-Aug-2003 lukem

fix description of MAKEOBJDIR. from Martin Husemann


# 1.40 29-Jul-2003 lukem

Add build.sh -Z var, to unset a variable and ensure it's unset in makewrapper.
For -M MAKEOBJDIRPREFIX, unset MAKEOBJDIR.
For -O MAKEOBJDIR, unset MAKEOBJDIRPREFIX.


# 1.39 18-Jul-2003 lukem

fix default location of TOOLDIR


# 1.38 18-Jul-2003 lukem

Update for the MKUNPRIVED/MKUPDATE changes.


# 1.37 18-Jul-2003 lukem

rebuild with new groff


# 1.36 03-Jul-2003 lukem

attempt to clarify how MAKEOBJDIR{,PREFIX} may be provided ...
(this document needs a rototill, which i may get to whilst writing a
paper about build.sh)


# 1.35 25-May-2003 lukem

all:
* add "releasekernel=conf", to install a gzipped copy of the kernels
built by "kernel=conf" to RELEASEDIR/MACHINE/binary/kernel

build.sh:
* be more consistent in various status messages
* move the {release,}kernel=conf conf parsing code into getkernelconf()
and use in both buildkernel() and releasekernel()
* only warn once when building multiple kernels without updating the tools


# 1.34 18-May-2003 lukem

For normal builds, MKOBJDIRS default to `no' (not `yes').
It's only build.sh that sets this to `yes' by default.
Noted by OGAWA Takaya in [toolchain/19823]


# 1.33 17-May-2003 lukem

improve description of how "build.sh -m mach" sets the default
MACHINE_ARCH, and list the special cases that this does not occur for.


# 1.32 10-May-2003 lukem

crank date for previous


# 1.31 10-May-2003 lukem

Add "sourcesets" argument/target, which builds source sets into
RELEASEDIR/source/sets


# 1.30 08-May-2003 lukem

build.sh now provides defaults for DESTDIR and RELEASEDIR if not expert mode.
Remove -D and -R from EXAMPLES since they're not necessary any more.


# 1.29 08-Feb-2003 lukem

Fix example 3; the build.sh target is "install" not "installworld".
Improve description.
Noted by Valeriy Ushakov (uwe@) in private email.


# 1.28 02-Feb-2003 lukem

attempt to further improve and clarify the examples...


# 1.27 30-Jan-2003 lukem

Prefix various paths with 'DESTDIR', to highlight that the DESTDIR
is taken into account.


# 1.26 29-Jan-2003 lukem

allow toolprefix to be easily changed


# 1.25 26-Jan-2003 lukem

Various improvements per discussion with Alan Barrett.


# 1.24 26-Jan-2003 lukem

- Add "sets" top-level Makefile target and build.sh operation.
[Latter suggested by Julio Merino in private email]
- Add "help" build.sh operation.


# 1.23 26-Jan-2003 lukem

Change build.sh so that at least one operation is required.
Add "makewrapper" operation to build.sh.
[The above changes were suggested by Alan Barrett on current-users@]

Fail if building as non-root unless: UNPRIVED is set, -U is given, or -E
(expert mode) is given.
[Suggested by James Wetterau in private email]

Improve the examples in BUILDING.


# 1.22 23-Jan-2003 lukem

Rework how build.sh functions, so that command line options set various
parameters, and a list of "operations" defines what to do.
The full usage is show below. Notes:
`-b' has been deprecated (it always occurs now)
`-d' is replaced by "distribution"
`-R rel' onlys sets RELEASEDIR; use "release" to build a release
`-k kern' has been replaced by "kernel=kern"
`-i idir' has been replaced by "install=idir"
-r now occurs before nbmake is rebuilt

Add a copyright (long due!). Rework the code to (a KNF inspired) ShellNF.
Use functions appropriately. Allow `nb' prefix to be easily changed to
something else. Solve world peace (just kidding)

This is part of the (never achievable) goal of attempting to make
NetBSD easier to build...


--8<-- new usage follows --8<--

Usage: build.sh [-EnorUu] [-a arch] [-B buildid] [-D dest] [-j njob] [-M obj]
[-m mach] [-O obj] [-R release] [-T tools] [-V var=[value]]
[-w wrapper] [operation [...] ]

System build operations (all imply "obj" and "tools"):
build Run "make build"
distribution Run "make distribution" (includes etc/ files)
release Run "make release" (includes kernels & distrib media)

Other operations:
obj Run "make obj" (default unless -o)
tools Build and install tools
kernel=conf Build kernel with config file `conf'
install=idir Run "make installworld" to `idir'
(useful after 'distribution' or 'release')

Options:
-a arch Set MACHINE_ARCH to arch (otherwise deduced from MACHINE)
-B buildId Set BUILDID to buildId
-D dest Set DESTDIR to dest
-E Set "expert" mode; disables some DESTDIR checks
-j njob Run up to njob jobs in parallel; see make(1)
-M obj Set obj root directory to obj (sets MAKEOBJDIRPREFIX)
-m mach Set MACHINE to mach (not required if NetBSD native)
-n Show commands that would be executed, but do not execute them
-O obj Set obj root directory to obj (sets a MAKEOBJDIR pattern)
-o Set MKOBJDIRS=no (do not create objdirs at start of build)
-R release Set RELEASEDIR to release
-r Remove contents of TOOLDIR and DESTDIR before building
-T tools Set TOOLDIR to tools. If unset, and TOOLDIR is not set in
the environment, nbmake will be (re)built unconditionally.
-U Set UNPRIVED
-u Set UPDATE
-V v=[val] Set variable `v' to `val'
-w wrapper Create nbmake script as wrapper
(default: ${TOOLDIR}/bin/nbmake-${MACHINE})


# 1.21 04-Jan-2003 lukem

Add "-V var=[value]", for setting arbitrary variables which will also
be added to the nbmake-${MACHINE} wrapper.
Useful for setting RELEASEDIR, without -R's habit of building a release.


Revision tags: fvdl_fs64_base
# 1.20 25-Dec-2002 lukem

Document:
* build.sh -i idir
* top level targets: distribution, buildworld, installworld
* top level variables: INSTALLWORLDDIR


# 1.19 08-Dec-2002 lukem

Add -E - "expert mode". If this is not specified, builds to DESTDIR=/ are
not permitted.
By using this flag, you are taking responsibility for any issues that
may occur because of this...


# 1.18 08-Dec-2002 lukem

- be consistent about option ordering in build.sh usage display
- use Fl and Ar instead of Sy and Em to format options


# 1.17 25-Nov-2002 wiz

Update location of BUILDING.mdoc.


# 1.16 20-Oct-2002 lukem

regen for build.sh -k


# 1.15 21-Sep-2002 lukem

regen for: USE_NEW_TOOLCHAIN was replaced with TOOLCHAIN_MISSING


# 1.14 17-Sep-2002 fredb

Expand on the difference between ``build.sh -d'' and ``make install'',
as requested by Brian Stark in PR toolchain/18228 (which this closes).


# 1.13 22-Jul-2002 wiz

Remove duplicate 'files'. From Ryo HAYASAKA in toolchain/17674.


Revision tags: netbsd-1-6-PATCH002-RC3 netbsd-1-6-PATCH002-RC2 netbsd-1-6-PATCH002-RC1 netbsd-1-6-PATCH001 netbsd-1-6-PATCH001-RELEASE netbsd-1-6-PATCH001-RC3 netbsd-1-6-PATCH001-RC2 netbsd-1-6-PATCH001-RC1 netbsd-1-6-RELEASE netbsd-1-6-RC3 netbsd-1-6-RC2 netbsd-1-6-RC1 netbsd-1-6-base
# 1.12 13-May-2002 lukem

branches: 1.12.2;
add "-M makeobjdirprefix" to build.sh


# 1.11 03-May-2002 lukem

Move the METALOG from ${_SRC_TOP_OBJ_} to ${DESTDIR}.

There were too many synchronisation problems with using the former;
including situations such as a "make clean" performed between two
installs to the same DESTDIR would result in a truncated METALOG and
the resultant sets would be missing stuff such as include files that
don't get reinstalled if they haven't changed, even with !UPDATE.


# 1.10 02-May-2002 sommerfeld

Re-gen.


# 1.9 14-Mar-2002 thorpej

Add a -B option to set the BUILDID for the build. This also causes
the make(1) wrapper script to be named "nbmake-MACHINE-BUILDID".


# 1.8 05-Mar-2002 lukem

document various supported environment variables, including MAKEOBJDIRPREFIX


# 1.7 04-Mar-2002 lukem

document:
- make's UNPRIVED support
- build.sh's -U support
- the build system currently needs to build onto a file system with
long file name and hard link support


# 1.6 25-Nov-2001 thorpej

Document the -d option to build.sh


# 1.5 15-Nov-2001 tv

Note only <bsd.own.mk> as the authority for determining whether the new
BUILDING instructions should be used.


# 1.4 14-Nov-2001 tv

Turn off host-specific objdirs by default. Set MKHOSTOBJ=yes to enable.


# 1.3 12-Nov-2001 tv

Major overhaul of src/tools and host toolchain. Summary of changes:

* Rewrite src/tools Make logic to work like the rest of the tree wrt
"dependall" and "install". The old "make build" hack is gone.

* Remove the MKTOOLS logic. This was linked to the "make build" hack,
and was only needed because TOOLDIR originally had no writable default.

* Redo the GNU configure/make logic to make it fit reasonably in a
BSD make wrapper. Use new ${.ALLTARGETS} variable to scan for
targets in $(srcdir), and mark them with .MADE: to prevent rebuilding.

* Only build cross tools in src/tools; remove some messy logic in
src/usr.* and src/gnu/usr.* that would do target filename rewriting
(improves consistency and readability).

* Add the ability to build cross gdb at tool build time by setting
MKCROSSGDB (default no) to "yes" in mk.conf.

* Add src/tools/groff and set up paths to work with this cross groff.


# 1.2 08-Nov-2001 wiz

Remove mention of BUILDLING.html, and follow rename of BUILDING.txt to
BUILDING.
Noted by Love <lha@stacken.kth.se> on tech-toolchain.


# 1.1 01-Nov-2001 tv

By popular demand, one preformatted version of BUILDING, plaintext, no CRs.


# 1.124 20-Feb-2017 christos

regen


# 1.123 16-Feb-2017 rin

The default values for MKPIC are yes and no for sh3 and m68000, respectively.
Bump date.


Revision tags: bouyer-socketcan-base pgoyette-localcount-20170107 pgoyette-localcount-20161104 localcount-20160914 pgoyette-localcount-20160806 pgoyette-localcount-20160726 pgoyette-localcount-base
# 1.122 29-Jan-2016 wiz

Document MKREPRO_TIMESTAMP.


# 1.121 23-Jul-2015 mrg

remove the xfree86 reachover makefiles and the vast majority of
the support in the rest of the source tree.

X11 sets could use some cleaning up perhaps (just deletion, as
we've never really marked the old X11R6 as obsolete for native
xorg using platforms so far either.)


# 1.120 07-Jun-2015 pgoyette

Update to reflect changes made in rev 1.398 of src/etc/Makefile


# 1.119 08-Apr-2015 wiz

regen


# 1.118 30-Nov-2014 uebayasi

regen


# 1.117 16-Nov-2014 uebayasi

regen


# 1.116 16-Nov-2014 uebayasi

regen


# 1.115 13-Nov-2014 apb

regen from doc/BUILDING.mdoc revision 1.107.
This reinstates documentation for "extsrc" which was lost in 2009.


# 1.114 08-Nov-2014 snj

fourth time's the charm, i guess. when committing a generated file,
it's best to use the latest revision of the source file (hi uebs!)

regen to include changes from revision 1.105 of doc/BUILDING.mdoc


# 1.113 06-Nov-2014 uebayasi

regen


# 1.112 06-Nov-2014 uebayasi

Expand TABs.


# 1.111 06-Nov-2014 uebayasi

Document the new "kernels" operation, prompted by joerg@.


# 1.110 05-Nov-2014 snj

regen


Revision tags: netbsd-7-base tls-earlyentropy-base tls-maxphys-base
# 1.109 07-Aug-2014 apb

branches: 1.109.2;
regen BUILDING from doc/BUILDING.mdoc


# 1.108 03-Aug-2014 apb

BUILDINFO part6: regen BUILDING from doc/BUILDING.mdoc


# 1.107 14-Jun-2014 apb

Regen from doc/BUILDING.mdoc;1.100:
Improve documentation for BUILDID.


# 1.106 21-May-2014 wiz

regen


Revision tags: yamt-pagecache-base9 riastradh-xf86-video-intel-2-7-1-pre-2-21-15 riastradh-drm2-base3 riastradh-drm2-base2 riastradh-drm2-base1 riastradh-drm2-base
# 1.105 29-May-2013 wiz

branches: 1.105.4;
regen using 'make regen' from src/doc.


# 1.104 29-May-2013 wiz

regen (using mandoc doc/BUILDING.mdoc > BUILDING -- let me know
if a different way is preferred, I see that it now contains formatting).


Revision tags: agc-symver-base yamt-pagecache-base8 yamt-pagecache-base7
# 1.103 08-Nov-2012 dholland

regen


Revision tags: yamt-pagecache-base6
# 1.102 19-Sep-2012 abs

regen


# 1.101 25-May-2012 wiz

branches: 1.101.2;
regen using 'make regen' in doc/


# 1.100 25-May-2012 wiz

Document MKREPRO using joerg's wording.


Revision tags: yamt-pagecache-base5 yamt-pagecache-base4
# 1.99 23-Feb-2012 tsutsui

Add a missing period.


Revision tags: netbsd-6-base
# 1.98 14-Feb-2012 apb

branches: 1.98.2;
Regen from revision 1.87 of doc/BUILDING.mdoc.


# 1.97 22-Jan-2012 tsutsui

Add "live-image" and "install-image" target support to build.sh.

"live-image" target builds pre-installed disk images that can be used on
emulators or boot from USB memory sticks to try NetBSD without installation.
Currently amd64, i386, pmax, sparc, sparc64, sun2, sun3, and vax
(which have working emulators and don't require extra tools like preparing
msdosfs or partitioning MD label structures) support this target.

"install-image" target builds an bootable installation disk image that can
be used as an install CD but burned into USB memory sticks etc.
Current only amd64 and i386 (which would support USB boot) have this target.

For more details (and known issue) see following posts on netbsd-bugs@:
http://mail-index.NetBSD.org/netbsd-bugs/2011/08/06/msg023639.html
http://mail-index.NetBSD.org/netbsd-bugs/2011/09/23/msg024207.html
http://mail-index.NetBSD.org/netbsd-bugs/2011/12/07/msg025166.html
http://mail-index.NetBSD.org/netbsd-bugs/2011/12/08/msg025178.html

No particular comments about implementation, and
"go ahead" comments from mrg@, riz@ and christos@.

Closes PR toolchain/45153 and PR misc/45155.


Revision tags: yamt-pagecache-base3 yamt-pagecache-base2 yamt-pagecache-base
# 1.96 09-Sep-2011 apb

branches: 1.96.2;
Add tests for the shell under which build.sh is run. If the
shell fails the tests, then build.sh tries to re-exec itself
under a more suitable shell.


# 1.95 09-Sep-2011 apb

Revisions 1.92 and 1.93 of src/BUILDING were not reflected in
src/doc/BUILDING.mdoc, so those changes were lost when src/BUILDING
was regenerated in revision 1.94.

Now update src/doc/BUILDING.mdoc and regenerate src/BUILDING to
reinstate the lost changes. (I also edited one of the changes, to use
the phrase "space-separated list" for consistency with other parts of
the document.)

The original changes were:


# 1.93 06-Aug-2011 jnemeth

Add description of MKKMOD, part of PR misc/45216


Revision tags: cherry-xenmp-base bouyer-quota2-nbase bouyer-quota2-base
# 1.92 29-Jan-2011 jym

Pass down INSTALLSETS variable to installsets target. Use :Q to escape
shell meta-characters, as the variable contains a list of sets, separated
by spaces.

$ ./build.sh -V INSTALLSETS="base etc" install=idir

should now work as expected.

Reviewed by apb@ on tech-toolchain.


# 1.94 09-Sep-2011 apb

Allow MAKEFLAGS to be set via build.sh -V. Somebody asked for this
in 2008.

Also add comments above a few functions in build.sh, and bump copyright
dates.


# 1.93 06-Aug-2011 jnemeth

Add description of MKKMOD, part of PR misc/45216


Revision tags: cherry-xenmp-base bouyer-quota2-nbase bouyer-quota2-base
# 1.92 29-Jan-2011 jym

Pass down INSTALLSETS variable to installsets target. Use :Q to escape
shell meta-characters, as the variable contains a list of sets, separated
by spaces.

$ ./build.sh -V INSTALLSETS="base etc" install=idir

should now work as expected.

Reviewed by apb@ on tech-toolchain.


Revision tags: matt-mips64-premerge-20101231
# 1.91 25-Jul-2010 mrg

branches: 1.91.2;
remove the MKSUBPIXEL/MKTTINTERP options; they're going away.

regenerate.


Revision tags: matt-premerge-20091211
# 1.90 30-Nov-2009 uebayasi

Support "extsrc", externally added programs and libraries. Users can write
their own reach-overs, cross-build, install, and get set files just like base
and X11 / X.org. (These sets are not included as TNF releases.)


# 1.89 10-Oct-2009 apb

If ${NETBDSRCDIR}/../xsrc exists, then use it as the default value
of X11SRCDIR. If it doesn't exist, then use /usr/xsrc as before.

OK mrg


# 1.88 27-Sep-2009 apb

* Use a more robust method of creating the top level object directory.
Use getmakevar to expand MAKEOBJDIRPREFIX or MAKEOBJDIR, or (if
neither of those variables is set) use a non-recursive "make obj" in
the top level source directory.

* Do not let TOP_objdir default to ${TOP}. It's now set only by the
-M or -O command line options, or after using getmakevar to expand
MAKEOBJDIRPREFIX or MAKEOBJDIR.

* Make try_set_TOOLDIR handle MAKEOBJDIRPERFIX passed from the
environment. It runs too early to use getmakevar, so it will not work
if the value contains embedded '${...}' variable references.

* Use '$TOOLDIR' (with a literal '$') instead of 'nonexistent' in
a message when rebuilding make when TOOLDIR is not yet known.


# 1.87 27-Sep-2009 apb

Allow build.sh "-C cdextra" option to be specified multiple times.


# 1.86 07-Sep-2009 jnemeth

Add a modules operation to build.sh, which builds and installs kernel modules
into DESTDIR.

This is based on the patch provided by tsutsui@ on tech-toolchain@.


# 1.85 12-Jul-2009 hubertf

regen


# 1.84 12-Jul-2009 hubertf

regen


Revision tags: jym-xensuspend-nbase jym-xensuspend-base
# 1.83 01-May-2009 snj

Introduce MKSUBPIXEL, which allows enabling subpixel rendering code
in FreeType.


# 1.82 02-Dec-2008 mrg

branches: 1.82.2;
be explicit about MAKEOBJDIR and MAKEOBJDIRPREFIX not being for
mk.conf or ${MAKECONF}.


# 1.81 15-Nov-2008 mrg

revert sparc back to default of XFree86 at the request of macallan.


# 1.80 13-Nov-2008 apb

Add support for new MAKEVERBOSE levels 3 and 4. The complete list is now:

0 Minimal output ("quiet")
1 Describe what is occurring
2 Describe what is occurring and echo the actual command
3 Ignore the effect of the "@" prefix in make commands
4 Trace shell commands using the shell's -x flag

The default remains MAKEVERBOSE=2.


# 1.79 09-Nov-2008 mrg

- retire MKXORG from public use
- introduce X11FLAVOUR to choose src/x11 vs src/external/mit/xorg
for the X11 to build if MKX11=yes is set. it takes the values
of either Xorg or XFree86.
- default to Xorg on alpha, i386, macppc, shark, sparc and sparc64
- remove MKXORG_WITH_XSRC_XSERVER, unused and never useful


Revision tags: netbsd-5-base matt-mips64-base2
# 1.78 24-Sep-2008 apb

branches: 1.78.2;
regen for recent change to examples and objdir advice,
and for the older MKSTRIPIDENT change.


Revision tags: wrstuden-revivesa-base-3 wrstuden-revivesa-base-2
# 1.77 06-Sep-2008 lukem

regen for MKHTML


# 1.76 28-Aug-2008 lukem

Improve support for MKXORG!=no to enable builds into external/mit/xorg.
This will be mutually exclusive to MKX11!=no.


# 1.75 18-Aug-2008 lukem

Document "build.sh cleandir".
Fix formatting nit.
Remove BUGS; all the in-tree platforms are using build.sh now.


# 1.74 11-Aug-2008 apb

* Suggest a "-j" value between 1+NCPU and 2*NCPU for the fastest builds.
* Remove some duplicated content that appeared in both the section about
make's -j flag and the section about build.sh's -j flag.


# 1.73 05-Aug-2008 apb

* Add more detail for build.sh -M and -O options.
* Mention new default when source is /usr/src but build.sh is run
with neither -M nor -O.


# 1.72 05-Aug-2008 perry

Builds now use "BUILDSEED" so that c++ binaries are reproduceable.
By default BUILDSEED is set to NetBSD-{majorversion} -- a -S flag may
be used to change it.

Discussed on tech-toolchain.


Revision tags: wrstuden-revivesa-base-1 yamt-pf42-base4 yamt-pf42-base3 hpcarm-cleanup-nbase yamt-pf42-baseX yamt-pf42-base2 wrstuden-revivesa-base keiichi-mipv6-nbase yamt-pf42-base keiichi-mipv6-base
# 1.71 29-Mar-2008 dholland

branches: 1.71.4;
Correct/clarify the default setting of USETOOLS in the previous version.
Noted by apb.


# 1.70 28-Mar-2008 dholland

Assorted updates and clarifications, grammar fixes and wording improvements,
and so on. Significant highlights:
- mention src/tests and reference atf;
- provide examples of MACHINE and MACHINE_ARCH;
- mention that MKOBJ=no is not recommended;
- correct the description of the default setting of USETOOLS;
- document the interactions of build.sh -[uo] with various things;
- document the interactions of build.sh tools and kernel=FOO;
- use a lot fewer parentheses.
Discussed on netbsd-docs.


Revision tags: matt-armv6-nbase
# 1.69 18-Mar-2008 lukem

Consistently document RELEASEDIR/RELEASEMACHINEDIR.


# 1.68 08-Mar-2008 reed

Mention that "build" and "distribution" do not build nor install (to DESTDIR)
a kernel.


Revision tags: cube-autoconf-base matt-armv6-base hpcarm-cleanup-base
# 1.67 23-Nov-2007 sborrill

branches: 1.67.4;
Add support for CDBUILDEXTRA which acts like CDEXTRA to add extra items
to the CD-ROM image.
Make CDEXTRA and CDBUILDEXTRA be able to contain lists of files and directories
which are added in turn.
Add support for CDEXTRA_SKIP which contains a list of fnmatch(3) items to
skip during the copy. This is _very_ useful for skipping CVS dirs for example.
CDBUILDEXTRA and CDEXTRA_SKIP are to be used in Makefiles creating the images,
CDEXTRA remains to be used from build.sh.
Update documentation and build.sh help text to show that -C can be used to
specify a list of files and directories rather than just a single dir.


# 1.66 01-Sep-2007 jnemeth

Convert build.sh iso-dir=directory option to -C cddir as per jmmv@ on
source-changes.


# 1.65 01-Sep-2007 jnemeth

Add an iso-dir=directory option. When combined with iso-image or
iso-image-source, it will cause directory to be added to the CD-ROM image.


# 1.64 30-Aug-2007 jnemeth

describe new iso-image-source target


# 1.63 30-Aug-2007 ad

Remove STATUS paragraph which makes it sound like the build system is
half baked.


Revision tags: matt-mips64-base
# 1.62 13-Apr-2007 apb

branches: 1.62.4;
Document recent changes to "make iso-image".


# 1.61 26-Mar-2007 apb

Document the fact that "make installworld" and "build.sh
installworld=..." do not install the etc or xetc sets. Suggest using
etcupdate(8) and postinstall(8) after installworld.


# 1.60 27-Jan-2007 apb

Try to clarify the description of build.sh -m mach.
Document new evbarm-eb and evbarm-el aliases.


Revision tags: netbsd-4-base
# 1.59 08-Oct-2006 apb

branches: 1.59.2;
Clarify that DESTDIR/OBJDIR/etc are absolute paths, but build.sh
-D/-O/etc allows relative paths.

Closes PR 32345 by Andre Luiz de Oliveira.


# 1.58 29-Sep-2006 apb

Use ${HOST_SH} instead of the host system's /bin/sh wherever possible:

* Describe the HOST_SH variable, and the way build.sh attempts to set it.

* Suggest passing HOST_SH in the environment if /bin/sh is not a working
shell.


Revision tags: abandoned-netbsd-4-base
# 1.57 29-Jan-2006 apb

mkisofs is in pkgsrc/sysutils/cdrtools now, not pkgsrc/sysutils/cdrecord.
Reported by Jukka Salmi.


# 1.56 28-Jan-2006 apb

* Add an "iso-image" target in the top level Makefile,
which invokes make iso-image in the etc directory.
* Add an "iso-image" action in build.sh, which
invokes make iso-image.
* Document the above in doc/BUILDING.mdoc.
* Re-generate BUILDING.

Approved by christos


# 1.55 12-Jan-2006 wiz

Bump date for syspkgs.


# 1.54 04-Jan-2006 apb

Document "make syspkgs" and "build.sh syspkgs".

Reviewed by agc


Revision tags: netbsd-3-1-1-RELEASE netbsd-3-0-3-RELEASE netbsd-3-1-RELEASE netbsd-3-0-2-RELEASE netbsd-3-1-RC4 netbsd-3-1-RC3 netbsd-3-1-RC2 netbsd-3-1-RC1 netbsd-3-0-1-RELEASE netbsd-3-0-RELEASE netbsd-3-0-RC6 netbsd-3-0-RC5 netbsd-3-0-RC4 netbsd-3-0-RC3 netbsd-3-0-RC2 netbsd-3-0-RC1 netbsd-3-base
# 1.53 15-Feb-2005 reed

Document the environment variables for if you need to override or
manually select your compilers.
(And regen BUILDING from doc/BUILDING.mdoc.)


# 1.52 12-Oct-2004 jmc

Fix some typo's/bad wording as highlighted in PR#27219


# 1.51 25-Jun-2004 wiz

regen (Document -h. From Karsten Kruse in PR 25974.
While here, remove a duplicate sentence).


Revision tags: netbsd-2-0-3-RELEASE netbsd-2-1-RELEASE netbsd-2-1-RC6 netbsd-2-1-RC5 netbsd-2-1-RC4 netbsd-2-1-RC3 netbsd-2-1-RC2 netbsd-2-1-RC1 netbsd-2-0-2-RELEASE netbsd-2-0-1-RELEASE netbsd-2-base netbsd-2-0-RELEASE netbsd-2-0-RC5 netbsd-2-0-RC4 netbsd-2-0-RC3 netbsd-2-0-RC2 netbsd-2-0-RC1 netbsd-2-0-base
# 1.50 19-Mar-2004 wiz

Document MKTTINTERP.


# 1.49 06-Feb-2004 lukem

* Document build.sh -X and -x
* Document MKX11 and X11SRCDIR
* Remove note warning against cross-building from systems other than NetBSD;
it works on many other platforms.


# 1.48 29-Dec-2003 jmc

Note tools/compat/README as the place to get notes from non-native cross builds


# 1.47 19-Dec-2003 zuntum

Change -v to -V in the following section:

"Print make(1)'s idea of the value of var. Does not build any targets."

To reflect reality.

Found by Tomasz Marciniak <Tomasz.Marciniak@felix.fizyka.amu.edu.pl>, thanks!


# 1.46 26-Oct-2003 lukem

Improve how build.sh -N and MAKEVERBOSE interoperate;
rather than adding '-s' to make's command line in the makewrapper,
use the .SILENT target based on MAKEVERBOSE's value.

This means that you can do:
./build.sh -N 1 makewrapper

$TOOLDIR/bin/nbmake-$MACHINE
# runs at MAKEVERBOSE==1, with command lines suppressed

$TOOLDIR/bin/nbmake-$MACHINE MAKEVERBOSE=2
# runs at MAKEVERBOSE==2 for this invocation, with command lines shown


# 1.45 25-Oct-2003 lukem

Implement build -N noisy, which sets MAKEVERBOSE to noisy and adds
`-s' to MAKEFLAGS for noisy < 2.


# 1.44 29-Sep-2003 lukem

regenerate for "%" prompt update


# 1.43 19-Aug-2003 martti

Backout the previous commit


# 1.42 19-Aug-2003 martti

Remove # from the example.


# 1.41 08-Aug-2003 lukem

fix description of MAKEOBJDIR. from Martin Husemann


# 1.40 29-Jul-2003 lukem

Add build.sh -Z var, to unset a variable and ensure it's unset in makewrapper.
For -M MAKEOBJDIRPREFIX, unset MAKEOBJDIR.
For -O MAKEOBJDIR, unset MAKEOBJDIRPREFIX.


# 1.39 18-Jul-2003 lukem

fix default location of TOOLDIR


# 1.38 18-Jul-2003 lukem

Update for the MKUNPRIVED/MKUPDATE changes.


# 1.37 18-Jul-2003 lukem

rebuild with new groff


# 1.36 03-Jul-2003 lukem

attempt to clarify how MAKEOBJDIR{,PREFIX} may be provided ...
(this document needs a rototill, which i may get to whilst writing a
paper about build.sh)


# 1.35 25-May-2003 lukem

all:
* add "releasekernel=conf", to install a gzipped copy of the kernels
built by "kernel=conf" to RELEASEDIR/MACHINE/binary/kernel

build.sh:
* be more consistent in various status messages
* move the {release,}kernel=conf conf parsing code into getkernelconf()
and use in both buildkernel() and releasekernel()
* only warn once when building multiple kernels without updating the tools


# 1.34 18-May-2003 lukem

For normal builds, MKOBJDIRS default to `no' (not `yes').
It's only build.sh that sets this to `yes' by default.
Noted by OGAWA Takaya in [toolchain/19823]


# 1.33 17-May-2003 lukem

improve description of how "build.sh -m mach" sets the default
MACHINE_ARCH, and list the special cases that this does not occur for.


# 1.32 10-May-2003 lukem

crank date for previous


# 1.31 10-May-2003 lukem

Add "sourcesets" argument/target, which builds source sets into
RELEASEDIR/source/sets


# 1.30 08-May-2003 lukem

build.sh now provides defaults for DESTDIR and RELEASEDIR if not expert mode.
Remove -D and -R from EXAMPLES since they're not necessary any more.


# 1.29 08-Feb-2003 lukem

Fix example 3; the build.sh target is "install" not "installworld".
Improve description.
Noted by Valeriy Ushakov (uwe@) in private email.


# 1.28 02-Feb-2003 lukem

attempt to further improve and clarify the examples...


# 1.27 30-Jan-2003 lukem

Prefix various paths with 'DESTDIR', to highlight that the DESTDIR
is taken into account.


# 1.26 29-Jan-2003 lukem

allow toolprefix to be easily changed


# 1.25 26-Jan-2003 lukem

Various improvements per discussion with Alan Barrett.


# 1.24 26-Jan-2003 lukem

- Add "sets" top-level Makefile target and build.sh operation.
[Latter suggested by Julio Merino in private email]
- Add "help" build.sh operation.


# 1.23 26-Jan-2003 lukem

Change build.sh so that at least one operation is required.
Add "makewrapper" operation to build.sh.
[The above changes were suggested by Alan Barrett on current-users@]

Fail if building as non-root unless: UNPRIVED is set, -U is given, or -E
(expert mode) is given.
[Suggested by James Wetterau in private email]

Improve the examples in BUILDING.


# 1.22 23-Jan-2003 lukem

Rework how build.sh functions, so that command line options set various
parameters, and a list of "operations" defines what to do.
The full usage is show below. Notes:
`-b' has been deprecated (it always occurs now)
`-d' is replaced by "distribution"
`-R rel' onlys sets RELEASEDIR; use "release" to build a release
`-k kern' has been replaced by "kernel=kern"
`-i idir' has been replaced by "install=idir"
-r now occurs before nbmake is rebuilt

Add a copyright (long due!). Rework the code to (a KNF inspired) ShellNF.
Use functions appropriately. Allow `nb' prefix to be easily changed to
something else. Solve world peace (just kidding)

This is part of the (never achievable) goal of attempting to make
NetBSD easier to build...


--8<-- new usage follows --8<--

Usage: build.sh [-EnorUu] [-a arch] [-B buildid] [-D dest] [-j njob] [-M obj]
[-m mach] [-O obj] [-R release] [-T tools] [-V var=[value]]
[-w wrapper] [operation [...] ]

System build operations (all imply "obj" and "tools"):
build Run "make build"
distribution Run "make distribution" (includes etc/ files)
release Run "make release" (includes kernels & distrib media)

Other operations:
obj Run "make obj" (default unless -o)
tools Build and install tools
kernel=conf Build kernel with config file `conf'
install=idir Run "make installworld" to `idir'
(useful after 'distribution' or 'release')

Options:
-a arch Set MACHINE_ARCH to arch (otherwise deduced from MACHINE)
-B buildId Set BUILDID to buildId
-D dest Set DESTDIR to dest
-E Set "expert" mode; disables some DESTDIR checks
-j njob Run up to njob jobs in parallel; see make(1)
-M obj Set obj root directory to obj (sets MAKEOBJDIRPREFIX)
-m mach Set MACHINE to mach (not required if NetBSD native)
-n Show commands that would be executed, but do not execute them
-O obj Set obj root directory to obj (sets a MAKEOBJDIR pattern)
-o Set MKOBJDIRS=no (do not create objdirs at start of build)
-R release Set RELEASEDIR to release
-r Remove contents of TOOLDIR and DESTDIR before building
-T tools Set TOOLDIR to tools. If unset, and TOOLDIR is not set in
the environment, nbmake will be (re)built unconditionally.
-U Set UNPRIVED
-u Set UPDATE
-V v=[val] Set variable `v' to `val'
-w wrapper Create nbmake script as wrapper
(default: ${TOOLDIR}/bin/nbmake-${MACHINE})


# 1.21 04-Jan-2003 lukem

Add "-V var=[value]", for setting arbitrary variables which will also
be added to the nbmake-${MACHINE} wrapper.
Useful for setting RELEASEDIR, without -R's habit of building a release.


Revision tags: fvdl_fs64_base
# 1.20 25-Dec-2002 lukem

Document:
* build.sh -i idir
* top level targets: distribution, buildworld, installworld
* top level variables: INSTALLWORLDDIR


# 1.19 08-Dec-2002 lukem

Add -E - "expert mode". If this is not specified, builds to DESTDIR=/ are
not permitted.
By using this flag, you are taking responsibility for any issues that
may occur because of this...


# 1.18 08-Dec-2002 lukem

- be consistent about option ordering in build.sh usage display
- use Fl and Ar instead of Sy and Em to format options


# 1.17 25-Nov-2002 wiz

Update location of BUILDING.mdoc.


# 1.16 20-Oct-2002 lukem

regen for build.sh -k


# 1.15 21-Sep-2002 lukem

regen for: USE_NEW_TOOLCHAIN was replaced with TOOLCHAIN_MISSING


# 1.14 17-Sep-2002 fredb

Expand on the difference between ``build.sh -d'' and ``make install'',
as requested by Brian Stark in PR toolchain/18228 (which this closes).


# 1.13 22-Jul-2002 wiz

Remove duplicate 'files'. From Ryo HAYASAKA in toolchain/17674.


Revision tags: netbsd-1-6-PATCH002-RC3 netbsd-1-6-PATCH002-RC2 netbsd-1-6-PATCH002-RC1 netbsd-1-6-PATCH001 netbsd-1-6-PATCH001-RELEASE netbsd-1-6-PATCH001-RC3 netbsd-1-6-PATCH001-RC2 netbsd-1-6-PATCH001-RC1 netbsd-1-6-RELEASE netbsd-1-6-RC3 netbsd-1-6-RC2 netbsd-1-6-RC1 netbsd-1-6-base
# 1.12 13-May-2002 lukem

branches: 1.12.2;
add "-M makeobjdirprefix" to build.sh


# 1.11 03-May-2002 lukem

Move the METALOG from ${_SRC_TOP_OBJ_} to ${DESTDIR}.

There were too many synchronisation problems with using the former;
including situations such as a "make clean" performed between two
installs to the same DESTDIR would result in a truncated METALOG and
the resultant sets would be missing stuff such as include files that
don't get reinstalled if they haven't changed, even with !UPDATE.


# 1.10 02-May-2002 sommerfeld

Re-gen.


# 1.9 14-Mar-2002 thorpej

Add a -B option to set the BUILDID for the build. This also causes
the make(1) wrapper script to be named "nbmake-MACHINE-BUILDID".


# 1.8 05-Mar-2002 lukem

document various supported environment variables, including MAKEOBJDIRPREFIX


# 1.7 04-Mar-2002 lukem

document:
- make's UNPRIVED support
- build.sh's -U support
- the build system currently needs to build onto a file system with
long file name and hard link support


# 1.6 25-Nov-2001 thorpej

Document the -d option to build.sh


# 1.5 15-Nov-2001 tv

Note only <bsd.own.mk> as the authority for determining whether the new
BUILDING instructions should be used.


# 1.4 14-Nov-2001 tv

Turn off host-specific objdirs by default. Set MKHOSTOBJ=yes to enable.


# 1.3 12-Nov-2001 tv

Major overhaul of src/tools and host toolchain. Summary of changes:

* Rewrite src/tools Make logic to work like the rest of the tree wrt
"dependall" and "install". The old "make build" hack is gone.

* Remove the MKTOOLS logic. This was linked to the "make build" hack,
and was only needed because TOOLDIR originally had no writable default.

* Redo the GNU configure/make logic to make it fit reasonably in a
BSD make wrapper. Use new ${.ALLTARGETS} variable to scan for
targets in $(srcdir), and mark them with .MADE: to prevent rebuilding.

* Only build cross tools in src/tools; remove some messy logic in
src/usr.* and src/gnu/usr.* that would do target filename rewriting
(improves consistency and readability).

* Add the ability to build cross gdb at tool build time by setting
MKCROSSGDB (default no) to "yes" in mk.conf.

* Add src/tools/groff and set up paths to work with this cross groff.


# 1.2 08-Nov-2001 wiz

Remove mention of BUILDLING.html, and follow rename of BUILDING.txt to
BUILDING.
Noted by Love <lha@stacken.kth.se> on tech-toolchain.


# 1.1 01-Nov-2001 tv

By popular demand, one preformatted version of BUILDING, plaintext, no CRs.


# 1.123 16-Feb-2017 rin

The default values for MKPIC are yes and no for sh3 and m68000, respectively.
Bump date.


Revision tags: bouyer-socketcan-base pgoyette-localcount-20170107 pgoyette-localcount-20161104 localcount-20160914 pgoyette-localcount-20160806 pgoyette-localcount-20160726 pgoyette-localcount-base
# 1.122 29-Jan-2016 wiz

Document MKREPRO_TIMESTAMP.


# 1.121 23-Jul-2015 mrg

remove the xfree86 reachover makefiles and the vast majority of
the support in the rest of the source tree.

X11 sets could use some cleaning up perhaps (just deletion, as
we've never really marked the old X11R6 as obsolete for native
xorg using platforms so far either.)


# 1.120 07-Jun-2015 pgoyette

Update to reflect changes made in rev 1.398 of src/etc/Makefile


# 1.119 08-Apr-2015 wiz

regen


# 1.118 30-Nov-2014 uebayasi

regen


# 1.117 16-Nov-2014 uebayasi

regen


# 1.116 16-Nov-2014 uebayasi

regen


# 1.115 13-Nov-2014 apb

regen from doc/BUILDING.mdoc revision 1.107.
This reinstates documentation for "extsrc" which was lost in 2009.


# 1.114 08-Nov-2014 snj

fourth time's the charm, i guess. when committing a generated file,
it's best to use the latest revision of the source file (hi uebs!)

regen to include changes from revision 1.105 of doc/BUILDING.mdoc


# 1.113 06-Nov-2014 uebayasi

regen


# 1.112 06-Nov-2014 uebayasi

Expand TABs.


# 1.111 06-Nov-2014 uebayasi

Document the new "kernels" operation, prompted by joerg@.


# 1.110 05-Nov-2014 snj

regen


Revision tags: netbsd-7-base tls-earlyentropy-base tls-maxphys-base
# 1.109 07-Aug-2014 apb

branches: 1.109.2;
regen BUILDING from doc/BUILDING.mdoc


# 1.108 03-Aug-2014 apb

BUILDINFO part6: regen BUILDING from doc/BUILDING.mdoc


# 1.107 14-Jun-2014 apb

Regen from doc/BUILDING.mdoc;1.100:
Improve documentation for BUILDID.


# 1.106 21-May-2014 wiz

regen


Revision tags: yamt-pagecache-base9 riastradh-xf86-video-intel-2-7-1-pre-2-21-15 riastradh-drm2-base3 riastradh-drm2-base2 riastradh-drm2-base1 riastradh-drm2-base
# 1.105 29-May-2013 wiz

branches: 1.105.4;
regen using 'make regen' from src/doc.


# 1.104 29-May-2013 wiz

regen (using mandoc doc/BUILDING.mdoc > BUILDING -- let me know
if a different way is preferred, I see that it now contains formatting).


Revision tags: agc-symver-base yamt-pagecache-base8 yamt-pagecache-base7
# 1.103 08-Nov-2012 dholland

regen


Revision tags: yamt-pagecache-base6
# 1.102 19-Sep-2012 abs

regen


# 1.101 25-May-2012 wiz

branches: 1.101.2;
regen using 'make regen' in doc/


# 1.100 25-May-2012 wiz

Document MKREPRO using joerg's wording.


Revision tags: yamt-pagecache-base5 yamt-pagecache-base4
# 1.99 23-Feb-2012 tsutsui

Add a missing period.


Revision tags: netbsd-6-base
# 1.98 14-Feb-2012 apb

branches: 1.98.2;
Regen from revision 1.87 of doc/BUILDING.mdoc.


# 1.97 22-Jan-2012 tsutsui

Add "live-image" and "install-image" target support to build.sh.

"live-image" target builds pre-installed disk images that can be used on
emulators or boot from USB memory sticks to try NetBSD without installation.
Currently amd64, i386, pmax, sparc, sparc64, sun2, sun3, and vax
(which have working emulators and don't require extra tools like preparing
msdosfs or partitioning MD label structures) support this target.

"install-image" target builds an bootable installation disk image that can
be used as an install CD but burned into USB memory sticks etc.
Current only amd64 and i386 (which would support USB boot) have this target.

For more details (and known issue) see following posts on netbsd-bugs@:
http://mail-index.NetBSD.org/netbsd-bugs/2011/08/06/msg023639.html
http://mail-index.NetBSD.org/netbsd-bugs/2011/09/23/msg024207.html
http://mail-index.NetBSD.org/netbsd-bugs/2011/12/07/msg025166.html
http://mail-index.NetBSD.org/netbsd-bugs/2011/12/08/msg025178.html

No particular comments about implementation, and
"go ahead" comments from mrg@, riz@ and christos@.

Closes PR toolchain/45153 and PR misc/45155.


Revision tags: yamt-pagecache-base3 yamt-pagecache-base2 yamt-pagecache-base
# 1.96 09-Sep-2011 apb

branches: 1.96.2;
Add tests for the shell under which build.sh is run. If the
shell fails the tests, then build.sh tries to re-exec itself
under a more suitable shell.


# 1.95 09-Sep-2011 apb

Revisions 1.92 and 1.93 of src/BUILDING were not reflected in
src/doc/BUILDING.mdoc, so those changes were lost when src/BUILDING
was regenerated in revision 1.94.

Now update src/doc/BUILDING.mdoc and regenerate src/BUILDING to
reinstate the lost changes. (I also edited one of the changes, to use
the phrase "space-separated list" for consistency with other parts of
the document.)

The original changes were:


# 1.93 06-Aug-2011 jnemeth

Add description of MKKMOD, part of PR misc/45216


Revision tags: cherry-xenmp-base bouyer-quota2-nbase bouyer-quota2-base
# 1.92 29-Jan-2011 jym

Pass down INSTALLSETS variable to installsets target. Use :Q to escape
shell meta-characters, as the variable contains a list of sets, separated
by spaces.

$ ./build.sh -V INSTALLSETS="base etc" install=idir

should now work as expected.

Reviewed by apb@ on tech-toolchain.


# 1.94 09-Sep-2011 apb

Allow MAKEFLAGS to be set via build.sh -V. Somebody asked for this
in 2008.

Also add comments above a few functions in build.sh, and bump copyright
dates.


# 1.93 06-Aug-2011 jnemeth

Add description of MKKMOD, part of PR misc/45216


Revision tags: cherry-xenmp-base bouyer-quota2-nbase bouyer-quota2-base
# 1.92 29-Jan-2011 jym

Pass down INSTALLSETS variable to installsets target. Use :Q to escape
shell meta-characters, as the variable contains a list of sets, separated
by spaces.

$ ./build.sh -V INSTALLSETS="base etc" install=idir

should now work as expected.

Reviewed by apb@ on tech-toolchain.


Revision tags: matt-mips64-premerge-20101231
# 1.91 25-Jul-2010 mrg

branches: 1.91.2;
remove the MKSUBPIXEL/MKTTINTERP options; they're going away.

regenerate.


Revision tags: matt-premerge-20091211
# 1.90 30-Nov-2009 uebayasi

Support "extsrc", externally added programs and libraries. Users can write
their own reach-overs, cross-build, install, and get set files just like base
and X11 / X.org. (These sets are not included as TNF releases.)


# 1.89 10-Oct-2009 apb

If ${NETBDSRCDIR}/../xsrc exists, then use it as the default value
of X11SRCDIR. If it doesn't exist, then use /usr/xsrc as before.

OK mrg


# 1.88 27-Sep-2009 apb

* Use a more robust method of creating the top level object directory.
Use getmakevar to expand MAKEOBJDIRPREFIX or MAKEOBJDIR, or (if
neither of those variables is set) use a non-recursive "make obj" in
the top level source directory.

* Do not let TOP_objdir default to ${TOP}. It's now set only by the
-M or -O command line options, or after using getmakevar to expand
MAKEOBJDIRPREFIX or MAKEOBJDIR.

* Make try_set_TOOLDIR handle MAKEOBJDIRPERFIX passed from the
environment. It runs too early to use getmakevar, so it will not work
if the value contains embedded '${...}' variable references.

* Use '$TOOLDIR' (with a literal '$') instead of 'nonexistent' in
a message when rebuilding make when TOOLDIR is not yet known.


# 1.87 27-Sep-2009 apb

Allow build.sh "-C cdextra" option to be specified multiple times.


# 1.86 07-Sep-2009 jnemeth

Add a modules operation to build.sh, which builds and installs kernel modules
into DESTDIR.

This is based on the patch provided by tsutsui@ on tech-toolchain@.


# 1.85 12-Jul-2009 hubertf

regen


# 1.84 12-Jul-2009 hubertf

regen


Revision tags: jym-xensuspend-nbase jym-xensuspend-base
# 1.83 01-May-2009 snj

Introduce MKSUBPIXEL, which allows enabling subpixel rendering code
in FreeType.


# 1.82 02-Dec-2008 mrg

branches: 1.82.2;
be explicit about MAKEOBJDIR and MAKEOBJDIRPREFIX not being for
mk.conf or ${MAKECONF}.


# 1.81 15-Nov-2008 mrg

revert sparc back to default of XFree86 at the request of macallan.


# 1.80 13-Nov-2008 apb

Add support for new MAKEVERBOSE levels 3 and 4. The complete list is now:

0 Minimal output ("quiet")
1 Describe what is occurring
2 Describe what is occurring and echo the actual command
3 Ignore the effect of the "@" prefix in make commands
4 Trace shell commands using the shell's -x flag

The default remains MAKEVERBOSE=2.


# 1.79 09-Nov-2008 mrg

- retire MKXORG from public use
- introduce X11FLAVOUR to choose src/x11 vs src/external/mit/xorg
for the X11 to build if MKX11=yes is set. it takes the values
of either Xorg or XFree86.
- default to Xorg on alpha, i386, macppc, shark, sparc and sparc64
- remove MKXORG_WITH_XSRC_XSERVER, unused and never useful


Revision tags: netbsd-5-base matt-mips64-base2
# 1.78 24-Sep-2008 apb

branches: 1.78.2;
regen for recent change to examples and objdir advice,
and for the older MKSTRIPIDENT change.


Revision tags: wrstuden-revivesa-base-3 wrstuden-revivesa-base-2
# 1.77 06-Sep-2008 lukem

regen for MKHTML


# 1.76 28-Aug-2008 lukem

Improve support for MKXORG!=no to enable builds into external/mit/xorg.
This will be mutually exclusive to MKX11!=no.


# 1.75 18-Aug-2008 lukem

Document "build.sh cleandir".
Fix formatting nit.
Remove BUGS; all the in-tree platforms are using build.sh now.


# 1.74 11-Aug-2008 apb

* Suggest a "-j" value between 1+NCPU and 2*NCPU for the fastest builds.
* Remove some duplicated content that appeared in both the section about
make's -j flag and the section about build.sh's -j flag.


# 1.73 05-Aug-2008 apb

* Add more detail for build.sh -M and -O options.
* Mention new default when source is /usr/src but build.sh is run
with neither -M nor -O.


# 1.72 05-Aug-2008 perry

Builds now use "BUILDSEED" so that c++ binaries are reproduceable.
By default BUILDSEED is set to NetBSD-{majorversion} -- a -S flag may
be used to change it.

Discussed on tech-toolchain.


Revision tags: wrstuden-revivesa-base-1 yamt-pf42-base4 yamt-pf42-base3 hpcarm-cleanup-nbase yamt-pf42-baseX yamt-pf42-base2 wrstuden-revivesa-base keiichi-mipv6-nbase yamt-pf42-base keiichi-mipv6-base
# 1.71 29-Mar-2008 dholland

branches: 1.71.4;
Correct/clarify the default setting of USETOOLS in the previous version.
Noted by apb.


# 1.70 28-Mar-2008 dholland

Assorted updates and clarifications, grammar fixes and wording improvements,
and so on. Significant highlights:
- mention src/tests and reference atf;
- provide examples of MACHINE and MACHINE_ARCH;
- mention that MKOBJ=no is not recommended;
- correct the description of the default setting of USETOOLS;
- document the interactions of build.sh -[uo] with various things;
- document the interactions of build.sh tools and kernel=FOO;
- use a lot fewer parentheses.
Discussed on netbsd-docs.


Revision tags: matt-armv6-nbase
# 1.69 18-Mar-2008 lukem

Consistently document RELEASEDIR/RELEASEMACHINEDIR.


# 1.68 08-Mar-2008 reed

Mention that "build" and "distribution" do not build nor install (to DESTDIR)
a kernel.


Revision tags: cube-autoconf-base matt-armv6-base hpcarm-cleanup-base
# 1.67 23-Nov-2007 sborrill

branches: 1.67.4;
Add support for CDBUILDEXTRA which acts like CDEXTRA to add extra items
to the CD-ROM image.
Make CDEXTRA and CDBUILDEXTRA be able to contain lists of files and directories
which are added in turn.
Add support for CDEXTRA_SKIP which contains a list of fnmatch(3) items to
skip during the copy. This is _very_ useful for skipping CVS dirs for example.
CDBUILDEXTRA and CDEXTRA_SKIP are to be used in Makefiles creating the images,
CDEXTRA remains to be used from build.sh.
Update documentation and build.sh help text to show that -C can be used to
specify a list of files and directories rather than just a single dir.


# 1.66 01-Sep-2007 jnemeth

Convert build.sh iso-dir=directory option to -C cddir as per jmmv@ on
source-changes.


# 1.65 01-Sep-2007 jnemeth

Add an iso-dir=directory option. When combined with iso-image or
iso-image-source, it will cause directory to be added to the CD-ROM image.


# 1.64 30-Aug-2007 jnemeth

describe new iso-image-source target


# 1.63 30-Aug-2007 ad

Remove STATUS paragraph which makes it sound like the build system is
half baked.


Revision tags: matt-mips64-base
# 1.62 13-Apr-2007 apb

branches: 1.62.4;
Document recent changes to "make iso-image".


# 1.61 26-Mar-2007 apb

Document the fact that "make installworld" and "build.sh
installworld=..." do not install the etc or xetc sets. Suggest using
etcupdate(8) and postinstall(8) after installworld.


# 1.60 27-Jan-2007 apb

Try to clarify the description of build.sh -m mach.
Document new evbarm-eb and evbarm-el aliases.


Revision tags: netbsd-4-base
# 1.59 08-Oct-2006 apb

branches: 1.59.2;
Clarify that DESTDIR/OBJDIR/etc are absolute paths, but build.sh
-D/-O/etc allows relative paths.

Closes PR 32345 by Andre Luiz de Oliveira.


# 1.58 29-Sep-2006 apb

Use ${HOST_SH} instead of the host system's /bin/sh wherever possible:

* Describe the HOST_SH variable, and the way build.sh attempts to set it.

* Suggest passing HOST_SH in the environment if /bin/sh is not a working
shell.


Revision tags: abandoned-netbsd-4-base
# 1.57 29-Jan-2006 apb

mkisofs is in pkgsrc/sysutils/cdrtools now, not pkgsrc/sysutils/cdrecord.
Reported by Jukka Salmi.


# 1.56 28-Jan-2006 apb

* Add an "iso-image" target in the top level Makefile,
which invokes make iso-image in the etc directory.
* Add an "iso-image" action in build.sh, which
invokes make iso-image.
* Document the above in doc/BUILDING.mdoc.
* Re-generate BUILDING.

Approved by christos


# 1.55 12-Jan-2006 wiz

Bump date for syspkgs.


# 1.54 04-Jan-2006 apb

Document "make syspkgs" and "build.sh syspkgs".

Reviewed by agc


Revision tags: netbsd-3-1-1-RELEASE netbsd-3-0-3-RELEASE netbsd-3-1-RELEASE netbsd-3-0-2-RELEASE netbsd-3-1-RC4 netbsd-3-1-RC3 netbsd-3-1-RC2 netbsd-3-1-RC1 netbsd-3-0-1-RELEASE netbsd-3-0-RELEASE netbsd-3-0-RC6 netbsd-3-0-RC5 netbsd-3-0-RC4 netbsd-3-0-RC3 netbsd-3-0-RC2 netbsd-3-0-RC1 netbsd-3-base
# 1.53 15-Feb-2005 reed

Document the environment variables for if you need to override or
manually select your compilers.
(And regen BUILDING from doc/BUILDING.mdoc.)


# 1.52 12-Oct-2004 jmc

Fix some typo's/bad wording as highlighted in PR#27219


# 1.51 25-Jun-2004 wiz

regen (Document -h. From Karsten Kruse in PR 25974.
While here, remove a duplicate sentence).


Revision tags: netbsd-2-0-3-RELEASE netbsd-2-1-RELEASE netbsd-2-1-RC6 netbsd-2-1-RC5 netbsd-2-1-RC4 netbsd-2-1-RC3 netbsd-2-1-RC2 netbsd-2-1-RC1 netbsd-2-0-2-RELEASE netbsd-2-0-1-RELEASE netbsd-2-base netbsd-2-0-RELEASE netbsd-2-0-RC5 netbsd-2-0-RC4 netbsd-2-0-RC3 netbsd-2-0-RC2 netbsd-2-0-RC1 netbsd-2-0-base
# 1.50 19-Mar-2004 wiz

Document MKTTINTERP.


# 1.49 06-Feb-2004 lukem

* Document build.sh -X and -x
* Document MKX11 and X11SRCDIR
* Remove note warning against cross-building from systems other than NetBSD;
it works on many other platforms.


# 1.48 29-Dec-2003 jmc

Note tools/compat/README as the place to get notes from non-native cross builds


# 1.47 19-Dec-2003 zuntum

Change -v to -V in the following section:

"Print make(1)'s idea of the value of var. Does not build any targets."

To reflect reality.

Found by Tomasz Marciniak <Tomasz.Marciniak@felix.fizyka.amu.edu.pl>, thanks!


# 1.46 26-Oct-2003 lukem

Improve how build.sh -N and MAKEVERBOSE interoperate;
rather than adding '-s' to make's command line in the makewrapper,
use the .SILENT target based on MAKEVERBOSE's value.

This means that you can do:
./build.sh -N 1 makewrapper

$TOOLDIR/bin/nbmake-$MACHINE
# runs at MAKEVERBOSE==1, with command lines suppressed

$TOOLDIR/bin/nbmake-$MACHINE MAKEVERBOSE=2
# runs at MAKEVERBOSE==2 for this invocation, with command lines shown


# 1.45 25-Oct-2003 lukem

Implement build -N noisy, which sets MAKEVERBOSE to noisy and adds
`-s' to MAKEFLAGS for noisy < 2.


# 1.44 29-Sep-2003 lukem

regenerate for "%" prompt update


# 1.43 19-Aug-2003 martti

Backout the previous commit


# 1.42 19-Aug-2003 martti

Remove # from the example.


# 1.41 08-Aug-2003 lukem

fix description of MAKEOBJDIR. from Martin Husemann


# 1.40 29-Jul-2003 lukem

Add build.sh -Z var, to unset a variable and ensure it's unset in makewrapper.
For -M MAKEOBJDIRPREFIX, unset MAKEOBJDIR.
For -O MAKEOBJDIR, unset MAKEOBJDIRPREFIX.


# 1.39 18-Jul-2003 lukem

fix default location of TOOLDIR


# 1.38 18-Jul-2003 lukem

Update for the MKUNPRIVED/MKUPDATE changes.


# 1.37 18-Jul-2003 lukem

rebuild with new groff


# 1.36 03-Jul-2003 lukem

attempt to clarify how MAKEOBJDIR{,PREFIX} may be provided ...
(this document needs a rototill, which i may get to whilst writing a
paper about build.sh)


# 1.35 25-May-2003 lukem

all:
* add "releasekernel=conf", to install a gzipped copy of the kernels
built by "kernel=conf" to RELEASEDIR/MACHINE/binary/kernel

build.sh:
* be more consistent in various status messages
* move the {release,}kernel=conf conf parsing code into getkernelconf()
and use in both buildkernel() and releasekernel()
* only warn once when building multiple kernels without updating the tools


# 1.34 18-May-2003 lukem

For normal builds, MKOBJDIRS default to `no' (not `yes').
It's only build.sh that sets this to `yes' by default.
Noted by OGAWA Takaya in [toolchain/19823]


# 1.33 17-May-2003 lukem

improve description of how "build.sh -m mach" sets the default
MACHINE_ARCH, and list the special cases that this does not occur for.


# 1.32 10-May-2003 lukem

crank date for previous


# 1.31 10-May-2003 lukem

Add "sourcesets" argument/target, which builds source sets into
RELEASEDIR/source/sets


# 1.30 08-May-2003 lukem

build.sh now provides defaults for DESTDIR and RELEASEDIR if not expert mode.
Remove -D and -R from EXAMPLES since they're not necessary any more.


# 1.29 08-Feb-2003 lukem

Fix example 3; the build.sh target is "install" not "installworld".
Improve description.
Noted by Valeriy Ushakov (uwe@) in private email.


# 1.28 02-Feb-2003 lukem

attempt to further improve and clarify the examples...


# 1.27 30-Jan-2003 lukem

Prefix various paths with 'DESTDIR', to highlight that the DESTDIR
is taken into account.


# 1.26 29-Jan-2003 lukem

allow toolprefix to be easily changed


# 1.25 26-Jan-2003 lukem

Various improvements per discussion with Alan Barrett.


# 1.24 26-Jan-2003 lukem

- Add "sets" top-level Makefile target and build.sh operation.
[Latter suggested by Julio Merino in private email]
- Add "help" build.sh operation.


# 1.23 26-Jan-2003 lukem

Change build.sh so that at least one operation is required.
Add "makewrapper" operation to build.sh.
[The above changes were suggested by Alan Barrett on current-users@]

Fail if building as non-root unless: UNPRIVED is set, -U is given, or -E
(expert mode) is given.
[Suggested by James Wetterau in private email]

Improve the examples in BUILDING.


# 1.22 23-Jan-2003 lukem

Rework how build.sh functions, so that command line options set various
parameters, and a list of "operations" defines what to do.
The full usage is show below. Notes:
`-b' has been deprecated (it always occurs now)
`-d' is replaced by "distribution"
`-R rel' onlys sets RELEASEDIR; use "release" to build a release
`-k kern' has been replaced by "kernel=kern"
`-i idir' has been replaced by "install=idir"
-r now occurs before nbmake is rebuilt

Add a copyright (long due!). Rework the code to (a KNF inspired) ShellNF.
Use functions appropriately. Allow `nb' prefix to be easily changed to
something else. Solve world peace (just kidding)

This is part of the (never achievable) goal of attempting to make
NetBSD easier to build...


--8<-- new usage follows --8<--

Usage: build.sh [-EnorUu] [-a arch] [-B buildid] [-D dest] [-j njob] [-M obj]
[-m mach] [-O obj] [-R release] [-T tools] [-V var=[value]]
[-w wrapper] [operation [...] ]

System build operations (all imply "obj" and "tools"):
build Run "make build"
distribution Run "make distribution" (includes etc/ files)
release Run "make release" (includes kernels & distrib media)

Other operations:
obj Run "make obj" (default unless -o)
tools Build and install tools
kernel=conf Build kernel with config file `conf'
install=idir Run "make installworld" to `idir'
(useful after 'distribution' or 'release')

Options:
-a arch Set MACHINE_ARCH to arch (otherwise deduced from MACHINE)
-B buildId Set BUILDID to buildId
-D dest Set DESTDIR to dest
-E Set "expert" mode; disables some DESTDIR checks
-j njob Run up to njob jobs in parallel; see make(1)
-M obj Set obj root directory to obj (sets MAKEOBJDIRPREFIX)
-m mach Set MACHINE to mach (not required if NetBSD native)
-n Show commands that would be executed, but do not execute them
-O obj Set obj root directory to obj (sets a MAKEOBJDIR pattern)
-o Set MKOBJDIRS=no (do not create objdirs at start of build)
-R release Set RELEASEDIR to release
-r Remove contents of TOOLDIR and DESTDIR before building
-T tools Set TOOLDIR to tools. If unset, and TOOLDIR is not set in
the environment, nbmake will be (re)built unconditionally.
-U Set UNPRIVED
-u Set UPDATE
-V v=[val] Set variable `v' to `val'
-w wrapper Create nbmake script as wrapper
(default: ${TOOLDIR}/bin/nbmake-${MACHINE})


# 1.21 04-Jan-2003 lukem

Add "-V var=[value]", for setting arbitrary variables which will also
be added to the nbmake-${MACHINE} wrapper.
Useful for setting RELEASEDIR, without -R's habit of building a release.


Revision tags: fvdl_fs64_base
# 1.20 25-Dec-2002 lukem

Document:
* build.sh -i idir
* top level targets: distribution, buildworld, installworld
* top level variables: INSTALLWORLDDIR


# 1.19 08-Dec-2002 lukem

Add -E - "expert mode". If this is not specified, builds to DESTDIR=/ are
not permitted.
By using this flag, you are taking responsibility for any issues that
may occur because of this...


# 1.18 08-Dec-2002 lukem

- be consistent about option ordering in build.sh usage display
- use Fl and Ar instead of Sy and Em to format options


# 1.17 25-Nov-2002 wiz

Update location of BUILDING.mdoc.


# 1.16 20-Oct-2002 lukem

regen for build.sh -k


# 1.15 21-Sep-2002 lukem

regen for: USE_NEW_TOOLCHAIN was replaced with TOOLCHAIN_MISSING


# 1.14 17-Sep-2002 fredb

Expand on the difference between ``build.sh -d'' and ``make install'',
as requested by Brian Stark in PR toolchain/18228 (which this closes).


# 1.13 22-Jul-2002 wiz

Remove duplicate 'files'. From Ryo HAYASAKA in toolchain/17674.


Revision tags: netbsd-1-6-PATCH002-RC3 netbsd-1-6-PATCH002-RC2 netbsd-1-6-PATCH002-RC1 netbsd-1-6-PATCH001 netbsd-1-6-PATCH001-RELEASE netbsd-1-6-PATCH001-RC3 netbsd-1-6-PATCH001-RC2 netbsd-1-6-PATCH001-RC1 netbsd-1-6-RELEASE netbsd-1-6-RC3 netbsd-1-6-RC2 netbsd-1-6-RC1 netbsd-1-6-base
# 1.12 13-May-2002 lukem

branches: 1.12.2;
add "-M makeobjdirprefix" to build.sh


# 1.11 03-May-2002 lukem

Move the METALOG from ${_SRC_TOP_OBJ_} to ${DESTDIR}.

There were too many synchronisation problems with using the former;
including situations such as a "make clean" performed between two
installs to the same DESTDIR would result in a truncated METALOG and
the resultant sets would be missing stuff such as include files that
don't get reinstalled if they haven't changed, even with !UPDATE.


# 1.10 02-May-2002 sommerfeld

Re-gen.


# 1.9 14-Mar-2002 thorpej

Add a -B option to set the BUILDID for the build. This also causes
the make(1) wrapper script to be named "nbmake-MACHINE-BUILDID".


# 1.8 05-Mar-2002 lukem

document various supported environment variables, including MAKEOBJDIRPREFIX


# 1.7 04-Mar-2002 lukem

document:
- make's UNPRIVED support
- build.sh's -U support
- the build system currently needs to build onto a file system with
long file name and hard link support


# 1.6 25-Nov-2001 thorpej

Document the -d option to build.sh


# 1.5 15-Nov-2001 tv

Note only <bsd.own.mk> as the authority for determining whether the new
BUILDING instructions should be used.


# 1.4 14-Nov-2001 tv

Turn off host-specific objdirs by default. Set MKHOSTOBJ=yes to enable.


# 1.3 12-Nov-2001 tv

Major overhaul of src/tools and host toolchain. Summary of changes:

* Rewrite src/tools Make logic to work like the rest of the tree wrt
"dependall" and "install". The old "make build" hack is gone.

* Remove the MKTOOLS logic. This was linked to the "make build" hack,
and was only needed because TOOLDIR originally had no writable default.

* Redo the GNU configure/make logic to make it fit reasonably in a
BSD make wrapper. Use new ${.ALLTARGETS} variable to scan for
targets in $(srcdir), and mark them with .MADE: to prevent rebuilding.

* Only build cross tools in src/tools; remove some messy logic in
src/usr.* and src/gnu/usr.* that would do target filename rewriting
(improves consistency and readability).

* Add the ability to build cross gdb at tool build time by setting
MKCROSSGDB (default no) to "yes" in mk.conf.

* Add src/tools/groff and set up paths to work with this cross groff.


# 1.2 08-Nov-2001 wiz

Remove mention of BUILDLING.html, and follow rename of BUILDING.txt to
BUILDING.
Noted by Love <lha@stacken.kth.se> on tech-toolchain.


# 1.1 01-Nov-2001 tv

By popular demand, one preformatted version of BUILDING, plaintext, no CRs.


Revision tags: pgoyette-localcount-20161104 localcount-20160914 pgoyette-localcount-20160806 pgoyette-localcount-20160726 pgoyette-localcount-base
# 1.122 29-Jan-2016 wiz

Document MKREPRO_TIMESTAMP.


# 1.121 23-Jul-2015 mrg

remove the xfree86 reachover makefiles and the vast majority of
the support in the rest of the source tree.

X11 sets could use some cleaning up perhaps (just deletion, as
we've never really marked the old X11R6 as obsolete for native
xorg using platforms so far either.)


# 1.120 06-Jun-2015 pgoyette

Update to reflect changes made in rev 1.398 of src/etc/Makefile


# 1.119 07-Apr-2015 wiz

regen


# 1.118 30-Nov-2014 uebayasi

regen


# 1.117 15-Nov-2014 uebayasi

regen


# 1.116 15-Nov-2014 uebayasi

regen


# 1.115 13-Nov-2014 apb

regen from doc/BUILDING.mdoc revision 1.107.
This reinstates documentation for "extsrc" which was lost in 2009.


# 1.114 07-Nov-2014 snj

fourth time's the charm, i guess. when committing a generated file,
it's best to use the latest revision of the source file (hi uebs!)

regen to include changes from revision 1.105 of doc/BUILDING.mdoc


# 1.113 05-Nov-2014 uebayasi

regen


# 1.112 05-Nov-2014 uebayasi

Expand TABs.


# 1.111 05-Nov-2014 uebayasi

Document the new "kernels" operation, prompted by joerg@.


# 1.110 05-Nov-2014 snj

regen


Revision tags: netbsd-7-base tls-earlyentropy-base tls-maxphys-base
# 1.109 07-Aug-2014 apb

branches: 1.109.2;
regen BUILDING from doc/BUILDING.mdoc


# 1.108 03-Aug-2014 apb

BUILDINFO part6: regen BUILDING from doc/BUILDING.mdoc


# 1.107 13-Jun-2014 apb

Regen from doc/BUILDING.mdoc;1.100:
Improve documentation for BUILDID.


# 1.106 21-May-2014 wiz

regen


Revision tags: yamt-pagecache-base9 riastradh-xf86-video-intel-2-7-1-pre-2-21-15 riastradh-drm2-base3 riastradh-drm2-base2 riastradh-drm2-base1 riastradh-drm2-base
# 1.105 29-May-2013 wiz

branches: 1.105.4;
regen using 'make regen' from src/doc.


# 1.104 29-May-2013 wiz

regen (using mandoc doc/BUILDING.mdoc > BUILDING -- let me know
if a different way is preferred, I see that it now contains formatting).


Revision tags: agc-symver-base yamt-pagecache-base8 yamt-pagecache-base7
# 1.103 08-Nov-2012 dholland

regen


Revision tags: yamt-pagecache-base6
# 1.102 19-Sep-2012 abs

regen


# 1.101 25-May-2012 wiz

branches: 1.101.2;
regen using 'make regen' in doc/


# 1.100 25-May-2012 wiz

Document MKREPRO using joerg's wording.


Revision tags: yamt-pagecache-base5 yamt-pagecache-base4
# 1.99 23-Feb-2012 tsutsui

Add a missing period.


Revision tags: netbsd-6-base
# 1.98 14-Feb-2012 apb

branches: 1.98.2;
Regen from revision 1.87 of doc/BUILDING.mdoc.


# 1.97 21-Jan-2012 tsutsui

Add "live-image" and "install-image" target support to build.sh.

"live-image" target builds pre-installed disk images that can be used on
emulators or boot from USB memory sticks to try NetBSD without installation.
Currently amd64, i386, pmax, sparc, sparc64, sun2, sun3, and vax
(which have working emulators and don't require extra tools like preparing
msdosfs or partitioning MD label structures) support this target.

"install-image" target builds an bootable installation disk image that can
be used as an install CD but burned into USB memory sticks etc.
Current only amd64 and i386 (which would support USB boot) have this target.

For more details (and known issue) see following posts on netbsd-bugs@:
http://mail-index.NetBSD.org/netbsd-bugs/2011/08/06/msg023639.html
http://mail-index.NetBSD.org/netbsd-bugs/2011/09/23/msg024207.html
http://mail-index.NetBSD.org/netbsd-bugs/2011/12/07/msg025166.html
http://mail-index.NetBSD.org/netbsd-bugs/2011/12/08/msg025178.html

No particular comments about implementation, and
"go ahead" comments from mrg@, riz@ and christos@.

Closes PR toolchain/45153 and PR misc/45155.


Revision tags: yamt-pagecache-base3 yamt-pagecache-base2 yamt-pagecache-base
# 1.96 09-Sep-2011 apb

branches: 1.96.2;
Add tests for the shell under which build.sh is run. If the
shell fails the tests, then build.sh tries to re-exec itself
under a more suitable shell.


# 1.95 09-Sep-2011 apb

Revisions 1.92 and 1.93 of src/BUILDING were not reflected in
src/doc/BUILDING.mdoc, so those changes were lost when src/BUILDING
was regenerated in revision 1.94.

Now update src/doc/BUILDING.mdoc and regenerate src/BUILDING to
reinstate the lost changes. (I also edited one of the changes, to use
the phrase "space-separated list" for consistency with other parts of
the document.)

The original changes were:


# 1.93 06-Aug-2011 jnemeth

Add description of MKKMOD, part of PR misc/45216


Revision tags: cherry-xenmp-base bouyer-quota2-nbase bouyer-quota2-base
# 1.92 29-Jan-2011 jym

Pass down INSTALLSETS variable to installsets target. Use :Q to escape
shell meta-characters, as the variable contains a list of sets, separated
by spaces.

$ ./build.sh -V INSTALLSETS="base etc" install=idir

should now work as expected.

Reviewed by apb@ on tech-toolchain.


# 1.94 09-Sep-2011 apb

Allow MAKEFLAGS to be set via build.sh -V. Somebody asked for this
in 2008.

Also add comments above a few functions in build.sh, and bump copyright
dates.


# 1.93 06-Aug-2011 jnemeth

Add description of MKKMOD, part of PR misc/45216


Revision tags: cherry-xenmp-base bouyer-quota2-nbase bouyer-quota2-base
# 1.92 29-Jan-2011 jym

Pass down INSTALLSETS variable to installsets target. Use :Q to escape
shell meta-characters, as the variable contains a list of sets, separated
by spaces.

$ ./build.sh -V INSTALLSETS="base etc" install=idir

should now work as expected.

Reviewed by apb@ on tech-toolchain.


Revision tags: matt-mips64-premerge-20101231
# 1.91 25-Jul-2010 mrg

branches: 1.91.2;
remove the MKSUBPIXEL/MKTTINTERP options; they're going away.

regenerate.


Revision tags: matt-premerge-20091211
# 1.90 30-Nov-2009 uebayasi

Support "extsrc", externally added programs and libraries. Users can write
their own reach-overs, cross-build, install, and get set files just like base
and X11 / X.org. (These sets are not included as TNF releases.)


# 1.89 10-Oct-2009 apb

If ${NETBDSRCDIR}/../xsrc exists, then use it as the default value
of X11SRCDIR. If it doesn't exist, then use /usr/xsrc as before.

OK mrg


# 1.88 27-Sep-2009 apb

* Use a more robust method of creating the top level object directory.
Use getmakevar to expand MAKEOBJDIRPREFIX or MAKEOBJDIR, or (if
neither of those variables is set) use a non-recursive "make obj" in
the top level source directory.

* Do not let TOP_objdir default to ${TOP}. It's now set only by the
-M or -O command line options, or after using getmakevar to expand
MAKEOBJDIRPREFIX or MAKEOBJDIR.

* Make try_set_TOOLDIR handle MAKEOBJDIRPERFIX passed from the
environment. It runs too early to use getmakevar, so it will not work
if the value contains embedded '${...}' variable references.

* Use '$TOOLDIR' (with a literal '$') instead of 'nonexistent' in
a message when rebuilding make when TOOLDIR is not yet known.


# 1.87 27-Sep-2009 apb

Allow build.sh "-C cdextra" option to be specified multiple times.


# 1.86 06-Sep-2009 jnemeth

Add a modules operation to build.sh, which builds and installs kernel modules
into DESTDIR.

This is based on the patch provided by tsutsui@ on tech-toolchain@.


# 1.85 12-Jul-2009 hubertf

regen


# 1.84 11-Jul-2009 hubertf

regen


Revision tags: jym-xensuspend-nbase jym-xensuspend-base
# 1.83 01-May-2009 snj

Introduce MKSUBPIXEL, which allows enabling subpixel rendering code
in FreeType.


# 1.82 02-Dec-2008 mrg

branches: 1.82.2;
be explicit about MAKEOBJDIR and MAKEOBJDIRPREFIX not being for
mk.conf or ${MAKECONF}.


# 1.81 15-Nov-2008 mrg

revert sparc back to default of XFree86 at the request of macallan.


# 1.80 13-Nov-2008 apb

Add support for new MAKEVERBOSE levels 3 and 4. The complete list is now:

0 Minimal output ("quiet")
1 Describe what is occurring
2 Describe what is occurring and echo the actual command
3 Ignore the effect of the "@" prefix in make commands
4 Trace shell commands using the shell's -x flag

The default remains MAKEVERBOSE=2.


# 1.79 09-Nov-2008 mrg

- retire MKXORG from public use
- introduce X11FLAVOUR to choose src/x11 vs src/external/mit/xorg
for the X11 to build if MKX11=yes is set. it takes the values
of either Xorg or XFree86.
- default to Xorg on alpha, i386, macppc, shark, sparc and sparc64
- remove MKXORG_WITH_XSRC_XSERVER, unused and never useful


Revision tags: netbsd-5-base matt-mips64-base2
# 1.78 24-Sep-2008 apb

branches: 1.78.2;
regen for recent change to examples and objdir advice,
and for the older MKSTRIPIDENT change.


Revision tags: wrstuden-revivesa-base-3 wrstuden-revivesa-base-2
# 1.77 06-Sep-2008 lukem

regen for MKHTML


# 1.76 28-Aug-2008 lukem

Improve support for MKXORG!=no to enable builds into external/mit/xorg.
This will be mutually exclusive to MKX11!=no.


# 1.75 17-Aug-2008 lukem

Document "build.sh cleandir".
Fix formatting nit.
Remove BUGS; all the in-tree platforms are using build.sh now.


# 1.74 11-Aug-2008 apb

* Suggest a "-j" value between 1+NCPU and 2*NCPU for the fastest builds.
* Remove some duplicated content that appeared in both the section about
make's -j flag and the section about build.sh's -j flag.


# 1.73 05-Aug-2008 apb

* Add more detail for build.sh -M and -O options.
* Mention new default when source is /usr/src but build.sh is run
with neither -M nor -O.


# 1.72 05-Aug-2008 perry

Builds now use "BUILDSEED" so that c++ binaries are reproduceable.
By default BUILDSEED is set to NetBSD-{majorversion} -- a -S flag may
be used to change it.

Discussed on tech-toolchain.


Revision tags: wrstuden-revivesa-base-1 yamt-pf42-base4 yamt-pf42-base3 hpcarm-cleanup-nbase yamt-pf42-baseX yamt-pf42-base2 wrstuden-revivesa-base keiichi-mipv6-nbase yamt-pf42-base keiichi-mipv6-base
# 1.71 28-Mar-2008 dholland

branches: 1.71.4;
Correct/clarify the default setting of USETOOLS in the previous version.
Noted by apb.


# 1.70 27-Mar-2008 dholland

Assorted updates and clarifications, grammar fixes and wording improvements,
and so on. Significant highlights:
- mention src/tests and reference atf;
- provide examples of MACHINE and MACHINE_ARCH;
- mention that MKOBJ=no is not recommended;
- correct the description of the default setting of USETOOLS;
- document the interactions of build.sh -[uo] with various things;
- document the interactions of build.sh tools and kernel=FOO;
- use a lot fewer parentheses.
Discussed on netbsd-docs.


Revision tags: matt-armv6-nbase
# 1.69 17-Mar-2008 lukem

Consistently document RELEASEDIR/RELEASEMACHINEDIR.


# 1.68 08-Mar-2008 reed

Mention that "build" and "distribution" do not build nor install (to DESTDIR)
a kernel.


Revision tags: cube-autoconf-base matt-armv6-base hpcarm-cleanup-base
# 1.67 23-Nov-2007 sborrill

branches: 1.67.4;
Add support for CDBUILDEXTRA which acts like CDEXTRA to add extra items
to the CD-ROM image.
Make CDEXTRA and CDBUILDEXTRA be able to contain lists of files and directories
which are added in turn.
Add support for CDEXTRA_SKIP which contains a list of fnmatch(3) items to
skip during the copy. This is _very_ useful for skipping CVS dirs for example.
CDBUILDEXTRA and CDEXTRA_SKIP are to be used in Makefiles creating the images,
CDEXTRA remains to be used from build.sh.
Update documentation and build.sh help text to show that -C can be used to
specify a list of files and directories rather than just a single dir.


# 1.66 01-Sep-2007 jnemeth

Convert build.sh iso-dir=directory option to -C cddir as per jmmv@ on
source-changes.


# 1.65 01-Sep-2007 jnemeth

Add an iso-dir=directory option. When combined with iso-image or
iso-image-source, it will cause directory to be added to the CD-ROM image.


# 1.64 30-Aug-2007 jnemeth

describe new iso-image-source target


# 1.63 29-Aug-2007 ad

Remove STATUS paragraph which makes it sound like the build system is
half baked.


Revision tags: matt-mips64-base
# 1.62 13-Apr-2007 apb

branches: 1.62.4;
Document recent changes to "make iso-image".


# 1.61 26-Mar-2007 apb

Document the fact that "make installworld" and "build.sh
installworld=..." do not install the etc or xetc sets. Suggest using
etcupdate(8) and postinstall(8) after installworld.


# 1.60 27-Jan-2007 apb

Try to clarify the description of build.sh -m mach.
Document new evbarm-eb and evbarm-el aliases.


Revision tags: netbsd-4-base
# 1.59 08-Oct-2006 apb

branches: 1.59.2;
Clarify that DESTDIR/OBJDIR/etc are absolute paths, but build.sh
-D/-O/etc allows relative paths.

Closes PR 32345 by Andre Luiz de Oliveira.


# 1.58 29-Sep-2006 apb

Use ${HOST_SH} instead of the host system's /bin/sh wherever possible:

* Describe the HOST_SH variable, and the way build.sh attempts to set it.

* Suggest passing HOST_SH in the environment if /bin/sh is not a working
shell.


Revision tags: abandoned-netbsd-4-base
# 1.57 29-Jan-2006 apb

mkisofs is in pkgsrc/sysutils/cdrtools now, not pkgsrc/sysutils/cdrecord.
Reported by Jukka Salmi.


# 1.56 28-Jan-2006 apb

* Add an "iso-image" target in the top level Makefile,
which invokes make iso-image in the etc directory.
* Add an "iso-image" action in build.sh, which
invokes make iso-image.
* Document the above in doc/BUILDING.mdoc.
* Re-generate BUILDING.

Approved by christos


# 1.55 12-Jan-2006 wiz

Bump date for syspkgs.


# 1.54 04-Jan-2006 apb

Document "make syspkgs" and "build.sh syspkgs".

Reviewed by agc


Revision tags: netbsd-3-1-1-RELEASE netbsd-3-0-3-RELEASE netbsd-3-1-RELEASE netbsd-3-0-2-RELEASE netbsd-3-1-RC4 netbsd-3-1-RC3 netbsd-3-1-RC2 netbsd-3-1-RC1 netbsd-3-0-1-RELEASE netbsd-3-0-RELEASE netbsd-3-0-RC6 netbsd-3-0-RC5 netbsd-3-0-RC4 netbsd-3-0-RC3 netbsd-3-0-RC2 netbsd-3-0-RC1 netbsd-3-base
# 1.53 15-Feb-2005 reed

Document the environment variables for if you need to override or
manually select your compilers.
(And regen BUILDING from doc/BUILDING.mdoc.)


# 1.52 11-Oct-2004 jmc

Fix some typo's/bad wording as highlighted in PR#27219


# 1.51 25-Jun-2004 wiz

regen (Document -h. From Karsten Kruse in PR 25974.
While here, remove a duplicate sentence).


Revision tags: netbsd-2-0-3-RELEASE netbsd-2-1-RELEASE netbsd-2-1-RC6 netbsd-2-1-RC5 netbsd-2-1-RC4 netbsd-2-1-RC3 netbsd-2-1-RC2 netbsd-2-1-RC1 netbsd-2-0-2-RELEASE netbsd-2-0-1-RELEASE netbsd-2-base netbsd-2-0-RELEASE netbsd-2-0-RC5 netbsd-2-0-RC4 netbsd-2-0-RC3 netbsd-2-0-RC2 netbsd-2-0-RC1 netbsd-2-0-base
# 1.50 18-Mar-2004 wiz

Document MKTTINTERP.


# 1.49 06-Feb-2004 lukem

* Document build.sh -X and -x
* Document MKX11 and X11SRCDIR
* Remove note warning against cross-building from systems other than NetBSD;
it works on many other platforms.


# 1.48 29-Dec-2003 jmc

Note tools/compat/README as the place to get notes from non-native cross builds


# 1.47 18-Dec-2003 zuntum

Change -v to -V in the following section:

"Print make(1)'s idea of the value of var. Does not build any targets."

To reflect reality.

Found by Tomasz Marciniak <Tomasz.Marciniak@felix.fizyka.amu.edu.pl>, thanks!


# 1.46 25-Oct-2003 lukem

Improve how build.sh -N and MAKEVERBOSE interoperate;
rather than adding '-s' to make's command line in the makewrapper,
use the .SILENT target based on MAKEVERBOSE's value.

This means that you can do:
./build.sh -N 1 makewrapper

$TOOLDIR/bin/nbmake-$MACHINE
# runs at MAKEVERBOSE==1, with command lines suppressed

$TOOLDIR/bin/nbmake-$MACHINE MAKEVERBOSE=2
# runs at MAKEVERBOSE==2 for this invocation, with command lines shown


# 1.45 24-Oct-2003 lukem

Implement build -N noisy, which sets MAKEVERBOSE to noisy and adds
`-s' to MAKEFLAGS for noisy < 2.


# 1.44 29-Sep-2003 lukem

regenerate for "%" prompt update


# 1.43 18-Aug-2003 martti

Backout the previous commit


# 1.42 19-Aug-2003 martti

Remove # from the example.


# 1.41 07-Aug-2003 lukem

fix description of MAKEOBJDIR. from Martin Husemann


# 1.40 29-Jul-2003 lukem

Add build.sh -Z var, to unset a variable and ensure it's unset in makewrapper.
For -M MAKEOBJDIRPREFIX, unset MAKEOBJDIR.
For -O MAKEOBJDIR, unset MAKEOBJDIRPREFIX.


# 1.39 18-Jul-2003 lukem

fix default location of TOOLDIR


# 1.38 18-Jul-2003 lukem

Update for the MKUNPRIVED/MKUPDATE changes.


# 1.37 17-Jul-2003 lukem

rebuild with new groff


# 1.36 02-Jul-2003 lukem

attempt to clarify how MAKEOBJDIR{,PREFIX} may be provided ...
(this document needs a rototill, which i may get to whilst writing a
paper about build.sh)


# 1.35 24-May-2003 lukem

all:
* add "releasekernel=conf", to install a gzipped copy of the kernels
built by "kernel=conf" to RELEASEDIR/MACHINE/binary/kernel

build.sh:
* be more consistent in various status messages
* move the {release,}kernel=conf conf parsing code into getkernelconf()
and use in both buildkernel() and releasekernel()
* only warn once when building multiple kernels without updating the tools


# 1.34 18-May-2003 lukem

For normal builds, MKOBJDIRS default to `no' (not `yes').
It's only build.sh that sets this to `yes' by default.
Noted by OGAWA Takaya in [toolchain/19823]


# 1.33 17-May-2003 lukem

improve description of how "build.sh -m mach" sets the default
MACHINE_ARCH, and list the special cases that this does not occur for.


# 1.32 10-May-2003 lukem

crank date for previous


# 1.31 10-May-2003 lukem

Add "sourcesets" argument/target, which builds source sets into
RELEASEDIR/source/sets


# 1.30 08-May-2003 lukem

build.sh now provides defaults for DESTDIR and RELEASEDIR if not expert mode.
Remove -D and -R from EXAMPLES since they're not necessary any more.


# 1.29 08-Feb-2003 lukem

Fix example 3; the build.sh target is "install" not "installworld".
Improve description.
Noted by Valeriy Ushakov (uwe@) in private email.


# 1.28 01-Feb-2003 lukem

attempt to further improve and clarify the examples...


# 1.27 29-Jan-2003 lukem

Prefix various paths with 'DESTDIR', to highlight that the DESTDIR
is taken into account.


# 1.26 29-Jan-2003 lukem

allow toolprefix to be easily changed


# 1.25 26-Jan-2003 lukem

Various improvements per discussion with Alan Barrett.


# 1.24 25-Jan-2003 lukem

- Add "sets" top-level Makefile target and build.sh operation.
[Latter suggested by Julio Merino in private email]
- Add "help" build.sh operation.


# 1.23 25-Jan-2003 lukem

Change build.sh so that at least one operation is required.
Add "makewrapper" operation to build.sh.
[The above changes were suggested by Alan Barrett on current-users@]

Fail if building as non-root unless: UNPRIVED is set, -U is given, or -E
(expert mode) is given.
[Suggested by James Wetterau in private email]

Improve the examples in BUILDING.


# 1.22 23-Jan-2003 lukem

Rework how build.sh functions, so that command line options set various
parameters, and a list of "operations" defines what to do.
The full usage is show below. Notes:
`-b' has been deprecated (it always occurs now)
`-d' is replaced by "distribution"
`-R rel' onlys sets RELEASEDIR; use "release" to build a release
`-k kern' has been replaced by "kernel=kern"
`-i idir' has been replaced by "install=idir"
-r now occurs before nbmake is rebuilt

Add a copyright (long due!). Rework the code to (a KNF inspired) ShellNF.
Use functions appropriately. Allow `nb' prefix to be easily changed to
something else. Solve world peace (just kidding)

This is part of the (never achievable) goal of attempting to make
NetBSD easier to build...


--8<-- new usage follows --8<--

Usage: build.sh [-EnorUu] [-a arch] [-B buildid] [-D dest] [-j njob] [-M obj]
[-m mach] [-O obj] [-R release] [-T tools] [-V var=[value]]
[-w wrapper] [operation [...] ]

System build operations (all imply "obj" and "tools"):
build Run "make build"
distribution Run "make distribution" (includes etc/ files)
release Run "make release" (includes kernels & distrib media)

Other operations:
obj Run "make obj" (default unless -o)
tools Build and install tools
kernel=conf Build kernel with config file `conf'
install=idir Run "make installworld" to `idir'
(useful after 'distribution' or 'release')

Options:
-a arch Set MACHINE_ARCH to arch (otherwise deduced from MACHINE)
-B buildId Set BUILDID to buildId
-D dest Set DESTDIR to dest
-E Set "expert" mode; disables some DESTDIR checks
-j njob Run up to njob jobs in parallel; see make(1)
-M obj Set obj root directory to obj (sets MAKEOBJDIRPREFIX)
-m mach Set MACHINE to mach (not required if NetBSD native)
-n Show commands that would be executed, but do not execute them
-O obj Set obj root directory to obj (sets a MAKEOBJDIR pattern)
-o Set MKOBJDIRS=no (do not create objdirs at start of build)
-R release Set RELEASEDIR to release
-r Remove contents of TOOLDIR and DESTDIR before building
-T tools Set TOOLDIR to tools. If unset, and TOOLDIR is not set in
the environment, nbmake will be (re)built unconditionally.
-U Set UNPRIVED
-u Set UPDATE
-V v=[val] Set variable `v' to `val'
-w wrapper Create nbmake script as wrapper
(default: ${TOOLDIR}/bin/nbmake-${MACHINE})


# 1.21 03-Jan-2003 lukem

Add "-V var=[value]", for setting arbitrary variables which will also
be added to the nbmake-${MACHINE} wrapper.
Useful for setting RELEASEDIR, without -R's habit of building a release.


Revision tags: fvdl_fs64_base
# 1.20 24-Dec-2002 lukem

Document:
* build.sh -i idir
* top level targets: distribution, buildworld, installworld
* top level variables: INSTALLWORLDDIR


# 1.19 08-Dec-2002 lukem

Add -E - "expert mode". If this is not specified, builds to DESTDIR=/ are
not permitted.
By using this flag, you are taking responsibility for any issues that
may occur because of this...


# 1.18 08-Dec-2002 lukem

- be consistent about option ordering in build.sh usage display
- use Fl and Ar instead of Sy and Em to format options


# 1.17 25-Nov-2002 wiz

Update location of BUILDING.mdoc.


# 1.16 20-Oct-2002 lukem

regen for build.sh -k


# 1.15 20-Sep-2002 lukem

regen for: USE_NEW_TOOLCHAIN was replaced with TOOLCHAIN_MISSING


# 1.14 17-Sep-2002 fredb

Expand on the difference between ``build.sh -d'' and ``make install'',
as requested by Brian Stark in PR toolchain/18228 (which this closes).


# 1.13 22-Jul-2002 wiz

Remove duplicate 'files'. From Ryo HAYASAKA in toolchain/17674.


Revision tags: netbsd-1-6-PATCH002-RC3 netbsd-1-6-PATCH002-RC2 netbsd-1-6-PATCH002-RC1 netbsd-1-6-PATCH001 netbsd-1-6-PATCH001-RELEASE netbsd-1-6-PATCH001-RC3 netbsd-1-6-PATCH001-RC2 netbsd-1-6-PATCH001-RC1 netbsd-1-6-RELEASE netbsd-1-6-RC3 netbsd-1-6-RC2 netbsd-1-6-RC1 netbsd-1-6-base
# 1.12 12-May-2002 lukem

branches: 1.12.2;
add "-M makeobjdirprefix" to build.sh


# 1.11 03-May-2002 lukem

Move the METALOG from ${_SRC_TOP_OBJ_} to ${DESTDIR}.

There were too many synchronisation problems with using the former;
including situations such as a "make clean" performed between two
installs to the same DESTDIR would result in a truncated METALOG and
the resultant sets would be missing stuff such as include files that
don't get reinstalled if they haven't changed, even with !UPDATE.


# 1.10 02-May-2002 sommerfeld

Re-gen.


# 1.9 14-Mar-2002 thorpej

Add a -B option to set the BUILDID for the build. This also causes
the make(1) wrapper script to be named "nbmake-MACHINE-BUILDID".


# 1.8 04-Mar-2002 lukem

document various supported environment variables, including MAKEOBJDIRPREFIX


# 1.7 03-Mar-2002 lukem

document:
- make's UNPRIVED support
- build.sh's -U support
- the build system currently needs to build onto a file system with
long file name and hard link support


# 1.6 25-Nov-2001 thorpej

Document the -d option to build.sh


# 1.5 15-Nov-2001 tv

Note only <bsd.own.mk> as the authority for determining whether the new
BUILDING instructions should be used.


# 1.4 14-Nov-2001 tv

Turn off host-specific objdirs by default. Set MKHOSTOBJ=yes to enable.


# 1.3 12-Nov-2001 tv

Major overhaul of src/tools and host toolchain. Summary of changes:

* Rewrite src/tools Make logic to work like the rest of the tree wrt
"dependall" and "install". The old "make build" hack is gone.

* Remove the MKTOOLS logic. This was linked to the "make build" hack,
and was only needed because TOOLDIR originally had no writable default.

* Redo the GNU configure/make logic to make it fit reasonably in a
BSD make wrapper. Use new ${.ALLTARGETS} variable to scan for
targets in $(srcdir), and mark them with .MADE: to prevent rebuilding.

* Only build cross tools in src/tools; remove some messy logic in
src/usr.* and src/gnu/usr.* that would do target filename rewriting
(improves consistency and readability).

* Add the ability to build cross gdb at tool build time by setting
MKCROSSGDB (default no) to "yes" in mk.conf.

* Add src/tools/groff and set up paths to work with this cross groff.


# 1.2 08-Nov-2001 wiz

Remove mention of BUILDLING.html, and follow rename of BUILDING.txt to
BUILDING.
Noted by Love <lha@stacken.kth.se> on tech-toolchain.


# 1.1 01-Nov-2001 tv

By popular demand, one preformatted version of BUILDING, plaintext, no CRs.


# 1.121 23-Jul-2015 mrg

remove the xfree86 reachover makefiles and the vast majority of
the support in the rest of the source tree.

X11 sets could use some cleaning up perhaps (just deletion, as
we've never really marked the old X11R6 as obsolete for native
xorg using platforms so far either.)


# 1.120 06-Jun-2015 pgoyette

Update to reflect changes made in rev 1.398 of src/etc/Makefile


# 1.119 07-Apr-2015 wiz

regen


# 1.118 30-Nov-2014 uebayasi

regen


# 1.117 15-Nov-2014 uebayasi

regen


# 1.116 15-Nov-2014 uebayasi

regen


# 1.115 13-Nov-2014 apb

regen from doc/BUILDING.mdoc revision 1.107.
This reinstates documentation for "extsrc" which was lost in 2009.


# 1.114 07-Nov-2014 snj

fourth time's the charm, i guess. when committing a generated file,
it's best to use the latest revision of the source file (hi uebs!)

regen to include changes from revision 1.105 of doc/BUILDING.mdoc


# 1.113 05-Nov-2014 uebayasi

regen


# 1.112 05-Nov-2014 uebayasi

Expand TABs.


# 1.111 05-Nov-2014 uebayasi

Document the new "kernels" operation, prompted by joerg@.


# 1.110 05-Nov-2014 snj

regen


# 1.109 07-Aug-2014 apb

branches: 1.109.2;
regen BUILDING from doc/BUILDING.mdoc


# 1.108 03-Aug-2014 apb

BUILDINFO part6: regen BUILDING from doc/BUILDING.mdoc


# 1.107 14-Jun-2014 apb

Regen from doc/BUILDING.mdoc;1.100:
Improve documentation for BUILDID.


# 1.106 21-May-2014 wiz

regen


# 1.105 29-May-2013 wiz

branches: 1.105.4;
regen using 'make regen' from src/doc.


# 1.104 29-May-2013 wiz

regen (using mandoc doc/BUILDING.mdoc > BUILDING -- let me know
if a different way is preferred, I see that it now contains formatting).


# 1.103 08-Nov-2012 dholland

regen


# 1.102 19-Sep-2012 abs

regen


# 1.101 25-May-2012 wiz

branches: 1.101.2;
regen using 'make regen' in doc/


# 1.100 25-May-2012 wiz

Document MKREPRO using joerg's wording.


# 1.99 23-Feb-2012 tsutsui

Add a missing period.


# 1.98 14-Feb-2012 apb

branches: 1.98.2;
Regen from revision 1.87 of doc/BUILDING.mdoc.


# 1.97 21-Jan-2012 tsutsui

Add "live-image" and "install-image" target support to build.sh.

"live-image" target builds pre-installed disk images that can be used on
emulators or boot from USB memory sticks to try NetBSD without installation.
Currently amd64, i386, pmax, sparc, sparc64, sun2, sun3, and vax
(which have working emulators and don't require extra tools like preparing
msdosfs or partitioning MD label structures) support this target.

"install-image" target builds an bootable installation disk image that can
be used as an install CD but burned into USB memory sticks etc.
Current only amd64 and i386 (which would support USB boot) have this target.

For more details (and known issue) see following posts on netbsd-bugs@:
http://mail-index.NetBSD.org/netbsd-bugs/2011/08/06/msg023639.html
http://mail-index.NetBSD.org/netbsd-bugs/2011/09/23/msg024207.html
http://mail-index.NetBSD.org/netbsd-bugs/2011/12/07/msg025166.html
http://mail-index.NetBSD.org/netbsd-bugs/2011/12/08/msg025178.html

No particular comments about implementation, and
"go ahead" comments from mrg@, riz@ and christos@.

Closes PR toolchain/45153 and PR misc/45155.


# 1.96 09-Sep-2011 apb

branches: 1.96.2;
Add tests for the shell under which build.sh is run. If the
shell fails the tests, then build.sh tries to re-exec itself
under a more suitable shell.


# 1.95 09-Sep-2011 apb

Revisions 1.92 and 1.93 of src/BUILDING were not reflected in
src/doc/BUILDING.mdoc, so those changes were lost when src/BUILDING
was regenerated in revision 1.94.

Now update src/doc/BUILDING.mdoc and regenerate src/BUILDING to
reinstate the lost changes. (I also edited one of the changes, to use
the phrase "space-separated list" for consistency with other parts of
the document.)

The original changes were:


# 1.93 06-Aug-2011 jnemeth

Add description of MKKMOD, part of PR misc/45216


# 1.92 29-Jan-2011 jym

Pass down INSTALLSETS variable to installsets target. Use :Q to escape
shell meta-characters, as the variable contains a list of sets, separated
by spaces.

$ ./build.sh -V INSTALLSETS="base etc" install=idir

should now work as expected.

Reviewed by apb@ on tech-toolchain.


# 1.94 09-Sep-2011 apb

Allow MAKEFLAGS to be set via build.sh -V. Somebody asked for this
in 2008.

Also add comments above a few functions in build.sh, and bump copyright
dates.


# 1.93 06-Aug-2011 jnemeth

Add description of MKKMOD, part of PR misc/45216


# 1.92 29-Jan-2011 jym

Pass down INSTALLSETS variable to installsets target. Use :Q to escape
shell meta-characters, as the variable contains a list of sets, separated
by spaces.

$ ./build.sh -V INSTALLSETS="base etc" install=idir

should now work as expected.

Reviewed by apb@ on tech-toolchain.


# 1.91 25-Jul-2010 mrg

branches: 1.91.2;
remove the MKSUBPIXEL/MKTTINTERP options; they're going away.

regenerate.


# 1.90 30-Nov-2009 uebayasi

Support "extsrc", externally added programs and libraries. Users can write
their own reach-overs, cross-build, install, and get set files just like base
and X11 / X.org. (These sets are not included as TNF releases.)


# 1.89 10-Oct-2009 apb

If ${NETBDSRCDIR}/../xsrc exists, then use it as the default value
of X11SRCDIR. If it doesn't exist, then use /usr/xsrc as before.

OK mrg


# 1.88 27-Sep-2009 apb

* Use a more robust method of creating the top level object directory.
Use getmakevar to expand MAKEOBJDIRPREFIX or MAKEOBJDIR, or (if
neither of those variables is set) use a non-recursive "make obj" in
the top level source directory.

* Do not let TOP_objdir default to ${TOP}. It's now set only by the
-M or -O command line options, or after using getmakevar to expand
MAKEOBJDIRPREFIX or MAKEOBJDIR.

* Make try_set_TOOLDIR handle MAKEOBJDIRPERFIX passed from the
environment. It runs too early to use getmakevar, so it will not work
if the value contains embedded '${...}' variable references.

* Use '$TOOLDIR' (with a literal '$') instead of 'nonexistent' in
a message when rebuilding make when TOOLDIR is not yet known.


# 1.87 27-Sep-2009 apb

Allow build.sh "-C cdextra" option to be specified multiple times.


# 1.86 06-Sep-2009 jnemeth

Add a modules operation to build.sh, which builds and installs kernel modules
into DESTDIR.

This is based on the patch provided by tsutsui@ on tech-toolchain@.


# 1.85 12-Jul-2009 hubertf

regen


# 1.84 12-Jul-2009 hubertf

regen


# 1.83 01-May-2009 snj

Introduce MKSUBPIXEL, which allows enabling subpixel rendering code
in FreeType.


# 1.82 02-Dec-2008 mrg

branches: 1.82.2;
be explicit about MAKEOBJDIR and MAKEOBJDIRPREFIX not being for
mk.conf or ${MAKECONF}.


# 1.81 15-Nov-2008 mrg

revert sparc back to default of XFree86 at the request of macallan.


# 1.80 13-Nov-2008 apb

Add support for new MAKEVERBOSE levels 3 and 4. The complete list is now:

0 Minimal output ("quiet")
1 Describe what is occurring
2 Describe what is occurring and echo the actual command
3 Ignore the effect of the "@" prefix in make commands
4 Trace shell commands using the shell's -x flag

The default remains MAKEVERBOSE=2.


# 1.79 09-Nov-2008 mrg

- retire MKXORG from public use
- introduce X11FLAVOUR to choose src/x11 vs src/external/mit/xorg
for the X11 to build if MKX11=yes is set. it takes the values
of either Xorg or XFree86.
- default to Xorg on alpha, i386, macppc, shark, sparc and sparc64
- remove MKXORG_WITH_XSRC_XSERVER, unused and never useful


# 1.78 24-Sep-2008 apb

branches: 1.78.2;
regen for recent change to examples and objdir advice,
and for the older MKSTRIPIDENT change.


# 1.77 06-Sep-2008 lukem

regen for MKHTML


# 1.76 28-Aug-2008 lukem

Improve support for MKXORG!=no to enable builds into external/mit/xorg.
This will be mutually exclusive to MKX11!=no.


# 1.75 17-Aug-2008 lukem

Document "build.sh cleandir".
Fix formatting nit.
Remove BUGS; all the in-tree platforms are using build.sh now.


# 1.74 11-Aug-2008 apb

* Suggest a "-j" value between 1+NCPU and 2*NCPU for the fastest builds.
* Remove some duplicated content that appeared in both the section about
make's -j flag and the section about build.sh's -j flag.


# 1.73 05-Aug-2008 apb

* Add more detail for build.sh -M and -O options.
* Mention new default when source is /usr/src but build.sh is run
with neither -M nor -O.


# 1.72 05-Aug-2008 perry

Builds now use "BUILDSEED" so that c++ binaries are reproduceable.
By default BUILDSEED is set to NetBSD-{majorversion} -- a -S flag may
be used to change it.

Discussed on tech-toolchain.


# 1.71 28-Mar-2008 dholland

branches: 1.71.4;
Correct/clarify the default setting of USETOOLS in the previous version.
Noted by apb.


# 1.70 27-Mar-2008 dholland

Assorted updates and clarifications, grammar fixes and wording improvements,
and so on. Significant highlights:
- mention src/tests and reference atf;
- provide examples of MACHINE and MACHINE_ARCH;
- mention that MKOBJ=no is not recommended;
- correct the description of the default setting of USETOOLS;
- document the interactions of build.sh -[uo] with various things;
- document the interactions of build.sh tools and kernel=FOO;
- use a lot fewer parentheses.
Discussed on netbsd-docs.


# 1.69 17-Mar-2008 lukem

Consistently document RELEASEDIR/RELEASEMACHINEDIR.


# 1.68 08-Mar-2008 reed

Mention that "build" and "distribution" do not build nor install (to DESTDIR)
a kernel.


# 1.67 23-Nov-2007 sborrill

branches: 1.67.4;
Add support for CDBUILDEXTRA which acts like CDEXTRA to add extra items
to the CD-ROM image.
Make CDEXTRA and CDBUILDEXTRA be able to contain lists of files and directories
which are added in turn.
Add support for CDEXTRA_SKIP which contains a list of fnmatch(3) items to
skip during the copy. This is _very_ useful for skipping CVS dirs for example.
CDBUILDEXTRA and CDEXTRA_SKIP are to be used in Makefiles creating the images,
CDEXTRA remains to be used from build.sh.
Update documentation and build.sh help text to show that -C can be used to
specify a list of files and directories rather than just a single dir.


# 1.66 01-Sep-2007 jnemeth

Convert build.sh iso-dir=directory option to -C cddir as per jmmv@ on
source-changes.


# 1.65 01-Sep-2007 jnemeth

Add an iso-dir=directory option. When combined with iso-image or
iso-image-source, it will cause directory to be added to the CD-ROM image.


# 1.64 30-Aug-2007 jnemeth

describe new iso-image-source target


# 1.63 29-Aug-2007 ad

Remove STATUS paragraph which makes it sound like the build system is
half baked.


# 1.62 13-Apr-2007 apb

branches: 1.62.4;
Document recent changes to "make iso-image".


# 1.61 26-Mar-2007 apb

Document the fact that "make installworld" and "build.sh
installworld=..." do not install the etc or xetc sets. Suggest using
etcupdate(8) and postinstall(8) after installworld.


# 1.60 27-Jan-2007 apb

Try to clarify the description of build.sh -m mach.
Document new evbarm-eb and evbarm-el aliases.


# 1.59 08-Oct-2006 apb

branches: 1.59.2;
Clarify that DESTDIR/OBJDIR/etc are absolute paths, but build.sh
-D/-O/etc allows relative paths.

Closes PR 32345 by Andre Luiz de Oliveira.


# 1.58 29-Sep-2006 apb

Use ${HOST_SH} instead of the host system's /bin/sh wherever possible:

* Describe the HOST_SH variable, and the way build.sh attempts to set it.

* Suggest passing HOST_SH in the environment if /bin/sh is not a working
shell.


# 1.57 29-Jan-2006 apb

mkisofs is in pkgsrc/sysutils/cdrtools now, not pkgsrc/sysutils/cdrecord.
Reported by Jukka Salmi.


# 1.56 28-Jan-2006 apb

* Add an "iso-image" target in the top level Makefile,
which invokes make iso-image in the etc directory.
* Add an "iso-image" action in build.sh, which
invokes make iso-image.
* Document the above in doc/BUILDING.mdoc.
* Re-generate BUILDING.

Approved by christos


# 1.55 12-Jan-2006 wiz

Bump date for syspkgs.


# 1.54 04-Jan-2006 apb

Document "make syspkgs" and "build.sh syspkgs".

Reviewed by agc


# 1.53 15-Feb-2005 reed

Document the environment variables for if you need to override or
manually select your compilers.
(And regen BUILDING from doc/BUILDING.mdoc.)


# 1.52 11-Oct-2004 jmc

Fix some typo's/bad wording as highlighted in PR#27219


# 1.51 25-Jun-2004 wiz

regen (Document -h. From Karsten Kruse in PR 25974.
While here, remove a duplicate sentence).


# 1.50 19-Mar-2004 wiz

Document MKTTINTERP.


# 1.49 06-Feb-2004 lukem

* Document build.sh -X and -x
* Document MKX11 and X11SRCDIR
* Remove note warning against cross-building from systems other than NetBSD;
it works on many other platforms.


# 1.48 29-Dec-2003 jmc

Note tools/compat/README as the place to get notes from non-native cross builds


# 1.47 19-Dec-2003 zuntum

Change -v to -V in the following section:

"Print make(1)'s idea of the value of var. Does not build any targets."

To reflect reality.

Found by Tomasz Marciniak <Tomasz.Marciniak@felix.fizyka.amu.edu.pl>, thanks!


# 1.46 25-Oct-2003 lukem

Improve how build.sh -N and MAKEVERBOSE interoperate;
rather than adding '-s' to make's command line in the makewrapper,
use the .SILENT target based on MAKEVERBOSE's value.

This means that you can do:
./build.sh -N 1 makewrapper

$TOOLDIR/bin/nbmake-$MACHINE
# runs at MAKEVERBOSE==1, with command lines suppressed

$TOOLDIR/bin/nbmake-$MACHINE MAKEVERBOSE=2
# runs at MAKEVERBOSE==2 for this invocation, with command lines shown


# 1.45 24-Oct-2003 lukem

Implement build -N noisy, which sets MAKEVERBOSE to noisy and adds
`-s' to MAKEFLAGS for noisy < 2.


# 1.44 29-Sep-2003 lukem

regenerate for "%" prompt update


# 1.43 19-Aug-2003 martti

Backout the previous commit


# 1.42 19-Aug-2003 martti

Remove # from the example.


# 1.41 07-Aug-2003 lukem

fix description of MAKEOBJDIR. from Martin Husemann


# 1.40 29-Jul-2003 lukem

Add build.sh -Z var, to unset a variable and ensure it's unset in makewrapper.
For -M MAKEOBJDIRPREFIX, unset MAKEOBJDIR.
For -O MAKEOBJDIR, unset MAKEOBJDIRPREFIX.


# 1.39 17-Jul-2003 lukem

fix default location of TOOLDIR


# 1.38 18-Jul-2003 lukem

Update for the MKUNPRIVED/MKUPDATE changes.


# 1.37 17-Jul-2003 lukem

rebuild with new groff


# 1.36 02-Jul-2003 lukem

attempt to clarify how MAKEOBJDIR{,PREFIX} may be provided ...
(this document needs a rototill, which i may get to whilst writing a
paper about build.sh)


# 1.35 25-May-2003 lukem

all:
* add "releasekernel=conf", to install a gzipped copy of the kernels
built by "kernel=conf" to RELEASEDIR/MACHINE/binary/kernel

build.sh:
* be more consistent in various status messages
* move the {release,}kernel=conf conf parsing code into getkernelconf()
and use in both buildkernel() and releasekernel()
* only warn once when building multiple kernels without updating the tools


# 1.34 18-May-2003 lukem

For normal builds, MKOBJDIRS default to `no' (not `yes').
It's only build.sh that sets this to `yes' by default.
Noted by OGAWA Takaya in [toolchain/19823]


# 1.33 17-May-2003 lukem

improve description of how "build.sh -m mach" sets the default
MACHINE_ARCH, and list the special cases that this does not occur for.


# 1.32 10-May-2003 lukem

crank date for previous


# 1.31 10-May-2003 lukem

Add "sourcesets" argument/target, which builds source sets into
RELEASEDIR/source/sets


# 1.30 08-May-2003 lukem

build.sh now provides defaults for DESTDIR and RELEASEDIR if not expert mode.
Remove -D and -R from EXAMPLES since they're not necessary any more.


# 1.29 08-Feb-2003 lukem

Fix example 3; the build.sh target is "install" not "installworld".
Improve description.
Noted by Valeriy Ushakov (uwe@) in private email.


# 1.28 02-Feb-2003 lukem

attempt to further improve and clarify the examples...


# 1.27 29-Jan-2003 lukem

Prefix various paths with 'DESTDIR', to highlight that the DESTDIR
is taken into account.


# 1.26 29-Jan-2003 lukem

allow toolprefix to be easily changed


# 1.25 26-Jan-2003 lukem

Various improvements per discussion with Alan Barrett.


# 1.24 25-Jan-2003 lukem

- Add "sets" top-level Makefile target and build.sh operation.
[Latter suggested by Julio Merino in private email]
- Add "help" build.sh operation.


# 1.23 25-Jan-2003 lukem

Change build.sh so that at least one operation is required.
Add "makewrapper" operation to build.sh.
[The above changes were suggested by Alan Barrett on current-users@]

Fail if building as non-root unless: UNPRIVED is set, -U is given, or -E
(expert mode) is given.
[Suggested by James Wetterau in private email]

Improve the examples in BUILDING.


# 1.22 23-Jan-2003 lukem

Rework how build.sh functions, so that command line options set various
parameters, and a list of "operations" defines what to do.
The full usage is show below. Notes:
`-b' has been deprecated (it always occurs now)
`-d' is replaced by "distribution"
`-R rel' onlys sets RELEASEDIR; use "release" to build a release
`-k kern' has been replaced by "kernel=kern"
`-i idir' has been replaced by "install=idir"
-r now occurs before nbmake is rebuilt

Add a copyright (long due!). Rework the code to (a KNF inspired) ShellNF.
Use functions appropriately. Allow `nb' prefix to be easily changed to
something else. Solve world peace (just kidding)

This is part of the (never achievable) goal of attempting to make
NetBSD easier to build...


--8<-- new usage follows --8<--

Usage: build.sh [-EnorUu] [-a arch] [-B buildid] [-D dest] [-j njob] [-M obj]
[-m mach] [-O obj] [-R release] [-T tools] [-V var=[value]]
[-w wrapper] [operation [...] ]

System build operations (all imply "obj" and "tools"):
build Run "make build"
distribution Run "make distribution" (includes etc/ files)
release Run "make release" (includes kernels & distrib media)

Other operations:
obj Run "make obj" (default unless -o)
tools Build and install tools
kernel=conf Build kernel with config file `conf'
install=idir Run "make installworld" to `idir'
(useful after 'distribution' or 'release')

Options:
-a arch Set MACHINE_ARCH to arch (otherwise deduced from MACHINE)
-B buildId Set BUILDID to buildId
-D dest Set DESTDIR to dest
-E Set "expert" mode; disables some DESTDIR checks
-j njob Run up to njob jobs in parallel; see make(1)
-M obj Set obj root directory to obj (sets MAKEOBJDIRPREFIX)
-m mach Set MACHINE to mach (not required if NetBSD native)
-n Show commands that would be executed, but do not execute them
-O obj Set obj root directory to obj (sets a MAKEOBJDIR pattern)
-o Set MKOBJDIRS=no (do not create objdirs at start of build)
-R release Set RELEASEDIR to release
-r Remove contents of TOOLDIR and DESTDIR before building
-T tools Set TOOLDIR to tools. If unset, and TOOLDIR is not set in
the environment, nbmake will be (re)built unconditionally.
-U Set UNPRIVED
-u Set UPDATE
-V v=[val] Set variable `v' to `val'
-w wrapper Create nbmake script as wrapper
(default: ${TOOLDIR}/bin/nbmake-${MACHINE})


# 1.21 04-Jan-2003 lukem

Add "-V var=[value]", for setting arbitrary variables which will also
be added to the nbmake-${MACHINE} wrapper.
Useful for setting RELEASEDIR, without -R's habit of building a release.


# 1.20 24-Dec-2002 lukem

Document:
* build.sh -i idir
* top level targets: distribution, buildworld, installworld
* top level variables: INSTALLWORLDDIR


# 1.19 08-Dec-2002 lukem

Add -E - "expert mode". If this is not specified, builds to DESTDIR=/ are
not permitted.
By using this flag, you are taking responsibility for any issues that
may occur because of this...


# 1.18 08-Dec-2002 lukem

- be consistent about option ordering in build.sh usage display
- use Fl and Ar instead of Sy and Em to format options


# 1.17 25-Nov-2002 wiz

Update location of BUILDING.mdoc.


# 1.16 20-Oct-2002 lukem

regen for build.sh -k


# 1.15 20-Sep-2002 lukem

regen for: USE_NEW_TOOLCHAIN was replaced with TOOLCHAIN_MISSING


# 1.14 16-Sep-2002 fredb

Expand on the difference between ``build.sh -d'' and ``make install'',
as requested by Brian Stark in PR toolchain/18228 (which this closes).


# 1.13 22-Jul-2002 wiz

Remove duplicate 'files'. From Ryo HAYASAKA in toolchain/17674.


# 1.12 12-May-2002 lukem

branches: 1.12.2;
add "-M makeobjdirprefix" to build.sh


# 1.11 03-May-2002 lukem

Move the METALOG from ${_SRC_TOP_OBJ_} to ${DESTDIR}.

There were too many synchronisation problems with using the former;
including situations such as a "make clean" performed between two
installs to the same DESTDIR would result in a truncated METALOG and
the resultant sets would be missing stuff such as include files that
don't get reinstalled if they haven't changed, even with !UPDATE.


# 1.10 02-May-2002 sommerfeld

Re-gen.


# 1.9 14-Mar-2002 thorpej

Add a -B option to set the BUILDID for the build. This also causes
the make(1) wrapper script to be named "nbmake-MACHINE-BUILDID".


# 1.8 04-Mar-2002 lukem

document various supported environment variables, including MAKEOBJDIRPREFIX


# 1.7 03-Mar-2002 lukem

document:
- make's UNPRIVED support
- build.sh's -U support
- the build system currently needs to build onto a file system with
long file name and hard link support


# 1.6 25-Nov-2001 thorpej

Document the -d option to build.sh


# 1.5 15-Nov-2001 tv

Note only <bsd.own.mk> as the authority for determining whether the new
BUILDING instructions should be used.


# 1.4 14-Nov-2001 tv

Turn off host-specific objdirs by default. Set MKHOSTOBJ=yes to enable.


# 1.3 12-Nov-2001 tv

Major overhaul of src/tools and host toolchain. Summary of changes:

* Rewrite src/tools Make logic to work like the rest of the tree wrt
"dependall" and "install". The old "make build" hack is gone.

* Remove the MKTOOLS logic. This was linked to the "make build" hack,
and was only needed because TOOLDIR originally had no writable default.

* Redo the GNU configure/make logic to make it fit reasonably in a
BSD make wrapper. Use new ${.ALLTARGETS} variable to scan for
targets in $(srcdir), and mark them with .MADE: to prevent rebuilding.

* Only build cross tools in src/tools; remove some messy logic in
src/usr.* and src/gnu/usr.* that would do target filename rewriting
(improves consistency and readability).

* Add the ability to build cross gdb at tool build time by setting
MKCROSSGDB (default no) to "yes" in mk.conf.

* Add src/tools/groff and set up paths to work with this cross groff.


# 1.2 08-Nov-2001 wiz

Remove mention of BUILDLING.html, and follow rename of BUILDING.txt to
BUILDING.
Noted by Love <lha@stacken.kth.se> on tech-toolchain.


# 1.1 01-Nov-2001 tv

By popular demand, one preformatted version of BUILDING, plaintext, no CRs.


# 1.12.2.2 23-Dec-2003 jmc

Pullup via hand patch (requested by zuntum in ticket #1582)
Change -v to -V in the following section:
Print make(1)'s idea of the value of var. Does not build any targets.

To reflect reality.


# 1.12.2.1 18-Dec-2003 tron

Regen.


# 1.59.2.3 29-Sep-2007 xtraeme

Pull up following revision(s) (requested by jnemeth in ticket #864):
distrib/common/Makefile.bootcd: revision 1.9
distrib/common/Makefile.bootcd: revision 1.10
distrib/common/Makefile.bootcd: revision 1.11
doc/BUILDING.mdoc: revision 1.51
doc/BUILDING.mdoc: revision 1.52
doc/BUILDING.mdoc: revision 1.53
build.sh: revision 1.172
build.sh: revision 1.173
build.sh: revision 1.174
build.sh: revision 1.175
BUILDING: revision 1.64
BUILDING: revision 1.65
BUILDING: revision 1.66
share/man/man7/release.7: revision 1.23
share/man/man7/release.7: revision 1.24
Makefile: revision 1.248

Add an iso-dir=directory option. When combined with iso-image or
iso-image-source, it will cause directory to be added to the CD-ROM image.

Convert build.sh iso-dir=directory option to -C cddir as per jmmv@ on
source-changes.


# 1.59.2.2 16-Apr-2007 bouyer

branches: 1.59.2.2.2;
Pull up following revision(s) (requested by apb in ticket #573):
share/man/man8/sysinst.8: revision 1.1
distrib/sets/lists/man/mi: revision 1.987
share/man/man8/Makefile: revision 1.89
BUILDING: revision 1.62
share/man/man7/release.7: revision 1.22
doc/BUILDING.mdoc: revision 1.49
Improve documentation for "make iso-image" and release(7),
and add a rudimentary man page for sysinst(8).


# 1.59.2.1 16-Apr-2007 bouyer

Pull up following revision(s) (requested by apb in ticket #572):
BUILDING: revision 1.61
doc/BUILDING.mdoc: revision 1.48
Improve documentation for "make installworld".


# 1.59.2.2.2.1 30-Sep-2007 wrstuden

Catch up w/ last night's netbsd-4


# 1.62.4.3 22-Mar-2008 matt

sync with HEAD


# 1.62.4.2 08-Jan-2008 matt

sync with HEAD


# 1.62.4.1 06-Nov-2007 matt

sync with HEAD


# 1.67.4.1 24-Mar-2008 keiichi

sync with head.


# 1.71.4.1 17-Sep-2008 wrstuden

Sync with wrstuden-revivesa-base-2.


# 1.78.2.4 07-Mar-2011 riz

Pull up following revision(s) (requested by jym in ticket #1565):
Makefile: revision 1.282 via patch
BUILDING: revision 1.92 via patch
Pass down INSTALLSETS variable to installsets target. Use :Q to escape
shell meta-characters, as the variable contains a list of sets, separated
by spaces.
$ ./build.sh -V INSTALLSETS="base etc" install=idir
should now work as expected.
Reviewed by apb@ on tech-toolchain.


# 1.78.2.3 11-May-2009 bouyer

Pull up following revision(s) (requested by snj in ticket #742):
doc/BUILDING.mdoc: revision 1.72
external/mit/xorg/lib/freetype/Makefile: revision 1.5
BUILDING: revision 1.83
Introduce MKSUBPIXEL, which allows enabling subpixel rendering code
in FreeType.


# 1.78.2.2 15-Nov-2008 snj

branches: 1.78.2.2.4;
Pull up following revision(s) (requested by mrg in ticket #64):
share/man/man5/mk.conf.5: revision 1.46
share/mk/bsd.own.mk: revision 1.550
doc/BUILDING.mdoc: revision 1.70
BUILDING: revision 1.81
share/mk/bsd.README: revision 1.242
revert sparc back to default of XFree86 at the request of macallan.


# 1.78.2.1 15-Nov-2008 snj

Pull up following revision(s) (requested by mrg in ticket #64):
distrib/sets/Makefile: revision 1.64
external/mit/xorg/server/Makefile: revision 1.5
share/mk/bsd.README: revision 1.237
BUILDING: revision 1.79
share/mk/bsd.x11.mk: revision 1.71
share/mk/bsd.own.mk: revision 1.544
usr.bin/ssh/Makefile.inc: revision 1.18
distrib/sets/sets.subr: revision 1.72
share/man/man5/mk.conf.5: revision 1.42
doc/BUILDING.mdoc: revision 1.68
etc/Makefile: revision 1.360
Makefile: revision 1.263
- retire MKXORG from public use
- introduce X11FLAVOUR to choose src/x11 vs src/external/mit/xorg
for the X11 to build if MKX11=yes is set. it takes the values
of either Xorg or XFree86.
- default to Xorg on alpha, i386, macppc, shark, sparc and sparc64
- remove MKXORG_WITH_XSRC_XSERVER, unused and never useful


# 1.78.2.2.4.1 20-Apr-2010 matt

sync to netbsd-5


# 1.82.2.1 13-May-2009 jym

Sync with HEAD.

Third (and last) commit. See http://mail-index.netbsd.org/source-changes/2009/05/13/msg221222.html


# 1.91.2.1 08-Feb-2011 bouyer

Sync with HEAD


# 1.96.2.4 22-May-2014 yamt

sync with head.

for a reference, the tree before this commit was tagged
as yamt-pagecache-tag8.

this commit was splitted into small chunks to avoid
a limitation of cvs. ("Protocol error: too many arguments")


# 1.96.2.3 15-Jan-2013 yamt

sync with (a bit old) head


# 1.96.2.2 30-Oct-2012 yamt

sync with head


# 1.96.2.1 16-Apr-2012 yamt

sync with head


# 1.98.2.1 02-Mar-2012 riz

Pull up following revision(s) (requested by tsutsui in ticket #68):
doc/BUILDING.mdoc: revision 1.88
BUILDING: revision 1.99
build.sh: revision 1.254
Add a missing period.
Add sanity checks for live-image and install-image targets
(which require mtree spec files built with MKUNPRIVED=yes)
to avoid unexpected makefs(8) error during image builds:
- if release op is specified with live-image or install-image
at the same time, make sure -U is also specified for the image builds
- before perform live-image and install-image ops check METALOG file
in DESTDIR to see if the build have been performed with MKUNPRIVED
XXX: Probably toolchain should create consistent spec files in
XXX: DESTDIR/etc/mtree dir regardless of MKUNPRIVED settings.


# 1.101.2.3 19-Aug-2014 tls

Rebase to HEAD as of a few days ago.


# 1.101.2.2 23-Jun-2013 tls

resync from head


# 1.101.2.1 19-Nov-2012 tls

Resync to 2012-11-19 00:00:00 UTC


# 1.105.4.1 10-Aug-2014 tls

Rebase.


# 1.109.2.1 14-Nov-2014 martin

Pull up following revision(s) (requested by snj in ticket #227):
Makefile: revision 1.311
build.sh: revision 1.299
doc/BUILDING.mdoc: revision 1.105
distrib/notes/macppc/prep.OPENFIRMWARE: revision 1.16
distrib/notes/macppc/prep.OPENFIRMWARE: revision 1.17
BUILDING: revision 1.110
distrib/notes/arc/prep: revision 1.3
distrib/notes/arc/prep: revision 1.4
distrib/notes/cats/prep: revision 1.12
distrib/notes/cats/prep: revision 1.13
distrib/notes/sparc/install: revision 1.58
distrib/notes/common/main: revision 1.512
share/man/man8/man8.macppc/ofwboot.8: revision 1.13
Update path to release ISOs.