#!/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

touch $LOGFILE

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

#Save the old ldconfig path
#set ldconfigpath=`ldconfig -r`
#ldconfig /usr/local/lib -v

foreach i ( bin sbin libexec usr.bin usr.sbin gnu share games)
    echo "    making /$i... (`date`)" >> $LOGFILE
    cd /usr/src/$i
    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
    if ( -f /usr/src/utils/.cleanafter ) then
        echo "        skipping make depend... (`date`)" >> $LOGFILE
    else
        echo "        make depend... (`date`)" >> $LOGFILE
        make depend
    endif
    echo "        make... (`date`)" >> $LOGFILE
    make
    echo "        make install... (`date`)" >> $LOGFILE
    make install
    if (-f /usr/src/utils/.cleanafter) then
        echo "        make clean (cleanup after) "
        make clean
    endif
end

if (-f /usr/src/utils/.this.is.a.i386) then  
echo "    making pcvt utils... (`date`)" >> $LOGFILE
cd /sys/arch/i386/isa/pcvt/Util/
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
endif
echo "        make depend... (`date`)" >> $LOGFILE
make depend
echo "        make... (`date`)" >> $LOGFILE
make
echo "        make install... (`date`)" >> $LOGFILE
make install

echo "Finished rebuild_bin build (`date`)" >> $LOGFILE
#ldconfig $ldconfigpath
#     ---------- >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...
#-----------------------------------------------------------------------------


