#CC=ocamlopt
CC=ocamlfind opt -package sem -cclib -lpthread -g
CFLAGS=-thread
LFLAGS=unix.cmxa threads/threads.cmxa str.cmxa sem.cmxa

# order of OBJS and CMIS is important!
OBJS=rtcp.cmx globals.cmx bebcast.cmx rbcast.cmx consensus.cmx abcast.cmx gbcast.cmx mp.cmx ar_app.cmx ar_app_parser.cmx ar_udp.cmx ar_framework.cmx
CMIS=rtcp.cmi globals.cmi bebcast.cmi rbcast.cmi consensus.cmi abcast.cmi gbcast.cmi mp.cmi ar_app.cmi ar_app_parser.cmi ar_udp.cmi ar_framework.cmi

TARGETS=ar_main main

RTCP_TEST_OBJS=rtcp.cmx globals.cmx
RTCP_TEST_TARGETS=servertest clienttest

all: $(TARGETS) $(RTCP_TEST_TARGETS)

$(RTCP_TEST_TARGETS): %: %.ml $(RTCP_TEST_OBJS)
    $(CC) -o $@ $(CFLAGS) $(LFLAGS) $(RTCP_TEST_OBJS) $<

$(TARGETS): %: %.ml $(OBJS)
    $(CC) -o $@ $(CFLAGS) $(LFLAGS) $(OBJS) $<

$(OBJS): %.cmx: %.ml $(CMIS) %.cmi
    $(CC) -c -o $@ $(CFLAGS) $<

$(CMIS): %.cmi: %.mli
    $(CC) $<


clean:
    rm -rf *.cm* *.a *.o $(TARGETS) $(RTCP_TEST_TARGETS)

Add a code snippet to your website: www.paste.org