[Cook] Multiple independent targets of a recipe
Fredrick Paul Eisele
phreed at netarx.com
Fri Feb 21 09:37:16 EST 2003
Yes.
What you are looking for is an implict (template) recipe.
When cook makes its first pass it expands the implicit recipes into
as many recipes as there are matching targets.
In other words you write something that looks similar to your second example
and cook generates the two rules (invisibly) as in your first example.
The implicit rule ...
target.%1: <inputs>
{
blah
}
The %1 is a wildcard parameter.
Look in the cook user's guide for details in writing the patterns.
David Johnston wrote:
>I have a cook question.
>
>I want to write a recipe which will produce one of two different targets
>using the same set of commands and inputs.
>
>Effectively I want the recipe to act as two separate recipes and act like:
>
> target.elf : <inputs>
> {
> blah
> }
>
> target.coff : <same inputs>
> {
> same blah
> }
>
>but obviously I don't want all the repetition.
>
>I tried writing it as follows:
>
> target.elf target.coff : <inputs>
> {
> blah
> }
>
>Unfortuately, because the recipe only ever produces one of the two targets,
>cook will always rebuild the target because it seems that cook expects such
>a recipe to produce _both_ targets.
>
>Putting a loop statement around the recipe does work:
>
> ruleTargets = coff elf;
>
> loop currTarget = [ruleTargets]
> {
> target.[currTarget] : <inputs>
> {
> blah
> }
> }
>
>...which is kind of ugly. Is there a neater way of doing this?
>
> thanks,
> david
>_______________________________________________
>Cook-users mailing list
>Cook-users at auug.org.au
>http://www.auug.org.au/mailman/listinfo/cook-users
>
>
More information about the Cook-users
mailing list