1TOPLEVEL=$(CURDIR)/../..
2XEN_ROOT=$(TOPLEVEL)/../..
3include $(TOPLEVEL)/common.make
4
5CFLAGS += -I../mmap
6CFLAGS += $(CFLAGS_libxenctrl) # For xen_mb()
7CFLAGS += $(CFLAGS_xeninclude)
8CFLAGS += $(APPEND_CFLAGS)
9OCAMLINCLUDE += -I ../mmap
10OCAMLOPTFLAGS += -for-pack Xenbus
11
12.NOTPARALLEL:
13# Ocaml is such a PITA!
14
15PREINTF = op.cmi partial.cmi packet.cmi
16PREOBJS = op partial packet xs_ring
17PRELIBS = $(foreach obj, $(PREOBJS),$(obj).cmo) $(foreach obj,$(PREOJBS),$(obj).cmx)
18OBJS = op partial packet xs_ring xb
19INTF = op.cmi packet.cmi xb.cmi
20LIBS = xenbus.cma xenbus.cmxa
21
22ALL_OCAML_OBJS = $(OBJS) $(PREOJBS)
23
24all: $(PREINTF) $(PRELIBS) $(INTF) $(LIBS) $(PROGRAMS)
25
26bins: $(PROGRAMS)
27
28libs: $(LIBS)
29
30xenbus_OBJS = xenbus
31xenbus_C_OBJS = xs_ring_stubs xenbus_stubs
32OCAML_LIBRARY = xenbus
33
34xenbus.cmx : $(foreach obj, $(OBJS), $(obj).cmx)
35	$(E) " CMX      $@"
36	$(OCAMLOPT) -pack -o $@ $^
37
38xenbus.cmo : $(foreach obj, $(OBJS), $(obj).cmo)
39	$(E) " CMO      $@"
40	$(OCAMLC) -pack -o $@ $^
41
42%.mli: %.ml
43	$(E) " MLI      $@"
44	$(Q)$(OCAMLC) $(OCAMLINCLUDE) -i $< $o
45
46.PHONY: install
47install: $(LIBS) META
48	mkdir -p $(OCAMLDESTDIR)
49	$(OCAMLFIND) remove -destdir $(OCAMLDESTDIR) xenbus
50	$(OCAMLFIND) install -destdir $(OCAMLDESTDIR) -ldconf ignore xenbus META $(LIBS) xenbus.cmo xenbus.cmi xenbus.cmx *.a *.so
51
52.PHONY: uninstall
53uninstall:
54	$(OCAMLFIND) remove -destdir $(OCAMLDESTDIR) xenbus
55
56include $(TOPLEVEL)/Makefile.rules
57