#!/bin/csh
## !/bin/tcsh
#From: "Michael L. VanLoon -- HeadCandy.com" <michaelv@HeadCandy.com>
#Sender: owner-current-users@NetBSD.ORG
#Precedence: list
#X-Loop: current-users@NetBSD.ORG
#X-Status: 
#
#
#>[ On Thu, March  2, 1995 at 04:52:17 (-0800), Alistair G. Crooks wrote: ]
#>> Due to some masochistic compulsion, I've just done this, and these
#>> are the steps that I used (on the i386 platform):
#
#>Why doesn't the top level Makefile do all of this properly (assuming you
#>select the right pseudo-target for it to build)?
#
#Because, I believe, the top-level Makefile is designed to rebuild a
#static system (like one of the releases).  It is not intended as a
#tool for upgrading to interum sources.
#
#I have a script I wrote that seems to do everything fairly well.  I
#don't know if it is capable of correctly building a system that is
#severely behind current, but it works excellently for keeping current
#with the on-going development sources.
#
#For your amusement, here it is:
#
#---------- >8 ----- begin /usr/src/utils/doall ----- 8< ----------

source /root/bin/rebuild_setenv

echo " " >> $LOGFILE
echo "Starting build_tobin (`date`)" >> $LOGFILE

if ( ! -f /usr/src/utils/.dosup ) then
    echo "Skipping sup" >> $LOGFILE
else
    echo "Starting sup (`date`)" >> $LOGFILE
    cd /usr/sup/
    # Run custom sup script:
    /root/bin/sup-it
    echo "Finished sup (`date`)" >> $LOGFILE
endif

echo "Starting preliminary updates (`date`)" >> $LOGFILE
echo "    /usr/src/include/... (`date`)" >> $LOGFILE
cd /usr/src/include/
make clean obj depend all install
echo "    making make... (`date`)" >> $LOGFILE
cd /usr/src/usr.bin/make/
rm -f obj/.depend
make clean obj depend all install
echo "    /usr/src/share/mk/... (`date`)" >> $LOGFILE
cd /usr/src/share/mk/
make clean obj depend all install
echo "Finished preliminary updates (`date`)" >> $LOGFILE

echo "Starting main build (`date`)" >> $LOGFILE

echo "    making libraries... (`date`)" >> $LOGFILE
cd /usr/src/lib/
echo "        src/lib/... (`date`)" >> $LOGFILE
if ( -f /usr/src/utils/.noclean ) then
    echo "        skipping make clean, obj... (`date`)" >> $LOGFILE
else
    echo "        make clean, obj... (`date`)" >> $LOGFILE
    make clean obj
endif
echo "        make depend... (`date`)" >> $LOGFILE
make depend
echo "        make... (`date`)" >> $LOGFILE
make
# Do it again just in case we get a sig 11 somewhere:
echo "        make (paranoid)... (`date`)" >> $LOGFILE
make
echo "        make install... (`date`)" >> $LOGFILE
make install
echo "        src/gnu/lib/... (`date`)" >> $LOGFILE
cd /usr/src/gnu/lib/
if ( ! -f /usr/src/utils/.noclean ) then
    make clean obj
endif
if ( ! -f /usr/src/utils/.cleanafter ) then
    make depend
endif
make all install
if ( -f /usr/src/utils/.cleanafter ) then
    make clean
endif

# Use custom Makefile to build just gcc, gas, and ld:
if ( -f /usr/src/utils/.buildgcc ) then
   echo "    making compilers... (`date`)" >> $LOGFILE
   cd /usr/src/gnu/usr.bin/
   echo "        make clean, obj... (`date`)" >> $LOGFILE
   make -f Makefile.compilers clean obj
   if ( -f /usr/src/utils/.cleanafter ) then
      echo "   Skipping make depend for Makefile.compilers"  >> $LOGFILE
   else
      echo "        make depend... (`date`)" >> $LOGFILE
      make -f Makefile.compilers depend
   endif
   echo "        make... (`date`)" >> $LOGFILE
   make -f Makefile.compilers
   echo "        make install... (`date`)" >> $LOGFILE
   make -f Makefile.compilers install
   if ( -f /usr/src/utils/.cleanafter)  then
      make clean
   endif
endif

echo "Finished build_tobin (`date`)" >> $LOGFILE
#     ---------- >8 -----  end /usr/src/utils/doall  ----- 8< ----------
#
#-----------------------------------------------------------------------------
#  Michael L. VanLoon                                 michaelv@HeadCandy.com
#       --<  Free your mind and your machine -- NetBSD free un*x  >--
#     NetBSD working ports: 386+PC, Mac, Amiga, HP300, Sun3, Sun4, PC532,
#                           DEC pmax (MIPS R2k/3k), DEC/AXP (Alpha)
#     NetBSD ports in progress: VAX and others...
#-----------------------------------------------------------------------------


