1#!/usr/local/bin/bash
2
3rm -f model.c
4rm -f $2
5
6echo "Creating model.c file from $1 ..."
7mod $1
8
9shopt -s extglob
10
11if test $2;
12 then target=$2;
13 else target=mcsim.${1%.mod?('el')};
14fi;
15
16if test -f model.c; then \
17
18	echo; \
19	echo "Compiling and linking model ..."; \
20	@CC@ -O3 -I@prefix@/include -L@prefix@/lib @CPPFLAGS@ @CFLAGS@ @LDFLAGS@ model.c -lmcsim -o $target @LIBS@ -Wall; \
21
22fi;
23
24if test -f $target; then \
25
26	echo "Cleaning up ..."; \
27	rm -f model.c; \
28
29	echo "Created executable $target"; \
30	echo; \
31
32fi;
33