[Omake] Generating byte code and native executables (OCaml)
Aleksey Nogin
anogin at hrl.com
Mon Nov 12 10:20:22 PST 2007
On 12.11.2007 09:48, Nikhil Dinesh wrote:
> While setting the BYTE_ENABLED and NATIVE_ENABLED
> flags lets me build .cma and .cmxa libs, it generates only native code.
[...]
> LIB = foo
>
> OCamlLibrary($(LIB),$(LIBFILES))
>
> OCamlProgram(fooTest, fooTest $(LIB))
>
> all: foo.cma foo.cmxa fooTest$(EXE)
The problem you are seeing comes from the last line - you are asking
OMake to build fooTest executable, which will always be built to "best
code". In other words, all the rules needed to build both are there, but
you never ask for the actual target. A more flexible alternative for the
above OMakefile snippet is the following:
LIB = foo
all: $(OCamlLibrary $(LIB),$(LIBFILES))
all: $(OCamlProgram fooTest, fooTest $(LIB))
This should do the right thing for any combination of
BYTE_ENABLED/NATIVE_ENABLED - the OCamlLibrary and OCamlProgram
functions return the list of all the targets that they know how to build.
Aleksey
--
Aleksey Nogin, Research Scientist
Advanced Technologies Department, Information & System Sciences Lab
HRL Laboratories, LLC, Malibu, CA
More information about the Omake
mailing list