CAMLLIB = $(shell ocamlc -where)
DEF_CPPFLAGS += -I$(CAMLLIB)

OCAMLFIND=ocamlfind
OCAMLOPT=ocamlopt


INCLUDES := -I .
OCAML_LIBS := unix.cmxa

OBJS := constants.cmx utils.cmx interface.cmx socket.cmx message.cmx connection.cmx store.cmx attack.cmx

# Static compilation is enabled by default, but if you're sure you have the
# right dynamic libraries in the guest domain, then leave this blank

#EXTRA_OPTS :=
EXTRA_OPTS := -ccopt -static


# Build rules

.PHONY: all default clean

all: attack
default: all


# Source build rules

%.cmx: %.ml
	$(OCAMLFIND) $(OCAMLOPT) $(INCLUDES) -c $< -o $@

%.o: %.c
	gcc -c $< -o $@


# Executable build rule

attack: $(OBJS)
	$(OCAMLFIND) $(OCAMLOPT) unix.cmxa -o attack $(OBJS) $(EXTRA_OPTS)

clean:
	rm -f *.a *.o *.cmx *.cmi attack
