[Omake] fsubst in a static section

Aleksey Nogin nogin at metaprl.org
Tue Mar 4 16:49:02 PST 2008


On 04.03.2008 15:37, Christopher L Conway wrote:

> I'm trying to use fsubst to output a configuration file in a static
> block. I can see the fsubst output among the OMake messages and the
> file Subst.out gets created, but the output is not piped into the
> file. My best guess is this has something to do with the configuration
> logic hijacking stdout. Is there a work-around?
> 
> $ cat OMakefile
> static. =
>    stdout = $(fopen Subst.out, w)
>    fsubst(Subst.in)
>    case $"\<\([[:alnum:]]+\)\." g
>       value $(capitalize $1).
>    close($(stdout))

Chris,

The issue is that the above code defines a new "static.stdout" variable 
instead of updating the value of "public.stdout" that the fsubst uses.

The easiest workaround is to put the fsubst stuff into a helper function 
(defined outside of the static block) and then call it from the static 
block.

> An aside: the manual has a bug in the section on fsubst. It states the
> last line above should be "close(stdout)", but this results in:
>    File OMakefile: line 8, characters 3-16
>    not a file descriptor:
>       "stdout" : Sequence

Fixed, thanks!

Aleksey


More information about the Omake mailing list