#! /bin/sh
#
# usage:        icleanpe.sh
#		icleanpe PIECE_PATH MATLAB (when executed from the CDROM)
#
# abstract:     Initial cleaning of the $MATLAB files associated with
#		the piece designated by the value of the environment
#		variable PIECE_PATH. This is ONLY for cleaning out
#		MATLAB 4 files that must be deleted before taring over them
#               or can't be deleted by looking at the differences between
#               b and .b files.
#
# note(s):      1. If $MATLAB/update/pd/$piece_path/.b exists then there
#		   is nothing to do.
#
#		2. Except when executed as a program the following variables
#		   must exist in the environment.
#
#		       PIECE_PATH
#		       MATLAB
#
#		   Otherwise, they are passed as the first two arguments.
#
#		4. This file is sourced by the normal install but executed
#		   by the CDROM install.
#
# Copyright (c) 1994-96 by The MathWorks, Inc.
# $Revision: 1.29 $  $Date: 1996/04/16 21:31:00 $
#----------------------------------------------------------------------------
#
    archlist='sun4 hp700 sgi ibm_rs dec_risc hp300 sol2 alpha lnx86'
#
# Do special things if this is not sourced (run as icleanpe).
#
    if [ "$temp_file4" = "" ]; then
	temp_file4=/tmp/$$a
	temp_file5=/tmp/$$b
	trap "rm -f $temp_file4 $temp_file5 > /dev/null 2>&1; exit 1"  1 2 3 15
	PIECE_PATH=$1
        MATLAB=$2
	startpath=`/bin/pwd`
	cd $MATLAB
    else
	startpath=`/bin/pwd`
	cd $MATLAB
    fi
#
# 3 header lines at the beginning of the file
#
    cat > $temp_file4 << EOF
#
cd $MATLAB
#
EOF
    if [ ! -f $MATLAB/update/pd/$PIECE_PATH/.b ]; then 
        case "$PIECE_PATH" in
	    install)
