Subject: Re: order of compiling/variables for -current
To: Greg A. Woods <woods@kuma.web.net>
From: Michael L. VanLoon -- HeadCandy.com <michaelv@HeadCandy.com>
List: current-users
Date: 03/02/1995 14:56:37
>[ 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< ----------
#!/bin/tcsh
## !/bin/csh

setenv DOALL
#setenv NOPROFILE
setenv MAKEFLAGS '-k'
setenv BSDSRCDIR '/usr/src'
setenv BSDOBJDIR '/local/obj'

set ARCH='i386'
# Config filename:
set CONFIG='MINDBENDER'

set LOGFILE='/usr/src/utils/logs/build.log'
touch $LOGFILE

echo " " >> $LOGFILE
echo "Starting build (`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:
    ./supit
    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
make depend all install
ldconfig /usr/local/lib -v

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

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
    echo "        make depend... (`date`)" >> $LOGFILE
    make depend
    echo "        make... (`date`)" >> $LOGFILE
    make
    echo "        make install... (`date`)" >> $LOGFILE
    make install
end

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
echo "        make depend... (`date`)" >> $LOGFILE
make depend
echo "        make... (`date`)" >> $LOGFILE
make
echo "        make install... (`date`)" >> $LOGFILE
make install

echo "    making sys libraries... (`date`)" >> $LOGFILE
cd /sys/
echo "        make clean, obj... (`date`)" >> $LOGFILE
make clean obj
echo "        make depend... (`date`)" >> $LOGFILE
make depend
echo "        make... (`date`)" >> $LOGFILE
make
echo "        make install... (`date`)" >> $LOGFILE
make install

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

echo "Starting kernel build (`date`)" >> $LOGFILE
cd /sys/arch/$ARCH/conf
# Run custom kernel build script:
doconfig $CONFIG
echo "Finished kernel build (`date`)" >> $LOGFILE

echo "Finished build (`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...
-----------------------------------------------------------------------------