# Make sure ocamlbuild can find opam-managed packages: first run
#
# eval `opam config env`
ALL: minimat.native minimat

.PHONY : minimat.native clean

minimat.native :
	ocamlbuild -use-ocamlfind -pkgs llvm,llvm.analysis -cflags -w,+a-4 \
		minimat.native
clean :
	ocamlbuild -clean
	rm -rf testall.log *.diff minimat scanner.ml parser.ml parser.mli
	rm -rf *.cmx *.cmi *.cmo *.cmx *.o *~


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

minimat : $(OBJS)
	ocamlfind ocamlopt -linkpkg -package llvm -package llvm.analysis $(OBJS) -o minimat

scanner.ml : scanner.mll
	ocamllex scanner.mll

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

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

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

%.cmx : %.ml
	ocamlfind ocamlopt -c -package llvm $<

### Generated by "ocamldep *.ml *.mli" after building scanner.ml and parser.ml
ast.cmo :
ast.cmx :
codegen.cmo : ast.cmo
codegen.cmx : ast.cmx
minimat.cmo : semant.cmo parser.cmi codegen.cmo ast.cmo
minimat.cmx : semant.cmx parser.cmx codegen.cmx ast.cmx
parser.cmo : ast.cmo parser.cmi
parser.cmx : ast.cmx parser.cmi
semant.cmo : ast.cmo
semant.cmx : ast.cmx
