# make all: 		make bytecode executables
# make clean: 		remove intermediate files
# make distclean: 	remove any superflous files

#----------------------------------------------------------------------
# specific rules for this package:

OBJECTS  = procdef.cmo client.cmo server.cmo
REQUIRES = equeue rpc

all: server client

server: $(OBJECTS)
	$(OCAMLC) -custom -o server -cclib -lunix \
		unix.cma equeue.cma rpc.cma procdef.cmo server.cmo 
client: $(OBJECTS)
	$(OCAMLMKTOP) -custom -o client -cclib -lunix \
		unix.cma equeue.cma rpc.cma procdef.cmo client.cmo 


#----------------------------------------------------------------------
# general rules:

OPTIONS   =
OCAMLC    = $(OCAMLFIND) ocamlc $(OPTIONS)     -package "$(REQUIRES)"
OCAMLMKTOP= $(OCAMLFIND) ocamlmktop $(OPTIONS) -package "$(REQUIRES)"
OCAMLOPT  = $(OCAMLFIND) ocamlopt $(OPTIONS)   -package "$(REQUIRES)"
OCAMLDEP  = ocamldep $(OPTIONS)
OCAMLFIND = ocamlfind

depend: *.ml
	$(OCAMLDEP) *.ml *.mli >depend

.PHONY: clean
clean:
	rm -f *.cmi *.cmo *.cma *.cmx *.o *.a *.cmxa

.PHONY: distclean
distclean: clean
	rm -f *~ client server

.PHONY: CLEAN
CLEAN: clean

.SUFFIXES: .cmo .cmi .cmx .ml .mli

.ml.cmx:
	$(OCAMLOPT) -c $<

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

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

include depend
