Commit Graph

361 Commits

Author SHA1 Message Date
apb f7004b0cbc Whenever we try to parse the output from make, run make with the -B
flag.  This ensures that -j<N> isn't accidentally inherited from the
environment, because the "--- foo ---" headers printed with -j<N> would
interfere with parsing the output.
2007-02-05 18:26:01 +00:00
matt 4e9d3760b0 Remove duplicate evbarm-e[bl] cases. Add evbppc64 and macppc64. 2007-01-29 00:08:13 +00:00
matt d9adacfe08 Add evbarm-e[bl] machine aliases for evbarm/armeb and evbarm/arm,
respectively.
2007-01-28 20:15:44 +00:00
apb 90b76996ba Add aliases evbarm-eb and evbarm-el, for consistency with several
existing *-e[bl] aliases.  build.sh -m MACHINE_ALIAS is (almost)
equivalent to build.sh -m MACHINE -a MACHINE_ARCH.
2007-01-27 11:27:33 +00:00
rillig ddda16fb21 Added a friendly error message in case the user forgot to "build.sh tools". 2007-01-17 03:43:18 +00:00
dsl 6875838454 Only cd "$(dirname $0)" when usr.bin/make doesn't exist. This caused grief
when I make my wrapper script source build.sh.  I can also think of other
times when it would be a PITA.
Abort the build if make fails in raw_getmakevar() - as tends to happen when
make itself is badly broken.
2007-01-14 17:02:56 +00:00
ober 02f3407a26 Updated to include the new Zaurus port for ARM.
OK'd by gimpy
2006-12-16 02:59:33 +00:00
dyoung f3fbc3bb0f Change the name of the host disklabel to nbdisklabel-${MAKEWRAPPERMACHINE},
where ${MAKEWRAPPERMACHINE} is the suffix XXX on the target's make
wrapper, nbmake-XXX.

Fixes toolchain/30673, "single arch host disklabel isn't enough".
2006-12-09 20:13:13 +00:00
apb 1889c0e175 Use ${HOST_SH} instead of the host system's /bin/sh wherever possible:
* Try to guess a suitable value for HOST_SH, if it was not set in
  the environment.  First try host-specific heuristics (Solaris has
  /usr/xpg4/bin/sh); then try to find the name of the shell that was used
  to run build.sh itself (by parsing the output from ps -p $$ -o comm);
  then fall back to "sh".

* Having found a value for HOST_SH, copy it to BSHELL and CONFIG_SHELL.

* Use ${HOST_SH} instead of /bin/sh when creating the make wrapper.

* Use ${HOST_SH} instead of unqualified sh when running shell scripts.
2006-09-29 19:53:54 +00:00
uwe 2e25d643b7 Recognize MACHINE=landisk (sh3el). 2006-09-01 21:52:55 +00:00
matt da01e9eb57 When going from -m {evb,sb}mips64-e[bl] to MACHINE,
make sure to remove 64-e[bl] so we wind up with just evbmips or sbmips.
2006-08-27 05:05:05 +00:00
matt 9e051a8002 Add enough configury glue so that src/tools can build a N64 mips toolchain. 2006-08-25 23:35:04 +00:00
jnemeth 252669904e PR/30842 -- compatibility issue with mksh from Thorsten Glaser 2006-08-09 22:13:12 +00:00
mrg d4ce694d06 preliminary support for powerpc64 toolchain:
- allow "-m macppc/evbppc" to also take "-a powerpc64" to build a
  powerpc64 toolchain.

XXX this may change, as an evbppc64 port may be required.
XXX deal with that when we have some code...
2006-06-22 20:00:18 +00:00
dogcow f76552d855 Huzzah. /bin/pwd -P, instead of silently failing, now returns an error code
on many linuces I've tried. If so, bail and invoke /bin/pwd sans argument.
2006-06-19 18:12:30 +00:00
apb fd0db8a416 Fix the iso-image action. These changes were accidentally omitted
from the previous commit.
2006-02-03 12:29:41 +00:00
apb 21078fc390 * 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
2006-01-28 21:34:07 +00:00
dsl 93ab8a734f Use separate invocations of make for cleandir dependall and install of
tools so that a parallel make doesn't start running dependall before
cleandir has finished.
Unfortunately make doesn't support .WAIT on the command line :-(
2006-01-08 11:03:40 +00:00
dsl 20683c5a8c Use parallel makes more often. 2006-01-07 18:45:15 +00:00
apb 026a2bfc50 Add a new "syspkgs" target, which simply chains to the "syspkgs" target
in the top level Makefile.

