#! /bin/csh
#
#               deletes all the libraries made with build 
#
set TOOLS = $TOOLSDIR
#
# Look at the arguments.  Try to identify -g -O -Opg and set the variables
# BOPT and PROFILE appropriately
#
set BOPT    = "O"
set PROFILE = ""
if ($#argv > 0) then
switch ("$1")
case "-g":
  set BOPT = "g"
  shift argv
  breaksw
case "-O":
  set BOPT = "O"
  shift argv
  breaksw
case "-Opg":
  set BOPT = "O"
  set PROFILE = "pg"
  shift argv
  breaksw
case "-help":
  echo "build [ -g | -O | -Opg ] [ARCH value] other_options"
  echo "Builds the libraries for debugging, optimized running, or profiling"
  echo "with optimized code.  If the first argument does not match, an"
  echo "unoptimized code is generated.  Other_options are passed to make."
  echo 'A useful option is "COMM=p4 OPT=-Dp4"'
  echo ""
  echo "If you want to pass multiple arguments as a value of a name,"
  echo "enclose the whole thing in single quotes.  For example:"
  echo "build -O 'OPT="'"-DDEBUG_ALL -DDEBUG_TRACEBACK"'"'"
  exit
default:
endsw
endif
#
# Look for ARCH name as lead argument
#
#echo $argv
if ($#argv > 1 && "$1" == "ARCH") then
  shift argv
  set ARCH = $1
  shift argv
else
if ($?ARCH == 0) set ARCH = "`arch`"
endif
#
# Correct arch values (different manufactures have different ideas of
# what arch is for their own machines; uname, by default, returns the 
# OS (System) name; at least on manufacture (IBM) interpreted  (machine
# uname -mname) as somethine like the cpu id.  Other machines don't even
# have an uname commend.  
#
rm -f $TOOLS/libs/libs$BOPT$PROFILE/$ARCH/*.a

