From: Vincent Bernardoff Subject: [PATCH v3 2/2] tools/ocaml: Fix library generation Date: Mon, 15 Apr 2013 17:02:41 +0100 Message-ID: <1366041761-20062-2-git-send-email-vincent.bernardoff@citrix.com> References: <1366041761-20062-1-git-send-email-vincent.bernardoff@citrix.com> Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Return-path: In-Reply-To: <1366041761-20062-1-git-send-email-vincent.bernardoff@citrix.com> List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Sender: xen-devel-bounces@lists.xen.org Errors-To: xen-devel-bounces@lists.xen.org To: xen-devel@lists.xen.org Cc: Vincent Bernardoff List-Id: xen-devel@lists.xenproject.org * Summary of changes: - .cma are created by using ocamlc with the -dllib -l option that will make a bytecode OCaml program link against at runtime. The -cclib/-ccopt options are only used in "custom runtime" mode, which we do not use, so I removed them. I changed .so to -l, as ocamlc only supports (according to its documentation) arguments in the form -l 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 --- 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` $2,MKLIB,$1) 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 .cmxa and .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))) endef define OCAML_NOC_LIBRARY_template -- 1.7.10.4