I have an action defined that generates coverage files, it takes some options.
actions coverage {
echo coverage $(OPTIONS) >> $(<)
}
I need a rule to set the $(OPTIONS)
variable:
rule coverage ( targets * : sources * : properties * ) {
OPTIONS on $(targets) = ... # Get from environment variables
}
Once I have done that, I can use the rule to generate coverage files:
make cov.xml : : @coverage ;
What I want is a second rule (that computes the $(OPTIONS)
variable in a different way), that uses the same actions. Is that possible without duplicating the action itself? In other words, is it possible to associate two rules with the same action?
What I want is something like this:
actions coverage-from-features {
# AVOID HAVING TO REPEAT THIS
echo coverage $(OPTIONS) >> $(<)
}
rule coverage-from-features ( targets * : sources * : properties * ) {
OPTIONS on $(targets) = ... # Get from feature values
}
make cov2.xml : : @coverage-from-features ;
Obviously without repeating the action commands itself (DRY and all that).