Commit Graph

95 Commits

Author SHA1 Message Date
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