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.PHONY: install
43install: $(LIBS) META
44	mkdir -p $(OCAMLDESTDIR)
45	$(OCAMLFIND) remove -destdir $(OCAMLDESTDIR) xenbus
46	$(OCAMLFIND) install -destdir $(OCAMLDESTDIR) -ldconf ignore xenbus META $(LIBS) xenbus.cmo xenbus.cmi xenbus.cmx *.a *.so
47
48.PHONY: uninstall
49uninstall:
50	$(OCAMLFIND) remove -destdir $(OCAMLDESTDIR) xenbus
51
52include $(TOPLEVEL)/Makefile.rules
53