[Omake] "export" failure

Aleksey Nogin nogin at metaprl.org
Tue Sep 2 09:49:57 PDT 2008


On 25.08.2008 11:10, Christopher L Conway wrote:

> In the following case, exporting a variable has no effect whatsoever.
> This is with OMake 0.9.8.5, installed via GODI.
> 
[...]
> OCAMLDOCFLAGS = -keep-code -sort -stars
> 
> # Build a .odoc file for a subdirectory
> ocaml_doc(name,files) =
>     SRC_FILES = $(filter-exists $(addsuffixes .mli .ml, $(files)))
>     ODOCFILE = $(file $(name).odoc)
> 
>     $(ODOCFILE):
>         if $(USE_OCAMLFIND)
>             OCAMLDOCFLAGS += -package $(concat $",", $(OCAMLPACKS))
>             export OCAMLDOCFLAGS
> 
>         $(OCAMLFIND) $(OCAMLDOC) $(OCAMLDOCFLAGS) \
>             $`(mapprefix -I, $(OCAMLINCLUDES)) -dump $(@) $(SRC_FILES)
[...]

Chris,

The issue here is that in a rule body, each command it independent. In 
order to make your code work as is, you need to put the body of the rule 
inside a section. A better solution may be to use the lazy evaluation:

OCAMLDOCFLAGS = -keep-code -sort -stars \
   $`(if $(USE_OCAMLFIND), -package $(concat $",", $(OCAMLPACKS)))
...
    $(ODOCFILE):
       $(OCAMLFIND) $(OCAMLDOC) $(OCAMLDOCFLAGS) \
          $(PREFIXED_OCAMLINCLUDES) -dump $@ $(SRC_FILES)
...

Aleksey

P.S. Sorry for the slow response - somehow I didn't see your message 
until today.


More information about the Omake mailing list