1TOPLEVEL=$(CURDIR)/../..
2XEN_ROOT=$(TOPLEVEL)/../..
3include $(TOPLEVEL)/common.make
4
5# allow mixed declarations and code
6CFLAGS += -Wno-declaration-after-statement
7
8CFLAGS += $(CFLAGS_libxentoollog)
9CFLAGS += $(APPEND_CFLAGS)
10OCAMLINCLUDE +=
11
12OBJS = xentoollog
13INTF = xentoollog.cmi
14LIBS = xentoollog.cma xentoollog.cmxa
15
16LIBS_xentoollog = $(LDLIBS_libxentoollog)
17
18xentoollog_OBJS = $(OBJS)
19xentoollog_C_OBJS = xentoollog_stubs
20
21OCAML_LIBRARY = xentoollog
22
23GENERATED_FILES += xentoollog.ml xentoollog.ml.tmp xentoollog.mli xentoollog.mli.tmp
24GENERATED_FILES += _xtl_levels.mli.in _xtl_levels.ml.in _xtl_levels.inc META
25
26all: $(INTF) $(LIBS)
27
28xentoollog.ml: xentoollog.ml.in _xtl_levels.ml.in
29	$(Q)sed -e '1i\
30(*\
31 * AUTO-GENERATED FILE DO NOT EDIT\
32 * Generated from xentoollog.ml.in and _xtl_levels.ml.in\
33 *)\
34' \
35	    -e '/^(\* @@XTL_LEVELS@@ \*)$$/r_xtl_levels.ml.in' \
36	  < xentoollog.ml.in > xentoollog.ml.tmp
37	$(Q)mv xentoollog.ml.tmp xentoollog.ml
38
39xentoollog.mli: xentoollog.mli.in _xtl_levels.mli.in
40	$(Q)sed -e '1i\
41(*\
42 * AUTO-GENERATED FILE DO NOT EDIT\
43 * Generated from xentoollog.mli.in and _xtl_levels.mli.in\
44 *)\
45' \
46	    -e '/^(\* @@XTL_LEVELS@@ \*)$$/r_xtl_levels.mli.in' \
47	  < xentoollog.mli.in > xentoollog.mli.tmp
48	$(Q)mv xentoollog.mli.tmp xentoollog.mli
49
50libs: $(LIBS)
51
52_xtl_levels.ml.in _xtl_levels.mli.in _xtl_levels.inc: genlevels.py $(XEN_ROOT)/tools/libs/toollog/include/xentoollog.h
53	$(PYTHON) genlevels.py _xtl_levels.mli.in _xtl_levels.ml.in _xtl_levels.inc
54
55.PHONY: install
56install: $(LIBS) META
57	mkdir -p $(OCAMLDESTDIR)
58	ocamlfind remove -destdir $(OCAMLDESTDIR) xentoollog
59	ocamlfind install -destdir $(OCAMLDESTDIR) -ldconf ignore xentoollog META $(INTF) $(LIBS) *.a *.so *.cmx
60
61.PHONY: uninstall
62uninstall:
63	ocamlfind remove -destdir $(OCAMLDESTDIR) xentoollog
64
65include $(TOPLEVEL)/Makefile.rules
66