if [ "$CD_ROOT" != "" ]; then
    if [ -d ./install ]; then
        ls -d ./install/* ./install/.* > $temp_file5 2>/dev/null
        (while read file
        do
            if [ ! -d $file ]; then
	        echo $file >> $temp_file4 2>/dev/null
	    fi
        done) < $temp_file5
    fi
fi
		;;
#	    install/sun4)
#		;;
#	    install/hp700)
#		;;
#	    install/sgi)
#		;;
#	    install/ibm_rs)
#		;;
#	    install/dec_risc)
#		;;
#	    install/hp300)
#		;;
#	    install/sol2)
#		;;
#	    install/alpha)
#		;;
#	    install/lnx86)
#		;;
#	    update)
#		;;
#	    update/sun4)
#		;;
#	    update/hp700)
#		;;
#	    update/sgi)
#		;;
#	    update/ibm_rs)
#		;;
#	    update/dec_risc)
#		;;
#	    update/hp300)
#		;;
#	    update/sol2)
#		;;
#	    update/alpha)
#		;;
#	    update/lnx86)
#		;;
#	    info/products)
#		;;
#	    info/technote)
#		;;
#--------------------------
	    matlab)
#
# Work on: .scripts, app-defaults, extern, man, update
#
# Don't worry about: bin, etc, install
#
if [ -d ./.scripts ]; then
    find ./.scripts -type f -print 2>/dev/null | egrep '.*\.bin.*' >> $temp_file4
fi
echo ./app-defaults >> $temp_file4 2>/dev/null
#
# Watch out! extern/include directory cannot be deleted if
#            compiler or mathlib files have been put down already.
#
if [ ! -d $MATLAB/update/pd/toolbox/compiler -a ! -d $MATLAB/update/pd/mathlib ]; then
    echo ./extern/include >> $temp_file4 2>/dev/null
fi
#
# Watch out! extern/src files only must be deleted only.
#
if [ -d ./extern/src ]; then
    ls -d ./extern/src/* ./extern/src/.* > $temp_file5 2>/dev/null
    (while read file
    do
        if [ ! -d $file ]; then
	    echo $file >> $temp_file4 2>/dev/null
	fi
    done) < $temp_file5
fi
if [ -d ./man ]; then
    ls -d ./man/* ./man/.* > $temp_file5 2>/dev/null
    (while read file
    do
        if [ ! -d $file ]; then
	    echo $file >> $temp_file4 2>/dev/null
	fi
    done) < $temp_file5
fi
echo ./update/.version  >> $temp_file4 2>/dev/null
echo ./update/install  >> $temp_file4 2>/dev/null
		;;
	    matlab/sun4)
if [ ! -d $MATLAB/update/pd/toolbox/compiler -a ! -d $MATLAB/update/pd/mathlib ]; then
    echo ./extern/lib/sun4  >> $temp_file4 2>/dev/null
fi
echo ./man/unformatted  >> $temp_file4 2>/dev/null
		;;
	    matlab/hp700)
if [ ! -d $MATLAB/update/pd/toolbox/compiler -a ! -d $MATLAB/update/pd/mathlib ]; then
    echo ./extern/lib/hp700  >> $temp_file4 2>/dev/null
fi
echo ./man/unformatted  >> $temp_file4 2>/dev/null
		;;
	    matlab/sgi)
if [ ! -d $MATLAB/update/pd/toolbox/compiler -a ! -d $MATLAB/update/pd/mathlib ]; then
    echo ./extern/lib/sgi  >> $temp_file4 2>/dev/null
fi
echo ./man/unformatted  >> $temp_file4 2>/dev/null
		;;
	    matlab/ibm_rs)
if [ ! -d $MATLAB/update/pd/toolbox/compiler -a ! -d $MATLAB/update/pd/mathlib ]; then
    echo ./extern/lib/ibm_rs  >> $temp_file4 2>/dev/null
fi
echo ./man/formatted  >> $temp_file4 2>/dev/null
		;;
	    matlab/dec_risc)
if [ ! -d $MATLAB/update/pd/toolbox/compiler -a ! -d $MATLAB/update/pd/mathlib ]; then
    echo ./extern/lib/dec_risc  >> $temp_file4 2>/dev/null
fi
echo ./man/unformatted  >> $temp_file4 2>/dev/null
		;;
	    matlab/hp300)
if [ ! -d $MATLAB/update/pd/toolbox/compiler -a ! -d $MATLAB/update/pd/mathlib ]; then
    echo ./extern/lib/hp300  >> $temp_file4 2>/dev/null
fi
echo ./man/unformatted  >> $temp_file4 2>/dev/null
		;;
	    matlab/sol2)
if [ ! -d $MATLAB/update/pd/toolbox/compiler -a ! -d $MATLAB/update/pd/mathlib ]; then
    echo ./extern/lib/sol2  >> $temp_file4 2>/dev/null
fi
echo ./man/unformatted  >> $temp_file4 2>/dev/null
		;;
	    matlab/alpha)
if [ ! -d $MATLAB/update/pd/toolbox/compiler -a ! -d $MATLAB/update/pd/mathlib ]; then
    echo ./extern/lib/alpha  >> $temp_file4 2>/dev/null
fi
echo ./man/unformatted  >> $temp_file4 2>/dev/null
		;;
	    matlab/lnx86)
if [ ! -d $MATLAB/update/pd/toolbox/compiler -a ! -d $MATLAB/update/pd/mathlib ]; then
    echo ./extern/lib/lnx86  >> $temp_file4 2>/dev/null
fi
echo ./man/unformatted  >> $temp_file4 2>/dev/null
		;;
#--------------------------
	    gs)
if [ -d ./ghostscript ]; then
    ls -d ./ghostscript/* ./ghostscript/.* > $temp_file5 2>/dev/null
    (while read file
    do
        if [ ! -d $file ]; then
	    echo $file >> $temp_file4 2>/dev/null
	fi
    done) < $temp_file5
fi
echo ./ghostscript/fonts >> $temp_file4 2>/dev/null
echo ./ghostscript/ps_files >> $temp_file4 2>/dev/null
		;;
#	    gs/sun4)
#		;;
#	    gs/hp700)
#		;;
#	    gs/sgi)
#		;;
#	    gs/ibm_rs)
#		;;
#	    gs/dec_risc)
#		;;
#	    gs/hp300)
#		;;
#	    gs/sol2)
#		;;
#	    gs/alpha)
#		;;
#	    gs/lnx86)
#		;;
#--------------------------
	    lm)
#
# Watch out for the dependencies between lm and lm/$Arch. Also leave
# all files in ./etc alone. There may be files that are useful to the
# user.
#
if [ "$CD_ROOT" != "" ]; then
    echo ./etc/util >> $temp_file4 2>/dev/null
fi
		;;
	    lm/sun4)
if [ "$CD_ROOT" != "" ]; then
    echo ./etc/sun4 >> $temp_file4 2>/dev/null
fi
		;;
	    lm/hp700)
if [ "$CD_ROOT" != "" ]; then
    echo ./etc/hp700 >> $temp_file4 2>/dev/null
fi
		;;
	    lm/sgi)
if [ "$CD_ROOT" != "" ]; then
    echo ./etc/sgi >> $temp_file4 2>/dev/null
fi
		;;
	    lm/ibm_rs)
if [ "$CD_ROOT" != "" ]; then
    echo ./etc/ibm_rs >> $temp_file4 2>/dev/null
fi
		;;
	    lm/dec_risc)
if [ "$CD_ROOT" != "" ]; then
    echo ./etc/dec_risc >> $temp_file4 2>/dev/null
fi
		;;
	    lm/hp300)
if [ "$CD_ROOT" != "" ]; then
    echo ./etc/hp300 >> $temp_file4 2>/dev/null
fi
		;;
	    lm/sol2)
if [ "$CD_ROOT" != "" ]; then
    echo ./etc/sol2 >> $temp_file4 2>/dev/null
fi
		;;
	    lm/alpha)
if [ "$CD_ROOT" != "" ]; then
    echo ./etc/alpha >> $temp_file4 2>/dev/null
fi
		;;
	    lm/lnx86)
if [ "$CD_ROOT" != "" ]; then
    echo ./etc/lnx86 >> $temp_file4 2>/dev/null
fi
		;;
#--------------------------
	    lm/scripts)
if [ -d ./.scripts ]; then
    find ./.scripts -type f -print 2>/dev/null | egrep '.*\.etc.*' >> $temp_file4
fi
		;;
#--------------------------
	    toolbox/matlab)
#
# Remove any top level files
#
if [ -d ./toolbox/matlab ]; then
    ls -d ./toolbox/matlab/* ./toolbox/matlab/.* > $temp_file5 2>/dev/null
    (while read file
    do
        if [ ! -d $file ]; then
	    echo $file >> $temp_file4 2>/dev/null
	fi
    done) < $temp_file5
fi
#
# Dependencies: doc, arch specific files
#
echo ./toolbox/matlab/color >> $temp_file4 2>/dev/null
if [ -d ./toolbox/matlab/datafun ]; then
    find ./toolbox/matlab/datafun -type f -print 2>/dev/null | egrep -v '.*\.mex.*' >> $temp_file4
fi
#
# Dependencies: demos - andrew.mat
#
if [ -d ./toolbox/matlab/demos ]; then
    ls -d ./toolbox/matlab/demos/* ./toolbox/matlab/demos/.* > $temp_file5 2>/dev/null
    (while read file
    do
	if [ ! -d $file ]; then
	    if [ "$file" != "./toolbox/matlab/demos/andrew.mat" ]; then 
	        echo $file >> $temp_file4 2>/dev/null
	    fi
	fi
    done) < $temp_file5
fi
#
echo ./toolbox/matlab/elfun >> $temp_file4 2>/dev/null
echo ./toolbox/matlab/elmat >> $temp_file4 2>/dev/null
if [ -d ./toolbox/matlab/funfun ]; then
    find ./toolbox/matlab/funfun -type f -print 2>/dev/null | egrep -v '.*\.mex.*' >> $temp_file4
fi
echo ./toolbox/matlab/general >> $temp_file4 2>/dev/null
echo ./toolbox/matlab/graphics >> $temp_file4 2>/dev/null
echo ./toolbox/matlab/iofun >> $temp_file4 2>/dev/null
echo ./toolbox/matlab/lang >> $temp_file4 2>/dev/null
echo ./toolbox/matlab/matfun >> $temp_file4 2>/dev/null
echo ./toolbox/matlab/ops >> $temp_file4 2>/dev/null
echo ./toolbox/matlab/plotxy >> $temp_file4 2>/dev/null
echo ./toolbox/matlab/plotxyz >> $temp_file4 2>/dev/null
echo ./toolbox/matlab/polyfun >> $temp_file4 2>/dev/null
if [ -d ./toolbox/matlab/sounds ]; then
    find ./toolbox/matlab/sounds -type f -print 2>/dev/null | egrep -v '.*\.mex.*' >> $temp_file4
fi
echo ./toolbox/matlab/sparfun >> $temp_file4 2>/dev/null
echo ./toolbox/matlab/specfun >> $temp_file4 2>/dev/null
echo ./toolbox/matlab/specmat >> $temp_file4 2>/dev/null
echo ./toolbox/matlab/strfun >> $temp_file4 2>/dev/null
		;;
#	    toolbox/matlab/doc)
#		;;
#	    toolbox/matlab/andrew)
#		;;
	    toolbox/matlab/sun4)
if [ -d ./toolbox/matlab/funfun ]; then
    find ./toolbox/matlab/funfun -type f -print 2>/dev/null | egrep '.*\.mex4' >> $temp_file4
fi
if [ -d ./toolbox/matlab/datafun ]; then
    find ./toolbox/matlab/datafun -type f -print 2>/dev/null | egrep '.*\.mex4' >> $temp_file4
fi
if [ -d ./toolbox/matlab/sounds ]; then
    find ./toolbox/matlab/sounds -type f -print 2>/dev/null | egrep '.*\.mex4' >> $temp_file4
fi
		;;
	    toolbox/matlab/hp700)
if [ -d ./toolbox/matlab/funfun ]; then
    find ./toolbox/matlab/funfun -type f -print 2>/dev/null | egrep '.*\.mexhp7' >> $temp_file4
fi
if [ -d ./toolbox/matlab/datafun ]; then
    find ./toolbox/matlab/datafun -type f -print 2>/dev/null | egrep '.*\.mexhp7' >> $temp_file4
fi
if [ -d ./toolbox/matlab/sounds ]; then
    find ./toolbox/matlab/sounds -type f -print 2>/dev/null | egrep '.*\.mexhp7' >> $temp_file4
fi
		;;
	    toolbox/matlab/sgi)
if [ -d ./toolbox/matlab/funfun ]; then
    find ./toolbox/matlab/funfun -type f -print 2>/dev/null | egrep '.*\.mexsg' >> $temp_file4
fi
if [ -d ./toolbox/matlab/datafun ]; then
    find ./toolbox/matlab/datafun -type f -print 2>/dev/null | egrep '.*\.mexsg' >> $temp_file4
fi
if [ -d ./toolbox/matlab/sounds ]; then
    find ./toolbox/matlab/sounds -type f -print 2>/dev/null | egrep '.*\.mexsg' >> $temp_file4
fi
		;;
	    toolbox/matlab/ibm_rs)
if [ -d ./toolbox/matlab/funfun ]; then
    find ./toolbox/matlab/funfun -type f -print 2>/dev/null | egrep '.*\.mexrs6' >> $temp_file4
fi
if [ -d ./toolbox/matlab/datafun ]; then
    find ./toolbox/matlab/datafun -type f -print 2>/dev/null | egrep '.*\.mexrs6' >> $temp_file4
fi
if [ -d ./toolbox/matlab/sounds ]; then
    find ./toolbox/matlab/sounds -type f -print 2>/dev/null | egrep '.*\.mexrs6' >> $temp_file4
fi
		;;
	    toolbox/matlab/dec_risc)
if [ -d ./toolbox/matlab/funfun ]; then
    find ./toolbox/matlab/funfun -type f -print 2>/dev/null | egrep '.*\.mexds' >> $temp_file4
fi
if [ -d ./toolbox/matlab/datafun ]; then
    find ./toolbox/matlab/datafun -type f -print 2>/dev/null | egrep '.*\.mexds' >> $temp_file4
fi
if [ -d ./toolbox/matlab/sounds ]; then
    find ./toolbox/matlab/sounds -type f -print 2>/dev/null | egrep '.*\.mexds' >> $temp_file4
fi
		;;
	    toolbox/matlab/hp300)
if [ -d ./toolbox/matlab/funfun ]; then
    find ./toolbox/matlab/funfun -type f -print 2>/dev/null | egrep '.*\.mexhp3' >> $temp_file4
fi
if [ -d ./toolbox/matlab/datafun ]; then
    find ./toolbox/matlab/datafun -type f -print 2>/dev/null | egrep '.*\.mexhp3' >> $temp_file4
fi
if [ -d ./toolbox/matlab/sounds ]; then
    find ./toolbox/matlab/sounds -type f -print 2>/dev/null | egrep '.*\.mexhp3' >> $temp_file4
fi
		;;
	    toolbox/matlab/sol2)
if [ -d ./toolbox/matlab/funfun ]; then
    find ./toolbox/matlab/funfun -type f -print 2>/dev/null | egrep '.*\.mexsol' >> $temp_file4
fi
if [ -d ./toolbox/matlab/datafun ]; then
    find ./toolbox/matlab/datafun -type f -print 2>/dev/null | egrep '.*\.mexsol' >> $temp_file4
fi
if [ -d ./toolbox/matlab/sounds ]; then
    find ./toolbox/matlab/sounds -type f -print 2>/dev/null | egrep '.*\.mexsol' >> $temp_file4
fi
		;;
	    toolbox/matlab/alpha)
if [ -d ./toolbox/matlab/funfun ]; then
    find ./toolbox/matlab/funfun -type f -print 2>/dev/null | egrep '.*\.mexaxp' >> $temp_file4
fi
if [ -d ./toolbox/matlab/datafun ]; then
    find ./toolbox/matlab/datafun -type f -print 2>/dev/null | egrep '.*\.mexaxp' >> $temp_file4
fi
if [ -d ./toolbox/matlab/sounds ]; then
    find ./toolbox/matlab/sounds -type f -print 2>/dev/null | egrep '.*\.mexaxp' >> $temp_file4
fi
		;;
	    toolbox/matlab/lnx86)
if [ -d ./toolbox/matlab/funfun ]; then
    find ./toolbox/matlab/funfun -type f -print 2>/dev/null | egrep '.*\.mexlx' >> $temp_file4
fi
if [ -d ./toolbox/matlab/datafun ]; then
    find ./toolbox/matlab/datafun -type f -print 2>/dev/null | egrep '.*\.mexlx' >> $temp_file4
fi
if [ -d ./toolbox/matlab/sounds ]; then
    find ./toolbox/matlab/sounds -type f -print 2>/dev/null | egrep '.*\.mexlx' >> $temp_file4
fi
		;;
#--------------------------
	    toolbox/simulink)
#
# Remove any top level files
#
if [ -d ./toolbox/simulink ]; then
    ls -d ./toolbox/simulink/* ./toolbox/simulink/.* > $temp_file5 2>/dev/null
    (while read file
    do
        if [ ! -d $file ]; then
	    echo $file >> $temp_file4 2>/dev/null
	fi
    done) < $temp_file5
fi
#
# Dependencies: doc, arch specific files
#
if [ -d ./toolbox/simulink/blocks ]; then
    find ./toolbox/simulink/blocks -type f -print 2>/dev/null | egrep -v '.*\.mex.*' >> $temp_file4
fi
if [ -d ./toolbox/simulink/sb2sl ]; then
    find ./toolbox/simulink/sb2sl -type f -print 2>/dev/null | egrep -v '.*\.mex.*' >> $temp_file4
fi
echo ./toolbox/simulink/simdemos >> $temp_file4 2>/dev/null
echo ./toolbox/simulink/simulink >> $temp_file4 2>/dev/null
		;;
#	    toolbox/simulink/doc)
#		;;
	    toolbox/simulink/sun4)
if [ -d ./toolbox/simulink/blocks ]; then
    find ./toolbox/simulink/blocks -type f -print 2>/dev/null | egrep '.*\.mex4' >> $temp_file4
fi
if [ -d ./toolbox/simulink/sb2sl ]; then
    find ./toolbox/simulink/sb2sl -type f -print 2>/dev/null | egrep '.*\.mex4' >> $temp_file4
fi
		;;
	    toolbox/simulink/hp700)
if [ -d ./toolbox/simulink/blocks ]; then
    find ./toolbox/simulink/blocks -type f -print 2>/dev/null | egrep '.*\.mexhp7' >> $temp_file4
fi
if [ -d ./toolbox/simulink/sb2sl ]; then
    find ./toolbox/simulink/sb2sl -type f -print 2>/dev/null | egrep '.*\.mexhp7' >> $temp_file4
fi
		;;
	    toolbox/simulink/sgi)
if [ -d ./toolbox/simulink/blocks ]; then
    find ./toolbox/simulink/blocks -type f -print 2>/dev/null | egrep '.*\.mexsg' >> $temp_file4
fi
if [ -d ./toolbox/simulink/sb2sl ]; then
    find ./toolbox/simulink/sb2sl -type f -print 2>/dev/null | egrep '.*\.mexsg' >> $temp_file4
fi
		;;
	    toolbox/simulink/ibm_rs)
if [ -d ./toolbox/simulink/blocks ]; then
    find ./toolbox/simulink/blocks -type f -print 2>/dev/null | egrep '.*\.mexrs6' >> $temp_file4
fi
if [ -d ./toolbox/simulink/sb2sl ]; then
    find ./toolbox/simulink/sb2sl -type f -print 2>/dev/null | egrep '.*\.mexrs6' >> $temp_file4
fi
		;;
	    toolbox/simulink/dec_risc)
if [ -d ./toolbox/simulink/blocks ]; then
    find ./toolbox/simulink/blocks -type f -print 2>/dev/null | egrep '.*\.mexds' >> $temp_file4
fi
if [ -d ./toolbox/simulink/sb2sl ]; then
    find ./toolbox/simulink/sb2sl -type f -print 2>/dev/null | egrep '.*\.mexds' >> $temp_file4
fi
		;;
	    toolbox/simulink/hp300)
if [ -d ./toolbox/simulink/blocks ]; then
    find ./toolbox/simulink/blocks -type f -print 2>/dev/null | egrep '.*\.mexhp3' >> $temp_file4
fi
if [ -d ./toolbox/simulink/sb2sl ]; then
    find ./toolbox/simulink/sb2sl -type f -print 2>/dev/null | egrep '.*\.mexhp3' >> $temp_file4
fi
		;;
	    toolbox/simulink/sol2)
if [ -d ./toolbox/simulink/blocks ]; then
    find ./toolbox/simulink/blocks -type f -print 2>/dev/null | egrep '.*\.mexsol' >> $temp_file4
fi
if [ -d ./toolbox/simulink/sb2sl ]; then
    find ./toolbox/simulink/sb2sl -type f -print 2>/dev/null | egrep '.*\.mexsol' >> $temp_file4
fi
		;;
	    toolbox/simulink/alpha)
if [ -d ./toolbox/simulink/blocks ]; then
    find ./toolbox/simulink/blocks -type f -print 2>/dev/null | egrep '.*\.mexaxp' >> $temp_file4
fi
if [ -d ./toolbox/simulink/sb2sl ]; then
    find ./toolbox/simulink/sb2sl -type f -print 2>/dev/null | egrep '.*\.mexaxp' >> $temp_file4
fi
		;;
	    toolbox/simulink/lnx86)
if [ -d ./toolbox/simulink/blocks ]; then
    find ./toolbox/simulink/blocks -type f -print 2>/dev/null | egrep '.*\.mexlx' >> $temp_file4
fi
if [ -d ./toolbox/simulink/sb2sl ]; then
    find ./toolbox/simulink/sb2sl -type f -print 2>/dev/null | egrep '.*\.mexlx' >> $temp_file4
fi
		;;
#--------------------------
	    toolbox/control)
echo ./toolbox/control >> $temp_file4 2>/dev/null
		;;
#	    toolbox/control.doc)
#		;;
#--------------------------
	    toolbox/ident)
echo ./toolbox/ident >> $temp_file4 2>/dev/null
if [ -d ./toolbox/uitools ]; then
    find ./toolbox/uitools -type f -print 2>/dev/null | egrep -v '.*\.mex.*' >> $temp_file4
fi
		;;
#	    toolbox/ident.doc)
#		;;
	    toolbox/ident/sun4)
if [ -d ./toolbox/uitools ]; then
    find ./toolbox/uitools -type f -print 2>/dev/null | egrep '.*\.mex4' >> $temp_file4
fi
		;;
	    toolbox/ident/hp700)
if [ -d ./toolbox/uitools ]; then
    find ./toolbox/uitools -type f -print 2>/dev/null | egrep '.*\.mexhp7' >> $temp_file4
fi
		;;
	    toolbox/ident/sgi)
if [ -d ./toolbox/uitools ]; then
    find ./toolbox/uitools -type f -print 2>/dev/null | egrep '.*\.mexsg' >> $temp_file4
fi
		;;
	    toolbox/ident/ibm_rs)
if [ -d ./toolbox/utools ]; then
    find ./toolbox/uitools -type f -print 2>/dev/null | egrep '.*\.mexrs6' >> $temp_file4
fi
		;;
	    toolbox/ident/dec_risc)
if [ -d ./toolbox/uitools ]; then
    find ./toolbox/uitools -type f -print 2>/dev/null | egrep '.*\.mexds' >> $temp_file4
fi
		;;
	    toolbox/ident/hp300)
if [ -d ./toolbox/uitools ]; then
    find ./toolbox/uitools -type f -print 2>/dev/null | egrep '.*\.mexhp3' >> $temp_file4
fi
		;;
	    toolbox/ident/sol2)
if [ -d ./toolbox/uitools ]; then
    find ./toolbox/uitools -type f -print 2>/dev/null | egrep '.*\.mexsol' >> $temp_file4
fi
		;;
	    toolbox/ident/alpha)
if [ -d ./toolbox/uitools ]; then
    find ./toolbox/uitools -type f -print 2>/dev/null | egrep '.*\.mexaxp' >> $temp_file4
fi
		;;
	    toolbox/ident/lnx86)
if [ -d ./toolbox/uitools ]; then
    find ./toolbox/uitools -type f -print 2>/dev/null | egrep '.*\.mexlx' >> $temp_file4
fi
		;;
#--------------------------
	    toolbox/robust)
echo ./toolbox/robust >> $temp_file4 2>/dev/null
		;;
#	    toolbox/robust.doc)
#		;;
#--------------------------
	    toolbox/optim)
echo ./toolbox/optim >> $temp_file4 2>/dev/null
		;;
#	    toolbox/optim.doc)
#		;;
#--------------------------
	    toolbox/splines)
echo ./toolbox/splines >> $temp_file4 2>/dev/null
		;;
#	    toolbox/splines.doc)
#		;;
#--------------------------
	    toolbox/signal)
if [ -d ./toolbox/signal ]; then
    find ./toolbox/signal -type f -print 2>/dev/null | egrep -v '.*\.mex.*' >> $temp_file4
fi
		;;
#	    toolbox/signal.doc)
#		;;
	    toolbox/signal/sun4)
if [ -d ./toolbox/signal ]; then
    find ./toolbox/signal -type f -print 2>/dev/null | egrep '.*\.mex4' >> $temp_file4
fi
		;;
	    toolbox/signal/hp700)
if [ -d ./toolbox/signal ]; then
    find ./toolbox/signal -type f -print 2>/dev/null | egrep '.*\.mexhp7' >> $temp_file4
fi
		;;
	    toolbox/signal/sgi)
if [ -d ./toolbox/signal ]; then
    find ./toolbox/signal -type f -print 2>/dev/null | egrep '.*\.mexsg' >> $temp_file4
fi
		;;
	    toolbox/signal/ibm_rs)
if [ -d ./toolbox/signal ]; then
    find ./toolbox/signal -type f -print 2>/dev/null | egrep '.*\.mexrs6' >> $temp_file4
fi
		;;
	    toolbox/signal/dec_risc)
if [ -d ./toolbox/signal ]; then
    find ./toolbox/signal -type f -print 2>/dev/null | egrep '.*\.mexds' >> $temp_file4
fi
		;;
	    toolbox/signal/hp300)
if [ -d ./toolbox/signal ]; then
    find ./toolbox/signal -type f -print 2>/dev/null | egrep '.*\.mexhp3' >> $temp_file4
fi
		;;
	    toolbox/signal/sol2)
if [ -d ./toolbox/signal ]; then
    find ./toolbox/signal -type f -print 2>/dev/null | egrep '.*\.mexsol' >> $temp_file4
fi
		;;
	    toolbox/signal/alpha)
if [ -d ./toolbox/signal ]; then
    find ./toolbox/signal -type f -print 2>/dev/null | egrep '.*\.mexaxp' >> $temp_file4
fi
		;;
	    toolbox/signal/lnx86)
if [ -d ./toolbox/signal ]; then
    find ./toolbox/signal -type f -print 2>/dev/null | egrep '.*\.mexlx' >> $temp_file4
fi
		;;
#--------------------------
	    toolbox/mmle3)
echo ./toolbox/mmle3 >> $temp_file4 2>/dev/null
		;;
#	    toolbox/mmle3.doc)
#		;;
#--------------------------
	    toolbox/mutools)
if [ -d ./toolbox/mutools ]; then
    find ./toolbox/mutools -type f -print 2>/dev/null | egrep -v './toolbox/mutools/doc' | egrep -v '.*\.mex.*' >> $temp_file4
fi
		;;
#	    toolbox/mutools/doc)
#		;;
	    toolbox/mutools/sun4)
if [ -d ./toolbox/mutools ]; then
    find ./toolbox/mutools -type f -print 2>/dev/null | egrep '.*\.mex4' >> $temp_file4
fi
		;;
	    toolbox/mutools/hp700)
if [ -d ./toolbox/mutools ]; then
    find ./toolbox/mutools -type f -print 2>/dev/null | egrep '.*\.mexhp7' >> $temp_file4
fi
		;;
	    toolbox/mutools/sgi)
if [ -d ./toolbox/mutools ]; then
    find ./toolbox/mutools -type f -print 2>/dev/null | egrep '.*\.mexsg' >> $temp_file4
fi
		;;
	    toolbox/mutools/ibm_rs)
if [ -d ./toolbox/mutools ]; then
    find ./toolbox/mutools -type f -print 2>/dev/null | egrep '.*\.mexrs6' >> $temp_file4
fi
		;;
	    toolbox/mutools/dec_risc)
if [ -d ./toolbox/mutools ]; then
    find ./toolbox/mutools -type f -print 2>/dev/null | egrep '.*\.mexds' >> $temp_file4
fi
		;;
	    toolbox/mutools/hp300)
if [ -d ./toolbox/mutools ]; then
    find ./toolbox/mutools -type f -print 2>/dev/null | egrep '.*\.mexhp3' >> $temp_file4
fi
		;;
	    toolbox/mutools/sol2)
if [ -d ./toolbox/mutools ]; then
    find ./toolbox/mutools -type f -print 2>/dev/null | egrep '.*\.mexsol' >> $temp_file4
fi
		;;
	    toolbox/mutools/alpha)
if [ -d ./toolbox/mutools ]; then
    find ./toolbox/mutools -type f -print 2>/dev/null | egrep '.*\.mexaxp' >> $temp_file4
fi
		;;
	    toolbox/mutools/lnx86)
if [ -d ./toolbox/mutools ]; then
    find ./toolbox/mutools -type f -print 2>/dev/null | egrep '.*\.mexlx' >> $temp_file4
fi
		;;
#--------------------------
	    toolbox/chem)
echo ./toolbox/chem >> $temp_file4 2>/dev/null
		;;
#	    toolbox/chem/doc)
#		;;
#--------------------------
	    toolbox/nnet)
echo ./toolbox/nnet >> $temp_file4 2>/dev/null
		;;
#	    toolbox/nnet/doc)
#		;;
#--------------------------
	    toolbox/codegen)
if [ -d ./toolbox/codegen ]; then
    find ./toolbox/codegen -type f -print 2>/dev/null | egrep -v '.*\.mex.*' >> $temp_file4
fi
		;;
#	    toolbox/codegen/doc)
#		;;
	    toolbox/codegen/sun4)
if [ -d ./toolbox/codegen ]; then
    find ./toolbox/codegen -type f -print 2>/dev/null | egrep '.*\.mex4' >> $temp_file4
fi
		;;
	    toolbox/codegen/hp700)
if [ -d ./toolbox/codegen ]; then
    find ./toolbox/codegen -type f -print 2>/dev/null | egrep '.*\.mexhp7' >> $temp_file4
fi
		;;
	    toolbox/codegen/sgi)
if [ -d ./toolbox/codegen ]; then
    find ./toolbox/codegen -type f -print 2>/dev/null | egrep '.*\.mexsg' >> $temp_file4
fi
		;;
	    toolbox/codegen/ibm_rs)
if [ -d ./toolbox/codegen ]; then
    find ./toolbox/codegen -type f -print 2>/dev/null | egrep '.*\.mexrs6' >> $temp_file4
fi
		;;
	    toolbox/codegen/dec_risc)
if [ -d ./toolbox/codegen ]; then
    find ./toolbox/codegen -type f -print 2>/dev/null | egrep '.*\.mexds' >> $temp_file4
fi
		;;
	    toolbox/codegen/hp300)
if [ -d ./toolbox/codegen ]; then
    find ./toolbox/codegen -type f -print 2>/dev/null | egrep '.*\.mexhp3' >> $temp_file4
fi
		;;
	    toolbox/codegen/sol2)
if [ -d ./toolbox/codegen ]; then
    find ./toolbox/codegen -type f -print 2>/dev/null | egrep '.*\.mexsol' >> $temp_file4
fi
		;;
	    toolbox/codegen/alpha)
if [ -d ./toolbox/codegen ]; then
    find ./toolbox/codegen -type f -print 2>/dev/null | egrep '.*\.mexaxp' >> $temp_file4
fi
		;;
	    toolbox/codegen/lnx86)
if [ -d ./toolbox/codegen ]; then
    find ./toolbox/codegen -type f -print 2>/dev/null | egrep '.*\.mexlx' >> $temp_file4
fi
		;;
#--------------------------
	    toolbox/symbolic)
if [ -d ./toolbox/symbolic ]; then
    ls -d ./toolbox/symbolic/* ./toolbox/symbolic/.* > $temp_file5 2>/dev/null
    (while read file
    do
        if [ ! -d $file ]; then
	    echo $file | egrep -v '(.*\.mex.*|/lib$|/\.maple.*:.*)' >> $temp_file4 2>/dev/null
	fi
    done) < $temp_file5
#
# Remove any hp300 mex files because this is no longer any hp300 symbolic.
#
    echo './toolbox/symbolic/*.mexhp3' >> $temp_file4 2>/dev/null
fi
		;;
#	    toolbox/symbolic/doc)
#		;;
	    toolbox/symbolic/lib)
#
# This will blow the 32-bit library directory or link to the library
# directory away
# 
echo ./toolbox/symbolic/lib >> $temp_file4 2>/dev/null
		;;
	    toolbox/symbolic/lib64)
#
# This will blow the 64-bit library directory or link to the library
# directory away
# 
echo ./toolbox/symbolic/lib64 >> $temp_file4 2>/dev/null
		;;
	    toolbox/symbolic/sun4)
if [ -d ./toolbox/symbolic ]; then
    find ./toolbox/symbolic -type f -print 2>/dev/null | egrep '.*\.mex4' >> $temp_file4
fi
		;;
	    toolbox/symbolic/hp700)
if [ -d ./toolbox/symbolic ]; then
    find ./toolbox/symbolic -type f -print 2>/dev/null | egrep '.*\.mexhp7' >> $temp_file4
fi
		;;
	    toolbox/symbolic/sgi)
if [ -d ./toolbox/symbolic ]; then
    find ./toolbox/symbolic -type f -print 2>/dev/null | egrep '.*\.mexsg' >> $temp_file4
fi
		;;
	    toolbox/symbolic/ibm_rs)
if [ -d ./toolbox/symbolic ]; then
    find ./toolbox/symbolic -type f -print 2>/dev/null | egrep '.*\.mexrs6' >> $temp_file4
fi
		;;
	    toolbox/symbolic/dec_risc)
if [ -d ./toolbox/symbolic ]; then
    find ./toolbox/symbolic -type f -print 2>/dev/null | egrep '.*\.mexds' >> $temp_file4
fi
		;;
	    toolbox/symbolic/hp300)
if [ -d ./toolbox/symbolic ]; then
    find ./toolbox/symbolic -type f -print 2>/dev/null | egrep '.*\.mexhp3' >> $temp_file4
fi
		;;
	    toolbox/symbolic/sol2)
if [ -d ./toolbox/symbolic ]; then
    find ./toolbox/symbolic -type f -print 2>/dev/null | egrep '.*\.mexsol' >> $temp_file4
fi
		;;
	    toolbox/symbolic/alpha)
if [ -d ./toolbox/symbolic ]; then
    find ./toolbox/symbolic -type f -print 2>/dev/null | egrep '.*\.mexaxp' >> $temp_file4
fi
		;;
	    toolbox/symbolic/lnx86)
if [ -d ./toolbox/symbolic ]; then
    find ./toolbox/symbolic -type f -print 2>/dev/null | egrep '.*\.mexlx' >> $temp_file4
fi
		;;
#--------------------------
	    toolbox/images)
if [ -d ./toolbox/images ]; then
    find ./toolbox/images -type f -print 2>/dev/null | egrep -v '.*\.mex.*' >> $temp_file4
fi
		;;
#	    toolbox/images/doc)
#		;;
	    toolbox/images/sun4)
if [ -d ./toolbox/images ]; then
    find ./toolbox/images -type f -print 2>/dev/null | egrep '.*\.mex4' >> $temp_file4
fi
		;;
	    toolbox/images/hp700)
if [ -d ./toolbox/images ]; then
    find ./toolbox/images -type f -print 2>/dev/null | egrep '.*\.mexhp7' >> $temp_file4
fi
		;;
	    toolbox/images/sgi)
if [ -d ./toolbox/images ]; then
    find ./toolbox/images -type f -print 2>/dev/null | egrep '.*\.mexsg' >> $temp_file4
fi
		;;
	    toolbox/images/ibm_rs)
if [ -d ./toolbox/images ]; then
    find ./toolbox/images -type f -print 2>/dev/null | egrep '.*\.mexrs6' >> $temp_file4
fi
		;;
	    toolbox/images/dec_risc)
if [ -d ./toolbox/images ]; then
    find ./toolbox/images -type f -print 2>/dev/null | egrep '.*\.mexds' >> $temp_file4
fi
		;;
	    toolbox/images/hp300)
if [ -d ./toolbox/images ]; then
    find ./toolbox/images -type f -print 2>/dev/null | egrep '.*\.mexhp3' >> $temp_file4
fi
		;;
	    toolbox/images/sol2)
if [ -d ./toolbox/images ]; then
    find ./toolbox/images -type f -print 2>/dev/null | egrep '.*\.mexsol' >> $temp_file4
fi
		;;
	    toolbox/images/alpha)
if [ -d ./toolbox/images ]; then
    find ./toolbox/images -type f -print 2>/dev/null | egrep '.*\.mexaxp' >> $temp_file4
fi
		;;
	    toolbox/images/lnx86)
if [ -d ./toolbox/images ]; then
    find ./toolbox/images -type f -print 2>/dev/null | egrep '.*\.mexlx' >> $temp_file4
fi
		;;
#--------------------------
	    toolbox/ncd)
echo ./toolbox/ncd >> $temp_file4 2>/dev/null
		;;
#	    toolbox/ncd/doc)
#		;;
#--------------------------
	    toolbox/stats)
if [ -d ./toolbox/stats ]; then
    find ./toolbox/stats -type f -print 2>/dev/null | egrep -v './toolbox/stats/doc' | egrep -v '.*\.mex.*' >> $temp_file4
fi
if [ -d ./toolbox/uitools ]; then
    find ./toolbox/uitools -type f -print 2>/dev/null | egrep -v '.*\.mex.*' >> $temp_file4
fi
		;;
#	    toolbox/stats/doc)
#		;;
	    toolbox/stats/sun4)
if [ -d ./toolbox/uitools ]; then
    find ./toolbox/uitools -type f -print 2>/dev/null | egrep '.*\.mex4' >> $temp_file4
fi
		;;
	    toolbox/stats/hp700)
if [ -d ./toolbox/uitools ]; then
    find ./toolbox/uitools -type f -print 2>/dev/null | egrep '.*\.mexhp7' >> $temp_file4
fi
		;;
	    toolbox/stats/sgi)
if [ -d ./toolbox/uitools ]; then
    find ./toolbox/uitools -type f -print 2>/dev/null | egrep '.*\.mexsg' >> $temp_file4
fi
		;;
	    toolbox/stats/ibm_rs)
if [ -d ./toolbox/uitools ]; then
    find ./toolbox/uitools -type f -print 2>/dev/null | egrep '.*\.mexrs6' >> $temp_file4
fi
		;;
	    toolbox/stats/dec_risc)
if [ -d ./toolbox/uitools ]; then
    find ./toolbox/uitools -type f -print 2>/dev/null | egrep '.*\.mexds' >> $temp_file4
fi
		;;
	    toolbox/stats/hp300)
if [ -d ./toolbox/uitools ]; then
    find ./toolbox/uitools -type f -print 2>/dev/null | egrep '.*\.mexhp3' >> $temp_file4
fi
		;;
	    toolbox/stats/sol2)
if [ -d ./toolbox/uitools ]; then
    find ./toolbox/uitools -type f -print 2>/dev/null | egrep '.*\.mexsol' >> $temp_file4
fi
		;;
	    toolbox/stats/alpha)
if [ -d ./toolbox/uitools ]; then
    find ./toolbox/uitools -type f -print 2>/dev/null | egrep '.*\.mexaxp' >> $temp_file4
fi
		;;
	    toolbox/stats/lnx86)
if [ -d ./toolbox/uitools ]; then
    find ./toolbox/uitools -type f -print 2>/dev/null | egrep '.*\.mexlx' >> $temp_file4
fi
		;;
#--------------------------
	    toolbox/hosa)
echo ./toolbox/hosa >> $temp_file4 2>/dev/null
# 
# Remove old hispec if it exists
#
if [ -d $MATLAB/update/pd/toolbox/hispec ]; then
    rm -rf $MATLAB/update/pd/toolbox/hispec > /dev/null 2>&1
    rm -rf $MATLAB/toolbox/hispec > /dev/null 2>&1
fi
		;;
#	    toolbox/hosa/doc)
#		;;
#--------------------------
	    toolbox/fdident)
echo ./toolbox/fdident >> $temp_file4 2>/dev/null
		;;
#	    toolbox/fdident/doc)
#		;;
#--------------------------
	    toolbox/mpc)
echo ./toolbox/mpc >> $temp_file4 2>/dev/null
		;;
#	    toolbox/mpc/doc)
#		;;
#--------------------------
	    toolbox/fuzzy)
#
# Remove any top level files
#
if [ -d ./toolbox/fuzzy ]; then
    ls -d ./toolbox/fuzzy/* ./toolbox/fuzzy/.* > $temp_file5 2>/dev/null
    (while read file
    do
        if [ ! -d $file ]; then
	    echo $file >> $temp_file4 2>/dev/null
	fi
    done) < $temp_file5
fi
#
# Dependencies: doc, arch specific files
#
if [ -d ./toolbox/fuzzy/fuzzy ]; then
    find ./toolbox/fuzzy/fuzzy -type f -print 2>/dev/null | egrep -v '.*\.mex.*' >> $temp_file4
fi
echo ./toolbox/fuzzy/fuzdemos >> $temp_file4 2>/dev/null
if [ -d ./toolbox/uitools ]; then
    find ./toolbox/uitools -type f -print 2>/dev/null | egrep -v '.*\.mex.*' >> $temp_file4
fi
		;;
#	    toolbox/fuzzy/doc)
#		;;
	    toolbox/fuzzy/sun4)
if [ -d ./toolbox/fuzzy/fuzzy ]; then
    find ./toolbox/fuzzy/fuzzy -type f -print 2>/dev/null | egrep '.*\.mex4' >> $temp_file4
fi
if [ -d ./toolbox/uitools ]; then
    find ./toolbox/uitools -type f -print 2>/dev/null | egrep '.*\.mex4' >> $temp_file4
fi
		;;
	    toolbox/fuzzy/hp700)
if [ -d ./toolbox/fuzzy/fuzzy ]; then
    find ./toolbox/fuzzy/fuzzy -type f -print 2>/dev/null | egrep '.*\.mexhp7' >> $temp_file4
fi
if [ -d ./toolbox/uitools ]; then
    find ./toolbox/uitools -type f -print 2>/dev/null | egrep '.*\.mexhp7' >> $temp_file4
fi
		;;
	    toolbox/fuzzy/sgi)
if [ -d ./toolbox/fuzzy/fuzzy ]; then
    find ./toolbox/fuzzy/fuzzy -type f -print 2>/dev/null | egrep '.*\.mexsg' >> $temp_file4
fi
if [ -d ./toolbox/uitools ]; then
    find ./toolbox/uitools -type f -print 2>/dev/null | egrep '.*\.mexsg' >> $temp_file4
fi
		;;
	    toolbox/fuzzy/ibm_rs)
if [ -d ./toolbox/fuzzy/fuzzy ]; then
    find ./toolbox/fuzzy/fuzzy -type f -print 2>/dev/null | egrep '.*\.mexrs6' >> $temp_file4
fi
if [ -d ./toolbox/uitools ]; then
    find ./toolbox/uitools -type f -print 2>/dev/null | egrep '.*\.mexrs6' >> $temp_file4
fi
		;;
	    toolbox/fuzzy/dec_risc)
if [ -d ./toolbox/fuzzy/fuzzy ]; then
    find ./toolbox/fuzzy/fuzzy -type f -print 2>/dev/null | egrep '.*\.mexds' >> $temp_file4
fi
if [ -d ./toolbox/uitools ]; then
    find ./toolbox/uitools -type f -print 2>/dev/null | egrep '.*\.mexds' >> $temp_file4
fi
		;;
	    toolbox/fuzzy/hp300)
if [ -d ./toolbox/fuzzy/fuzzy ]; then
    find ./toolbox/fuzzy/fuzzy -type f -print 2>/dev/null | egrep '.*\.mexhp3' >> $temp_file4
fi
if [ -d ./toolbox/uitools ]; then
    find ./toolbox/uitools -type f -print 2>/dev/null | egrep '.*\.mexhp3' >> $temp_file4
fi
		;;
	    toolbox/fuzzy/sol2)
if [ -d ./toolbox/fuzzy/fuzzy ]; then
    find ./toolbox/fuzzy/fuzzy -type f -print 2>/dev/null | egrep '.*\.mexsol' >> $temp_file4
fi
if [ -d ./toolbox/uitools ]; then
    find ./toolbox/uitools -type f -print 2>/dev/null | egrep '.*\.mexsol' >> $temp_file4
fi
		;;
	    toolbox/fuzzy/alpha)
if [ -d ./toolbox/fuzzy/fuzzy ]; then
    find ./toolbox/fuzzy/fuzzy -type f -print 2>/dev/null | egrep '.*\.mexaxp' >> $temp_file4
fi
if [ -d ./toolbox/uitools ]; then
    find ./toolbox/uitools -type f -print 2>/dev/null | egrep '.*\.mexaxp' >> $temp_file4
fi
		;;
	    toolbox/fuzzy/lnx86)
if [ -d ./toolbox/fuzzy/fuzzy ]; then
    find ./toolbox/fuzzy/fuzzy -type f -print 2>/dev/null | egrep '.*\.mexlx' >> $temp_file4
fi
if [ -d ./toolbox/uitools ]; then
    find ./toolbox/uitools -type f -print 2>/dev/null | egrep '.*\.mexlx' >> $temp_file4
fi
		;;
#--------------------------
	    toolbox/dspblks)
if [ -d ./toolbox/dspblks ]; then
    ls -d ./toolbox/dspblks/* | egrep -v '.*\.mex.*' > $temp_file5 2>/dev/null
    (while read file
    do
        if [ ! -d $file ]; then
            echo $file >> $temp_file4 2>/dev/null
        fi
    done) < $temp_file5
fi
echo ./toolbox/dspblks/bin/roller >> $temp_file4 2>/dev/null
		;;
#	    toolbox/dspblks.doc)
#		;;
	    toolbox/dspblks/sun4)
if [ -d ./toolbox/dspblks ]; then
    find ./toolbox/dspblks -type f -print 2>/dev/null | egrep '.*\.mex4' >> $temp_file4
fi
echo ./toolbox/dspblks/bin/sun4 >> $temp_file4 2>/dev/null
		;;
	    toolbox/dspblks/hp700)
if [ -d ./toolbox/dspblks ]; then
    find ./toolbox/dspblks -type f -print 2>/dev/null | egrep '.*\.mexhp7' >> $temp_file4
fi
echo ./toolbox/dspblks/bin/hp700 >> $temp_file4 2>/dev/null
		;;
	    toolbox/dspblks/sgi)
if [ -d ./toolbox/dspblks ]; then
    find ./toolbox/dspblks -type f -print 2>/dev/null | egrep '.*\.mexsg' >> $temp_file4
fi
echo ./toolbox/dspblks/bin/sgi/roller >> $temp_file4 2>/dev/null
		;;
	    toolbox/dspblks/ibm_rs)
if [ -d ./toolbox/dspblks ]; then
    find ./toolbox/dspblks -type f -print 2>/dev/null | egrep '.*\.mexrs6' >> $temp_file4
fi
echo ./toolbox/dspblks/bin/ibm_rs >> $temp_file4 2>/dev/null
		;;
	    toolbox/dspblks/dec_risc)
if [ -d ./toolbox/dspblks ]; then
    find ./toolbox/dspblks -type f -print 2>/dev/null | egrep '.*\.mexds' >> $temp_file4
fi
echo ./toolbox/dspblks/bin/dec_risc >> $temp_file4 2>/dev/null
		;;
	    toolbox/dspblks/hp300)
if [ -d ./toolbox/dspblks ]; then
    find ./toolbox/dspblks -type f -print 2>/dev/null | egrep '.*\.mexhp3' >> $temp_file4
fi
echo ./toolbox/dspblks/bin/hp300 >> $temp_file4 2>/dev/null
		;;
	    toolbox/dspblks/sol2)
if [ -d ./toolbox/dspblks ]; then
    find ./toolbox/dspblks -type f -print 2>/dev/null | egrep '.*\.mexsol' >> $temp_file4
fi
echo ./toolbox/dspblks/bin/sol2 >> $temp_file4 2>/dev/null
		;;
	    toolbox/dspblks/alpha)
if [ -d ./toolbox/dspblks ]; then
    find ./toolbox/dspblks -type f -print 2>/dev/null | egrep '.*\.mexaxp' >> $temp_file4
fi
echo ./toolbox/dspblks/bin/alpha >> $temp_file4 2>/dev/null
		;;
	    toolbox/dspblks/lnx86)
if [ -d ./toolbox/dspblks ]; then
    find ./toolbox/dspblks -type f -print 2>/dev/null | egrep '.*\.mexlx' >> $temp_file4
fi
echo ./toolbox/dspblks/bin/lnx86 >> $temp_file4 2>/dev/null
		;;
#--------------------------
	    toolbox/fixpoint)
if [ -d ./toolbox/fixpoint ]; then
    ls -d ./toolbox/fixpoint/* | egrep -v '.*\.mex.*' > $temp_file5 2>/dev/null
    (while read file
    do
        if [ ! -d $file ]; then
            echo $file >> $temp_file4 2>/dev/null
        fi
    done) < $temp_file5
fi
echo ./toolbox/fixpoint/bin/fpoptmze >> $temp_file4 2>/dev/null
		;;
#	    toolbox/fixpoint.doc)
#		;;
	    toolbox/fixpoint/sun4)
if [ -d ./toolbox/fixpoint ]; then
    find ./toolbox/fixpoint -type f -print 2>/dev/null | egrep '.*\.mex4' >> $temp_file4
fi
echo ./toolbox/fixpoint/bin/sun4 >> $temp_file4 2>/dev/null
		;;
	    toolbox/fixpoint/hp700)
if [ -d ./toolbox/fixpoint ]; then
    find ./toolbox/fixpoint -type f -print 2>/dev/null | egrep '.*\.mexhp7' >> $temp_file4
fi
echo ./toolbox/fixpoint/bin/hp700 >> $temp_file4 2>/dev/null
		;;
	    toolbox/fixpoint/sgi)
if [ -d ./toolbox/fixpoint ]; then
    find ./toolbox/fixpoint -type f -print 2>/dev/null | egrep '.*\.mexsg' >> $temp_file4
fi
echo ./toolbox/fixpoint/bin/sgi >> $temp_file4 2>/dev/null
		;;
	    toolbox/fixpoint/ibm_rs)
if [ -d ./toolbox/fixpoint ]; then
    find ./toolbox/fixpoint -type f -print 2>/dev/null | egrep '.*\.mexrs6' >> $temp_file4
fi
echo ./toolbox/fixpoint/bin/ibm_rs >> $temp_file4 2>/dev/null
		;;
	    toolbox/fixpoint/dec_risc)
if [ -d ./toolbox/fixpoint ]; then
    find ./toolbox/fixpoint -type f -print 2>/dev/null | egrep '.*\.mexds' >> $temp_file4
fi
echo ./toolbox/fixpoint/bin/dec_risc >> $temp_file4 2>/dev/null
		;;
	    toolbox/fixpoint/hp300)
if [ -d ./toolbox/fixpoint ]; then
    find ./toolbox/fixpoint -type f -print 2>/dev/null | egrep '.*\.mexhp3' >> $temp_file4
fi
echo ./toolbox/fixpoint/bin/hp300 >> $temp_file4 2>/dev/null
		;;
	    toolbox/fixpoint/sol2)
if [ -d ./toolbox/fixpoint ]; then
    find ./toolbox/fixpoint -type f -print 2>/dev/null | egrep '.*\.mexsol' >> $temp_file4
fi
echo ./toolbox/fixpoint/bin/sol2 >> $temp_file4 2>/dev/null
		;;
	    toolbox/fixpoint/alpha)
if [ -d ./toolbox/fixpoint ]; then
    find ./toolbox/fixpoint -type f -print 2>/dev/null | egrep '.*\.mexaxp' >> $temp_file4
fi
echo ./toolbox/fixpoint/bin/alpha >> $temp_file4 2>/dev/null
		;;
	    toolbox/fixpoint/lnx86)
if [ -d ./toolbox/fixpoint ]; then
    find ./toolbox/fixpoint -type f -print 2>/dev/null | egrep '.*\.mexlx' >> $temp_file4
fi
echo ./toolbox/fixpoint/bin/lnx86 >> $temp_file4 2>/dev/null
		;;
#--------------------------
	    toolbox/qft)
echo ./toolbox/qft >> $temp_file4 2>/dev/null
		;;
#	    toolbox/qft/doc)
#		;;
#--------------------------
	    toolbox/nag)
#
# Remove any top level files
#
if [ -d ./toolbox/nag ]; then
    ls -d ./toolbox/nag/* ./toolbox/nag/.* > $temp_file5 2>/dev/null
    (while read file
    do
        if [ ! -d $file ]; then
	    echo $file >> $temp_file4 2>/dev/null
	fi
    done) < $temp_file5
fi
#
# Dependencies: doc, arch specific files
#
if [ -d ./toolbox/nag/nag ]; then
    find ./toolbox/nag/nag -type f -print 2>/dev/null | egrep -v '.*\.mex.*' >> $temp_file4
fi
echo ./toolbox/nag/examples >> $temp_file4 2>/dev/null
		;;
#	    toolbox/nag/doc)
#		;;
	    toolbox/nag/sun4)
if [ -d ./toolbox/nag/nag ]; then
    find ./toolbox/nag/nag -type f -print 2>/dev/null | egrep '.*\.mex4' >> $temp_file4
fi
		;;
	    toolbox/nag/hp700)
if [ -d ./toolbox/nag/nag ]; then
    find ./toolbox/nag/nag -type f -print 2>/dev/null | egrep '.*\.mexhp7' >> $temp_file4
fi
		;;
	    toolbox/nag/sgi)
if [ -d ./toolbox/nag/nag ]; then
    find ./toolbox/nag/nag -type f -print 2>/dev/null | egrep '.*\.mexsg' >> $temp_file4
fi
		;;
	    toolbox/nag/ibm_rs)
if [ -d ./toolbox/nag/nag ]; then
    find ./toolbox/nag/nag -type f -print 2>/dev/null | egrep '.*\.mexrs6' >> $temp_file4
fi
		;;
	    toolbox/nag/dec_risc)
if [ -d ./toolbox/nag/nag ]; then
    find ./toolbox/nag/nag -type f -print 2>/dev/null | egrep '.*\.mexds' >> $temp_file4
fi
		;;
	    toolbox/nag/hp300)
if [ -d ./toolbox/nag/nag ]; then
    find ./toolbox/nag/nag -type f -print 2>/dev/null | egrep '.*\.mexhp3' >> $temp_file4
fi
		;;
	    toolbox/nag/sol2)
if [ -d ./toolbox/nag/nag ]; then
    find ./toolbox/nag/nag -type f -print 2>/dev/null | egrep '.*\.mexsol' >> $temp_file4
fi
		;;
	    toolbox/nag/alpha)
if [ -d ./toolbox/nag/nag ]; then
    find ./toolbox/nag/nag -type f -print 2>/dev/null | egrep '.*\.mexaxp' >> $temp_file4
fi
		;;
	    toolbox/nag/lnx86)
if [ -d ./toolbox/nag/nag ]; then
    find ./toolbox/nag/nag -type f -print 2>/dev/null | egrep '.*\.mexlx' >> $temp_file4
fi
		;;
#--------------------------
	    toolbox/compiler)
if [ -d ./toolbox/compiler ]; then
    find ./toolbox/compiler -type f -print 2>/dev/null | egrep -v '.*\.mex.*' >> $temp_file4
fi
#
# look to delete toolbox/compiler/arch if only .b and the version is beta.
#
for tryarch in $archlist
do
    trydir=$MATLAB/update/pd/toolbox/compiler/$tryarch
    if [ -d $trydir ]; then
        list=`(cd $trydir; ls -d * .[a-z]*) 2>/dev/null`
	found=1
        for file in $list
        do
	    if [ "$file" != ".b" ]; then
		found=0
		break
            fi
        done
	if [ "$found" = "1" ]; then
	    cmd=`cat $trydir/.b | sed -n -e "1p" | grep "beta"`
	    if [ "$cmd" != "" ]; then
echo $trydir >> $temp_file4 2>/dev/null
echo ./extern/lib/$tryarch/libmccmx.a >> $temp_file4 2>/dev/null
	    fi
	fi
    fi
    trydir=$MATLAB/update/pd/mathlib/$tryarch
    if [ ! -d $trydir ]; then
echo ./extern/lib/$tryarch/libmcc.a >> $temp_file4 2>/dev/null
echo ./extern/lib/$tryarch/libmlm.a >> $temp_file4 2>/dev/null
echo ./extern/lib/$tryarch/libmlt.a >> $temp_file4 2>/dev/null
    fi
done
#
echo ./etc/license.dat.DEMO.compiler >> $temp_file4 2>/dev/null
echo ./extern/src/compiler >> $temp_file4 2>/dev/null
echo ./extern/include/mcc.h >> $temp_file4 2>/dev/null
echo ./extern/include/mlm.h >> $temp_file4 2>/dev/null
echo ./extern/include/mlt.h >> $temp_file4 2>/dev/null
		;;
#	    toolbox/compiler/doc)
#		;;
	    toolbox/compiler/sun4)
if [ -d ./extern/lib/sun4 ]; then
echo ./extern/lib/sun4/libmccmx.a >> $temp_file4 2>/dev/null
echo ./extern/lib/sun4/libmlm.a >> $temp_file4 2>/dev/null
echo ./extern/lib/sun4/libmlt.a >> $temp_file4 2>/dev/null
    if [ ! -d $MATLAB/update/pd/mathlib/sun4 ]; then
echo ./extern/lib/sun4/libmcc.a >> $temp_file4 2>/dev/null
    fi
fi
if [ -d ./toolbox/compiler ]; then
    find ./toolbox/compiler -type f -print 2>/dev/null | egrep '.*\.mex4' >> $temp_file4
fi
		;;
	    toolbox/compiler/hp700)
if [ -d ./extern/lib/hp700 ]; then
echo ./extern/lib/hp700/libmccmx.a >> $temp_file4 2>/dev/null
echo ./extern/lib/hp700/libmlm.a >> $temp_file4 2>/dev/null
echo ./extern/lib/hp700/libmlt.a >> $temp_file4 2>/dev/null
    if [ ! -d $MATLAB/update/pd/mathlib/hp700 ]; then
echo ./extern/lib/hp700/libmcc.a >> $temp_file4 2>/dev/null
    fi
fi
if [ -d ./toolbox/compiler ]; then
    find ./toolbox/compiler -type f -print 2>/dev/null | egrep '.*\.mexhp7' >> $temp_file4
fi
		;;
	    toolbox/compiler/sgi)
if [ -d ./extern/lib/sgi ]; then
echo ./extern/lib/sgi/libmccmx.a >> $temp_file4 2>/dev/null
echo ./extern/lib/sgi/libmlm.a >> $temp_file4 2>/dev/null
echo ./extern/lib/sgi/libmlt.a >> $temp_file4 2>/dev/null
    if [ ! -d $MATLAB/update/pd/mathlib/sgi ]; then
echo ./extern/lib/sgi/libmcc.a >> $temp_file4 2>/dev/null
    fi
fi
if [ -d ./toolbox/compiler ]; then
    find ./toolbox/compiler -type f -print 2>/dev/null | egrep '.*\.mexsg' >> $temp_file4
fi
		;;
	    toolbox/compiler/ibm_rs)
if [ -d ./extern/lib/ibm_rs ]; then
echo ./extern/lib/ibm_rs/libmccmx.a >> $temp_file4 2>/dev/null
echo ./extern/lib/ibm_rs/libmlm.a >> $temp_file4 2>/dev/null
echo ./extern/lib/ibm_rs/libmlt.a >> $temp_file4 2>/dev/null
    if [ ! -d $MATLAB/update/pd/mathlib/ibm_rs ]; then
echo ./extern/lib/ibm_rs/libmcc.a >> $temp_file4 2>/dev/null
    fi
fi
if [ -d ./toolbox/compiler ]; then
    find ./toolbox/compiler -type f -print 2>/dev/null | egrep '.*\.mexrs6' >> $temp_file4
fi
		;;
	    toolbox/compiler/dec_risc)
if [ -d ./extern/lib/dec_risc ]; then
echo ./extern/lib/dec_risc/libmccmx.a >> $temp_file4 2>/dev/null
echo ./extern/lib/dec_risc/libmlm.a >> $temp_file4 2>/dev/null
echo ./extern/lib/dec_risc/libmlt.a >> $temp_file4 2>/dev/null
    if [ ! -d $MATLAB/update/pd/mathlib/dec_risc ]; then
echo ./extern/lib/dec_risc/libmcc.a >> $temp_file4 2>/dev/null
    fi
fi
if [ -d ./toolbox/compiler ]; then
    find ./toolbox/compiler -type f -print 2>/dev/null | egrep '.*\.mexds' >> $temp_file4
fi
		;;
	    toolbox/compiler/hp300)
if [ -d ./extern/lib/hp300 ]; then
echo ./extern/lib/hp300/libmccmx.a >> $temp_file4 2>/dev/null
echo ./extern/lib/hp300/libmlm.a >> $temp_file4 2>/dev/null
echo ./extern/lib/hp300/libmlt.a >> $temp_file4 2>/dev/null
    if [ ! -d $MATLAB/update/pd/mathlib/hp300 ]; then
echo ./extern/lib/hp300/libmcc.a >> $temp_file4 2>/dev/null
    fi
fi
if [ -d ./toolbox/compiler ]; then
    find ./toolbox/compiler -type f -print 2>/dev/null | egrep '.*\.mexhp3' >> $temp_file4
fi
		;;
	    toolbox/compiler/sol2)
if [ -d ./extern/lib/sol2 ]; then
echo ./extern/lib/sol2/libmccmx.a >> $temp_file4 2>/dev/null
echo ./extern/lib/sol2/libmlm.a >> $temp_file4 2>/dev/null
echo ./extern/lib/sol2/libmlt.a >> $temp_file4 2>/dev/null
    if [ ! -d $MATLAB/update/pd/mathlib/sol2 ]; then
echo ./extern/lib/sol2/libmcc.a >> $temp_file4 2>/dev/null
    fi
fi
if [ -d ./toolbox/compiler ]; then
    find ./toolbox/compiler -type f -print 2>/dev/null | egrep '.*\.mexsol' >> $temp_file4
fi
		;;
	    toolbox/compiler/alpha)
if [ -d ./extern/lib/alpha ]; then
echo ./extern/lib/alpha/libmccmx.a >> $temp_file4 2>/dev/null
echo ./extern/lib/alpha/libmlm.a >> $temp_file4 2>/dev/null
echo ./extern/lib/alpha/libmlt.a >> $temp_file4 2>/dev/null
    if [ ! -d $MATLAB/update/pd/mathlib/alpha ]; then
echo ./extern/lib/alpha/libmcc.a >> $temp_file4 2>/dev/null
    fi
fi
if [ -d ./toolbox/compiler ]; then
    find ./toolbox/compiler -type f -print 2>/dev/null | egrep '.*\.mexaxp' >> $temp_file4
fi
		;;
	    toolbox/compiler/lnx86)
if [ -d ./extern/lib/lnx86 ]; then
echo ./extern/lib/lnx86/libmccmx.a >> $temp_file4 2>/dev/null
echo ./extern/lib/lnx86/libmlm.a >> $temp_file4 2>/dev/null
echo ./extern/lib/lnx86/libmlt.a >> $temp_file4 2>/dev/null
    if [ ! -d $MATLAB/update/pd/mathlib/lnx86 ]; then
echo ./extern/lib/lnx86/libmcc.a >> $temp_file4 2>/dev/null
    fi
fi
if [ -d ./toolbox/compiler ]; then
    find ./toolbox/compiler -type f -print 2>/dev/null | egrep '.*\.mexlx' >> $temp_file4
fi
		;;
#--------------------------
	    toolbox/lmi)
#
# Remove any top level files
#
if [ -d ./toolbox/lmi ]; then
    ls -d ./toolbox/lmi/* ./toolbox/lmi/.* > $temp_file5 2>/dev/null
    (while read file
    do
        if [ ! -d $file ]; then
	    echo $file >> $temp_file4 2>/dev/null
	fi
    done) < $temp_file5
fi
#
# Dependencies: doc, arch specific files
#
if [ -d ./toolbox/lmi/lmilab ]; then
    find ./toolbox/lmi/lmilab -type f -print 2>/dev/null | egrep -v '.*\.mex.*' >> $temp_file4
fi
echo ./toolbox/lmi/lmictrl >> $temp_file4 2>/dev/null
		;;
#	    toolbox/lmi/doc)
#		;;
	    toolbox/lmi/sun4)
if [ -d ./toolbox/lmi/lmilab ]; then
    find ./toolbox/lmi/lmilab -type f -print 2>/dev/null | egrep '.*\.mex4' >> $temp_file4
fi
		;;
	    toolbox/lmi/hp700)
if [ -d ./toolbox/lmi/lmilab ]; then
    find ./toolbox/lmi/lmilab -type f -print 2>/dev/null | egrep '.*\.mexhp7' >> $temp_file4
fi
		;;
	    toolbox/lmi/sgi)
if [ -d ./toolbox/lmi/lmilab ]; then
    find ./toolbox/lmi/lmilab -type f -print 2>/dev/null | egrep '.*\.mexsg' >> $temp_file4
fi
		;;
	    toolbox/lmi/ibm_rs)
if [ -d ./toolbox/lmi/lmilab ]; then
    find ./toolbox/lmi/lmilab -type f -print 2>/dev/null | egrep '.*\.mexrs6' >> $temp_file4
fi
		;;
	    toolbox/lmi/dec_risc)
if [ -d ./toolbox/lmi/lmilab ]; then
    find ./toolbox/lmi/lmilab -type f -print 2>/dev/null | egrep '.*\.mexds' >> $temp_file4
fi
		;;
	    toolbox/lmi/hp300)
if [ -d ./toolbox/lmi/lmilab ]; then
    find ./toolbox/lmi/lmilab -type f -print 2>/dev/null | egrep '.*\.mexhp3' >> $temp_file4
fi
		;;
	    toolbox/lmi/sol2)
if [ -d ./toolbox/lmi/lmilab ]; then
    find ./toolbox/lmi/lmilab -type f -print 2>/dev/null | egrep '.*\.mexsol' >> $temp_file4
fi
		;;
	    toolbox/lmi/alpha)
if [ -d ./toolbox/lmi/lmilab ]; then
    find ./toolbox/lmi/lmilab -type f -print 2>/dev/null | egrep '.*\.mexaxp' >> $temp_file4
fi
		;;
	    toolbox/lmi/lnx86)
if [ -d ./toolbox/lmi/lmilab ]; then
    find ./toolbox/lmi/lmilab -type f -print 2>/dev/null | egrep '.*\.mexlx' >> $temp_file4
fi
		;;
#--------------------------
	    toolbox/finance)
echo ./toolbox/finance >> $temp_file4 2>/dev/null
		;;
#	    toolbox/finance/doc)
#		;;
#--------------------------
	    toolbox/pde)
echo ./toolbox/pde >> $temp_file4 2>/dev/null
if [ -d ./toolbox/uitools ]; then
    find ./toolbox/uitools -type f -print 2>/dev/null | egrep -v '.*\.mex.*' >> $temp_file4
fi
		;;
#	    toolbox/pde/doc)
#		;;
	    toolbox/pde/sun4)
if [ -d ./toolbox/uitools ]; then
    find ./toolbox/uitools -type f -print 2>/dev/null | egrep '.*\.mex4' >> $temp_file4
fi
		;;
	    toolbox/pde/hp700)
if [ -d ./toolbox/uitools ]; then
    find ./toolbox/uitools -type f -print 2>/dev/null | egrep '.*\.mexhp7' >> $temp_file4
fi
		;;
	    toolbox/pde/sgi)
if [ -d ./toolbox/uitools ]; then
    find ./toolbox/uitools -type f -print 2>/dev/null | egrep '.*\.mexsg' >> $temp_file4
fi
		;;
	    toolbox/pde/ibm_rs)
if [ -d ./toolbox/uitools ]; then
    find ./toolbox/uitools -type f -print 2>/dev/null | egrep '.*\.mexrs6' >> $temp_file4
fi
		;;
	    toolbox/pde/dec_risc)
if [ -d ./toolbox/uitools ]; then
    find ./toolbox/uitools -type f -print 2>/dev/null | egrep '.*\.mexds' >> $temp_file4
fi
		;;
	    toolbox/pde/hp300)
if [ -d ./toolbox/uitools ]; then
    find ./toolbox/uitools -type f -print 2>/dev/null | egrep '.*\.mexhp3' >> $temp_file4
fi
		;;
	    toolbox/pde/sol2)
if [ -d ./toolbox/uitools ]; then
    find ./toolbox/uitools -type f -print 2>/dev/null | egrep '.*\.mexsol' >> $temp_file4
fi
		;;
	    toolbox/pde/alpha)
if [ -d ./toolbox/uitools ]; then
    find ./toolbox/uitools -type f -print 2>/dev/null | egrep '.*\.mexaxp' >> $temp_file4
fi
		;;
	    toolbox/pde/lnx86)
if [ -d ./toolbox/uitools ]; then
    find ./toolbox/uitools -type f -print 2>/dev/null | egrep '.*\.mexlx' >> $temp_file4
fi
		;;
#--------------------------
	    mathlib)
echo ./extern/src/compiler/lorenz.c >> $temp_file4 2>/dev/null
echo ./extern/src/compiler/lormain.c >> $temp_file4 2>/dev/null
#
# if mathlib/arch does not exist blow away any library
# files that may have come with the beta compiler.
#
for tryarch in $archlist
do
    trydir=$MATLAB/update/pd/mathlib/$tryarch
    if [ ! -d $trydir ]; then
echo ./extern/lib/$tryarch/libmcc.a >> $temp_file4 2>/dev/null
echo ./extern/lib/$tryarch/libmlm.a >> $temp_file4 2>/dev/null
echo ./extern/lib/$tryarch/libmlt.a >> $temp_file4 2>/dev/null
    fi
done
echo ./extern/include/mlm.h >> $temp_file4 2>/dev/null
echo ./extern/include/mlt.h >> $temp_file4 2>/dev/null
		;;
#	    mathlib/doc)
#		;;
	    mathlib/sun4)
echo ./extern/lib/sun4/libmcc.a >> $temp_file4 2>/dev/null
echo ./extern/lib/sun4/libmlm.a >> $temp_file4 2>/dev/null
echo ./extern/lib/sun4/libmlt.a >> $temp_file4 2>/dev/null
		;;
	    mathlib/hp700)
echo ./extern/lib/hp700/libmcc.a >> $temp_file4 2>/dev/null
echo ./extern/lib/hp700/libmlm.a >> $temp_file4 2>/dev/null
echo ./extern/lib/hp700/libmlt.a >> $temp_file4 2>/dev/null
		;;
	    mathlib/sgi)
echo ./extern/lib/sgi/libmcc.a >> $temp_file4 2>/dev/null
echo ./extern/lib/sgi/libmlm.a >> $temp_file4 2>/dev/null
echo ./extern/lib/sgi/libmlt.a >> $temp_file4 2>/dev/null
		;;
	    mathlib/ibm_rs)
echo ./extern/lib/ibm_rs/libmcc.a >> $temp_file4 2>/dev/null
echo ./extern/lib/ibm_rs/libmlm.a >> $temp_file4 2>/dev/null
echo ./extern/lib/ibm_rs/libmlt.a >> $temp_file4 2>/dev/null
		;;
	    mathlib/dec_risc)
echo ./extern/lib/dec_risc/libmcc.a >> $temp_file4 2>/dev/null
echo ./extern/lib/dec_risc/libmlm.a >> $temp_file4 2>/dev/null
echo ./extern/lib/dec_risc/libmlt.a >> $temp_file4 2>/dev/null
		;;
	    mathlib/hp300)
echo ./extern/lib/hp300/libmcc.a >> $temp_file4 2>/dev/null
echo ./extern/lib/hp300/libmlm.a >> $temp_file4 2>/dev/null
echo ./extern/lib/hp300/libmlt.a >> $temp_file4 2>/dev/null
		;;
	    mathlib/sol2)
echo ./extern/lib/sol2/libmcc.a >> $temp_file4 2>/dev/null
echo ./extern/lib/sol2/libmlm.a >> $temp_file4 2>/dev/null
echo ./extern/lib/sol2/libmlt.a >> $temp_file4 2>/dev/null
		;;
	    mathlib/alpha)
echo ./extern/lib/alpha/libmcc.a >> $temp_file4 2>/dev/null
echo ./extern/lib/alpha/libmlm.a >> $temp_file4 2>/dev/null
echo ./extern/lib/alpha/libmlt.a >> $temp_file4 2>/dev/null
		;;
	    mathlib/lnx86)
echo ./extern/lib/lnx86/libmcc.a >> $temp_file4 2>/dev/null
echo ./extern/lib/lnx86/libmlm.a >> $temp_file4 2>/dev/null
echo ./extern/lib/lnx86/libmlt.a >> $temp_file4 2>/dev/null
		;;
#--------------------------
	    ada)
if [ -d ./toolbox/ada ]; then
    find ./toolbox/ada -type f -print 2>/dev/null | egrep -v '.*\.mex.*' >> $temp_file4
fi
if [ -d ./codegen/ada ]; then
    find ./codegen/ada -type f -print 2>/dev/null | egrep -v '.*\.mex.*' >> $temp_file4
fi
		;;
#	    ada/doc)
#		;;
	    ada/sun4)
if [ -d ./toolbox/ada ]; then
    find ./toolbox/ada -type f -print 2>/dev/null | egrep '.*\.mex4' >> $temp_file4
fi
if [ -d ./codegen/ada ]; then
    find ./codegen/ada -type f -print 2>/dev/null | egrep '.*\.mex4' >> $temp_file4
fi
		;;
	    ada/hp700)
if [ -d ./toolbox/ada ]; then
    find ./toolbox/ada -type f -print 2>/dev/null | egrep '.*\.mexhp7' >> $temp_file4
fi
if [ -d ./codegen/ada ]; then
    find ./codegen/ada -type f -print 2>/dev/null | egrep '.*\.mexhp7' >> $temp_file4
fi
		;;
	    ada/sgi)
if [ -d ./toolbox/ada ]; then
    find ./toolbox/ada -type f -print 2>/dev/null | egrep '.*\.mexsg' >> $temp_file4
fi
if [ -d ./codegen/ada ]; then
    find ./codegen/ada -type f -print 2>/dev/null | egrep '.*\.mexsg' >> $temp_file4
fi
		;;
	    ada/ibm_rs)
if [ -d ./toolbox/ada ]; then
    find ./toolbox/ada -type f -print 2>/dev/null | egrep '.*\.mexrs6' >> $temp_file4
fi
if [ -d ./codegen/ada ]; then
    find ./codegen/ada -type f -print 2>/dev/null | egrep '.*\.mexrs6' >> $temp_file4
fi
		;;
	    ada/dec_risc)
if [ -d ./toolbox/ada ]; then
    find ./toolbox/ada -type f -print 2>/dev/null | egrep '.*\.mexds' >> $temp_file4
fi
if [ -d ./codegen/ada ]; then
    find ./codegen/ada -type f -print 2>/dev/null | egrep '.*\.mexds' >> $temp_file4
fi
		;;
	    ada/hp300)
if [ -d ./toolbox/ada ]; then
    find ./toolbox/ada -type f -print 2>/dev/null | egrep '.*\.mexhp3' >> $temp_file4
fi
if [ -d ./codegen/ada ]; then
    find ./codegen/ada -type f -print 2>/dev/null | egrep '.*\.mexhp3' >> $temp_file4
fi
		;;
	    ada/sol2)
if [ -d ./toolbox/ada ]; then
    find ./toolbox/ada -type f -print 2>/dev/null | egrep '.*\.mexsol' >> $temp_file4
fi
if [ -d ./codegen/ada ]; then
    find ./codegen/ada -type f -print 2>/dev/null | egrep '.*\.mexsol' >> $temp_file4
fi
		;;
	    ada/alpha)
if [ -d ./toolbox/ada ]; then
    find ./toolbox/ada -type f -print 2>/dev/null | egrep '.*\.mexaxp' >> $temp_file4
fi
if [ -d ./codegen/ada ]; then
    find ./codegen/ada -type f -print 2>/dev/null | egrep '.*\.mexaxp' >> $temp_file4
fi
		;;
	    ada/lnx86)
if [ -d ./toolbox/ada ]; then
    find ./toolbox/ada -type f -print 2>/dev/null | egrep '.*\.mexlx' >> $temp_file4
fi
if [ -d ./codegen/ada ]; then
    find ./codegen/ada -type f -print 2>/dev/null | egrep '.*\.mexlx' >> $temp_file4
fi
		;;
#--------------------------
	    applink)
#
# Remove any top level files
#
if [ -d ./applink ]; then
    ls -d ./applink/* ./applink/.* > $temp_file5 2>/dev/null
    (while read file
    do
        if [ ! -d $file ]; then
	    echo $file >> $temp_file4 2>/dev/null
	fi
    done) < $temp_file5
fi
		;;
#	    applink/doc)
#		;;
	    applink/sun4)
echo ./applink/sun4 >> $temp_file4 2>/dev/null
		;;
	    applink/hp700)
echo ./applink/hp700 >> $temp_file4 2>/dev/null
		;;
	    applink/sgi)
echo ./applink/sgi >> $temp_file4 2>/dev/null
		;;
	    applink/ibm_rs)
echo ./applink/ibm_rs >> $temp_file4 2>/dev/null
		;;
	    applink/dec_risc)
echo ./applink/dec_risc >> $temp_file4 2>/dev/null
		;;
	    applink/hp300)
echo ./applink/hp300 >> $temp_file4 2>/dev/null
		;;
	    applink/sol2)
echo ./applink/sol2 >> $temp_file4 2>/dev/null
		;;
	    applink/alpha)
echo ./applink/alpha >> $temp_file4 2>/dev/null
		;;
	    applink/lnx86)
echo ./applink/lnx86 >> $temp_file4 2>/dev/null
		;;
#--------------------------
	    toolbox/wavelet)
echo ./toolbox/wavelet >> $temp_file4 2>/dev/null
		;;
#	    toolbox/wavelet/doc)
#		;;
#--------------------------
	    toolbox/comm)
#
# Remove any top level files
#
if [ -d ./toolbox/comm ]; then
    find ./toolbox/comm -type f -print 2>/dev/null | egrep -v './toolbox/comm/doc' | egrep -v '.*\.mex.*' >> $temp_file4
fi
if [ -d ./toolbox/uitools ]; then
    find ./toolbox/uitools -type f -print 2>/dev/null | egrep -v '.*\.mex.*' >> $temp_file4
fi
		;;
#	    toolbox/comm/doc)
#		;;
	    toolbox/comm/sun4)
if [ -d ./toolbox/comm ]; then
    find ./toolbox/comm -type f -print 2>/dev/null | egrep -v './toolbox/comm/doc' | egrep '.*\.mex4' >> $temp_file4
fi
if [ -d ./toolbox/uitools ]; then
    find ./toolbox/uitools -type f -print 2>/dev/null | egrep '.*\.mex4' >> $temp_file4
fi
		;;
	    toolbox/comm/hp700)
if [ -d ./toolbox/comm ]; then
    find ./toolbox/comm -type f -print 2>/dev/null | egrep -v './toolbox/comm/do
c' | egrep '.*\.mexhp7' >> $temp_file4
fi
if [ -d ./toolbox/uitools ]; then
    find ./toolbox/uitools -type f -print 2>/dev/null | egrep '.*\.mexhp7' >> $temp_file4
fi
		;;
	    toolbox/comm/sgi)
if [ -d ./toolbox/comm ]; then
    find ./toolbox/comm -type f -print 2>/dev/null | egrep -v './toolbox/comm/do
c' | egrep '.*\.mexsg' >> $temp_file4
fi
if [ -d ./toolbox/uitools ]; then
    find ./toolbox/uitools -type f -print 2>/dev/null | egrep '.*\.mexsg' >> $temp_file4
fi
		;;
	    toolbox/comm/ibm_rs)
if [ -d ./toolbox/comm ]; then
    find ./toolbox/comm -type f -print 2>/dev/null | egrep -v './toolbox/comm/do
c' | egrep '.*\.mexrs6' >> $temp_file4
fi
if [ -d ./toolbox/uitools ]; then
    find ./toolbox/uitools -type f -print 2>/dev/null | egrep '.*\.mexrs6' >> $temp_file4
fi
		;;
	    toolbox/comm/dec_risc)
if [ -d ./toolbox/comm ]; then
    find ./toolbox/comm -type f -print 2>/dev/null | egrep -v './toolbox/comm/do
c' | egrep '.*\.mexds' >> $temp_file4
fi
if [ -d ./toolbox/uitools ]; then
    find ./toolbox/uitools -type f -print 2>/dev/null | egrep '.*\.mexds' >> $temp_file4
fi
		;;
	    toolbox/comm/hp300)
if [ -d ./toolbox/comm ]; then
    find ./toolbox/comm -type f -print 2>/dev/null | egrep -v './toolbox/comm/doc' | egrep '.*\.mexhp3' >> $temp_file4
fi
if [ -d ./toolbox/uitools ]; then
    find ./toolbox/uitools -type f -print 2>/dev/null | egrep '.*\.mexhp3' >> $temp_file4
fi
		;;
	    toolbox/comm/sol2)
if [ -d ./toolbox/comm ]; then
    find ./toolbox/comm -type f -print 2>/dev/null | egrep -v './toolbox/comm/do
c' | egrep '.*\.mexsol' >> $temp_file4
fi
if [ -d ./toolbox/uitools ]; then
    find ./toolbox/uitools -type f -print 2>/dev/null | egrep '.*\.mexsol' >> $temp_file4
fi
		;;
	    toolbox/comm/alpha)
if [ -d ./toolbox/comm ]; then
    find ./toolbox/comm -type f -print 2>/dev/null | egrep -v './toolbox/comm/do
c' | egrep '.*\.mexaxp' >> $temp_file4
fi
if [ -d ./toolbox/uitools ]; then
    find ./toolbox/uitools -type f -print 2>/dev/null | egrep '.*\.mexaxp' >> $temp_file4
fi
		;;
	    toolbox/comm/lnx86)
if [ -d ./toolbox/comm ]; then
    find ./toolbox/comm -type f -print 2>/dev/null | egrep -v './toolbox/comm/do
c' | egrep '.*\.mexlx' >> $temp_file4
fi
if [ -d ./toolbox/uitools ]; then
    find ./toolbox/uitools -type f -print 2>/dev/null | egrep '.*\.mexlx' >> $temp_file4
fi
		;;
#--------------------------
	    *)
:
		;;
	esac
    fi
#
# Skip over the first 3 lines which are not file/directories
#
    sed -e '4,$s/^/rm -rf /' -e '4,$s%$% > /dev/null 2>\&1%' $temp_file4 > $temp_file5
    chmod +x $temp_file5
#
    . $temp_file5
    cd $startpath
    rm -f $temp_file4 $temp_file5 > /dev/null 2>&1
