Route ampif77 and ampif90 through ampiCC, factoring out duplicated code 87/4787/8
authorEvan Ramos <evan@hpccharm.com>
Wed, 7 Nov 2018 22:29:39 +0000 (16:29 -0600)
committerEvan Ramos <evan@hpccharm.com>
Thu, 14 Mar 2019 18:12:48 +0000 (13:12 -0500)
Change-Id: I89430b1833d0cda8d3875e6b6a2142158701b3c4

src/libs/ck-libs/ampi/ampiCC
src/libs/ck-libs/ampi/ampif77
src/libs/ck-libs/ampi/ampif90

index 3cb2fa4..db173a1 100755 (executable)
@@ -1,6 +1,7 @@
 #!/bin/sh
 CHARMBIN=`dirname $0`
 
+[ -z "$AMPICC_MODE" ] && AMPICC_MODE='ampi'
 STANDALONE=""
 
 processArgs() {
@@ -24,27 +25,33 @@ done
 
 eval processArgs "$@"
 
-charmarch=$(cat $CHARMBIN/../tmp/.gdir)
-
 AMPICC_EXTRA_OPTIONS=""
 
-if test "$charmarch" = "mpi"
+if test "$AMPICC_MODE" = 'ampi'
 then
+  charmarch=$(cat $CHARMBIN/../tmp/.gdir)
+
+  if test "$charmarch" = "mpi"
+  then
     dirName=ampicc.inc.$$
     mkdir $dirName
     cp -n $CHARMBIN/../include/mpi.h $dirName/mpi.h   2>/dev/null
-    AMPICC_EXTRA_OPTIONS="-I./$dirName"
+    AMPICC_EXTRA_OPTIONS="$AMPICC_EXTRA_OPTIONS -I./$dirName"
+  fi
 fi
 
 [ -f $CHARMBIN/../lib/libampiromio.a -a -z "$STANDALONE" ] && ROMIO=-lampiromio
 
-$CHARMBIN/charmc -language ampi -default-to-aout $AMPICC_EXTRA_OPTIONS $@ $ROMIO
+$CHARMBIN/charmc -language $AMPICC_MODE -default-to-aout $AMPICC_EXTRA_OPTIONS $@ $ROMIO
 status=$?
 
-if test "$charmarch" = "mpi"
+if test "$AMPICC_MODE" = 'ampi'
 then
+  if test "$charmarch" = "mpi"
+  then
     /bin/rm -f $dirName/mpi.h 2>/dev/null
     rmdir $dirName
+  fi
 fi
 
 # Copy ampirun, but do not overwrite it if it already exists.
index bfa9f3e..d7aa228 100755 (executable)
@@ -1,25 +1,6 @@
 #!/bin/sh
 CHARMBIN=`dirname $0`
 
-STANDALONE=""
+export AMPICC_MODE='ampif'
 
-processArgs() {
-while [ ! $# -eq 0 ]
-do
-  arg="$1"
-  case "$arg" in
-  -standalone)
-     STANDALONE="true"
-     ;;
-  *)
-     ;;
-  esac
-  shift
-done
-}
-
-eval processArgs "$@"
-
-[ -f $CHARMBIN/../lib/libampiromio.a -a -z "$STANDALONE" ] && ROMIO=-lampiromio
-
-$CHARMBIN/charmc -language ampif -default-to-aout $@ $ROMIO
+$CHARMBIN/ampiCC $@
index 545835a..de07ae9 100755 (executable)
@@ -1,29 +1,10 @@
 #!/bin/sh
 CHARMBIN=`dirname $0`
 
-STANDALONE=""
-
-processArgs() {
-while [ ! $# -eq 0 ]
-do
-  arg="$1"
-  case "$arg" in
-  -standalone)
-     STANDALONE="true"
-     ;;
-  *)
-     ;;
-  esac
-  shift
-done
-}
-
-eval processArgs "$@"
-
-[ -f $CHARMBIN/../lib/libampiromio.a -a -z "$STANDALONE" ] && ROMIO=-lampiromio
+export AMPICC_MODE='ampif'
 
 cp -n $CHARMBIN/../include/mpif.h .
-$CHARMBIN/charmc -language ampif -default-to-aout $@ $ROMIO
+$CHARMBIN/ampiCC $@
 status=$?
 /bin/rm -f mpif.h
 exit $status