[Omake] individual compilation
Aleksey Nogin
anogin at hrl.com
Fri May 18 09:14:59 PDT 2007
On 17.05.2007 07:41, Anastasia Gornostaeva wrote:
> Thanks for your simple answers. My next trouble is now:
> How to properly write OMakefile that builds casual ocaml library and
> camlp4 preprocessor macro library?
>
> FILES[] =
> file1
> file2
> LIB: mylib
>
> .DEFAULT: $(OCamlLibrary $(LIB), $(FILES)) $(SomeWhatToBuildPP)
>
> where "SomeWhatToBuldPP does:
>
> ocamlfind ocamlc -a -o pa_mypp.cma \
> -pp 'camlp4o pa_extend.cmo q_MLast.cmo' -package camlp4 \
> pa_mypp.ml
>
> (or the same without ocamlfind)
Note that the command line above would do
several things at once:
- compile pa_mypp.cmo
- link pa_mypp.cmo into a library
With OMake, you normally specify those two steps separately, using
something like:
FILES[] =
file1
file2
LIB: mylib
.DEFAULT: $(OCamlLibrary $(LIB), $(FILES))
CAMLP4_FILES[] =
pa_mypp
section
#These files require camlp4 pre-processing
OCAMLPPFLAGS += -pp $'camlp4o pa_extend.cmo q_MLast.cmo'
OCAMLDEPFLAGS += -pp $'camlp4o pa_extend.cmo q_MLast.cmo'
#Also, include camlp4 package (assumes ocamlfind)
OCAMLPACKS[] += camlp4
#"Pin" the following targets to the current variable environment
$(addsuffixes .cmo .cmx .cmi $(EXT_OBJ), $(CAMLP4_FILES)):
#Link the pa_mypp library
.DEFAULT: $(OCamlLibrary pa_mypp, $(CAMLP4_FILES))
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