OBJS = parser.cmo scanner.cmo mbc.cmo

TESTS = \
addsub-bad \
addsub-good \
assign-bad \
assign-good \
for-bad \
for-good \
forloops-bad \
forloops-good \
identifiers-bad \
identifiers-good \
ifthen-bad \
ifthen-good \
literals \
multdiv-bad \
multdiv-good \
print \
relation-bad \
relation-good \
rem \
while-bad \
while-good

EXAMPLES = \
exampleprogram1 \
exampleprogram2 \
forloop \
ifthen \
math \
whileloop 

TARFILES = Makefile scanner.mll parser.mly ast.mli mbc.ml test.sh \
           jec2160-mbc-final-report.pdf jec2160-mbc-final-report.docx \
           jec2160-mbc-project-presentation.pptx README.1ST \
           $(TESTS:%=testcases/%.bas) \
		   $(EXAMPLES:%=examples/%.bas)

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

.PHONY : test
test : mbc test.sh
	./test.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 $<

mbc.tar.gz : $(TARFILES)
	cd .. && tar zcf mbc/mbc.tar.gz $(TARFILES:%=mbc/%)

.PHONY : clean
clean :
	rm -f mbc parser.ml parser.mli scanner.ml *.cmo *.cmi

# Generated by ocamldep *.ml *.mli
mbc.cmo: scanner.cmo parser.cmi ast.cmi 
mbc.cmx: scanner.cmx parser.cmx ast.cmi 
parser.cmo: ast.cmi parser.cmi 
parser.cmx: ast.cmi parser.cmi 
scanner.cmo: parser.cmi 
scanner.cmx: parser.cmx 
parser.cmi: ast.cmi 

