#!/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 model.c /usr/pkg/share/mcsim/sim/*.c -o $target -lgsl -lgslcblas -lm -Wall; \

fi;

if test -f $target; then \

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

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

fi;
