[Omake] Some problems with -pack
Aleksey Nogin
anogin at hrl.com
Mon Mar 26 17:54:52 PDT 2007
On 25.03.2007 23:53, Achim Blumensath wrote:
> I've converted my project to omake (version 0.9.8.1) recently and
> stumbled upon some problems with the support for the -pack option:
Yes, getting things to work right with -pack can be a bit painful.
> (a) How do I tell omake to consider the modules generated by -pack when
> computing dependencies? Currently, I use commands
>
> LocalOCamlGeneratedFiles(lib/Foo.cmx lib/Foo.cmi lib/Foo.o)
>
> in any subdirectory which depends on the package Foo.
I do not see any reason why this would not work...
> But this does not seem to work. When Foo changes not everything that
> should be recompiled is updated.
Do you have a concrete example? I've checked out Ant, so I could try
debugging things in more detail.
> (b) I tried to use OCAMLDEP_MODULES to see whether this would solve (a).
This might be a way to go (especially once the OS X case insensitivity
problem is resolved).
> Unfortunately, with this option (Local)OCamlGeneratedFiles has no
> effect. My project uses two camlp4 extensions which have to be compiled
> before dependency analysis. How am I to tell omake to do so without
> using (Local)(OCamlGeneratedFiles)?
If you are using the default OCaml rules, something like
.SCANNER: scan-ocaml-%: $(MLPP_TARGETS)
should work.
> (c) I had a hard time debugging a problem with OCamlPackage which turned
> out to be caused by my usage of the variable $(CMO) which clashes with
> an internal variable of OCamlPackage. Is this supposed to happen?
Currently, the variable name clashes do produce strange results at
times. This unfortunate problem is supposed to go away once the current
"development" (AKA 0.9.9.x) branch finally lands.
> (d) When using OCamlPackage(Foo, $(modules)) I have to compile every
> file in $(modules) with the -for-pack option. What is the preferred way
> to do so? Currently, I use the function:
>
> OCamlPackageModules(package, modules) =
> section
> # compile the modules with "-for-pack"
> OCAMLFLAGS += -for-pack $(package)
>
> foreach(m, $(modules))
> if $(target-exists $(m).ml)
> if $(NATIVE_ENABLED)
> $(m).cmx $(m).o: $(m).ml
> else
> $(m).cmo: $(m).ml
>
> if $(target-exists $(m).mli)
> $(m).cmi: $(m).mli
> elseif $(target-exists $(m).ml)
> $(m).cmi: $(m).ml
I believe that it should be sufficient to do:
OCamlPackageModules(package, modules) =
# compile the modules with "-for-pack"
OCAMLFLAGS += -for-pack $(package)
foreach(m, $(modules))
$m.cmx $m.o:
$m.cmo:
$m.cmi:
- You do not need a "section" block since the body of a function is
already a block (the variables will not get exported, unless you
explicitly request it)
- You do not need a "real" dependency in order to "pin" a target to the
current variable environment - it is sufficient to have an empty one
- You can give an empty "$m.cmx $m.o:" dependency even if NATIVE_ENABLED
is false, or if you are not planning to build $m at all, so there is no
need to test for that.
> (e) Why does OCamlLibraryCopy define the variable FILES? It is not used
> anywhere in OCaml.om.
It's a bug - the function was meant to return $(FILES), but somehow that
never happened. Fixed in rev. 10282, thanks!
> PS: In case anyone wants to take a look, my sources can be found at:
>
> http://developer.berlios.de/projects/ant/
Looks very impressive! Do you mind if I list it at
http://omake.metaprl.org/omake_users.html ?
Aleksey
--
Aleksey Nogin, Research Staff Member
Advanced Technologies Department, Information & System Sciences Lab
HRL Laboratories, LLC, Malibu, CA
More information about the Omake
mailing list