(linenum→info "unix/slp.c:2238")

netbsdsrc/4.0/usr/src/build.sh

    1: #! /usr/bin/env sh
    2: #       $NetBSD: build.sh,v 1.153.2.5 2007/11/26 21:40:55 xtraeme Exp $
    3: #
    4: # Copyright (c) 2001-2005 The NetBSD Foundation, Inc.
    5: # All rights reserved.
    6: #
    7: # This code is derived from software contributed to The NetBSD Foundation
    8: # by Todd Vierling and Luke Mewburn.
    9: #
   10: # Redistribution and use in source and binary forms, with or without
   11: # modification, are permitted provided that the following conditions
   12: # are met:
   13: # 1. Redistributions of source code must retain the above copyright
   14: #    notice, this list of conditions and the following disclaimer.
   15: # 2. Redistributions in binary form must reproduce the above copyright
   16: #    notice, this list of conditions and the following disclaimer in the
   17: #    documentation and/or other materials provided with the distribution.
   18: # 3. All advertising materials mentioning features or use of this software
   19: #    must display the following acknowledgement:
   20: #        This product includes software developed by the NetBSD
   21: #        Foundation, Inc. and its contributors.
   22: # 4. Neither the name of The NetBSD Foundation nor the names of its
   23: #    contributors may be used to endorse or promote products derived
   24: #    from this software without specific prior written permission.
   25: #
   26: # THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
   27: # ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
   28: # TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
   29: # PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
   30: # BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
   31: # CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
   32: # SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
   33: # INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
   34: # CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
   35: # ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
   36: # POSSIBILITY OF SUCH DAMAGE.
   37: #
   38: #
   39: # Top level build wrapper, for a system containing no tools.
   40: #
   41: # This script should run on any POSIX-compliant shell.  If the
   42: # first "sh" found in the PATH is a POSIX-compliant shell, then
   43: # you should not need to take any special action.  Otherwise, you
   44: # should set the environment variable HOST_SH to a POSIX-compliant
   45: # shell, and invoke build.sh with that shell.  (Depending on your
   46: # system, one of /bin/ksh, /usr/local/bin/bash, or /usr/xpg4/bin/sh
   47: # might be a suitable shell.)
   48: #
   49: 
   50: progname=${0##*/}
   51: toppid=$$
   52: results=/dev/null
   53: trap "exit 1" 1 2 3 15
   54: 
   55: bomb()
   56: {
   57:         cat >&2 <<ERRORMESSAGE
   58: 
   59: ERROR: $@
   60: *** BUILD ABORTED ***
   61: ERRORMESSAGE
   62:         kill ${toppid}         # in case we were invoked from a subshell
   63:         exit 1
   64: }
   65: 
   66: 
   67: statusmsg()
   68: {
   69:         ${runcmd} echo "===> $@" | tee -a "${results}"
   70: }
   71: 
   72: # Find a program in the PATH
   73: find_in_PATH()
   74: {
   75:         local prog="$1"
   76:         local oldIFS="${IFS}"
   77:         local dir
   78:         IFS=":"
   79:         for dir in ${PATH}; do
   80:                 if [ -x "${dir}/${prog}" ]; then
   81:                         prog="${dir}/${prog}"
   82:                         break
   83:                 fi
   84:         done
   85:         IFS="${oldIFS}"
   86:         echo "${prog}"
   87: }
   88: 
   89: # Try to find a working POSIX shell, and set HOST_SH to refer to it.
   90: # Assumes that uname_s, uname_m, and PWD have been set.
   91: set_HOST_SH()
   92: {
   93:         # Even if ${HOST_SH} is already defined, we still do the
   94:         # sanity checks at the end.
   95: 
   96:         # Solaris has /usr/xpg4/bin/sh.
   97:         #
   98:         [ -z "${HOST_SH}" ] && [ x"${uname_s}" = x"SunOS" ] && \
   99:                 [ -x /usr/xpg4/bin/sh ] && HOST_SH="/usr/xpg4/bin/sh"
  100: 
  101:         # Try to get the name of the shell that's running this script,
  102:         # by parsing the output from "ps".  We assume that, if the host
  103:         # system's ps command supports -o comm at all, it will do so
  104:         # in the usual way: a one-line header followed by a one-line
  105:         # result, possibly including trailing white space.  And if the
  106:         # host system's ps command doesn't support -o comm, we assume
  107:         # that we'll get an error message on stderr and nothing on
  108:         # stdout.  (We don't try to use ps -o 'comm=' to suppress the
  109:         # header line, because that is less widely supported.)
  110:         #
  111:         # If we get the wrong result here, the user can override it by
  112:         # specifying HOST_SH in the environment.
  113:         #
  114:         [ -z "${HOST_SH}" ] && HOST_SH="$(
  115:                 (ps -p $$ -o comm | sed -ne '2s/[ \t]*$//p') 2>/dev/null )"
  116: 
  117:         # If nothing above worked, use "sh".  We will later find the
  118:         # first directory in the PATH that has a "sh" program.
  119:         #
  120:         [ -z "${HOST_SH}" ] && HOST_SH="sh"
  121: 
  122:         # If the result so far is not an absolute path, try to prepend
  123:         # PWD or search the PATH.
  124:         #
  125:         case "${HOST_SH}" in
  126:         /*)    :
  127:                 ;;
  128:         */*)   HOST_SH="${PWD}/${HOST_SH}"
  129:                 ;;
  130:         *)     HOST_SH="$(find_in_PATH "${HOST_SH}")"
  131:                 ;;
  132:         esac
  133: 
  134:         # If we don't have an absolute path by now, bomb.
  135:         #
  136:         case "${HOST_SH}" in
  137:         /*)    :
  138:                 ;;
  139:         *)     bomb "HOST_SH=\"${HOST_SH}\" is not an absolute path."
  140:                 ;;
  141:         esac
  142: 
  143:         # If HOST_SH is not executable, bomb.
  144:         #
  145:         [ -x "${HOST_SH}" ] ||
  146:             bomb "HOST_SH=\"${HOST_SH}\" is not executable."
  147: }
  148: 
  149: initdefaults()
  150: {
  151:         cd "$(dirname $0)"
  152:         [ -d usr.bin/make ] ||
  153:             bomb "build.sh must be run from the top source level"
  154:         [ -f share/mk/bsd.own.mk ] ||
  155:             bomb "src/share/mk is missing; please re-fetch the source tree"
  156: 
  157:         # Find information about the build platform.
  158:         #
  159:         uname_s=$(uname -s 2>/dev/null)
  160:         uname_r=$(uname -r 2>/dev/null)
  161:         uname_m=$(uname -m 2>/dev/null)
  162: 
  163:         # If $PWD is a valid name of the current directory, POSIX mandates
  164:         # that pwd return it by default which causes problems in the
  165:         # presence of symlinks.  Unsetting PWD is simpler than changing
  166:         # every occurrence of pwd to use -P.
  167:         #
  168:         # XXX Except that doesn't work on Solaris. Or many Linuces.
  169:         #
  170:         unset PWD
  171:         TOP=$(/bin/pwd -P 2>/dev/null || /bin/pwd 2>/dev/null)
  172: 
  173:         # The user can set HOST_SH in the environment, or we try to
  174:         # guess an appropriate value.  Then we set several other
  175:         # variables from HOST_SH.
  176:         #
  177:         set_HOST_SH
  178:         setmakeenv HOST_SH "${HOST_SH}"
  179:         setmakeenv BSHELL "${HOST_SH}"
  180:         setmakeenv CONFIG_SHELL "${HOST_SH}"
  181: 
  182:         # Set defaults.
  183:         #
  184:         toolprefix=nb
  185: 
  186:         # Some systems have a small ARG_MAX.  -X prevents make(1) from
  187:         # exporting variables in the environment redundantly.
  188:         #
  189:         case "${uname_s}" in
  190:         Darwin | FreeBSD | CYGWIN*)
  191:                 MAKEFLAGS=-X
  192:                 ;;
  193:         *)
  194:                 MAKEFLAGS=
  195:                 ;;
  196:         esac
  197: 
  198:         makeenv=
  199:         makewrapper=
  200:         makewrappermachine=
  201:         runcmd=
  202:         operations=
  203:         removedirs=
  204:         do_expertmode=false
  205:         do_rebuildmake=false
  206:         do_removedirs=false
  207: 
  208:         # do_{operation}=true if given operation is requested.
  209:         #
  210:         do_tools=false
  211:         do_obj=false
  212:         do_build=false
  213:         do_distribution=false
  214:         do_release=false
  215:         do_kernel=false
  216:         do_releasekernel=false
  217:         do_install=false
  218:         do_sets=false
  219:         do_sourcesets=false
  220:         do_syspkgs=false
  221:         do_iso_image=false
  222:         do_iso_image_source=false
  223:         do_params=false
  224: 
  225:         # Create scratch directory
  226:         #
  227:         tmpdir="${TMPDIR-/tmp}/nbbuild$$"
  228:         mkdir "${tmpdir}" || bomb "Cannot mkdir: ${tmpdir}"
  229:         trap "cd /; rm -r -f \"${tmpdir}\"" 0
  230:         results="${tmpdir}/build.sh.results"
  231: 
  232:         # Set source directories
  233:         #
  234:         setmakeenv NETBSDSRCDIR "${TOP}"
  235: 
  236:         # Find the version of NetBSD
  237:         #
  238:         DISTRIBVER="$(${HOST_SH} ${TOP}/sys/conf/osrelease.sh)"
  239: 
  240:         # Set various environment variables to known defaults,
  241:         # to minimize (cross-)build problems observed "in the field".
  242:         #
  243:         unsetmakeenv INFODIR
  244:         unsetmakeenv LESSCHARSET
  245:         setmakeenv LC_ALL C
  246: }
  247: 
  248: getarch()
  249: {
  250:         # Translate a MACHINE into a default MACHINE_ARCH.
  251:         #
  252:         case "${MACHINE}" in
  253: 
  254:         acorn26|acorn32|cats|evbarm|hpcarm|iyonix|netwinder|shark)
  255:                 MACHINE_ARCH=arm
  256:                 ;;
  257: 
  258:         hp700)
  259:                 MACHINE_ARCH=hppa
  260:                 ;;
  261: 
  262:         sun2)
  263:                 MACHINE_ARCH=m68000
  264:                 ;;
  265: 
  266:         amiga|atari|cesfic|hp300|luna68k|mac68k|mvme68k|news68k|next68k|sun3|x68k)
  267:                 MACHINE_ARCH=m68k
  268:                 ;;
  269: 
  270:         evbmips-e[bl]|sbmips-e[bl])
  271:                 MACHINE_ARCH=mips${MACHINE##*-}
  272:                 makewrappermachine=${MACHINE}
  273:                 MACHINE=${MACHINE%-e[bl]}
  274:                 ;;
  275: 
  276:         evbmips64-e[bl]|sbmips64-e[bl])
  277:                 MACHINE_ARCH=mips64${MACHINE##*-}
  278:                 makewrappermachine=${MACHINE}
  279:                 MACHINE=${MACHINE%64-e[bl]}
  280:                 ;;
  281: 
  282:         evbmips|sbmips)                # no default MACHINE_ARCH
  283:                 ;;
  284: 
  285:         ews4800mips|mipsco|newsmips|sgimips)
  286:                 MACHINE_ARCH=mipseb
  287:                 ;;
  288: 
  289:         algor|arc|cobalt|hpcmips|playstation2|pmax)
  290:                 MACHINE_ARCH=mipsel
  291:                 ;;
  292: 
  293:         pc532)
  294:                 MACHINE_ARCH=ns32k
  295:                 ;;
  296: 
  297:         amigappc|bebox|evbppc|ibmnws|macppc|mvmeppc|ofppc|pmppc|prep|sandpoint)
  298:                 MACHINE_ARCH=powerpc
  299:                 ;;
  300: 
  301:         evbsh3-e[bl])
  302:                 MACHINE_ARCH=sh3${MACHINE##*-}
  303:                 makewrappermachine=${MACHINE}
  304:                 MACHINE=${MACHINE%-e[bl]}
  305:                 ;;
  306: 
  307:         evbsh3)                        # no default MACHINE_ARCH
  308:                 ;;
  309: 
  310:         mmeye)
  311:                 MACHINE_ARCH=sh3eb
  312:                 ;;
  313: 
  314:         dreamcast|hpcsh|landisk)
  315:                 MACHINE_ARCH=sh3el
  316:                 ;;
  317: 
  318:         amd64)
  319:                 MACHINE_ARCH=x86_64
  320:                 ;;
  321: 
  322:         alpha|i386|sparc|sparc64|vax|ia64)
  323:                 MACHINE_ARCH=${MACHINE}
  324:                 ;;
  325: 
  326:         *)
  327:                 bomb "Unknown target MACHINE: ${MACHINE}"
  328:                 ;;
  329: 
  330:         esac
  331: }
  332: 
  333: validatearch()
  334: {
  335:         # Ensure that the MACHINE_ARCH exists (and is supported by build.sh).
  336:         #
  337:         case "${MACHINE_ARCH}" in
  338: 
  339:         alpha|arm|armeb|hppa|i386|m68000|m68k|mipse[bl]|mips64e[bl]|ns32k|powerpc|powerpc64|sh[35]e[bl]|sparc|sparc64|vax|x86_64|ia64)
  340:                 ;;
  341: 
  342:         "")
  343:                 bomb "No MACHINE_ARCH provided"
  344:                 ;;
  345: 
  346:         *)
  347:                 bomb "Unknown target MACHINE_ARCH: ${MACHINE_ARCH}"
  348:                 ;;
  349: 
  350:         esac
  351: 
  352:         # Determine valid MACHINE_ARCHs for MACHINE
  353:         #
  354:         case "${MACHINE}" in
  355: 
  356:         evbarm)
  357:                 arches="arm armeb"
  358:                 ;;
  359: 
  360:         evbmips|sbmips)
  361:                 arches="mipseb mipsel mips64eb mips64el"
  362:                 ;;
  363: 
  364:         sgimips)
  365:                 arches="mipseb mips64eb"
  366:                 ;;
  367: 
  368:         evbsh3)
  369:                 arches="sh3eb sh3el"
  370:                 ;;
  371: 
  372:         macppc|evbppc)
  373:                 arches="powerpc powerpc64"
  374:                 ;;
  375:         *)
  376:                 oma="${MACHINE_ARCH}"
  377:                 getarch
  378:                 arches="${MACHINE_ARCH}"
  379:                 MACHINE_ARCH="${oma}"
  380:                 ;;
  381: 
  382:         esac
  383: 
  384:         # Ensure that MACHINE_ARCH supports MACHINE
  385:         #
  386:         archok=false
  387:         for a in ${arches}; do
  388:                 if [ "${a}" = "${MACHINE_ARCH}" ]; then
  389:                         archok=true
  390:                         break
  391:                 fi
  392:         done
  393:         ${archok} ||
  394:             bomb "MACHINE_ARCH '${MACHINE_ARCH}' does not support MACHINE '${MACHINE}'"
  395: }
  396: 
  397: raw_getmakevar()
  398: {
  399:         [ -x "${make}" ] || bomb "raw_getmakevar $1: ${make} is not executable"
  400:         "${make}" -m ${TOP}/share/mk -s -B -f- _x_ <<EOF
  401: _x_:
  402:         echo \${$1}
  403: .include <bsd.prog.mk>
  404: .include <bsd.kernobj.mk>
  405: EOF
  406: }
  407: 
  408: getmakevar()
  409: {
  410:         # raw_getmakevar() doesn't work properly if $make hasn't yet been
  411:         # built, which can happen when running with the "-n" option.
  412:         # getmakevar() deals with this by emitting a literal '$'
  413:         # followed by the variable name, instead of trying to find the
  414:         # variable's value.
  415:         #
  416:         if [ -x "${make}" ]; then
  417:                 raw_getmakevar "$1"
  418:         else
  419:                 echo "\$$1"
  420:         fi
  421: }
  422: 
  423: setmakeenv()
  424: {
  425:         eval "$1='$2'; export $1"
  426:         makeenv="${makeenv} $1"
  427: }
  428: 
  429: unsetmakeenv()
  430: {
  431:         eval "unset $1"
  432:         makeenv="${makeenv} $1"
  433: }
  434: 
  435: # Convert possibly-relative path to absolute path by prepending
  436: # ${TOP} if necessary.  Also delete trailing "/", if any.
  437: resolvepath()
  438: {
  439:         case "${OPTARG}" in
  440:         /)
  441:                 ;;
  442:         /*)
  443:                 OPTARG="${OPTARG%/}"
  444:                 ;;
  445:         *)
  446:                 OPTARG="${TOP}/${OPTARG%/}"
  447:                 ;;
  448:         esac
  449: }
  450: 
  451: usage()
  452: {
  453:         if [ -n "$*" ]; then
  454:                 echo ""
  455:                 echo "${progname}: $*"
  456:         fi
  457:         cat <<_usage_
  458: 
  459: Usage: ${progname} [-EnorUux] [-a arch] [-B buildid] [-C cddir] [-D dest]
  460:                 [-j njob] [-M obj] [-m mach] [-N noisy] [-O obj] [-R release]
  461:                 [-T tools] [-V var=[value]] [-w wrapper] [-X x11src] [-Z var]
  462:                 operation [...]
  463: 
  464:  Build operations (all imply "obj" and "tools"):
  465:     build               Run "make build".
  466:     distribution        Run "make distribution" (includes DESTDIR/etc/ files).
  467:     release             Run "make release" (includes kernels & distrib media).
  468: 
  469:  Other operations:
  470:     help                Show this message and exit.
  471:     makewrapper         Create ${toolprefix}make-\${MACHINE} wrapper and ${toolprefix}make.
  472:                         Always performed.
  473:     obj                 Run "make obj".  [Default unless -o is used]
  474:     tools               Build and install tools.
  475:     install=idir        Run "make installworld" to \`idir' to install all sets
  476:                         except \`etc'.  Useful after "distribution" or "release"
  477:     kernel=conf         Build kernel with config file \`conf'
  478:     releasekernel=conf  Install kernel built by kernel=conf to RELEASEDIR.
  479:     sets                Create binary sets in RELEASEDIR/MACHINE/binary/sets.
  480:                         DESTDIR should be populated beforehand.
  481:     sourcesets          Create source sets in RELEASEDIR/source/sets.
  482:     syspkgs             Create syspkgs in RELEASEDIR/MACHINE/binary/syspkgs.
  483:     iso-image           Create CD-ROM image in RELEASEDIR/iso.
  484:     iso-image-source    Create CD-ROM image with source in RELEASEDIR/iso.
  485:     params              Display various make(1) parameters.
  486: 
  487:  Options:
  488:     -a arch     Set MACHINE_ARCH to arch.  [Default: deduced from MACHINE]
  489:     -B buildId  Set BUILDID to buildId.
  490:     -C cddir    Set CDEXTRA to cddir.
  491:     -D dest     Set DESTDIR to dest.  [Default: destdir.MACHINE]
  492:     -E          Set "expert" mode; disables various safety checks.
  493:                 Should not be used without expert knowledge of the build system.
  494:     -h          Print this help message.
  495:     -j njob     Run up to njob jobs in parallel; see make(1) -j.
  496:     -M obj      Set obj root directory to obj; sets MAKEOBJDIRPREFIX.
  497:                 Unsets MAKEOBJDIR.
  498:     -m mach     Set MACHINE to mach; not required if NetBSD native.
  499:     -N noisy    Set the noisyness (MAKEVERBOSE) level of the build:
  500:                     0 Quiet
  501:                     1 Operations are described, commands are suppressed
  502:                     2 Full output
  503:                 [Default: 2]
  504:     -n          Show commands that would be executed, but do not execute them.
  505:     -O obj      Set obj root directory to obj; sets a MAKEOBJDIR pattern.
  506:                 Unsets MAKEOBJDIRPREFIX.
  507:     -o          Set MKOBJDIRS=no; do not create objdirs at start of build.
  508:     -R release  Set RELEASEDIR to release.  [Default: releasedir]
  509:     -r          Remove contents of TOOLDIR and DESTDIR before building.
  510:     -T tools    Set TOOLDIR to tools.  If unset, and TOOLDIR is not set in
  511:                 the environment, ${toolprefix}make will be (re)built unconditionally.
  512:     -U          Set MKUNPRIVED=yes; build without requiring root privileges,
  513:                 install from an UNPRIVED build with proper file permissions.
  514:     -u          Set MKUPDATE=yes; do not run "make clean" first.
  515:                 Without this, everything is rebuilt, including the tools.
  516:     -V v=[val]  Set variable \`v' to \`val'.
  517:     -w wrapper  Create ${toolprefix}make script as wrapper.
  518:                 [Default: \${TOOLDIR}/bin/${toolprefix}make-\${MACHINE}]
  519:     -X x11src   Set X11SRCDIR to x11src.  [Default: /usr/xsrc]
  520:     -x          Set MKX11=yes; build X11R6 from X11SRCDIR
  521:     -Z v        Unset ("zap") variable \`v'.
  522: 
  523: _usage_
  524:         exit 1
  525: }
  526: 
  527: parseoptions()
  528: {
  529:         opts='a:B:bC:D:dEhi:j:k:M:m:N:nO:oR:rT:tUuV:w:xX:Z:'
  530:         opt_a=no
  531: 
  532:         if type getopts >/dev/null 2>&1; then
  533:                 # Use POSIX getopts.
  534:                 #
  535:                 getoptcmd='getopts ${opts} opt && opt=-${opt}'
  536:                 optargcmd=':'
  537:                 optremcmd='shift $((${OPTIND} -1))'
  538:         else
  539:                 type getopt >/dev/null 2>&1 ||
  540:                     bomb "/bin/sh shell is too old; try ksh or bash"
  541: 
  542:                 # Use old-style getopt(1) (doesn't handle whitespace in args).
  543:                 #
  544:                 args="$(getopt ${opts} $*)"
  545:                 [ $? = 0 ] || usage
  546:                 set -- ${args}
  547: 
  548:                 getoptcmd='[ $# -gt 0 ] && opt="$1" && shift'
  549:                 optargcmd='OPTARG="$1"; shift'
  550:                 optremcmd=':'
  551:         fi
  552: 
  553:         # Parse command line options.
  554:         #
  555:         while eval ${getoptcmd}; do
  556:                 case ${opt} in
  557: 
  558:                 -a)
  559:                         eval ${optargcmd}
  560:                         MACHINE_ARCH=${OPTARG}
  561:                         opt_a=yes
  562:                         ;;
  563: 
  564:                 -B)
  565:                         eval ${optargcmd}
  566:                         BUILDID=${OPTARG}
  567:                         ;;
  568: 
  569:                 -b)
  570:                         usage "'-b' has been replaced by 'makewrapper'"
  571:                         ;;
  572: 
  573:                 -C)
  574:                         eval ${optargcmd}; resolvepath
  575:                         iso_dir=${OPTARG}
  576:                         ;;
  577: 
  578:                 -D)
  579:                         eval ${optargcmd}; resolvepath
  580:                         setmakeenv DESTDIR "${OPTARG}"
  581:                         ;;
  582: 
  583:                 -d)
  584:                         usage "'-d' has been replaced by 'distribution'"
  585:                         ;;
  586: 
  587:                 -E)
  588:                         do_expertmode=true
  589:                         ;;
  590: 
  591:                 -i)
  592:                         usage "'-i idir' has been replaced by 'install=idir'"
  593:                         ;;
  594: 
  595:                 -j)
  596:                         eval ${optargcmd}
  597:                         parallel="-j ${OPTARG}"
  598:                         ;;
  599: 
  600:                 -k)
  601:                         usage "'-k conf' has been replaced by 'kernel=conf'"
  602:                         ;;
  603: 
  604:                 -M)
  605:                         eval ${optargcmd}; resolvepath
  606:                         makeobjdir="${OPTARG}"
  607:                         unsetmakeenv MAKEOBJDIR
  608:                         setmakeenv MAKEOBJDIRPREFIX "${OPTARG}"
  609:                         ;;
  610: 
  611:                         # -m overrides MACHINE_ARCH unless "-a" is specified
  612:                 -m)
  613:                         eval ${optargcmd}
  614:                         MACHINE="${OPTARG}"
  615:                         [ "${opt_a}" != "yes" ] && getarch
  616:                         ;;
  617: 
  618:                 -N)
  619:                         eval ${optargcmd}
  620:                         case "${OPTARG}" in
  621:                         0|1|2)
  622:                                 setmakeenv MAKEVERBOSE "${OPTARG}"
  623:                                 ;;
  624:                         *)
  625:                                 usage "