[Omake] -exists and dependencies
Aleksey Nogin
nogin at metaprl.org
Mon Sep 24 10:09:32 PDT 2007
On 23.09.2007 14:11, Michael Furr wrote:
> I found some wierd behavior with {filter,file}-exists functions when
> used with the *-dependencies functions. Assume I have a project with a
> file test.ml, but no test.mli. Then the rule:
>
> .PHONY: foo
> foo: test.cmx
> foreach(name, $(filter-exists $(dependencies-all test.cmx)))
> echo $(name)
> echo $(file-exists $(name))
>
> prints:
>
> test.cmx
> true
> test.ml
> true
> test.mli
> true
>
> So, both the filter-exists and file-exists function thinks that the file
> "test.mli" exists, but it is not on the filesystem.
Not quite - the string conversion here is hiding a very important piece
of information. If you replace "echo $(name)" with "printvln($(name))",
you'll see:
test.cmx : File
true
<exists test.mli> : File
true
test.ml : File
true
So the second dependency of test.cmx is a "exists" property of test.mli
(if test.cmx is built in absence of test.mli and later test.mli is
created, the "exists" dependency changes and the test.cmx is no longer
considered up-to-date). Obviously, the "exists" property always exists.
Perhaps we need some sort of "filter-normal-files" function that drops
all dependencies that are not proper files (filtering out scanner
targets, phony targets, "exists" dependencies, etc).
Aleksey
More information about the Omake
mailing list