Reviewed by agc
2006-01-04 15:31:40 +00:00
tsutsui 32af391479 Add ews4800mips to mipseb ports.
Build for ews4800mips might fail (yet),
but please don't complain for now.
2005-12-29 15:38:54 +00:00
jmc ad14f15c1d Nuke LESSCHARSET as well since it affects the output character set of groff 2005-12-12 04:51:55 +00:00
isaki 9265690c77 It needs the braceexpand option for PD KSH, regardless of
whether the host system is OpenBSD.
from Wim Lewis. reviewed by sjg@.
2005-09-25 05:34:21 +00:00
skrll 784c9344e8 Initial pass at an in-tree ia64 toolchain. From PR 29141 with some fixes
from me.
2005-08-17 07:13:32 +00:00
bouyer 44d1677f84 Remove support for build.sh -m xen, this has been merged in the i386
build. Pointed out by Chuck Silvers.
2005-05-29 10:54:40 +00:00
lukem 6ec400133b Unset INFODIR in the makewrapper.
Should fix a build problem observed when installing .info files
when the build user's environment has INFODIR set.
2005-05-19 01:37:30 +00:00
isaki 5067941219 Avoid the brace expansion on OpenBSD.
approved by sjg@.
2005-03-26 06:02:13 +00:00
gavan 0560d8b947 Initial import of iyonix port.
The Iyonix is a desktop machine from Castle Technology, based on a 600MHz
XScale[tm] 80321 processor.

* Uses the bootloader from NetBSD/acorn32, which is now 32-bit compatible.
* Currently boots multiuser with a serial console.
* Device support is not yet complete.

With help from abs.
2004-10-13 23:28:34 +00:00
martin 17cfe6c93e Backout previous on request from mrg - it breaks cross compilation for
sparc64. Matt will recommit a fixed version later.
2004-10-11 06:18:38 +00:00
mrg 57d6df6697 add new ${uname_p} (as `uname -p`).
set ${arches} to "sparc64 sparc" for MACHINE=sparc64.
for 32 bit sparc64 host, default to building 32 bit world (same as native).
2004-10-09 20:38:01 +00:00
junyoung 0220a8417b Remove trailing / in pathname.
From Alan Barrett. See tech-toolchain@ for related discussion.
2004-08-17 14:00:30 +00:00
jmc bd789f7eba Add a change requested in PR#15548 and append the args passed to build.sh
into the comments in the make wrapper.
2004-07-02 04:25:24 +00:00
wiz 40726f5f0d Document -h. From Karsten Kruse in PR 25974. 2004-06-25 15:03:39 +00:00
cl 885c0b6fc9 ``build.sh -m xen-i386 release'' now builds a release for NetBSD/xen
for i386.  The resulting release consists of:
- NetBSD/xen for i386 kernel, loader and docuemntation
- NetBSD/i386 userland sets
2004-05-12 16:56:41 +00:00
lukem d0ca5ded84 Add
-x		set MKX11=yes
	-X x11src	set X11SRCDIR to x11src
2004-02-06 23:19:30 +00:00
lukem c77dab9416 highlight that the noisyless level is the MAKEVERBOSE level 2004-02-04 11:23:40 +00:00
lukem 1710dac7b6 tweak usage message.
when performing "sets", highlight that DESTDIR should be
pre-populated.  suggested by glen mccready.
2003-11-14 12:38:12 +00:00
lukem b60bb5a7dd Now that MKUPDATE and MKUNPRIVED are "normalized" with getmakevar(),
test with  "${MKxxx}" = "no"  instead of  -z "${MKxxx}"

Ignore errors when running pwd -P.  (GNU coreutils incorrectly complains)


Both problems pointed out in private email from Christian Limpach.
2003-11-12 15:51:45 +00:00
lukem f87ba55ff9 Always use `/bin/pwd -P` to get the "TOP" of the source tree, so that
MAKEOBJDIR (and other parameters) work correctly with symlinks, amd(8), etc.
Should fix PR [bin/23313], and possibly others.
2003-10-31 01:46:39 +00:00
lukem 301dd07e78 Explain why make is being rebuilt.
Patch from Hubert Feyrer in [toolchain/23156].
2003-10-26 03:12:21 +00:00
lukem 5daa33014e 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
2003-10-26 02:17:46 +00:00
lukem 371e58334b "Normalise" MKOBJDIRS MKUPDATE MKUNPRIVED with getmakevar() before
trying to use them internally to build.sh.
Fixes issue where build.sh would run "make cleandir" if MKUPDATE=yes was
set in mk.conf and -u wasn't given to build.sh.
2003-10-26 02:00:37 +00:00
lukem 070871b5fc Implement build -N noisy, which sets MAKEVERBOSE to noisy and adds
`-s' to MAKEFLAGS for noisy < 2.
2003-10-25 03:46:09 +00:00
matt daa035e3e8 Teach build.sh about the ibmnws port. 2003-10-19 03:37:36 +00:00
lukem e72c726f88 Revert part of previous commit and do NOT explicitly set BSDSRCDIR in the
makewrapper, as doing so can break various builds.

(Setting NETBSDSRCDIR isn't strictly necessary either, but AFAICT, it
shouldn't hurt)
2003-09-24 00:24:53 +00:00
jmmv 0de57ce6ff Set BSDSRCDIR and NETBSDSRCDIR in the make wrapper, so we always get the
right source directories (in case they are defined in mk.conf using '?=').
2003-09-20 10:14:41 +00:00
jmmv 2e336929ff Pass '-de' to make(1) to get the expected behavior ("failed target" and
"failed command" messages).
2003-09-10 18:05:52 +00:00
lukem 58cb3cd0a2 in getkernelconf(), remove check for non-empty $makeobjdir, as it's not
performed elsewhere in similar code, and causes problems if you run "kernel="
without an operation that performs "make obj" in sys/ beforehand.
2003-08-16 11:46:44 +00:00
jmc d9556f9ecc Fix 2 remaining places items are depending on execute permissions coming out
from a cvs checkout on scripts.
2003-08-11 19:26:04 +00:00
sommerfeld 22a1b1038e Improve usage for -U so others won't make the mistake I just made. 2003-08-10 16:20:37 +00:00
lukem 13b0ffec63 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.
2003-07-29 10:07:15 +00:00
lukem 1b9a8aed24 Add missing "cd ${TOP}" to buildtools(). Problem identified by John Nemeth
in private mail.

Remove some debugging messages that crept in a little while ago.
2003-07-28 12:33:42 +00:00
lukem 833a10cf56 * set & export LC_ALL=C, so that end-user use of non `C' LC_COLLATE locales
won't cause expressions such as `echo [0-9a-z]*` to match "CVS"
* add getmakeenv(var, value), and use appropriatly.
2003-07-20 09:26:49 +00:00
lukem 1553f8efd9 Replace UNPRIVED=yes with MKUNPRIVED=yes.
Replace UPDATE=yes with MKUPDATE=yes.
2003-07-18 08:30:07 +00:00
lukem f17ac45381 add "params" operation 2003-07-16 13:21:47 +00:00
lukem ccfdea7ffb Broaden the scope of when "make obj NOSUBDIR=" will be run in tools/
to be at any time that build.sh is run without -o, because we need
the objdir of the top-level to exist if build.sh is going to provide
a default DESTDIR/RELEASEDIR, and with the previous code, if
MAKEOBJDIRPREFIX was used and the objdir of the source tree didn't
exist, build.sh would incorrectly determine the DESTDIR.
(mmm, obscure bugs).
2003-05-26 06:35:17 +00:00
lukem 4e33a0f5d5 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
2003-05-25 12:34:27 +00:00
lukem 6019a973a8 * Display the start time again just before the end time, to make it
easier to work out how long things took.  Suggested by Alistair Crooks.
* Explicitly display the makewrapper path
2003-05-18 10:57:11 +00:00
lukem e128ff2fcf Change evbsh3 to be like evbmips, in that a default MACHINE_ARCH
won't be provided for a MACHINE of "evbsh3"; the user has to explicitly
use "evbsh3-eb" or "evbsh3-el"
2003-05-17 07:52:52 +00:00
lukem e3fa32ff73 * Display default DESTDIR & RELEASEDIR. (Well, they're actually in
the .OBJDIR of the top of the source tree, but expressing that in 1
  line or less starts to get complicated).   Requested by Hubert.
* When using a -el or -eb MACHINE "shortcut", use that original value
  as the MACHINE for the default makewrapper filename.  Requested by Simon.
2003-05-12 03:01:16 +00:00
lukem 8bced05906 * Add support for MACHINEs: evbmips-eb evbmips-el sbmips-eb sbmips-el
which sets the appropriate MACHINE_ARCH and rewrites MACHINE to lose
  the -e[bl] suffix.
* Don't default to a MACHINE_ARCH for evbmips or sbmips.

