[Omake] Newbie: removing quotes for command

Hugo Ferreira hmf at inescporto.pt
Thu Mar 22 00:41:05 PDT 2007


Hello,

Jason Hickey wrote:
> 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!  

Thank you.

> 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
> 

Ok. I had tried this but insisted on using a space. Teach me to read the
documents with greater care.

> 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
> 

I see that one can either use an array or a sequence for OCAMLINCLUDES.
What is more interesting is that tests in the shell show that the
application of mapprefix result in the exact same type. When should I
opt for one or the other?

> 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
> 

Interesting. This seems to be very useful.

Thank you for the info.
Hugo Ferreira.


> Jason
> 
> -- 
> Jason Hickey                  http://www.cs.caltech.edu/~jyh
> Caltech Computer Science      Tel: 626-395-6568 FAX: 626-792-4257
> 
> 
> 
> _______________________________________________
> Omake mailing list
> Omake at metaprl.org
> https://lists.metaprl.org/mailman/listinfo/omake
> 



More information about the Omake mailing list