#!/bin/sh # # mpicc and mpif77 for PowerMPI # # Written at Jan,Apr 1999 by Ilya Evseev (evseev@csa.ru) # #------------ Options --------------# # PX_MPI=/export/home/parix/mpi CMDLINE="" #----------- Variables -------------# # NOLINK=0 FIRST= DEST= SHOW=eval MYNAME=`basename $0` #--------- Check self name ---------# # case z_$MYNAME in z_mpicc ) SRC_EXT=.c ; COMPILER=ancc ;; z_mpif77 ) SRC_EXT=.f ; COMPILER=fc ;; *) echo My name must be mpicc or mpif77 only, not $MYNAME ; exit 1 ;; esac syntax() { test -z "$1" || echo ERROR: $* echo ...... Syntax: $0 filename${SRC_EXT} [files...] [switches...] echo ...... Switches: -c, -o file, -show, --help echo ...... All others switches are passed to compiler exit 1 } #------- Parse command line --------# # while [ ! -z "$1" ] do case $1 in -c) NOLINK=1 ;; -o) shift test -z "$1" && syntax "Missing output name after -o switch" DEST="-o $1" ;; -show) SHOW=echo ;; --help) syntax ;; -*) CMDLINE="${CMDLINE} $1" ;; *) test -z "${FIRST}" && FIRST=$1 CMDLINE="${CMDLINE} $1" esac shift done test -z "${FIRST}" && syntax "Missing source filename" #----- Produce output filename -----# # if [ ${NOLINK} = 1 ]; then DEST="-c ${DEST}" elif [ "${DEST}" = "" ]; then DEST="-o `dirname ${FIRST}`/`basename ${FIRST} ${SRC_EXT}`.px" fi #---------- Run compiler -----------# # ${SHOW} px ${COMPILER} ${DEST} ${CMDLINE} \ -I${PX_MPI}/include -L${PX_MPI}/lib/parix/ch_px -lmpi exit $? ## EOF ##