#!/bin/csh
##############################################################################
# INSTALL SCARECROW
#       Leif Laaksonen     1992-03-30
#
# make_ver      =   ( irix4, irix5, entry4, entry5 , unix )
#
##############################################################################


clear
echo ""
echo "`date`"
echo "SCARECROW (C) Leif Laaksonen (1993)"
echo ""

# set default types

set make_ver      = irix4
set make_hardware = mips1

if ( $#argv == 0) then

    echo " "
    echo " Usage: scare_inst make_ver"
    echo " "
    echo "      make_ver is one of the following"
    echo "             irix4   (if you are running IRIX 4. , default)"
    echo "             irix5   (       -''-              5.)"
    echo "             entry4  (for 8 bit plane INDIGO with dithering, IRIX4)"
    echo "             entry5  (for 8 bit plane INDIGO with dithering, IRIX5)"
    echo "             unix    (for any type of unix, still to be done)"
    echo " "
    exit
endif
#
if ($#argv == 1) then
set make_ver      = $argv[1]
else 
    echo " Wrong number of parameters "
    exit
endif

    echo ""
    echo ""
    echo ""
    echo "Do you want to install SCARECROW?"
    echo -n "?: (y/n) "
    set flag = $<
    if ($flag == 'n') then 
        goto end
    endif

    echo ""
    echo " "
    echo ""

# make also the forms library (just for sure)
    echo ""
    echo " Making the FORMS library ..."
    echo ""
    cd forms/FORMS ; /bin/rm -f *.a ; make
    cd .. ; cd ..

#   Make first SCARECROW
#
    echo ""
    echo " Making SCARECROW ..."
    echo ""

switch($make_ver)
#
    case irix4
    cd src ; /bin/rm -f *.o 
    make -f makefiles/makefile.irix4
    /bin/rm -f *.o
    cd ..
    breaksw
#
    case irix5
    cd src ; /bin/rm -f *.o
    make -f makefiles/makefile.irix5
    /bin/rm -f *.o
    cd ..
    breaksw
#
    case entry4
    cd src ; /bin/rm -f *.o
    make -f makefiles/makefile.entry4
    /bin/rm -f *.o
    cd ..
    breaksw
#
    case entry5
    cd src ; /bin/rm -f *.o
    make -f makefiles/makefile.entry5
    /bin/rm -f *.o
    cd ..
    breaksw

    case unix
    echo " ** Not yet working **"
    breaksw
endsw
#
    echo ""
    echo " Making ICON8 ..."
    echo ""
    cd icon8 ; /bin/rm -f *.o ; make
    /bin/rm -f *.o
    cd ..
    echo ""
    echo " Making ProbeSurface ..."
    echo ""
    cd probsurf ; /bin/rm -f *.o ; make
    /bin/rm -f *.o
    cd ..
    echo ""
    echo " Making Density ..."
    echo ""
    cd density ; /bin/rm -f *.o ; make
    /bin/rm -f *.o
    cd ..
    echo ""
    echo " Making VSS ..."
    echo ""
    cd vss ; /bin/rm -f *.o ; make
    /bin/rm -f *.o
    cd ..
#
    echo ""
    echo " Make of programs is done, will now make some files ..."
    echo ""

#
#    chmod go+x ../bin/scare.exe

if (-e setscare) then
    /bin/rm -rf setscare
endif

#   Write sample scare  file
echo "#   Leif Laaksonen 1993  " >setscare
echo "#   This file is needed before SCARECROW can run" >>setscare
echo "#   Remember to 'source `pwd`/setscare'               " >>setscare
echo ""							      >>setscare

    set SCR_BIN  = `pwd`/bin
    set SCR_DATA = `pwd`/data 

    echo "setenv SCR_DATA `pwd`/data "   >> setscare

    echo "setenv SCR_BIN `pwd`/bin "   >> setscare

    echo "alias dynal     $SCR_BIN/scare.exe "     >> setscare
    echo "alias vss       $SCR_BIN/vss "           >> setscare
    echo "alias icon8     $SCR_BIN/icon8 "         >> setscare
    echo "alias density   $SCR_BIN/density "       >> setscare
    echo "alias probesurf $SCR_BIN/probsurf "      >> setscare
    echo " "                                       >> setscare

# Configuration is complete

echo ""
echo ""
echo "Done.  "

     source setscare

     dynal -h

echo " "
echo "  Remember to 'source `pwd`/setscare' before you start      "
echo " "


end:

