[BACK]Return to build.sh CVS log [TXT][DIR] Up to [cvs.NetBSD.org] / src

Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.

Diff for /src/build.sh between version 1.71 and 1.72

version 1.71, 2002/11/05 01:53:58 version 1.72, 2002/11/17 12:59:37
Line 138  _usage_
Line 138  _usage_
 MAKEFLAGS=  MAKEFLAGS=
 buildtarget=build  buildtarget=build
 do_buildsystem=true  do_buildsystem=true
 do_buildonlykernel=false  do_buildkernel=false
 do_buildonlytools=false  do_buildtools=false
 do_rebuildmake=false  do_rebuildmake=false
 do_removedirs=false  do_removedirs=false
 makeenv=  makeenv=
Line 179  while eval $getoptcmd; do case $opt in
Line 179  while eval $getoptcmd; do case $opt in
         -j)     eval $optargcmd          -j)     eval $optargcmd
                 parallel="-j $OPTARG";;                  parallel="-j $OPTARG";;
   
         -k)     do_buildonlykernel=true; do_buildsystem=false          -k)     do_buildkernel=true; do_buildsystem=false
                 eval $optargcmd                  eval $optargcmd
                 KERNCONFNAME=$OPTARG;;                  kernconfname=$OPTARG;;
   
         # -m overrides MACHINE_ARCH unless "-a" is specified          # -m overrides MACHINE_ARCH unless "-a" is specified
         -m)     eval $optargcmd          -m)     eval $optargcmd
Line 193  while eval $getoptcmd; do case $opt in
Line 193  while eval $getoptcmd; do case $opt in
   
         -r)     do_removedirs=true; do_rebuildmake=true;;          -r)     do_removedirs=true; do_rebuildmake=true;;
   
         -t)     do_buildonlytools=true; do_buildsystem=false;;          -t)     do_buildtools=true; do_buildsystem=false;;
   
         -U)     UNPRIVED=yes; export UNPRIVED          -U)     UNPRIVED=yes; export UNPRIVED
                 makeenv="$makeenv UNPRIVED";;                  makeenv="$makeenv UNPRIVED";;
Line 279  if $do_rebuildmake; then
Line 279  if $do_rebuildmake; then
         trap "exit 1" 1 2 3 15          trap "exit 1" 1 2 3 15
         $runcmd cd "$tmpdir"          $runcmd cd "$tmpdir"
   
         $runcmd env CC="${HOST_CC-cc}" CPPFLAGS="${HOST_CPPFLAGS}" CFLAGS="${HOST_CFLAGS--O}" LDFLAGS="${HOST_LDFLAGS}" \          $runcmd env CC="${HOST_CC-cc}" CPPFLAGS="${HOST_CPPFLAGS}" \
                 "$TOP/tools/make/configure" || bomb "configure of nbmake failed"                  CFLAGS="${HOST_CFLAGS--O}" LDFLAGS="${HOST_LDFLAGS}" \
                   "$TOP/tools/make/configure" \
                   || bomb "configure of nbmake failed"
         $runcmd sh buildmake.sh || bomb "build of nbmake failed"          $runcmd sh buildmake.sh || bomb "build of nbmake failed"
   
         make="$tmpdir/nbmake"          make="$tmpdir/nbmake"
Line 317  fi
Line 319  fi
 # default setting from <bsd.own.mk> is used.  # default setting from <bsd.own.mk> is used.
 if [ -z "$TOOLDIR" ] && [ "$MKOBJDIRS" != "no" ]; then  if [ -z "$TOOLDIR" ] && [ "$MKOBJDIRS" != "no" ]; then
         $runcmd cd tools          $runcmd cd tools
         $runcmd $make -m ${TOP}/share/mk obj NOSUBDIR= || exit 1          $runcmd $make -m ${TOP}/share/mk obj NOSUBDIR= \
                   || bomb "make obj failed in tools"
         $runcmd cd "$TOP"          $runcmd cd "$TOP"
 fi  fi
   
Line 337  if [ "$runcmd" = "echo" ]; then
Line 340  if [ "$runcmd" = "echo" ]; then
 else  else
         DESTDIR=`getmakevar DESTDIR`;          DESTDIR=`getmakevar DESTDIR`;
         [ $? = 0 ] || bomb "getmakevar DESTDIR failed";          [ $? = 0 ] || bomb "getmakevar DESTDIR failed";
         echo "===> DESTDIR path: $DESTDIR"          $runcmd echo "===> DESTDIR path: $DESTDIR"
   
         TOOLDIR=`getmakevar TOOLDIR`;          TOOLDIR=`getmakevar TOOLDIR`;
         [ $? = 0 ] || bomb "getmakevar TOOLDIR failed";          [ $? = 0 ] || bomb "getmakevar TOOLDIR failed";
         echo "===> TOOLDIR path: $TOOLDIR"          $runcmd echo "===> TOOLDIR path: $TOOLDIR"
   
         export DESTDIR TOOLDIR          export DESTDIR TOOLDIR
 fi  fi
