3cb2fa40afde225e68eafcbb1aca25cf67278ab5
[charm.git] / src / libs / ck-libs / ampi / ampiCC
1 #!/bin/sh
2 CHARMBIN=`dirname $0`
3
4 STANDALONE=""
5
6 processArgs() {
7 while [ ! $# -eq 0 ]
8 do
9   arg="$1"
10   case "$arg" in
11   -show)
12      echo "charmc"
13      exit 0
14      ;;
15   -standalone)
16      STANDALONE="true"
17      ;;
18   *)
19      ;;
20   esac
21   shift
22 done
23 }
24
25 eval processArgs "$@"
26
27 charmarch=$(cat $CHARMBIN/../tmp/.gdir)
28
29 AMPICC_EXTRA_OPTIONS=""
30
31 if test "$charmarch" = "mpi"
32 then
33     dirName=ampicc.inc.$$
34     mkdir $dirName
35     cp -n $CHARMBIN/../include/mpi.h $dirName/mpi.h   2>/dev/null
36     AMPICC_EXTRA_OPTIONS="-I./$dirName"
37 fi
38
39 [ -f $CHARMBIN/../lib/libampiromio.a -a -z "$STANDALONE" ] && ROMIO=-lampiromio
40
41 $CHARMBIN/charmc -language ampi -default-to-aout $AMPICC_EXTRA_OPTIONS $@ $ROMIO
42 status=$?
43
44 if test "$charmarch" = "mpi"
45 then
46     /bin/rm -f $dirName/mpi.h 2>/dev/null
47     rmdir $dirName
48 fi
49
50 # Copy ampirun, but do not overwrite it if it already exists.
51 [ $status -eq 0 ] && cp -n $CHARMBIN/ampirun .
52
53 exit $status