#!/bin/bash

args=$*
for a in $args; do
	ext=`echo $a | cut -f2 -d.`
	if [ $ext  == ic ]; then
		name=`echo $a | cut -f1 -d.`;
	fi;
done

echo "*** Compile $name.ic"
java -cp ../classes IC/Compiler $*

echo "*** Assemble $name.s"
as -o $name.o $name.s

echo "*** Link $name.o"
ld -o $name.exe $name.o /lib/crt0.o libic.a -lcygwin -lkernel32
rm $name.o

