[Omake] Wildcards in functions used within dependencies
John Billings
jnb26 at cam.ac.uk
Mon Sep 3 15:12:35 PDT 2007
Hello Aleksey,
Thanks for getting back to me on that.
> First, there is an issue of the evaluation order - the dependencies in the
> implicit ("pattern") rules are evaluated when the _implicit_ rule is
> created, not when the rule is instantiated. So in the code you use, the
> "$(CProgram %, %)" will be called as soon as the rule is encountered, so you
> get a rule for building the program "%" out of "%.o" and an implicit rule
>
> %.done: "%"
> ...
OK, this seems reasonable.
> You can change the evaluation order by using the "section rule"
> construct:
>
> %.done:
> section rule
> %.done: $(CProgram %, %)
> ./$< && touch $@
>
> One you do that, unfortunately you'd hit the second issue - currently,
> OMake does not allow new rules to be created once the OMakefiles are
> read and the build phase starts (the only exceptions are instantiations
> of implicit rules).
I had indeed tried that, but was rather mystified about what was going
on `under the hood'.
I've ended up using a loop to generate a new rule for each test. Not the
cleanest way, but it works :)
# Generate rules to build executables
foreach(t, $(TESTS))
RUN = $(replacesuffixes .test, .run, $t)
TEST = $(replacesuffixes .test, _test, $t)
CProgram($(RUN), $(TEST))
%.done: %.run$(EXE)
./$< && touch %.done
(code unsimplified but it gives the idea)
Cheers,
John
More information about the Omake
mailing list