vscode.native :
	opam config exec -- \
	ocamlbuild -use-ocamlfind vscode.native

TARFILES = Makefile scanner.mll parser.mly ast.ml vscode.ml semant.ml codegen.ml _tags

OBJS = ast.cmx codegen.cmx parser.cmx scanner.cmx semant.cmx vscode.cmx

LINKS = ast.cmo semant.cmo

vscode : $(OBJS) $(LINKS)
	ocamlc $(LINKS) -o vscode $(OBJS)

scanner.ml : scanner.mll
	ocamllex scanner.mll

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

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

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

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

.PHONY : clean
clean :
	rm -f vscode parser.ml parser.mli scanner.ml *.native *.cmo *.cmi parser.output test-.* fail-.*

.Phony : menhir
menhir:
	menhir --interpret --interpret-show-cst parser.mly

# Generated by ocamldep *.ml *.mli
ast.cmo:
ast.cmx:
vscode.cmo: scanner.cmo parser.cmi ast.cmo semant.cmo codegen.cmo
vscode.cmx: scanner.cmx parser.cmx ast.cmx semant.cmx codegen.cmx
codegen.cmo : ast.cmo
codegen.cmx : ast.cmx
semant.cmo: ast.cmo
semant.cmx: ast.cmx
parser.cmi: ast.cmo
parser.cmo: ast.cmo parser.cmi
parser.cmx: ast.cmx parser.cmi
scanner.cmo: parser.cmi
scanner.cmx: parser.cmx
