[Omake] Newbie: removing quotes for command

Jason Hickey jyh at cs.caltech.edu
Wed Mar 21 11:10:23 PDT 2007


On Mar 21, 2007, at 10:09 AM, Hugo Ferreira wrote:
> So if I want to place the prefix -I to the path, but separated by a  
> space so that "ocamlc" may function, how should I go about it.

Hi Hugo,

Welcome to OMake!  You want to use mapprefix, but without the extra  
space after the -I.  mapprefix(p, a) takes a prefix p, and an array  
a, and produces an array with twice the length where the odd items  
are "p", and the even items are from "a".

osh> echo $(mapprefix x, a b c)
x a x b x c

For convenience, you might define a variable PREFIXED_OCAMLINCLUDES  
that adds the prefixes (this is what we do in current OMake).

osh> OCAMLINCLUDES[] = a b c
- : <array ...> : Array
osh> PREFIXED_OCAMLINCLUDES = $`(mapprefix -I, $(OCAMLINCLUDES))
- : ...
osh> echo $(PREFIXED_OCAMLINCLUDES)
-I a -I b -I c

The definition of PREFIXED_OCAMLINCLUDES is lazy (uses a $`(...)  
form) so that you can update OCAMLINCLUDES and the PREFIXED version  
will refer to the updates.

osh> OCAMLINCLUDES[] += d e f
- : <array a b c d e f> : Array
osh> echo $(PREFIXED_OCAMLINCLUDES)
-I a -I b -I c -I d -I e -I f

Jason

--
Jason Hickey                  http://www.cs.caltech.edu/~jyh
Caltech Computer Science      Tel: 626-395-6568 FAX: 626-792-4257





More information about the Omake mailing list