tools/ocaml: clean META files
PATCH v3 1/2 tools/ocaml: clean META files
As META files are generated from META.in files, they should be cleaned by clean rules.
--- tools/ocaml/Makefile.rules | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
tools/ocaml/Makefile.rules +1 -1
@@ -45,7 +45,7 @@ ALL_OCAML_OBJ_SOURCES=$(addsuffix .ml, $(ALL_OCAML_OBJS)) $(call quiet-command, $(OCAMLDEP) $(ALL_OCAML_OBJ_SOURCES) *.mli $o,MLDEP,) clean: $(CLEAN_HOOKS) - $(Q)rm -f .*.d *.o *.so *.a *.cmo *.cmi *.cma *.cmx *.cmxa *.annot *.spot *.spit $(LIBS) $(PROGRAMS) $(GENERATED_FILES) .ocamldep.make + $(Q)rm -f .*.d *.o *.so *.a *.cmo *.cmi *.cma *.cmx *.cmxa *.annot *.spot *.spit $(LIBS) $(PROGRAMS) $(GENERATED_FILES) .ocamldep.make META quiet-command = $(if $(V),$1,@printf " %-8s %s\n" "$2" "$3" && $1)
Signature · 1 line
1.7.10.4
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.
--- tools/ocaml/Makefile.rules | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-)
tools/ocaml/Makefile.rules +3 -3
@@ -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 <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))) endef define OCAML_NOC_LIBRARY_template
Signature · 1 line
1.7.10.4
Quoted 4 lines · Vincent Bernardoff
As META files are generated from META.in files, they should be cleaned by clean rules.
Signed-off-by Vincent Bernardoff <[email protected]>
Acked + applied, thanks.