[Top][All Lists]

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

Re: Copying Prerequisites / conditional remove Prerequisites

From: Paul Smith
Subject: Re: Copying Prerequisites / conditional remove Prerequisites
Date: Tue, 12 Oct 2010 13:09:31 -0400

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

> Finally I'm looking for a possibility that prevents that new prerequisites 
> get appended to a target.
> 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.

 Paul D. Smith <address@hidden>          Find some GNU make tips at:            
 "Please remain calm...I may be mad, but I am a professional." --Mad Scientist

reply via email to

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