#!/bin/sh
if [ $# != 1 ] ; then
  echo "Usage: $0 <path/to/eclipse/root>"
  echo ""
  echo "Please enter the location of your eclipse installation."
  echo "Note that you must use a TAU Eclipse package directory"
  echo "and have a recognized MPI in your binary path."
  exit 1
fi

TYPE="NIL"

if [ ! -d "$1" ] ; then
    echo "Invalid eclipse directory"
    exit 1
fi

if [[ "$1" == *"eclipse"*"AIX"* ]] ; then
    #echo "It's AIX!"
    TYPE="aix"
fi
if [[ "$1" == *"eclipse"*"PPC"* ]] ; then
    #echo "It's PPC!"
    TYPE="linux.ppc"
fi
if [[ "$1" == *"eclipse"*"X86"* ]] ; then
    #echo "It's X86!"
    TYPE="linux.x86_2."
fi
if [[ "$1" == *"eclipse"*"X64"* ]] ; then
    #echo "It's X64!"
    TYPE="linux.x86_64"
fi

if [ $TYPE == "NIL" ] ; then
    echo "Invalid directory: This script requires a TAU Eclipse"
    echo "package directory with its default name."
    exit 1
fi

if [ ! -d "$1"/plugins/ ] ; then
    echo "No plugins directory in eclipse root."
    exit 1
fi

pushd $1/plugins/org.eclipse.ptp.$TYPE*

sh BUILD

popd