Per discussion wth Simon Burge.
2003-05-12 02:33:17 +00:00
lukem b7d3d22051 Add "sourcesets" argument/target, which builds source sets into
RELEASEDIR/source/sets
2003-05-10 07:12:37 +00:00
lukem 9ca2699e2b When providing a default DESTDIR & RELEASEDIR in non-expert mode, add
these to makeenv so that the generated makewrapper contains these settings...
2003-05-09 09:10:06 +00:00
lukem ad89cbfee9 New features:
*	If not expert mode, provide defaults for:
		DESTDIR		/top/of/obj/destdir.${MACHINE}
		RELEASEDIR	/top/of/obj/releasedir
    *	Collate the various status messages output during the run
	and display them at the end in a "summary report".
    *	Cross-check the validity of MACHINE against MACHINE_ARCH.
	Fixes PR [toolchain/20193] from David Maxwell.
    *	Highlight that the tools will be rebuilt if UPDATE isn't set.
    *	Add stronger language recommending against -E unless you
    *	Improve whitespace use in usage()

Code stuff:
    *	Be consistent about using "${var}"
    *	Be more consistent how [ tests ] are run
    *	Improve some comments
    *	Rename getmakevar() to raw_getmakevar()
    *	Rename safe_getmakevar() to getmakevar()
    *	cd back to ${TOP} after a kernel build.
    *	Always keep the tmpdir around for the build (it's where the
	status messages are collated, for one).
2003-05-08 14:19:39 +00:00
christos 985fd8014b CYGWIN needs -X too (John Gordon) 2003-05-08 12:49:45 +00:00
fvdl 796c8a1016 Adapt for x86_64 -> amd64 rename. 2003-04-26 18:42:34 +00:00
thorpej d2809fcf8a Put -X into MAKEFLAGS on FreeBSD and Mac OS X; they have a small ARG_MAX. 2003-03-14 05:22:50 +00:00
lukem ea64374119 remove unnecessary message 2003-03-07 01:22:16 +00:00
lukem cfcaeea176 don't print the command & start time until after the options are parsed... 2003-03-04 02:20:28 +00:00
lukem bfc98ff079 Display the build.sh command line and the start & end times.
Based on suggestion from Andrew Brown <atatat@netbsd.org>.
2003-02-18 23:59:06 +00:00
lukem 9fd6e49e07 Enhance "kernel=" to print pathnames of newly built kernels for cut & paste.
(Previously we just printed the build directory.)
2003-02-16 04:35:03 +00:00
enami 561033c00e Consistently, don't expand ${MACHINE} in help message. 2003-02-06 22:19:06 +00:00
lukem e6d083f5b9 another DESTDIR clarification 2003-01-31 01:38:35 +00:00
lukem 1f9a9dde05 add missing usage for "sets" 2003-01-26 13:12:05 +00:00
lukem 4e91f80fa2 - Add "sets" top-level Makefile target and build.sh operation.
[Latter suggested by Julio Merino in private email]
- Add "help" build.sh operation.
2003-01-26 06:19:12 +00:00
lukem 46d44d89e9 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.
2003-01-26 05:34:32 +00:00
lukem f643db1c84 Can't check if cross building with "install=" until after $MACHINE has
been validated.  Noted by Anthony Mallet on current-users@
2003-01-24 01:17:52 +00:00
lukem 31b7057f61 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})
2003-01-23 16:24:08 +00:00
lukem 6bbdc41e7b reorder usage so that "mutually exclusive build" operations are listed
separately from "set variable" operations, in an attempt to make
build.sh easier to use
2003-01-22 11:26:11 +00:00
lukem 001300d84b Improvements from Alan Barrett (in private email), with minor tweaking:
(Thanks Alan!)

* Before attempting to use KERNOBJDIR, we now need to "make obj" in
  ${KERNSRCDIR}/${KERNARCHDIR}/compile, not in ${TOP}/etc as used to be
  the case.

* Fix one place where getmakevar was invoked unconditionally.  It needs
  to be conditional on $runcmd != "echo", so that we can rely on the
  existence of the new $make executable.

* Add a sanity check to getmakevar, to bomb if a similar error is
  introduced in the future.

* Changed the bomb function to print to stderr instead of to stdout, and
  to kill the top level shell process.  Without this, an attempted bomb
  from inside getmakevar did not work properly.

* Moved some duplicated code into a new safe_getmakevar function, which
  calls getmakevar if that is safe, or else emits a literal '$' followed
  by the variable name.


Improvements from me:

* Always 'trap "exit 1" 1 2 3 15', so the kill in bomb() doesn't cause ugly
  output.
