[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Xen-devel] [PATCH v3 2/2] tools/ocaml: Fix library generation

* Summary of changes:

 - .cma are created by using ocamlc with the -dllib -l<libname> option
   that will make a bytecode OCaml program link against <libname> at
   runtime. The -cclib/-ccopt options are only used in "custom
   runtime" mode, which we do not use, so I removed them. I changed
   <libname>.so to -l<libname>, as ocamlc only supports (according to
   its documentation) arguments in the form -l<libname> for -dllib.

- $(CC) -shared is used in lieu and place of $(OCAMLMKLIB). ocamlmklib
  do not provide enough flexibility for doing what we want,
  i.e. linking against specific .so libraries that we give in the
  command line. Using $(CC) directly addresses this issue.

Signed-off-by: Vincent Bernardoff <vincent.bernardoff@xxxxxxxxxx>
 tools/ocaml/Makefile.rules |    6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/tools/ocaml/Makefile.rules b/tools/ocaml/Makefile.rules
index 5e6d81e..1ff5e43 100644
--- a/tools/ocaml/Makefile.rules
+++ b/tools/ocaml/Makefile.rules
@@ -54,18 +54,18 @@ mk-caml-lib-bytecode = $(call quiet-command, $(OCAMLC) 
$(OCAMLCFLAGS) -a -o $1 $
 mk-caml-stubs = $(call quiet-command, $(OCAMLMKLIB) -o `basename $1 .a` 
 mk-caml-lib-stubs = \
-       $(call quiet-command, $(AR) rcs $1 $2 && $(OCAMLMKLIB) -o `basename $1 
.a | sed -e 's/^lib//'` $2,MKLIB,$1)
+       $(call quiet-command, $(AR) rcs $1 $2 && $(CC) -shared -o dll`basename 
$1 .a | sed -e 's/^lib//'`.so $2 $3,MKLIB,$1)
 # define a library target <name>.cmxa and <name>.cma
 define OCAML_LIBRARY_template
  $(1).cmxa: lib$(1)_stubs.a $(foreach obj,$($(1)_OBJS),$(obj).cmx)
        $(call mk-caml-lib-native,$$@, -cclib -l$(1)_stubs $(foreach 
lib,$(LIBS_$(1)),-cclib $(lib)), $(foreach obj,$($(1)_OBJS),$(obj).cmx))
  $(1).cma: $(foreach obj,$($(1)_OBJS),$(obj).cmo)
-       $(call mk-caml-lib-bytecode,$$@, -dllib dll$(1)_stubs.so -cclib 
-l$(1)_stubs, $$+)
+       $(call mk-caml-lib-bytecode,$$@, -dllib -l$(1)_stubs, $$+)
  $(1)_stubs.a: $(foreach obj,$$($(1)_C_OBJS),$(obj).o)
        $(call mk-caml-stubs,$$@, $$+)
  lib$(1)_stubs.a: $(foreach obj,$($(1)_C_OBJS),$(obj).o)
-       $(call mk-caml-lib-stubs,$$@, $$+)
+       $(call mk-caml-lib-stubs,$$@, $$+, $(foreach lib,$(LIBS_$(1)),$(lib)))
 define OCAML_NOC_LIBRARY_template

Xen-devel mailing list



Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.