OBJS = ast.cmo sast.cmo semantics.cmo parser.cmo scanner.cmo interpret.cmo bytecode.cmo compile.cmo execute.cmo agrajag.cmo

TESTS = \
arith1 \
arith2 \
fib \
for1 \
func1 \
func2 \
func3 \
gcd \
global1 \
hello \
if1 \
if2 \
if3 \
if4 \
ops1 \
var1 \
while1

TARFILES = Makefile testall.sh scanner.mll parser.mly \
	ast.ml bytecode.ml interpret.ml compile.ml execute.ml agrajag.ml \
	$(TESTS:%=tests/test-%.ag) \
	$(TESTS:%=tests/test-%.out)

agrajag : $(OBJS)
	ocamlc -g -o agrajag $(OBJS)

.PHONY : test
test : agrajag testall.sh
	./testall.sh

scanner.ml : scanner.mll
	ocamllex scanner.mll

parser.ml parser.mli : parser.mly
	ocamlyacc -v parser.mly

%.cmo : %.ml
	ocamlc -g -c $<

%.cmi : %.mli
	ocamlc -g -c $<

agrajag.tar.gz : $(TARFILES)
	cd .. && tar czf agrajag/agrajag.tar.gz $(TARFILES:%=agrajag/%)

.PHONY : clean
clean :
	rm -f agrajag parser.ml parser.mli scanner.ml testall.log \
	*.cmo *.cmi *.out *.diff *.output *.parsed

# Generated by ocamldep *.ml *.mli
ast.cmo:
ast.cmx:
bytecode.cmo: ast.cmo
bytecode.cmx: ast.cmx
compile.cmo: sast.cmo bytecode.cmo ast.cmo
compile.cmx: sast.cmx bytecode.cmx ast.cmx
execute.cmo: bytecode.cmo ast.cmo
execute.cmx: bytecode.cmx ast.cmx
interpret.cmo: sast.cmo ast.cmo
interpret.cmx: sast.cmx ast.cmx
agrajag2.cmo: scanner.cmo parser.cmi compile.cmo bytecode.cmo ast.cmo
agrajag2.cmx: scanner.cmx parser.cmx compile.cmx bytecode.cmx ast.cmx
agrajag.cmo: semantics.cmo scanner.cmo sast.cmo parser.cmi interpret.cmo execute.cmo compile.cmo bytecode.cmo ast.cmo
agrajag.cmx: semantics.cmx scanner.cmx sast.cmx parser.cmx interpret.cmx execute.cmx compile.cmx bytecode.cmo ast.cmx
parser.cmo: ast.cmo parser.cmi
parser.cmx: ast.cmx parser.cmi
sast.cmo: ast.cmo
sast.cmx: ast.cmx
scanner.cmo: parser.cmi
scanner.cmx: parser.cmx
semantics.cmo: sast.cmo ast.cmo
semantics.cmx: sast.cmx ast.cmx
parser.cmi: ast.cmo
