1TOPLEVEL=$(CURDIR)/../..
2XEN_ROOT=$(TOPLEVEL)/../..
3include $(TOPLEVEL)/common.make
4
5# ignore unused generated functions and allow mixed declarations and code
6CFLAGS += -Wno-unused -Wno-declaration-after-statement
7
8CFLAGS += $(CFLAGS_libxenlight)
9CFLAGS += -I ../xentoollog
10CFLAGS += $(APPEND_CFLAGS)
11
12OBJS = xenlight
13INTF = xenlight.cmi
14LIBS = xenlight.cma xenlight.cmxa
15
16OCAMLINCLUDE += -I ../xentoollog
17
18LIBS_xenlight = $(LDLIBS_libxenlight)
19
20xenlight_OBJS = $(OBJS)
21xenlight_C_OBJS = xenlight_stubs
22
23OCAML_LIBRARY = xenlight
24
25GENERATED_FILES += xenlight.ml xenlight.ml.tmp xenlight.mli xenlight.mli.tmp
26GENERATED_FILES += _libxl_types.ml.in _libxl_types.mli.in
27GENERATED_FILES += _libxl_types.inc META
28
29all: $(INTF) $(LIBS)
30
31xenlight.ml: xenlight.ml.in _libxl_types.ml.in
32	$(Q)sed -e '1i\
33(*\
34 * AUTO-GENERATED FILE DO NOT EDIT\
35 * Generated from xenlight.ml.in and _libxl_types.ml.in\
36 *)\
37' \
38	    -e '/^(\* @@LIBXL_TYPES@@ \*)$$/r_libxl_types.ml.in' \
39	  < xenlight.ml.in > xenlight.ml.tmp
40	$(Q)mv xenlight.ml.tmp xenlight.ml
41
42xenlight.mli: xenlight.mli.in _libxl_types.mli.in
43	$(Q)sed -e '1i\
44(*\
45 * AUTO-GENERATED FILE DO NOT EDIT\
46 * Generated from xenlight.mli.in and _libxl_types.mli.in\
47 *)\
48' \
49	    -e '/^(\* @@LIBXL_TYPES@@ \*)$$/r_libxl_types.mli.in' \
50	  < xenlight.mli.in > xenlight.mli.tmp
51	$(Q)mv xenlight.mli.tmp xenlight.mli
52
53_libxl_types.ml.in _libxl_types.mli.in _libxl_types.inc: genwrap.py $(XEN_ROOT)/tools/libxl/libxl_types.idl \
54                $(XEN_ROOT)/tools/libxl/idl.py
55	PYTHONPATH=$(XEN_ROOT)/tools/libxl $(PYTHON) genwrap.py \
56		$(XEN_ROOT)/tools/libxl/libxl_types.idl \
57		_libxl_types.mli.in _libxl_types.ml.in _libxl_types.inc
58
59libs: $(LIBS)
60
61.PHONY: install
62install: $(LIBS) META
63	mkdir -p $(OCAMLDESTDIR)
64	$(OCAMLFIND) remove -destdir $(OCAMLDESTDIR) xenlight
65	$(OCAMLFIND) install -destdir $(OCAMLDESTDIR) -ldconf ignore xenlight META $(INTF) $(LIBS) *.a *.so *.cmx
66
67.PHONY: uninstall
68uninstall:
69	$(OCAMLFIND) remove -destdir $(OCAMLDESTDIR) xenlight
70
71include $(TOPLEVEL)/Makefile.rules
72