[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Copying Prerequisites / conditional remove Prerequisites

From: Erik Rull
Subject: Re: Copying Prerequisites / conditional remove Prerequisites
Date: Tue, 12 Oct 2010 22:06:16 +0200
User-agent: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv: Gecko/20100914 Lightning/1.0b1 SeaMonkey/2.0.8

Paul Smith wrote:
On Tue, 2010-10-12 at 18:55 +0200, Erik Rull wrote:
I want to read out the prerequisites of a defined target into a variable
but outside the target rule. Within the target rule I can access to it via
$$+, but how can I get this value from outside?

You can't.  The list of prerequisites is not completely constructed
until and unless the target is considered for building, so you can't get
this list anywhere other than in the recipe for the target.

One thing you can try is using eval from within the recipe, like this:

                $(eval foo_PREREQS := $+)

then in subsequent recipes you can use $(foo_PREREQS).  But you CANNOT
use these values inside ifdef etc., or other target or variable lists,
or anything like that: only in other recipes.

And of course, only variables for targets that are actually built will
be present; so if "foo" was up-to-date or otherwise didn't get built,
then $(foo_PREREQS) will be empty.

Thus this is useless in your "clean" example because foo won't have been

You can write
target: prerequisiteN
as often as you want but how can I "close" the list of prerequisites so
that there cannot be appended anything else? (or that all successive
appended prerequistes are ignored)

You can't.

Hi Paul,

thanks for your explanations.

Do you have an idea how to get the list of all targets that are defined in a make call (after evaluating all rules)?

Or is this not possible, too?

Best regards,


reply via email to

[Prev in Thread] Current Thread [Next in Thread]