2001-10-19 06:21:03 +04:00
|
|
|
#! /bin/sh
|
2002-03-21 13:54:50 +03:00
|
|
|
# $NetBSD: build.sh,v 1.53 2002/03/21 10:54:50 pk Exp $
|
2001-10-19 06:21:03 +04:00
|
|
|
#
|
|
|
|
# Top level build wrapper, for a system containing no tools.
|
|
|
|
#
|
|
|
|
# This script should run on any POSIX-compliant shell. For systems
|
2001-12-12 00:13:35 +03:00
|
|
|
# with a strange /bin/sh, "ksh" or "bash" may be an ample alternative.
|
2001-10-19 06:21:03 +04:00
|
|
|
#
|
|
|
|
|
|
|
|
bomb () {
|
|
|
|
echo ""
|
|
|
|
echo "ERROR: $@"
|
|
|
|
echo "*** BUILD ABORTED ***"
|
|
|
|
exit 1
|
|
|
|
}
|
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 22:59:43 +03:00
|
|
|
[ -d usr.bin/make ] || bomb "build.sh must be run from the top source level"
|
2001-10-19 06:21:03 +04:00
|
|
|
|
2001-12-03 11:18:00 +03:00
|
|
|
TOP=`pwd`
|
|
|
|
|
2001-10-19 06:21:03 +04:00
|
|
|
getarch () {
|
|
|
|
# Translate a MACHINE into a default MACHINE_ARCH.
|
|
|
|
case $MACHINE in
|
2002-02-10 22:09:13 +03:00
|
|
|
arm26|evbarm|hpcarm|netwinder)
|
2001-10-19 06:21:03 +04:00
|
|
|
MACHINE_ARCH=arm;;
|
|
|
|
|
2002-02-10 22:09:13 +03:00
|
|
|
acorn32|cats|shark)
|
2001-10-24 18:00:24 +04:00
|
|
|
MACHINE_ARCH=arm32;;
|
|
|
|
|
2001-10-19 06:21:03 +04:00
|
|
|
sun2)
|
|
|
|
MACHINE_ARCH=m68000;;
|
|
|
|
|
|
|
|
amiga|atari|cesfic|hp300|sun3|*68k)
|
|
|
|
MACHINE_ARCH=m68k;;
|
|
|
|
|
2002-03-07 02:32:52 +03:00
|
|
|
mipsco|newsmips|sbmips|sgimips)
|
2001-10-19 06:21:03 +04:00
|
|
|
MACHINE_ARCH=mipseb;;
|
|
|
|
|
2002-03-07 17:59:04 +03:00
|
|
|
algor|arc|cobalt|evbmips|hpcmips|playstation2|pmax)
|
2001-10-19 06:21:03 +04:00
|
|
|
MACHINE_ARCH=mipsel;;
|
|
|
|
|
|
|
|
pc532)
|
|
|
|
MACHINE_ARCH=ns32k;;
|
|
|
|
|
2002-02-28 00:19:08 +03:00
|
|
|
bebox|mvmeppc|prep|sandpoint|walnut|*ppc)
|
2001-10-19 06:21:03 +04:00
|
|
|
MACHINE_ARCH=powerpc;;
|
|
|
|
|
2001-11-12 11:54:58 +03:00
|
|
|
evbsh3|mmeye)
|
2001-10-19 06:21:03 +04:00
|
|
|
MACHINE_ARCH=sh3eb;;
|
|
|
|
|
2001-11-12 11:54:58 +03:00
|
|
|
dreamcast|hpcsh)
|
2001-10-19 06:21:03 +04:00
|
|
|
MACHINE_ARCH=sh3el;;
|
|
|
|
|
2001-10-24 18:00:24 +04:00
|
|
|
alpha|i386|sparc|sparc64|vax|x86_64)
|
2001-10-24 06:39:56 +04:00
|
|
|
MACHINE_ARCH=$MACHINE;;
|
|
|
|
|
|
|
|
*) bomb "unknown target MACHINE: $MACHINE";;
|
2001-10-19 06:21:03 +04:00
|
|
|
esac
|
|
|
|
}
|
|
|
|
|
2002-03-02 00:06:40 +03:00
|
|
|
validatearch () {
|
|
|
|
# Ensure that the MACHINE_ARCH exists (and is supported by build.sh).
|
|
|
|
case $MACHINE_ARCH in
|
2002-03-02 05:09:18 +03:00
|
|
|
alpha|arm|i386|m68000|m68k|mipse[bl]|powerpc|sh3e[bl]|sparc|sparc64|vax|x86_64)
|
2002-03-02 00:06:40 +03:00
|
|
|
;;
|
|
|
|
|
|
|
|
*) bomb "unknown target MACHINE_ARCH: $MACHINE_ARCH";;
|
|
|
|
esac
|
|
|
|
}
|
|
|
|
|
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 22:59:43 +03:00
|
|
|
getmakevar () {
|
2001-12-04 07:28:23 +03:00
|
|
|
$make -m ${TOP}/share/mk -s -f- _x_ <<EOF
|
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 22:59:43 +03:00
|
|
|
_x_:
|
|
|
|
echo \${$1}
|
|
|
|
.include <bsd.prog.mk>
|
|
|
|
EOF
|
|
|
|
}
|
|
|
|
|
2001-10-31 01:33:00 +03:00
|
|
|
resolvepath () {
|
|
|
|
case $OPTARG in
|
|
|
|
/*) ;;
|
|
|
|
*) OPTARG="$cwd/$OPTARG";;
|
|
|
|
esac
|
|
|
|
}
|
|
|
|
|
2001-10-19 06:21:03 +04:00
|
|
|
usage () {
|
|
|
|
echo "Usage:"
|
2002-03-14 21:33:04 +03:00
|
|
|
echo "$0 [-bdorUu] [-a arch] [-B buildid] [-j njob] [-m mach] "
|
|
|
|
echo " [-w wrapper] [-D dest] [-O obj] [-R release] [-T tools]"
|
2001-10-24 06:39:56 +04:00
|
|
|
echo ""
|
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 22:59:43 +03:00
|
|
|
echo " -a: set MACHINE_ARCH to arch (otherwise deduced from MACHINE)"
|
2002-03-14 21:33:04 +03:00
|
|
|
echo " -B: set BUILDID to buildid"
|
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 22:59:43 +03:00
|
|
|
echo " -b: build nbmake and nbmake wrapper script, if needed"
|
2001-12-17 16:16:10 +03:00
|
|
|
echo " -D: set DESTDIR to dest"
|
2001-11-25 21:35:06 +03:00
|
|
|
echo " -d: build a full distribution into DESTDIR (including etc files)"
|
2001-10-19 20:43:47 +04:00
|
|
|
echo " -j: set NBUILDJOBS to njob"
|
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 22:59:43 +03:00
|
|
|
echo " -m: set MACHINE to mach (not required if NetBSD native)"
|
2001-10-31 04:56:10 +03:00
|
|
|
echo " -n: show commands that would be executed, but do not execute them"
|
2001-12-17 16:16:10 +03:00
|
|
|
echo " -O: set obj root directory to obj (sets a MAKEOBJDIR pattern)"
|
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 22:59:43 +03:00
|
|
|
echo " -o: set MKOBJDIRS=no (do not create objdirs at start of build)"
|
2001-12-17 16:16:10 +03:00
|
|
|
echo " -R: build a release (and set RELEASEDIR to release)"
|
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 22:59:43 +03:00
|
|
|
echo " -r: remove contents of TOOLDIR and DESTDIR before building"
|
2001-12-17 16:16:10 +03:00
|
|
|
echo " -T: set TOOLDIR to tools"
|
2001-11-01 03:14:17 +03:00
|
|
|
echo " -t: build and install tools only (implies -b)"
|
2002-02-27 16:55:28 +03:00
|
|
|
echo " -U: set UNPRIVED"
|
2001-11-02 08:07:22 +03:00
|
|
|
echo " -u: set UPDATE"
|
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 22:59:43 +03:00
|
|
|
echo " -w: create nbmake script at wrapper (default TOOLDIR/bin/nbmake-MACHINE)"
|
|
|
|
echo ""
|
|
|
|
echo "Note: if -T is unset and TOOLDIR is not set in the environment,"
|
|
|
|
echo " nbmake will be [re]built unconditionally."
|
2001-10-19 06:21:03 +04:00
|
|
|
exit 1
|
|
|
|
}
|
|
|
|
|
2001-10-31 01:33:00 +03:00
|
|
|
# Set defaults.
|
2001-11-02 08:07:22 +03:00
|
|
|
MAKEFLAGS=
|
2001-10-31 04:56:10 +03:00
|
|
|
buildtarget=build
|
2001-10-31 01:33:00 +03:00
|
|
|
cwd=`pwd`
|
|
|
|
do_buildsystem=true
|
2001-11-01 03:14:17 +03:00
|
|
|
do_buildonlytools=false
|
2001-10-31 01:33:00 +03:00
|
|
|
do_rebuildmake=false
|
|
|
|
do_removedirs=false
|
2001-11-02 08:07:22 +03:00
|
|
|
makeenv=
|
|
|
|
makewrapper=
|
2001-10-31 01:33:00 +03:00
|
|
|
opt_a=no
|
2002-03-14 21:33:04 +03:00
|
|
|
opts='a:B:bdhj:m:nortuw:D:O:R:T:U'
|
2001-11-02 08:07:22 +03:00
|
|
|
runcmd=
|
2001-10-19 06:25:48 +04:00
|
|
|
|
2001-10-24 06:39:56 +04:00
|
|
|
if type getopts >/dev/null 2>&1; then
|
|
|
|
# Use POSIX getopts.
|
|
|
|
getoptcmd='getopts $opts opt && opt=-$opt'
|
|
|
|
optargcmd=':'
|
|
|
|
else
|
2001-12-12 00:13:35 +03:00
|
|
|
type getopt >/dev/null 2>&1 || bomb "/bin/sh shell is too old; try ksh or bash"
|
2001-10-19 06:21:03 +04:00
|
|
|
|
2001-10-24 06:39:56 +04:00
|
|
|
# Use old-style getopt(1) (doesn't handle whitespace in args).
|
|
|
|
args="`getopt $opts $*`"
|
|
|
|
[ $? = 0 ] || usage
|
|
|
|
set -- $args
|
|
|
|
|
|
|
|
getoptcmd='[ $# -gt 0 ] && opt="$1" && shift'
|
|
|
|
optargcmd='OPTARG="$1"; shift'
|
|
|
|
fi
|
2001-10-31 01:33:00 +03:00
|
|
|
|
|
|
|
# Parse command line options.
|
2001-10-24 06:39:56 +04:00
|
|
|
while eval $getoptcmd; do case $opt in
|
|
|
|
-a) eval $optargcmd
|
|
|
|
MACHINE_ARCH=$OPTARG; opt_a=yes;;
|
2001-10-19 06:21:03 +04:00
|
|
|
|
2002-03-14 21:33:04 +03:00
|
|
|
-B) eval $optargcmd
|
|
|
|
BUILDID=$OPTARG;;
|
|
|
|
|
2001-10-31 01:33:00 +03:00
|
|
|
-b) do_buildsystem=false;;
|
2001-10-31 00:04:05 +03:00
|
|
|
|
2001-11-25 21:35:06 +03:00
|
|
|
-d) buildtarget=distribution;;
|
|
|
|
|
2001-10-24 06:39:56 +04:00
|
|
|
-j) eval $optargcmd
|
2001-11-02 08:07:22 +03:00
|
|
|
MAKEFLAGS="$MAKEFLAGS NBUILDJOBS=$OPTARG"; export MAKEFLAGS;;
|
2001-10-19 06:21:03 +04:00
|
|
|
|
2001-10-24 06:39:56 +04:00
|
|
|
# -m overrides MACHINE_ARCH unless "-a" is specified
|
|
|
|
-m) eval $optargcmd
|
|
|
|
MACHINE=$OPTARG; [ "$opt_a" != "yes" ] && getarch;;
|
2001-10-19 20:43:47 +04:00
|
|
|
|
2001-10-31 01:33:00 +03:00
|
|
|
-n) runcmd=echo;;
|
|
|
|
|
2001-10-31 04:56:10 +03:00
|
|
|
-o) MKOBJDIRS=no;;
|
|
|
|
|
2001-10-31 01:33:00 +03:00
|
|
|
-r) do_removedirs=true; do_rebuildmake=true;;
|
2001-10-19 06:21:03 +04:00
|
|
|
|
2001-11-01 03:14:17 +03:00
|
|
|
-t) do_buildonlytools=true; do_buildsystem=false;;
|
|
|
|
|
2002-02-27 16:55:28 +03:00
|
|
|
-U) UNPRIVED=yes; export UNPRIVED
|
|
|
|
makeenv="$makeenv UNPRIVED";;
|
|
|
|
|
2001-11-02 08:07:22 +03:00
|
|
|
-u) UPDATE=yes; export UPDATE
|
|
|
|
makeenv="$makeenv UPDATE";;
|
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 22:59:43 +03:00
|
|
|
|
|
|
|
-w) eval $optargcmd; resolvepath
|
|
|
|
makewrapper="$OPTARG";;
|
2001-10-31 04:56:10 +03:00
|
|
|
|
2001-10-31 01:33:00 +03:00
|
|
|
-D) eval $optargcmd; resolvepath
|
2001-11-05 05:17:47 +03:00
|
|
|
DESTDIR="$OPTARG"; export DESTDIR
|
2001-11-02 08:07:22 +03:00
|
|
|
makeenv="$makeenv DESTDIR";;
|
2001-10-24 06:39:56 +04:00
|
|
|
|
2001-10-31 04:56:10 +03:00
|
|
|
-O) eval $optargcmd; resolvepath
|
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 22:59:43 +03:00
|
|
|
MAKEOBJDIR="\${.CURDIR:C,^$cwd,$OPTARG,}"; export MAKEOBJDIR
|
2001-11-26 08:57:33 +03:00
|
|
|
makeobjdir=$OPTARG
|
2001-11-02 08:07:22 +03:00
|
|
|
makeenv="$makeenv MAKEOBJDIR";;
|
2001-10-31 04:56:10 +03:00
|
|
|
|
2001-10-31 01:33:00 +03:00
|
|
|
-R) eval $optargcmd; resolvepath
|
2001-11-02 08:07:22 +03:00
|
|
|
RELEASEDIR=$OPTARG; export RELEASEDIR
|
|
|
|
makeenv="$makeenv RELEASEDIR"
|
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 22:59:43 +03:00
|
|
|
buildtarget=release;;
|
2001-10-24 06:39:56 +04:00
|
|
|
|
2001-10-31 01:33:00 +03:00
|
|
|
-T) eval $optargcmd; resolvepath
|
2001-11-02 08:07:22 +03:00
|
|
|
TOOLDIR="$OPTARG"; export TOOLDIR;;
|
2001-10-24 06:39:56 +04:00
|
|
|
|
|
|
|
--) break;;
|
|
|
|
-'?'|-h) usage;;
|
2001-10-19 06:21:03 +04:00
|
|
|
esac; done
|
|
|
|
|
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 22:59:43 +03:00
|
|
|
# Set up MACHINE*. On a NetBSD host, these are allowed to be unset.
|
|
|
|
if [ -z "$MACHINE" ]; then
|
|
|
|
if [ "`uname -s 2>/dev/null`" != "NetBSD" ]; then
|
|
|
|
echo "MACHINE must be set, or -m must be used, for cross builds."
|
2001-10-24 06:39:56 +04:00
|
|
|
echo ""; usage
|
|
|
|
fi
|
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 22:59:43 +03:00
|
|
|
MACHINE=`uname -m`
|
2001-10-19 06:21:03 +04:00
|
|
|
fi
|
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 22:59:43 +03:00
|
|
|
[ -n "$MACHINE_ARCH" ] || getarch
|
2002-03-02 00:06:40 +03:00
|
|
|
validatearch
|
2001-10-19 06:21:03 +04:00
|
|
|
|
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 22:59:43 +03:00
|
|
|
# Set up default make(1) environment.
|
2001-11-02 08:07:22 +03:00
|
|
|
makeenv="$makeenv TOOLDIR MACHINE MACHINE_ARCH MAKEFLAGS"
|
2002-03-14 21:33:04 +03:00
|
|
|
if [ ! -z "$BUILDID" ]; then
|
|
|
|
makeenv="$makeenv BUILDID"
|
|
|
|
fi
|
2001-11-02 08:07:22 +03:00
|
|
|
MAKEFLAGS="-m $cwd/share/mk $MAKEFLAGS MKOBJDIRS=${MKOBJDIRS-yes}"
|
|
|
|
export MAKEFLAGS MACHINE MACHINE_ARCH
|
2001-10-19 20:43:47 +04:00
|
|
|
|
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 22:59:43 +03:00
|
|
|
# Test make source file timestamps against installed nbmake binary,
|
|
|
|
# if TOOLDIR is pre-set.
|
2002-03-01 23:57:26 +03:00
|
|
|
#
|
|
|
|
# Note that we do NOT try to grovel "mk.conf" here to find out if TOOLDIR
|
|
|
|
# is set there, because it can contain make variable expansions and other
|
|
|
|
# stuff only parseable *after* we have a working nbmake. So this logic
|
|
|
|
# can only work if the user has pre-set TOOLDIR in the environment or
|
|
|
|
# used the -T option to build.sh.
|
|
|
|
#
|
2002-03-21 13:54:50 +03:00
|
|
|
make="${TOOLDIR-nonexistent}/bin/nbmake"
|
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 22:59:43 +03:00
|
|
|
if [ -x $make ]; then
|
2001-10-19 06:21:03 +04:00
|
|
|
for f in usr.bin/make/*.[ch] usr.bin/make/lst.lib/*.[ch]; do
|
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 22:59:43 +03:00
|
|
|
if [ $f -nt $make ]; then
|
2001-10-31 01:33:00 +03:00
|
|
|
do_rebuildmake=true; break
|
2001-10-19 06:21:03 +04:00
|
|
|
fi
|
|
|
|
done
|
|
|
|
else
|
2001-10-31 01:33:00 +03:00
|
|
|
do_rebuildmake=true
|
2001-10-19 06:21:03 +04:00
|
|
|
fi
|
|
|
|
|
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 22:59:43 +03:00
|
|
|
# Build bootstrap nbmake if needed.
|
2001-10-31 01:33:00 +03:00
|
|
|
if $do_rebuildmake; then
|
2001-11-02 08:07:22 +03:00
|
|
|
$runcmd echo "===> Bootstrapping nbmake"
|
2002-03-21 13:54:50 +03:00
|
|
|
tmpdir="${TMPDIR-/tmp}/nbbuild$$"
|
2001-10-24 06:39:56 +04:00
|
|
|
|
2002-03-21 13:54:50 +03:00
|
|
|
$runcmd mkdir "$tmpdir" || bomb "cannot mkdir: $tmpdir"
|
|
|
|
trap "cd /; rm -r -f \"$tmpdir\"" 0
|
2001-10-24 06:39:56 +04:00
|
|
|
trap "exit 1" 1 2 3 15
|
2002-03-21 13:54:50 +03:00
|
|
|
$runcmd cd "$tmpdir"
|
2001-10-19 06:21:03 +04:00
|
|
|
|
2002-01-19 19:49:28 +03:00
|
|
|
$runcmd env CC="${HOST_CC-cc}" CPPFLAGS="${HOST_CPPFLAGS}" CFLAGS="${HOST_CFLAGS--O}" LDFLAGS="${HOST_LDFLAGS}" \
|
2002-03-21 13:54:50 +03:00
|
|
|
"$cwd/tools/make/configure" || bomb "configure of nbmake failed"
|
2002-01-15 22:19:35 +03:00
|
|
|
$runcmd sh buildmake.sh || bomb "build of nbmake failed"
|
2001-10-19 06:21:03 +04:00
|
|
|
|
2002-03-21 13:54:50 +03:00
|
|
|
make="$tmpdir/nbmake"
|
|
|
|
$runcmd cd "$cwd"
|
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 22:59:43 +03:00
|
|
|
$runcmd rm -f usr.bin/make/*.o usr.bin/make/lst.lib/*.o
|
|
|
|
fi
|
|
|
|
|
2002-03-21 13:54:50 +03:00
|
|
|
if [ "$runcmd" = "echo" ]; then
|
|
|
|
USE_NEW_TOOLCHAIN=yes
|
|
|
|
else
|
|
|
|
USE_NEW_TOOLCHAIN=`getmakevar USE_NEW_TOOLCHAIN`
|
|
|
|
fi
|
2001-12-13 02:50:27 +03:00
|
|
|
if [ "${USE_NEW_TOOLCHAIN}" = "" ]; then
|
2001-12-04 07:28:23 +03:00
|
|
|
echo "ERROR: build.sh (new toolchain) is not yet enabled for"
|
|
|
|
echo
|
|
|
|
echo "MACHINE: ${MACHINE}"
|
|
|
|
echo "MACHINE_ARCH: ${MACHINE_ARCH}"
|
|
|
|
echo
|
|
|
|
echo "All builds for this platform should be done via a traditional make"
|
|
|
|
echo
|
|
|
|
echo "If you wish to test using the new toolchain set"
|
|
|
|
echo
|
|
|
|
echo "USE_NEW_TOOLCHAIN=yes"
|
|
|
|
echo
|
|
|
|
echo "in either the environment or mk.conf and rerun"
|
|
|
|
echo
|
|
|
|
echo "$0 $*"
|
|
|
|
exit 1
|
|
|
|
fi
|
|
|
|
|
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 22:59:43 +03:00
|
|
|
# If TOOLDIR isn't already set, make objdirs in "tools" in case the
|
|
|
|
# default setting from <bsd.own.mk> is used.
|
|
|
|
if [ -z "$TOOLDIR" ] && [ "$MKOBJDIRS" != "no" ]; then
|
2001-11-02 08:07:22 +03:00
|
|
|
$runcmd cd tools
|
2001-12-03 11:18:00 +03:00
|
|
|
$runcmd $make -m ${TOP}/share/mk obj NOSUBDIR= || exit 1
|
2001-11-02 08:07:22 +03:00
|
|
|
$runcmd cd ..
|
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 22:59:43 +03:00
|
|
|
fi
|
|
|
|
|
2001-11-26 08:57:33 +03:00
|
|
|
#
|
|
|
|
# If setting -O to root an obj dir make sure the base directory is made
|
|
|
|
# before continuing as bsd.own.mk will need this to pick up _SRC_TOP_OBJ_
|
|
|
|
#
|
|
|
|
if [ "$MKOBJDIRS" != "no" ] && [ ! -z "$makeobjdir" ]; then
|
2002-03-21 13:54:50 +03:00
|
|
|
$runcmd mkdir -p "$makeobjdir"
|
2001-11-26 08:57:33 +03:00
|
|
|
fi
|
|
|
|
|
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 22:59:43 +03:00
|
|
|
# Find DESTDIR and TOOLDIR.
|
|
|
|
if [ "$runcmd" = "echo" ]; then
|
2001-11-13 22:03:08 +03:00
|
|
|
# shown symbolically with -n because these may come from mk.conf
|
|
|
|
DESTDIR='$DESTDIR'
|
|
|
|
TOOLDIR='$TOOLDIR'
|
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 22:59:43 +03:00
|
|
|
else
|
2002-03-21 13:54:50 +03:00
|
|
|
DESTDIR=`getmakevar DESTDIR`;
|
|
|
|
[ $? = 0 ] || bomb "getmakevar DESTDIR failed";
|
|
|
|
echo "===> DESTDIR path: $DESTDIR"
|
|
|
|
|
|
|
|
TOOLDIR=`getmakevar TOOLDIR`;
|
|
|
|
[ $? = 0 ] || bomb "getmakevar DESTDIR failed";
|
|
|
|
echo "===> TOOLDIR path: $TOOLDIR"
|
|
|
|
|
2001-11-02 08:07:22 +03:00
|
|
|
export DESTDIR TOOLDIR
|
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 22:59:43 +03:00
|
|
|
fi
|
|
|
|
|
|
|
|
# Check validity of TOOLDIR and DESTDIR.
|
|
|
|
if [ -z "$TOOLDIR" ] || [ "$TOOLDIR" = "/" ]; then
|
|
|
|
bomb "TOOLDIR '$TOOLDIR' invalid"
|
|
|
|
fi
|
|
|
|
removedirs="$TOOLDIR"
|
|
|
|
|
|
|
|
if [ -z "$DESTDIR" ] || [ "$DESTDIR" = "/" ]; then
|
2001-11-01 03:14:17 +03:00
|
|
|
if $do_buildsystem && \
|
2001-11-25 21:35:06 +03:00
|
|
|
([ "$buildtarget" != "build" ] || \
|
2001-11-01 03:14:17 +03:00
|
|
|
[ "`uname -s 2>/dev/null`" != "NetBSD" ] || \
|
|
|
|
[ "`uname -m`" != "$MACHINE" ]); then
|
2001-11-25 21:35:06 +03:00
|
|
|
bomb "DESTDIR must be set to a non-root path for cross builds or -d or -R."
|
2001-11-01 03:14:17 +03:00
|
|
|
elif $do_buildsystem; then
|
|
|
|
echo "===> WARNING: Building to /."
|
|
|
|
echo "===> If your kernel is not up to date, this may cause the system to break!"
|
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 22:59:43 +03:00
|
|
|
fi
|
|
|
|
else
|
|
|
|
removedirs="$removedirs $DESTDIR"
|
|
|
|
fi
|
|
|
|
|
|
|
|
# Remove the target directories.
|
|
|
|
if $do_removedirs; then
|
|
|
|
for f in $removedirs; do
|
|
|
|
echo "===> Removing $f"
|
|
|
|
$runcmd rm -r -f $f
|
|
|
|
done
|
|
|
|
fi
|
|
|
|
|
|
|
|
# Recreate $TOOLDIR.
|
2002-03-21 13:54:50 +03:00
|
|
|
$runcmd mkdir -p "$TOOLDIR/bin" || bomb "mkdir of '$TOOLDIR/bin' failed"
|
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 22:59:43 +03:00
|
|
|
|
|
|
|
# Install nbmake if it was built.
|
|
|
|
if $do_rebuildmake; then
|
2002-03-21 13:54:50 +03:00
|
|
|
$runcmd rm -f "$TOOLDIR/bin/nbmake"
|
|
|
|
$runcmd cp $make "$TOOLDIR/bin/nbmake"
|
|
|
|
$runcmd rm -r -f "$tmpdir"
|
2001-10-24 06:39:56 +04:00
|
|
|
trap 0 1 2 3 15
|
2001-10-19 06:21:03 +04:00
|
|
|
fi
|
|
|
|
|
2001-10-24 06:39:56 +04:00
|
|
|
# Build a nbmake wrapper script, usable by hand as well as by build.sh.
|
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 22:59:43 +03:00
|
|
|
if [ -z "$makewrapper" ]; then
|
2002-03-21 13:54:50 +03:00
|
|
|
makewrapper="$TOOLDIR/bin/nbmake-$MACHINE"
|
2002-03-14 21:33:04 +03:00
|
|
|
if [ ! -z "$BUILDID" ]; then
|
2002-03-21 13:54:50 +03:00
|
|
|
makewrapper="$makewrapper-$BUILDID"
|
2002-03-14 21:33:04 +03:00
|
|
|
fi
|
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 22:59:43 +03:00
|
|
|
fi
|
2001-10-24 06:39:56 +04:00
|
|
|
|
2002-03-21 13:54:50 +03:00
|
|
|
$runcmd rm -f "$makewrapper"
|
2001-11-11 04:34:30 +03:00
|
|
|
if [ "$runcmd" = "echo" ]; then
|
|
|
|
echo 'cat <<EOF >'$makewrapper
|
|
|
|
makewrapout=
|
|
|
|
else
|
2002-03-21 13:54:50 +03:00
|
|
|
makewrapout=">>\$makewrapper"
|
2001-11-11 04:34:30 +03:00
|
|
|
fi
|
2001-11-02 08:07:22 +03:00
|
|
|
|
2001-11-11 04:34:30 +03:00
|
|
|
eval cat <<EOF $makewrapout
|
2001-10-24 06:39:56 +04:00
|
|
|
#! /bin/sh
|
|
|
|
# Set proper variables to allow easy "make" building of a NetBSD subtree.
|
2002-03-21 13:54:50 +03:00
|
|
|
# Generated from: \$NetBSD: build.sh,v 1.53 2002/03/21 10:54:50 pk Exp $
|
2001-10-24 06:39:56 +04:00
|
|
|
#
|
2001-11-02 08:07:22 +03:00
|
|
|
|
|
|
|
EOF
|
2001-11-11 04:34:30 +03:00
|
|
|
for f in $makeenv; do
|
|
|
|
eval echo "$f=\'\$`echo $f`\'\;\ export\ $f" $makewrapout
|
|
|
|
done
|
|
|
|
eval echo "USETOOLS=yes\; export USETOOLS" $makewrapout
|
2001-11-02 08:07:22 +03:00
|
|
|
|
2002-03-21 13:54:50 +03:00
|
|
|
eval cat <<'EOF' $makewrapout
|
2001-11-02 08:07:22 +03:00
|
|
|
|
2002-03-21 13:54:50 +03:00
|
|
|
exec "$TOOLDIR/bin/nbmake" ${1+"$@"}
|
2001-10-24 06:39:56 +04:00
|
|
|
EOF
|
2001-11-11 04:34:30 +03:00
|
|
|
[ "$runcmd" = "echo" ] && echo EOF
|
2002-03-21 13:54:50 +03:00
|
|
|
$runcmd chmod +x "$makewrapper"
|
2001-10-24 06:39:56 +04:00
|
|
|
|
2001-10-31 01:33:00 +03:00
|
|
|
if $do_buildsystem; then
|
2002-03-21 13:54:50 +03:00
|
|
|
${runcmd-exec} "$makewrapper" $buildtarget
|
2001-11-01 03:14:17 +03:00
|
|
|
elif $do_buildonlytools; then
|
|
|
|
if [ "$MKOBJDIRS" != "no" ]; then
|
2002-03-21 13:54:50 +03:00
|
|
|
$runcmd "$makewrapper" obj-tools || exit 1
|
2001-11-01 03:14:17 +03:00
|
|
|
fi
|
2001-11-02 08:07:22 +03:00
|
|
|
$runcmd cd tools
|
2001-12-09 09:07:16 +03:00
|
|
|
if [ "$UPDATE" = "" ]; then
|
2002-03-21 13:54:50 +03:00
|
|
|
${runcmd-exec} "$makewrapper" cleandir dependall install
|
2001-12-09 09:07:16 +03:00
|
|
|
else
|
2002-03-21 13:54:50 +03:00
|
|
|
${runcmd-exec} "$makewrapper" dependall install
|
2001-12-09 09:07:16 +03:00
|
|
|
fi
|
2001-10-31 00:04:05 +03:00
|
|
|
fi
|