#!/bin/sh
#							Author: Kees J. Bot
# Compile one soft FP source file.
# (These files shouldn't be optimized normally, but the 16-bit C compiler
# only optimizes scratch register allocation a bit with -O.  To the 32-bit
# compiler -O is a no-op.)

case $#:$2 in
2:*.fc)	;;
*)	echo "$0: $1: not a FC file" >&2; exit 1
esac

dst=$1
src=$2
base="`basename "$src" .fc`"
trap 'rm -f tmp.c tmp.s"; exit 1' 2

cp "$src" tmp.c &&
cc -O -I. -D_MINIX -D_POSIX_SOURCE -S tmp.c &&
sed -f FP.script tmp.s > "$base.s" &&
cc -c -o $dst "$base.s" &&
rm tmp.c tmp.s
