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

AUTH_MODULE=auth_sys
# one of: auth_sys auth_dh auth_ssl

REQUIRES = rpc,unix
OBJ = queues_aux.cmo queues_clnt.cmo queues_srv.cmo qserver.cmo qclient.cmo
SRV_EXPLICIT_OBJ = 
CLNT_EXPLICIT_OBJ = 

include Makefile.$(AUTH_MODULE)

SRV_EXPLICIT_OBJ += qserver_main.cmo
CLNT_EXPLICIT_OBJ += qclient_main.cmo

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


all: queueslib.cma qserver qclient

opt: queueslib.cmxa qserver.opt qclient.opt

qserver: $(SRV_EXPLICIT_OBJ)
	$(OCAMLC) -o qserver -custom queueslib.cma $(SRV_EXPLICIT_OBJ) -linkpkg

qserver.opt: $(SRV_EXPLICIT_XOBJ)
	$(OCAMLOPT) -o qserver.opt queueslib.cmxa $(SRV_EXPLICIT_XOBJ) -linkpkg

qclient: $(CLNT_EXPLICIT_OBJ)
	$(OCAMLC) -o qclient -custom queueslib.cma $(CLNT_EXPLICIT_OBJ) -linkpkg

qclient.opt: $(CLNT_EXPLICIT_XOBJ)
	$(OCAMLOPT) -o qclient.opt queueslib.cmxa $(CLNT_EXPLICIT_XOBJ) -linkpkg

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

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

include depend
