#!/bin/sh
#
# $Id: genie_f77.in 3826 1998-06-16 22:34:26Z faa $
#
# genie_f77.  Generated from genie_f77.in by configure.
#
# Run f2c followed by cc
#
link='yes'
pre_link_flags=''
post_link_flags='' 
executable=''
TMPDIR=${TMPDIR-/tmp}
# where to put intermediate C files
if [ -w . ]; then 
    BUILD_DIR=.
else
    BUILD_DIR=$TMPDIR
fi
f2cflags="-A -d$BUILD_DIR"
cflags='-g -O2'
files=''
CC='gcc'
F2C=${F2C-f2c}
while 
    test X"$1" != X
do
    case "$1" in 
	-g*)
		cflags="${cflags} $1"
		shift
		;;
	-c)
		link='no'
		shift
		;;
	-o)
		executable="$2"
		shift 2
		;;
	-O)
		cflags="${cflags} -O"
		shift
		;;
	-I*)
		f2cflags="${f2cflags} $1"
		cflags="${cflags} $1"
		pre_link_flags="${pre_link_flags} $1"
		shift
		;;
	-L*)
		pre_link_flags="${pre_link_flags} $1"
		shift
		;;
	-l*)
		post_link_flags="${post_link_flags} $1"
		shift
		;;
    	-*)		
	 	echo "genie_f77: Ignoring argument $1"
		shift
		;;      # ignore any command line options
    	*)
		files="$files $1"
		shift
		;;
	esac
done
for i in $files; do
        	base=`basename $i .f`
		object="${base}.o"
		[ $link = 'no' -a ! -z "$executable" ] && object=$executable
		${F2C} ${f2cflags} $i && ${CC} ${cflags} -c ${BUILD_DIR}/${base}.c -o $object && objects="$objects $object"
		rm -f ${BUILD_DIR}/${base}.c
done
if test $link = 'yes'; then
    [ -z "$executable" ] && executable="a.out"
    ${CC} -o $executable $pre_link_flags $objects $post_link_flags -lf2c
fi
