Commits

camlspotter committed c0489d4

packge system

Comments (0)

Files changed (1)

 # Installation mark files
 # =======================================================================
 
+#| Installation mark files are put inside this directory.
 INSTALLED=$(BIG_ROOT)/installed
 mkdir(-p $(INSTALLED))
 
 # OCamlFind
 # ========================================================================
 
-#|OMy requires OCamlFind!
+#|OMy requires OCamlFind! Do not ask me how to use OMy without OCamlFind. Please.
 USE_OCAMLFIND = true
 OCAMLFIND_DESTDIR=$(PREFIX)/lib/ocaml/site-lib
 
 %.spit: %.mli 
 	$(OCamlC) -c $<
 
+# Packages
+# =========================================================
+
+#| OCaml packages required for compilation. MyCaml* functions automatically add necessary dependencies over packages in $(OCAMLPACKS).
+public.OCAMLPACKS[]=
+
+#| CamlP4 syntax extension packages required for parsing. MyCaml* functions automatically add necessary dependencies over packages in $(CAMLP4PACKS).
+public.CAMLP4PACKS[]=
+
 # Dependencies
 # =========================================================================
 
+#|Add dependencies of any build activity over $(packages).
+# This introduces implicit rule: *you may need to export it, if you use this function in a local context.*
+RequirePackages(packages) =
+    required_packs = $(set-diff $(packages), $(OCAMLFIND_PREINSTALLED_PACKAGES))
+    .SCANNER: scan-%: $(Installed $(required_packs))
+    % : $(Installed $(required_packs))
+    export
+
 #|Add dependencies of OCaml compiled files (cmx, cmo, etc.) over $(packages).
 # $(packages) listed in OCAMLFIND_PREINSTALLED_PACKAGES are ignored.
 #
-# This introduces implicit rule: *you may need to export it.*
-OCamlRequire(packages) =
+# Usually you do not need to call this function. Use OCAMLPACKS variable instead. 
+# This introduces implicit rule: *you may need to export it, if you use this function in a local context.*
+OCamlRequirePackages(packages) =
     packages += findlib # Yes we use findlib
     required_packs = $(set-diff $(packages), $(OCAMLFIND_PREINSTALLED_PACKAGES))
     %.cmx %.cmo %.cmi %.cma %.cmxa %.annot %.spot %.spit : $(Installed $(required_packs))
 # Use this for adding dependencies for CamlP4 extensions.
 # $(packages) listed in OCAMLFIND_PREINSTALLED_PACKAGES are ignored.
 #
-# This introduces implicit rules: *you may need to export it.*
-OCamlRequireCamlP4(packages) =
+# Usually you do not need to call this function. Use CAML4PACKS variable instead. 
+# This introduces implicit rule: *you may need to export it, if you use this function in a local context.*
+OCamlRequireCamlP4Packages(packages) =
     packages += findlib # Yes we use findlib
     required_packs = $(set-diff $(packages), $(OCAMLFIND_PREINSTALLED_PACKAGES))
     .SCANNER: scan-ocaml-%: $(Installed $(required_packs))
 %.auto.mli: %.ml
 	$(OCamlC) -i -c $< > $@
 
-# Packages
-# =========================================================
-
-#| CamlP4 syntax extension packages required for parsing
-public.CAMLP4PACKS[]=
-
 # Build rules
 # ==========================================================
 
 # If this function is used in a local scope, you may want to export. 
 AddLocalOCamlPackageDependencies() =
   # We make sure the required libraries are installed
-  OCamlRequire($(OCAMLPACKS)) # must be exported!
-  OCamlRequireCamlP4($(CAMLP4PACKS))
+  OCamlRequirePackages($(OCAMLPACKS)) # must be exported!
+  OCamlRequireCamlP4Packages($(CAMLP4PACKS))
   export
 
 #| Add a rule for OCaml package $(library_name).cmo, $(library_name).cmx and etc.