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

REQUIRES = rpc,unix,netplex
OBJ = finder_service_aux.cmo finder_service_clnt.cmo finder_service_srv.cmo
SRV_EXPLICIT_OBJ = 
CLNT_EXPLICIT_OBJ = 

SRV_EXPLICIT_OBJ += finder_daemon.cmo
CLNT_EXPLICIT_OBJ += finder_client.cmo

XOBJ = $(OBJ:.cmo=.cmx)
SRV_EXPLICIT_XOBJ = $(SRV_EXPLICIT_OBJ:.cmo=.cmx)
CLNT_EXPLICIT_XOBJ = $(CLNT_EXPLICIT_OBJ:.cmo=.cmx)

CLEAN_LIST += finder_daemon finder_client

all: finderlib.cma finder_daemon finder_client

opt: finderlib.cmxa finder_daemon.opt finder_client.opt

finder_daemon: $(SRV_EXPLICIT_OBJ)
	$(OCAMLC) -o finder_daemon finderlib.cma $(SRV_EXPLICIT_OBJ) -linkpkg -thread

finder_daemon.opt: $(SRV_EXPLICIT_XOBJ)
	$(OCAMLOPT) -o finder_daemon finderlib.cmxa $(SRV_EXPLICIT_XOBJ) -linkpkg -thread

finder_client: $(CLNT_EXPLICIT_OBJ)
	$(OCAMLC) -o finder_client finderlib.cma $(CLNT_EXPLICIT_OBJ) -linkpkg

finder_client.opt: $(CLNT_EXPLICIT_XOBJ)
	$(OCAMLOPT) -o finder_client finderlib.cmxa $(CLNT_EXPLICIT_XOBJ) -linkpkg

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

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

include depend