2003-01-15 01:49:03 +00:00
lukem cc3d03cf30 improve usage 2003-01-04 14:55:44 +00:00
lukem a04634dbdf 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.
2003-01-04 12:55:32 +00:00
lukem 3d8ce73f53 some cleanups and tweaks to my preferred "sh KNF" (SNF ? :) 2003-01-02 23:11:07 +00:00
lukem f9ad379bbd cd `dirname $0` so that this runs from the directory that build.sh is in.
Per discussion with Andrew Brown.
2003-01-02 05:11:12 +00:00
lukem 27b32c4276 - Implement "-i installworlddir", which runs
make INSTALLWORLDDIR=installworlddir installworld
  after every other operation has completed.
  If you want to run this target without rebuilding, use -b as well...
- Cache the output of `uname -s` and `uname -m` for future use.
2002-12-25 00:42:50 +00:00
scw 84058abd72 The walnut port has been subsumed by evbppc. 2002-12-09 12:49:55 +00:00
lukem 83978b2301 improve message. suggestion from Scott Reynolds 2002-12-09 03:13:41 +00:00
lukem 239dc05c4f 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...
2002-12-08 22:14:00 +00:00
lukem 4f856ef51a - be consistent about option ordering in build.sh usage display
- use Fl and Ar instead of Sy and Em to format options
2002-12-08 08:42:51 +00:00
lukem 32615eac46 Apply fixes & enhancements from Alan Barrett. (Thanks Alan!)
* When building a kernel with the -k option, make obj in $TOP/etc to
    ensure that the correct KERNOBJDIR is created and used.  Previously,
    KERNOBJDIR could sometimes be an objdir outside the source tree
    and sometimes $TOP/sys/arch/$ARCH/compile inside the source tree,
    depending on whether or not a complete build had beed done before
    the kernel build.

  * Renamed KERNCONFNAME to kernconfname, for consistency with what
    seems to be a convention that variables local to build.sh (as
    opposed to make or environment variables) have lowercase names.

  * Renamed the do_buildonlytools and do_buildonlykernel variables to
    do_buildtools and do_buildkernel, because the word "only" is no
    longer appropriate now that more than one of them can be active
    simultaneously.

  * Changed a few '|| exit 1' tests to '|| bomb "message"', and added a
    few more similar tests.

  * Changed all 'echo "===> ..."' to use $runcmd, and added a few more
    similar echos.  Previously, some used $runcmd and some did not.
2002-11-17 12:59:37 +00:00
enami 6709c26d9f In the function usage(),
- The -n and -t option was missing in sample command line.
- Indent the description of -r option correctly.
- Use `basename $0` instead of $0.
2002-11-05 01:53:58 +00:00
lukem da7aeb45e7 - Add support for ./build.sh -k kern, which configures and builds the named
kernel using the $TOOLDIR toolchain.  If kern doesn't contain `/', it will
  be searched for in ${KERNCONFDIR} (typically, sys/arch/${MACHINE}/conf).
- Improve ./build.sh usage.
- Add some examples to the documentation.

