camlspotter avatar camlspotter committed baa79f8

auto update of OMyMakefile

Comments (0)

Files changed (1)

   ## the followings are necessary for packing
 
   OCAMLPACKAGEFLAGS += -for-pack $(capitalize $(library_name))
-  export OCAMLPACKAGEFLAGS
+  # export OCAMLPACKAGEFLAGS
 
   ## build rule
 
 #          Name of the program
 #      files
 #          OCaml module names (without .ml)
-#  In addition to MyOCamlProgram, the binary is installed by omake install
+#  In addition to MyOCamlTestProgram, the binary is installed by omake install
 MyOCamlProgram(name, files) =
   MyOCamlTestProgram($(name), $(files))
   export # The above thing is local: need to be exported
       rm -f $(PREFIX)/bin/$(name) $(PREFIX)/bin/$(name).run $(PREFIX)/bin/$(name).opt
     export
 
+#| Add a rule to build a toplevel $(name)
+#      name
+#          Name of the program
+#      files
+#          OCaml module names (without .ml)
+OCamlTop(name, files) =
+   # XXX: JYH: these variables should be marked private in 0.9.9
+   protected.CMOFILES  = $(addsuffix .cmo, $(files))
+   # protected.CMXFILES  = $(addsuffix .cmx, $(files))
+   # protected.OFILES    = $(addsuffix $(EXT_OBJ), $(files))
+
+   protected.CMAFILES  = $(addsuffix .cma,  $(OCAML_LIBS))
+   # protected.CMXAFILES = $(addsuffix .cmxa, $(OCAML_LIBS))
+   protected.ARFILES   = $(addsuffix $(EXT_LIB), $(OCAML_LIBS))
+   protected.CMA_OTHER_FILES = $(addsuffix .cma, $(OCAML_OTHER_LIBS))
+   # protected.CMXA_OTHER_FILES = $(addsuffix .cmxa, $(OCAML_OTHER_LIBS))
+
+   protected.CLIBS = $(addsuffix $(EXT_LIB), $(OCAML_CLIBS))
+
+   protected.name = $(file $(name))
+
+   protected.PROG     = $(file $(name)$(EXE))
+   protected.BYTEPROG = $(file $(name).run)
+   # protected.OPTPROG  = $(file $(name).opt)
+
+   #
+   # Rules to build byte-code and native targets
+   #
+   $(BYTEPROG): $(CMAFILES) $(CMOFILES) $(CLIBS)
+        $(OCAMLFIND) $(OCAMLMKTOP) $(LAZY_OCAMLFINDFLAGS) $(PREFIXED_OCAMLPACKS) $(OCAMLFLAGS) $(OCAMLCFLAGS)\
+                $(PREFIXED_OCAMLINCLUDES) $(OCAML_BYTE_LINK_FLAGS)\
+                -o $@ $(CMA_OTHER_FILES) $(CMAFILES) $(OCamlLinkSort $(CMOFILES))\
+                $(CLIBS) $(OCAML_LINK_FLAGS)
+
+   $(PROG): $(BYTEPROG)
+        ln-or-cp $< $@
+
+   return $(array $(PROG), $(BYTEPROG))
+
+MyOCamlTop(name, files) =
+  AddLocalOCamlPackageDependencies()
+  export # The above thing is local: need to be exported
+
+  $(name): $(Installed $(OMyManagedPackages $(OCAMLPACKS)))
+
+  # CR jfuruse: forgot to add the deps over the packages!
+  .DEFAULT: $(OCamlTop $(name), $(files))
+
+  # The following clean the files twice if MyOCamlPackge coexists,
+  # but who cases ?
+  AutoClean()
+  export # The above thing is local: need to be exported
+
+  if $(not $(NO_INSTALL))
+    install: $(name) $(name).run
+      install $(name) $(name).run $(PREFIX)/bin
+    uninstall:
+      rm -f $(PREFIX)/bin/$(name) $(PREFIX)/bin/$(name).run
+    export
+
 #|  Add rules to build OCaml library $(name)
 #        name
 #            Name of the library
Tip: Filter by directory path e.g. /media app.js to search for public/media/app.js.
Tip: Use camelCasing e.g. ProjME to search for ProjectModifiedEvent.java.
Tip: Filter by extension type e.g. /repo .js to search for all .js files in the /repo directory.
Tip: Separate your search with spaces e.g. /ssh pom.xml to search for src/ssh/pom.xml.
Tip: Use ↑ and ↓ arrow keys to navigate and return to view the file.
Tip: You can also navigate files with Ctrl+j (next) and Ctrl+k (previous) and view the file with Ctrl+o.
Tip: You can also navigate files with Alt+j (next) and Alt+k (previous) and view the file with Alt+o.