Line 359  if [ -z "$DESTDIR" ] || [ "$DESTDIR" = "
Line 362  if [ -z "$DESTDIR" ] || [ "$DESTDIR" = "
             [ "`uname -m`" != "$MACHINE" ]); then              [ "`uname -m`" != "$MACHINE" ]); then
                 bomb "DESTDIR must be set to a non-root path for cross builds or -d or -R."                  bomb "DESTDIR must be set to a non-root path for cross builds or -d or -R."
         elif $do_buildsystem; then          elif $do_buildsystem; then
                 echo "===> WARNING: Building to /."                  $runcmd echo "===> WARNING: Building to /."
                 echo "===> If your kernel is not up to date, this may cause the system to break!"                  $runcmd echo "===> If your kernel is not up to date, this may cause the system to break!"
         fi          fi
 else  else
         removedirs="$removedirs $DESTDIR"          removedirs="$removedirs $DESTDIR"
Line 369  fi
Line 372  fi
 # Remove the target directories.  # Remove the target directories.
 if $do_removedirs; then  if $do_removedirs; then
         for f in $removedirs; do          for f in $removedirs; do
                 echo "===> Removing $f"                  $runcmd echo "===> Removing $f"
                 $runcmd rm -r -f $f                  $runcmd rm -r -f $f
         done          done
 fi  fi
Line 380  $runcmd mkdir -p "$TOOLDIR/bin" || bomb 
Line 383  $runcmd mkdir -p "$TOOLDIR/bin" || bomb 
 # Install nbmake if it was built.  # Install nbmake if it was built.
 if $do_rebuildmake; then  if $do_rebuildmake; then
         $runcmd rm -f "$TOOLDIR/bin/nbmake"          $runcmd rm -f "$TOOLDIR/bin/nbmake"
         $runcmd cp $make "$TOOLDIR/bin/nbmake"          $runcmd cp $make "$TOOLDIR/bin/nbmake" \
                   || bomb "failed to install \$TOOLDIR/bin/nbmake"
           make="$TOOLDIR/bin/nbmake"
         $runcmd rm -r -f "$tmpdir"          $runcmd rm -r -f "$tmpdir"
         trap 0 1 2 3 15          trap 0 1 2 3 15
 fi  fi
