[Cook] Multiple independent targets of a recipe

David Johnston davidj at klaxoniqa.com
Fri Feb 21 08:59:38 EST 2003


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



More information about the Cook-users mailing list