TOP_DIR = ../..
include $(TOP_DIR)/Makefile.rules

REQUIRES = rpc,unix,netplex
OBJ = operation_aux.cmo operation_clnt.cmo operation_srv.cmo
XOBJ = $(OBJ:.cmo=.cmx)

OCAMLC_OPTIONS = -custom

all: testlib.cma test_client helper_container helloworld lever

opt: testlib.cmxa test_client.opt helper_container.opt helloworld.opt lever.opt

helper_container: testlib.cma helper_container.ml
	$(OCAMLC) -o helper_container testlib.cma helper_container.ml -linkpkg -thread

helper_container.opt: testlib.cmxa helper_container.ml
	$(OCAMLOPT) -o helper_container.opt testlib.cmxa helper_container.ml -linkpkg -thread

helloworld: testlib.cma helloworld.ml
	$(OCAMLC) -o helloworld testlib.cma helloworld.ml -linkpkg -thread

helloworld.opt: testlib.cmxa helloworld.ml
	$(OCAMLOPT) -o helloworld.opt testlib.cmxa helloworld.ml -linkpkg -thread

lever: testlib.cma lever.ml
	$(OCAMLC) -o lever testlib.cma lever.ml -linkpkg -thread

lever.opt: testlib.cmxa lever.ml
	$(OCAMLOPT) -o lever.opt testlib.cmxa lever.ml -linkpkg -thread

test_client: testlib.cma test_client.ml
	$(OCAMLC) -o test_client testlib.cma test_client.ml -linkpkg

test_client.opt: testlib.cmxa test_client.ml
	$(OCAMLOPT) -o test_client.opt testlib.cmxa test_client.ml -linkpkg

testlib.cma: $(OBJ)
	$(OCAMLC) -o testlib.cma -a $(OBJ)

testlib.cmxa: $(XOBJ)
	$(OCAMLOPT) -o testlib.cmxa -a $(XOBJ)

include depend