Line 421  EOF
Line 426  EOF
 $runcmd chmod +x "$makewrapper"  $runcmd chmod +x "$makewrapper"
   
 if $do_buildsystem; then  if $do_buildsystem; then
         ${runcmd-exec} "$makewrapper" $parallel $buildtarget          # Build everything.
           ${runcmd-exec} "$makewrapper" $parallel $buildtarget \
                   || bomb "failed to make $buildtarget"
 else  else
         # One or more of do_buildonlytools and do_buildonlykernel          # One or more of do_buildtools and do_buildkernel
         # might be set.  Do them in the appropriate order.          # might be set.  Do them in the appropriate order.
         if $do_buildonlytools; then          if $do_buildtools; then
                 if [ "$MKOBJDIRS" != "no" ]; then                  if [ "$MKOBJDIRS" != "no" ]; then
                         $runcmd "$makewrapper" $parallel obj-tools || exit 1                          $runcmd "$makewrapper" $parallel obj-tools \
                                   || bomb "failed to make obj-tools"
                 fi                  fi
                 $runcmd cd tools                  $runcmd cd tools
                 if [ "$UPDATE" = "" ]; then                  if [ "$UPDATE" = "" ]; then
                         $runcmd "$makewrapper" cleandir dependall install                          $runcmd "$makewrapper" cleandir dependall install \
                                   || bomb "failed to make tools"
                 else                  else
                         $runcmd "$makewrapper" dependall install                          $runcmd "$makewrapper" dependall install \
                                   || bomb "failed to make tools"
                 fi                  fi
         fi          fi
         if $do_buildonlykernel; then          if $do_buildkernel; then
                 $runcmd echo "===> Building kernel ${KERNCONFNAME}"                  if ! $do_buildtools; then
                           # Building tools every time we build a kernel
                           # is clearly unnecessary.  We could try to
                           # figure out whether rebuilding the tools is
                           # necessary this time, but it doesn't seem
                           # worth the trouble.  Instead, we say it's the
                           # user's responsibility to rebuild the tools if
                           # necessary.
                           $runcmd echo "===> Building kernel" \
                                   "without building new tools"
                   fi
                   $runcmd echo "===> Building kernel ${kernconfname}"
                   # The correct value of KERNOBJDIR might depend on a
                   # prior "make obj" in TOP/etc.
                   if [ "$MKOBJDIRS" != "no" ] && [ ! -z "$makeobjdir" ]; then
                           $runcmd cd "$TOP/etc"
                           $runcmd "$makewrapper" obj \
                                   || bomb "failed to make obj in etc"
                           $runcmd cd "$TOP"
                   fi
                 if [ "$runcmd" = "echo" ]; then                  if [ "$runcmd" = "echo" ]; then
                         # shown symbolically with -n                          # shown symbolically with -n
                         # because getmakevar might not work yet                          # because getmakevar might not work yet
                         KERNCONFDIR='${KERNCONFDIR}'                          KERNCONFDIR='$KERNCONFDIR'
                         KERNOBJDIR='${KERNOBJDIR}'                          KERNOBJDIR='$KERNOBJDIR'
                 else                  else
                         KERNCONFDIR="$( getmakevar KERNCONFDIR )"                          KERNCONFDIR="$( getmakevar KERNCONFDIR )"
                           [ $? = 0 ] || bomb "getmakevar KERNCONFDIR failed";
                         KERNOBJDIR="$( getmakevar KERNOBJDIR )"                          KERNOBJDIR="$( getmakevar KERNOBJDIR )"
                           [ $? = 0 ] || bomb "getmakevar KERNOBJDIR failed";
                 fi                  fi
                 case "${KERNCONFNAME}" in                  case "${kernconfname}" in
                 */*)                  */*)
                         kernconfpath=${KERNCONFNAME}                          kernconfpath="${kernconfname}"
                         KERNCONFNAME=`basename ${KERNCONFNAME}`                          kernconfbase="$( basename "${kernconfname}" )"
                         ;;                          ;;
                 *)                  *)
                         kernconfpath=${KERNCONFDIR}/${KERNCONFNAME}                          kernconfpath="${KERNCONFDIR}/${kernconfname}"
                           kernconfbase="${kernconfname}"
                         ;;                          ;;
                 esac                  esac
                 $runcmd mkdir -p "${KERNOBJDIR}/${KERNCONFNAME}"                  kernbuilddir="${KERNOBJDIR}/${kernconfbase}"
                   $runcmd echo "===> Kernel build directory: ${kernbuilddir}"
                   $runcmd mkdir -p "${kernbuilddir}" \
                           || bomb "cannot mkdir: ${kernbuilddir}"
                 if [ "$UPDATE" = "" ]; then                  if [ "$UPDATE" = "" ]; then
                         $runcmd cd "${KERNOBJDIR}/${KERNCONFNAME}"                          $runcmd cd "${kernbuilddir}"
                         $runcmd "$makewrapper" cleandir                          $runcmd "$makewrapper" cleandir \
                                   || bomb "make cleandir failed in " \
                                           "${kernbuilddir}"
                         $runcmd cd "$TOP"                          $runcmd cd "$TOP"
                 fi                  fi
                 $runcmd "${TOOLDIR}/bin/nbconfig" \                  $runcmd "${TOOLDIR}/bin/nbconfig" \
                         -b "${KERNOBJDIR}/${KERNCONFNAME}" \                          -b "${kernbuilddir}" \
                         -s "${TOP}/sys" "${kernconfpath}"                          -s "${TOP}/sys" "${kernconfpath}" \
                 $runcmd cd "${KERNOBJDIR}/${KERNCONFNAME}"                          || bomb "nbconfig failed for ${kernconfname}"
                 $runcmd "$makewrapper" depend                  $runcmd cd "${kernbuilddir}"
                 $runcmd "$makewrapper" $parallel all                  $runcmd "$makewrapper" depend \
                 echo "New kernel should be in ${KERNOBJDIR}/${KERNCONFNAME}"                          || bomb "make depend failed in ${kernbuilddir}"
                   $runcmd "$makewrapper" $parallel all \
                           || bomb "make all failed in ${kernbuilddir}"
                   $runcmd echo "===> New kernel should be in ${kernbuilddir}"
         fi          fi
 fi  fi

Legend:
Removed from v.1.71  
changed lines
  Added in v.1.72

CVSweb <webmaster@jp.NetBSD.org>