#!/bin/csh -f
#
# unSETUP_csc: Removes softlinks created by SETUP_csc
#
unalias *
unsetenv PVM_ARCH

set debug=$1

if ( ! $?PVM_ROOT_DIR ) then
   setenv PVM_ROOT_DIR  /appl/compiler/pvm3      # Modify this if necessary
endif

set INCDIR=/usr/local/include                        # Modify this if necessary
set LIBDIR=/usr/local/lib                            # Modify this if necessary
set BINDIR=/usr/local/bin                            # Modify this if necessary

set ROOTDIR=${PVM_ROOT_DIR}/easypvm3

set PVM_ARCH=`${ROOTDIR}/lib/pvmgetarch`

if ( "$PVM_ARCH" == "" ) then
  echo "$0: Cannot set PVM_ARCH"
endif

set libs=`ls ${ROOTDIR}/lib/${PVM_ARCH}/lib*.a`

set bins="`ls ${ROOTDIR}/lib/${PVM_ARCH}/pvm*`"
set bins="$bins `ls ${ROOTDIR}/bin/pvm*`"
set bins="$bins ${ROOTDIR}/lib/pvmgetarch"

set incs="${ROOTDIR}/include/easy.h ${ROOTDIR}/include/feasy.h"

echo "LIBs:"

foreach LIB ( $libs )
   set FILE=${LIBDIR}/`basename $LIB`
   echo "  Unlinking  $FILE from $LIB"
   if ( "$debug" != "-d" ) then
     /bin/rm -f $FILE
   endif
end

echo "BINs:"

foreach BIN ( $bins )
   set FILE=${BINDIR}/`basename $BIN`
   echo "  Unlinking  $FILE from $BIN"
   if ( "$debug" != "-d" ) then
     /bin/rm -f $FILE
   endif
end

echo "INCLUDEs:"

foreach INC ( $incs )
   set FILE=${INCDIR}/`basename $INC`
   echo "  Unlinking  $FILE from $INC"
   if ( "$debug" != "-d" ) then
     /bin/rm -f $FILE
   endif
end


exit 0

