# Eff in OCaml
OCAMLBIN:=$(shell dirname `which ocaml`)
OCAMLC=$(OCAMLBIN)/ocamlc
OCAML=$(OCAMLBIN)/ocaml
OCAMLLIB:=$(shell $(OCAMLC) -where)

#Requires delimcc

.SUFFIXES: .ml .mli .cmi .cmo .cmx .cmxa .dvi .pdf .ps .tex .eps .jpg .png .bbl

%.cmi: %.mli
	$(OCAMLC) -c $<

%.cmi: %.ml
	$(OCAMLC) -c $<

%.cmo: %.ml %.cmi
	$(OCAMLC) -c $<

.PHONY: all
all: intro intro1 eff_sem delimcc_sem translation

intro:
	$(OCAML) delimcc.cma eff.ml

intro1:
	$(OCAML) delimcc.cma eff1.ml

eff_sem: eff_semantics.cmo eff_semantics.cmi
	$(OCAMLC) -o eff_semantics eff_semantics.cmo
	./eff_semantics

clean::
	$(RM) eff_semantics

delimcc_sem: delimcc_semantics.cmo delimcc_semantics.cmi
	$(OCAMLC) -o delimcc_semantics delimcc_semantics.cmo
	./delimcc_semantics

clean::
	$(RM) delimcc_semantics

translation: eff_semantics.cmo delimcc_semantics.cmo
	$(OCAMLC) -o translation eff_semantics.cmo delimcc_semantics.cmo \
	translation.ml
	./translation

clean::
	$(RM) translation

bench_delim: delimcc_semantics.cmo bench_nondet.cmo
	$(OCAMLC) -o bench_delim delimcc.cma \
	delimcc_semantics.cmo bench_nondet.cmo
	./bench_delim

clean::
	$(RM) bench_delim

clean::
	$(RM) *.cm[ioxa] *.[oa] *~ *.aux *.vrb
