[Omake] A question about the OCamlPackage function and its use...

Francisco Jos? Valverde Albacete fva at tsc.uc3m.es
Wed Jan 31 06:43:23 PST 2007


Hi,

I am trying to switch from OCamlMakefile to Omake but I continually trip 
over the smallest tasks. My last stumble was to try to make a package 
and then a library out of it.

The idea I got from the OCaml manual was (stripped to the essentials)
1) Compile the individual files with -for-pack
    ocamlc -for-pack package -c foo.ml
    ocamlc -for-pack package -c bar.ml
2) Make a package with the chosen name:
    ocamlc -pack -o package.o foo.cmo bar.cmo
3) If you want to, pack the thing into a library, say package.cma

I now understand that OCamlPackage can only accomplish 2 and tries to 
trigger 1, but I find it impossible to pass -for-pack to the components 
*without* passing -for-pack to the actual package (which  would result 
in a structure Package.Package.Foo, for instance)

My best effort so far has been to build MyOCamlPackage and try to hack 
things in there, but I get the twice-packed configuration above...

BElow is how I used to do it (using OCamlPackage). I am trying to redefine

public.OCAMLFLAGS =
     OCAMLFLAGS += -for-pack <pacakge>
     export

locally in the body of OCamlPackage, so that when the *.ml(i)'s are 
compiled, my extended variable would be used, but I am not suceeding at 
all. Anyway, I don't know how to roll back to OCAMLFLAGS so that when I 
exit OCamlPackage the old value is still there.

Any ideas?Any help would really be appreciated.

Regards,

    Francisco Valverde
    Univ. Carlos III de Madrid, Spain

-------
RESULT=algebra
### THis project is going to pack some files into a module with the same 
name of the lib.
PACK = $(RESULT)
USE_OCAMLFIND = true
OCAMLPACKS[] +=
    prelude
    ocamlgraph
#get rid of -warn-errors A
OCAMLFLAGS    = -for-pack $(PACK)
PACKED_FILES[] =
    compare
    orders
    lattices
    andsoonandsoforth
################################################
### Build a particular pack
### List here all the PACKS and their PACKED FILES
pack: $(OCamlPackage $(PACK), $(PACKED_FILES))

################################################
# Build an OCaml library
# In this instance, the library just contains one package.
FILES[] =
    $(PACK)

LIB = $(RESULT)

#.DEFAULT: pack $(OCamlLibrary $(LIB), $(FILES))



More information about the Omake mailing list