[Omake] Newbie: removing quotes for command
Hugo Ferreira
hmf at inescporto.pt
Thu Mar 22 01:16:46 PDT 2007
Hello,
Aleksey Nogin wrote:
> On 21.03.2007 10:09, Hugo Ferreira wrote:
>
>>> % INCLUDES[] = a b c
>>> - : <array
>>> "a" : Sequence
>>> "b" : Sequence
>>> "c" : Sequence>
>>> : Array
>>> % addprefix(-I, $(INCLUDES))
snip
>>
>> Now I am still baffled. It seems like whether or not I use the space,
>> I still get a string (addprefix does not seem to be the in the list
>> you provide below).
>
> Not quite. What you get is a sequence. The main difference between a
> string and a sequence is that the string is always interpreted
> literally, while all the "special" characters in a sequence retain their
> meaning.
>
> For example, running osh in a directory that contains a file named "foo":
>
> % ls $(addprefix f, *)
> foo
> % ls $"$(addprefix f, *)"
> /bin/ls: f*: No such file or directory
> - : <exit-code 1> : Int
> % ls $(addprefix f, $"*")
> /bin/ls: f*: No such file or directory
> - : <exit-code 1> : Int
>
A parenthesis here: I did these tests above in version 0.9.6.5 and all 3
options worked. I am assuming this is inconsistent behavior that has
been corrected in the latest versions. However in the execution of the
target I use, it does exhibit the expected error.
> However, what addprefix (and pretty much every other "map-like"
> function) does do is packing its results into array - and any spaces
> inside array elements are taken literally (which is the whole point of
> arrays - and is especially handy when you want to support
> files/directories with spaces in their names).
>
Ok. Finally got it.
> This is why, as Jason said, you need to use mapprefix - instead of
> appending the prefix within the same array item (as addprefix does),
> mapprefix creates a separate array element for each prefix:
>
> % mapprefix(-I, $(INCLUDES))
> - : <array
> <array
> "-I" : Sequence
> "a" : Sequence>
> : Array
> <array
> "-I" : Sequence
> "b" : Sequence>
> : Array
> <array
> "-I" : Sequence
> "c" : Sequence>
> : Array>
> : Array
>
> Or, if you want to see (the equivalent) flattened version,
>
> % array($(mapprefix -I, $(INCLUDES)))
> - : <array
> "-I" : Sequence
> "a" : Sequence
> "-I" : Sequence
> "b" : Sequence
> "-I" : Sequence
> "c" : Sequence>
> : Array
>
>>> BTW, is there some reason why you are implementing your own build
>>> recipes for OCaml (note that at the moment you recipes are missing
>>> such things as dependency scanning, which may result in all kinds of
>>> problems) instead of using the existing build/OCaml.om that comes
>>> with OMake?
>>>
>>
>> I cannot use the latest and greatest version OMake which has the
>> required recipes for menhir. I am therefore trying to use the files
>> provided in its demos (by changing the compilation parameters).
>
> What version of OMake are you currently using?
I have 0.9.6.5.
I can try using the "unstable" version 0.9.6.9 (later versions are not
available).
> Unless you are using
> something very ancient, it might be easier to try backporting a newer
> OCaml.om (at least the relevant parts of it) than to write one from
> scratch. An additional benefit of backporting, of course, is that it
> should then be easier to switch to a more recent version of OMake in the
> future.
>
I figure to limit myself to an include and a single target:
MenhirMulti(libparse, parse.mly, $(MENHIR_FLAGS))
When I get a new version of OMake I need only:
1. Use the flag above as is
2. Add the MENHIR_ENABLED (set to true).
3. Remove 2 flags currently used by the include not used by the OMake system
Easier than backporting no?
Thank you for your help.
Hugo Ferreira.
> Aleksey
>
More information about the Omake
mailing list