OBJS = ast.cmo parser.cmo scanner.cmo bytecode.cmo compile.cmo execute.cmo learn.cmo

TESTS = \
arithmetic \
assignment \
declarations-array \
equality \
function \
if1 \
if2 \
logical-comparison \
relational \
statements-loop \
unary

TARFILES = Makefile testall.sh scanner.mll parser.mly \
	ast.ml bytecode.ml compile.ml execute.ml learn.ml \
	$(TESTS:%=tests/test-%.learn) \
	$(TESTS:%=tests/test-%.output) \
	$(TESTS:%=tests/test-%.input) \

learn : $(OBJS)
	ocamlc -o learn $(OBJS)

.PHONY : test
test : learn testall.sh
	./testall.sh

scanner.ml : scanner.mll
	ocamllex scanner.mll

parser.ml parser.mli : parser.mly
	ocamlyacc parser.mly

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

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

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

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

# Generated by ocamldep *.ml *.mli
ast.cmo: 
ast.cmx: 
bytecode.cmo: ast.cmo 
bytecode.cmx: ast.cmx 
compile.cmo: bytecode.cmo ast.cmo 
compile.cmx: bytecode.cmx ast.cmx 
execute.cmo: bytecode.cmo ast.cmo 
execute.cmx: bytecode.cmx ast.cmx 
learn.cmo: scanner.cmo parser.cmi execute.cmo compile.cmo \
    bytecode.cmo ast.cmo 
learn.cmx: scanner.cmx parser.cmx execute.cmx compile.cmx \
    bytecode.cmx ast.cmx 
parser.cmo: ast.cmo parser.cmi 
parser.cmx: ast.cmx parser.cmi 
scanner.cmo: parser.cmi 
scanner.cmx: parser.cmx 
parser.cmi: ast.cmo 