This is heavily based on [toolchain/18739] from Alan Barrett <apb@cequrux.com>,
with improvements by me.
2002-10-20 15:48:01 +00:00
thorpej cd51665a0d Add sh5 cases. 2002-10-02 16:57:29 +00:00
thorpej 0e750f659f Remove USE_NEW_TOOLCHAIN, replacing it with similar logic using
TOOLCHAIN_MISSING and EXTERNAL_TOOLCHAIN.
2002-09-18 15:20:53 +00:00
thorpej c26422231a * Use /usr/bin/env to invoke the real interpreter. This allows us to
get the POSIX shell on more systems.
* Deal with a broken "pwd" on Solaris (suggested by Christos).
2002-09-13 23:27:13 +00:00
thorpej c7acd88451 Back out previous; I'll figure out another way. 2002-09-13 22:17:04 +00:00
thorpej 7db1a04e8c Use /bin/test explicitly in one place, rather than [ or test (which
might be a shell built-in).  This allows this script to work otherwise
unchanged with Solaris 8's /bin/sh.
2002-09-13 18:36:01 +00:00
bjh21 ec793cfe29 Unset PWD so that pwd is guaranteed to return a physical path.
This fixes PR 17313.  Thanks to Ian Dall for providing the fix.
2002-09-03 22:03:48 +00:00
pooka d1cacc3197 fix pasto in error message
reported by Andrew Freedman in toolchain/17530
2002-07-09 06:36:16 +00:00
fredette 4234bc92d3 Add hppa as a supported MACHINE_ARCH. 2002-06-10 14:08:05 +00:00
augustss 2862ed3546 Remove redundant pattern in case. 2002-06-05 06:27:09 +00:00
thorpej 82d4bf2f9f Allow ns32k. 2002-06-05 02:32:15 +00:00
msaitoh 7c929f204a add armeb as valid MACHINE_ARCH 2002-05-24 14:43:31 +00:00
lukem 7d134e662e add "-M makeobjdirprefix" to build.sh 2002-05-13 01:44:34 +00:00
sommerfeld 965e0acae4 Correct BUGS in BUILDING.mdoc now that most ports are USE_NEW_TOOLCHAIN
Obsolete NBUILDJOBS; build.sh just passes -jN through to make(1),
which inherits it cooperatively through the build tree.  Fix
documentation so that it's shown to be deprecated.

If you use build -jN, please save full build logs so that errors due
to missing dependancies can be analyzed and corrected.
2002-05-02 22:13:30 +00:00
tv d5a1eec92f Bomb if share/mk/bsd.own.mk is missing. 2002-04-18 01:38:11 +00:00
thorpej 0c3d55ef67 Switch remaining ARM ports (acorn32, cats, shark) to ELF. 2002-04-02 16:34:49 +00:00
bjh21 dc96e428af Rename arm26 -> acorn26. 2002-03-24 22:21:41 +00:00
pk 19c8da4424 Crank up robustness. 2002-03-21 10:54:50 +00:00
thorpej e4732a956b 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".
2002-03-14 18:33:04 +00:00
simonb a79fb9541b Add evbmips.
XXX: This is hard-coded to little-endian here, but there's not reason for
     some this.  The MALTA can be used with either-endianness.
2002-03-07 14:59:04 +00:00
simonb 92ae660710 Add sbmips. 2002-03-06 23:32:52 +00:00
tv 8ea025ea42 Nuke my "mkdirp" hack. "mkdir -p" is used so liberally throughout the
tree that the hack is just a maintenance annoyance here.
2002-03-02 03:51:02 +00:00
mjl 416ce5ecbb powerpc is a valid MACHINE_ARCH too. 2002-03-02 02:09:18 +00:00
tv be05d061b7 Related to PR toolchain/15780, sanity check MACHINE_ARCH. 2002-03-01 21:06:40 +00:00
tv 1e5d325cf1 Related to PR 15781, explain better in a comment why it is not possible
to grovel mk.conf using sed/awk/etc. before nbmake is available.
2002-03-01 20:57:26 +00:00
scw 3c68fd62d5 Add mvmeppc to powerpc case. 2002-02-27 21:19:08 +00:00
lukem c17ada6ca5 add -U; set UNPRIVED= 2002-02-27 13:55:28 +00:00
thorpej 91adf0a52c Shark is not yet MACHINE_ARCH=arm. 2002-02-10 19:09:13 +00:00
wiz f7d9c1c5ff s/dnard/shark/ 2002-02-10 18:28:12 +00:00
tv ff243397df chdir out of $tmpdir before removing it; some vendors' rm(1) programs will
not remove cwd....
2002-01-29 08:46:59 +00:00
tv d7938946ac Honor HOST_{CC,CFLAGS,CPPFLAGS,LDFLAGS} passed in from the environment
when building nbmake.  Use the correct defaults if not set (HOST_CC=cc,
HOST_CFLAGS=-O).
2002-01-19 16:49:28 +00:00
tv a4d805e9d2 Make sure buildmake.sh is run with "sh", rather than depending on executable
status.  (XXX we should probably come up with a HOST_SH variable for these
instances....)
2002-01-15 19:19:35 +00:00
tv 442feae097 Make use of new make(1) bootstrap in src/tools/make. 2002-01-15 19:17:23 +00:00
tv caacefb033 Apply workaround for some Bourne shells not handling IFS in the POSIX way.
Based on the change suggested by <david@l8s.co.uk> on current-users.
2001-12-19 20:59:07 +00:00
wiz cd1d503ed0 Sort options in usage in default order (AaBb...). 2001-12-17 13:16:10 +00:00
jmc eb0d4b304f Change check for USE_NEW_TOOLCHAIN to just looking for it being defined. 2001-12-12 23:50:27 +00:00
lukem 90d4be2b55 as -m mach is optional, indicate this in the usage 2001-12-11 23:57:49 +00:00
tv b7c526a551 Honor HOST_LDFLAGS in environment.
Add bash to the suggestions of alternative shells if /bin/sh isn't enough.
2001-12-11 21:13:35 +00:00
tv 906700c90b Revert part of rev. 1.28. DO NOT set MAKE_MACHINE, since "nbmake" is a
platform-independent binary.  It should have no default.  Setting MACHINE
is the purpose of the wrapper script.
2001-12-11 20:45:31 +00:00
jmc a0062bb4ae Make -t and -u behave together so a -t doesn't always force a cleandir in the
tools directory.
2001-12-09 06:07:16 +00:00
jmc b1561d46b2 Check if this platform is supported for USE_NEW_TOOLCHAIN and exit with a
complaint if it's not. Point out to run a traditional make and also how to
force a new toolchain build if one wants to test
2001-12-04 04:28:23 +00:00
jmc b24c81ca0c Make sure the makes running before the make build rule include
-m <top dir>/share/mk
2001-12-03 08:18:00 +00:00
thorpej a3c473186e - Define MAKE_MACHINE reasonably for the bootstrap make.
- Don't unset IFS; some shells don't like that.  Instead save, and
  restore IFS.
2001-11-30 02:18:13 +00:00
jmc df406df953 If using objdirs make sure the objdir root is made before starting the build.
Otherwise problems with bsd.own.mk and _SRC_TOP_OBJ can result.
2001-11-26 05:57:33 +00:00
thorpej 9b19c5d978 Add a "-d" option that uses the "distribution" target, rather than
the "build" target.
2001-11-25 18:35:06 +00:00
thorpej 9f11f1b5b4 If using -t, do a "cleandir" before building/installing the
tools.  This is something the old "build" hack used to do.
2001-11-15 00:14:35 +00:00
tv 8db91a3669 Revert part of rev. 1.20 -- $DESTDIR and $TOOLDIR are deliberately shown
symbolically with "-n", as these may come from mk.conf after building the
bootstrap make.  Add a comment to that effect.
2001-11-13 19:03:08 +00:00
tv b5cd2489b2 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.
2001-11-12 23:16:17 +00:00
msaitoh 7e478326bd change MACHINE_ARCH of evbsh3 from sh3el to sh3eb because all config files
for evbsh3 defaults to big endian.
2001-11-12 08:54:58 +00:00
jmc a1ae34bc72 Always rebuild the nbmake wrapper script. Otherwise the options passed to
build.sh just get lost if they differ from a previous invocation (i.e. letting
MKOBJDIRS get set the first time, -o will get ignored after this unless a
rebuild of the script happens). It's low overhead so this adds little burden
to getting it right.
2001-11-11 01:34:30 +00:00
thorpej 3b569c7be3 * Fix a quoting error so that when using -n, we actually see
$TOOLDIR and $DESTDIR in their expanded form.
* Set USETOOLS=yes in the make wrapper script; it's pretty pointless
  using the make wrapper unless you're using the host tools.
* In the -t case, make sure to only echo the "make obj" command if -n.
2001-11-09 04:14:17 +00:00
dillo c5b59dd31e export DESTDIR when set via -D. 2001-11-05 02:17:47 +00:00
tv 472dcba2fb * Always use the makewrapper when starting a build phase.
* Set stuff mostly in the environment, not on make(1)'s command line.
  This is needed for MACHINE and MACHINE_ARCH (noted by bjh21), and keeps
  the mk.conf-overriding-env behavior (suggested by several people).

* Use MAKEFLAGS to make the wrapper script more readable.

* When prepping objdir in tools for the default TOOLDIR value, just make
  that objdir; leave the recursive "make obj" for later.
2001-11-02 05:07:22 +00:00
thorpej a4a68fe775 When doing an only-tools build, don't use the makewrapper. 2001-11-01 01:49:44 +00:00
thorpej f55ffb9482 Add a -t option that builds and installs the toolchain only
(and thus implies -b).  To make this work, we also check do_buildsystem
when doing the DESTDIR sanity check.
2001-11-01 00:14:17 +00:00
tv dadd6e7370 Major cleanup and overhaul:
* Allow MACHINE to be set automatically on NetBSD native builds.
  Require -m only if the host is not NetBSD.

* Fail if DESTDIR is set to root (/) and the build is not NetBSD native,
  or the build is attempting a "make release" (option -R).

* Warn the user if DESTDIR is set to root (/) that the kernel must be up
  to date, or else the build might hose the system.  Also, do not remove
  DESTDIR on -r if it is set to root.

* Fail if TOOLDIR is set to / or empty after checking with nbmake.

* Allow DESTDIR and TOOLDIR to be set in mk.conf and/or by the new default
  from <bsd.own.mk>.  Note that if -T is not used to set TOOLDIR, and
  TOOLDIR is not set in the environment, then nbmake will always be
  bootstrapped (rather than looking at nbmake's timestamp).  This is
  because /bin/sh doesn't know how to get TOOLDIR from mk.conf without
  first having nbmake (...which lives in TOOLDIR).

* Do a pass of "make obj" through src/tools before installing nbmake (so
  long as -o/MKOBJDIRS=no is not specified).  This ensures that objdirs
  exist if they are desired, and paves the way for using build.sh to
  build all the src/tools without building everything else.

* Add "-w" option, which allows the builder to specify where the nbmake
  wrapper shell script should be created.  If not specified,
  $TOOLDIR/bin/nbmake-$MACHINE is still created as a default.

* Print the values of DESTDIR and TOOLDIR after bootstrapping nbmake,
  for informational purposes.

It should now be possible to type just "./build.sh" on a NetBSD-current
host and get a new build in / for the appropriate architecture.
However, building in-place like this has *not* been extensively tested
yet, so be careful.
2001-10-31 19:59:43 +00:00
jmc a6ddeb5145 Add a sanity check. Don't rm -rf / if TOOLDIR or DESTDIR got set to / and -r
was an option
2001-10-31 18:23:55 +00:00
reinoud a7b1e2f4a6 Rollback 2001-10-31 13:12:35 +00:00
tv 7636e93f41 * Fix brokenness created by the -n option additions ("eval" still kept
quoting, so the commands were thought to be one big word with embedded
  whitespace)

* New options:
  -O obj    Set root of an obj tree; sets MAKEOBJDIR to an appropriate
            substitution pattern.
  -o        Sets MKOBJDIRS=no (otherwise sets MKOBJDIRS=yes)
  -u        Sets UPDATE
2001-10-31 01:56:10 +00:00
reinoud 3d76fbc53f Acorn's MACHINE_ARFCH is now arm, not arm32 ... moving it effectively to
ELF (Yay!)
2001-10-31 00:08:03 +00:00
tv 732cb3a230 * Clean up a bit; always use [] for comparison tests.
* Don't require DESTDIR when -b is set.

* Add -n option, which prints the commands that would be run by build.sh,
  but doesn't run them (much like make's -n option).

* Auto-resolve relative paths for -D, -R, and -T (but not for the
  corresponding environment variables).

* Explicitly declare defaults of all shell variables used where feasible,
  rather than sprinkling ${varname-value} expansions.

* Prefix shell true/false variables with "do_" to indicate their use as
  actual values in shell expressions (like "$do_buildsystem && echo foo").
2001-10-30 22:33:00 +00:00
jmc ac3e0f6b6c Add -b option. Bootstrap only. i.e. build and install nbmake and then exit 2001-10-30 21:04:05 +00:00
tv 3ae57da833 Set TOOLDIR in the nbmake-MACHINE wrapper script. 2001-10-29 19:47:51 +00:00
matt 0c7ce20cc8 Netwinder's MACHINE_ARCH is arm, not arm32 2001-10-26 23:25:03 +00:00
bjh21 5b191935e3 Re-instate MACHINE -> MACHINE_ARCH entry for arm26, which I left out of the
last change.
2001-10-24 14:55:09 +00:00
bjh21 ad870d54a0 Sync the MACHINE -> MACHINE_ARCH mapping for ARM platforms with
sys/arch/*/param.h.  While not necessarily correct, param.h is at least
definitively incorrect.
2001-10-24 14:00:24 +00:00
tv e7f296218e - Supply full list of MACHINEs for implicit MACHINE_ARCH evaluation.
If a machine is not known, abort.

- Emulate "mkdir -p" for Old "mkdir" programs on some host OS's.

- Add "-a" option to provide MACHINE_ARCH explicitly (for MACHINEs
  that are capable of having more than one MACHINE_ARCH, such as sh3
  and sparc64)

- Where "getopts" is not available in the shell, try using "getopt".
  It's not whitespace compatible, but works in most cases.

- Rename "bmake" to "nbmake" per suggestions.

- When building nbmake, create a temporary directory for the purpose
  of holding host compiler objects that might be created in the cwd.
  Delete this directory if aborted via sh's "trap".

- Create a wrapper script in $TOOLDIR/bin called "nbmake-$MACHINE",
  which can be run by hand for building parts of a cross tree easily.
  Use this script when finally starting the build.
2001-10-24 02:39:56 +00:00
tv 2c014f233f Move mkdir of TOOLDIR/bin to after removing TOOLDIR as specified by -r.
Add -R option to specify RELEASEDIR directory and flag using "make release"
instead of "make build" (inverted logic from removed -n option).
2001-10-19 16:43:47 +00:00
tv 79069d719a Add error handling to bmake build, and add "-j" option to set NBUILDJOBS. 2001-10-19 02:25:48 +00:00
tv 41334a362b Script to automate bootstrapping a build on any host platform. Creates
a bmake (rebuilds, if necessary) and invokes that to start the build.
2001-10-19 02:21:03 +00:00