#!/bin/sh

rm -f model.c
rm -f $2

echo "Creating model.c file from $1 ..."
mod $1

if test $2; 
 then target=$2;
 else target=mcsim.$1;
fi;

if test -f model.c; then \

	echo; \
	echo "Compiling model ..."; \
	gcc -I/usr/pkg/include -L/usr/pkg/lib model.c -lmcsim -lmodelu -o $target -lgsl -lgslcblas -lm -Wall; \

fi;

if test -f $target; then \

	echo "Cleaning up ..."; \
	rm -f model.c; \

	echo "Created executable $target."; \
	echo; \

fi;
