Commits

camlspotter  committed b9893f8

sharing dependency info for lib and example

  • Participants
  • Parent commits afa0c8a

Comments (0)

Files changed (7)

File META

-name="llvm_phantom"
-version="0.0.1"
-description="LLVM OCaml binding with Phantom type"
-archive(byte)="llvm_phantom.cmo"
-archive(native)="llvm_phantom.cmx"
-linkopts = ""
    include OMyMakefile
    export
 
+CAMLP4PACKS[]=
+    monad-custom
+
+OCAMLPACKS[]= 
+    spotlib
+    ocaml-llvm
+
+OCAML_PREINSTALLED_PACKS += ocaml-llvm
+
+OCAMLDEPFLAGS= -syntax camlp4o -package monad-custom
+OCAMLPPFLAGS= -syntax camlp4o -package monad-custom
+
 OCAMLINCLUDES +=
 
 OCAMLFLAGS    += -annot -w Ae
 #     linkopts
 #         C library link option (without OCaml -cclib options)    
 #
+#  You can specify MyOCamlPackageExtras before using this function to install files out of the scope of this rule.   
+#
 #  Example::
 #
 #      MyOCamlPackage(foo, alpha beta, $(EMPTY), $(EMPTY))
   CMA=$(library_name).cma
   CMXA=$(library_name).cmxa
 
+  if $(not $(defined MyOCamlPackageExtras))
+      MyOCamlPackageExtras[]=
+      export
+
   CSTUBLIBRARIES=
   if $(not $(equal $(cmodules), $(EMPTY)))
       CSTUBLIBRARIES= dll$(library_name).so lib$(library_name).a 
   # CR jfuruse: I guess we do not need the following
   # export # export the implicit rule above
 
-  .DEFAULT: $(library_name).cmo $(library_name).cmx $(library_name).cma $(library_name).cmxa
+  .DEFAULT: $(library_name).cmo $(library_name).cmx $(library_name).cma $(library_name).cmxa $(MyOCamlPackageExtras)
 
   $(CMA) $(CMXA) $(library_name).a $(CSTUBLIBRARIES) : $(CSTUBS) $(CMOS) $(CMXS)
       ocamlmklib -verbose -o $(library_name) $(CSTUBS) $(linkopts) $(CMOS) $(CMXS)
   ## install
 
   # CR jfuruse: x.cmi is required if x.mli does not exist!
-  targets[]=META $(glob i, *.mli) $(library_name).cmi $(library_name).cmo $(library_name).cmx $(library_name).cma $(library_name).cmxa $(library_name).o $(library_name).a $(CSTUBLIBRARIES)
+  targets[]=META $(glob i, *.mli) $(library_name).cmi $(library_name).cmo $(library_name).cmx $(library_name).cma $(library_name).cmxa $(library_name).o $(library_name).a $(CSTUBLIBRARIES) $(MyOCamlPackageExtras)
 
   if $(OCAML_SPOT)
     targets[]+= $(library_name).spot

File examples/OMakefile

-OCAMLINCLUDES += ..
+OCAMLINCLUDES += ../lib
 OCAML_BYTE_LINK_FLAGS += llvm_phantom.cmo
 OCAML_NATIVE_LINK_FLAGS += llvm_phantom.cmx
-OCAMLDEPFLAGS += -I .. 
+OCAMLDEPFLAGS += -I ../lib 
 
 MyOCamlProgram(double, double)
 MyOCamlProgram(double_phantom, double_phantom)
+name="llvm_phantom"
+version="0.0.1"
+description="LLVM OCaml binding with Phantom type"
+archive(byte)="llvm_phantom.cmo"
+archive(native)="llvm_phantom.cmx"
+linkopts = ""

File lib/OMakefile

 OCAML_BYTE_LINK_FLAGS +=
 OCAML_NATIVE_LINK_FLAGS +=
 
-CAMLP4PACKS[]=
-    monad-custom
-
-OCAMLPACKS[]= 
-    spotlib
-    ocaml-llvm
-
-OCAML_PREINSTALLED_PACKS += llvm
-
-OCAMLDEPFLAGS= -syntax camlp4o -package monad-custom
-OCAMLPPFLAGS= -syntax camlp4o -package monad-custom
-
 FILES[] =
    extension
    context

File lib/build.ml

 open P.Open
 
 module Builder = struct
+  type 'a t = Llvm.llbuilder -> 'a
   include Monad.Make(struct
     type 'a t = Llvm.llbuilder -> 'a
     let bind a f = fun builder ->