help-make
[Top][All Lists]
Advanced

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

Re: (no subject)


From: Paul D. Smith
Subject: Re: (no subject)
Date: Wed, 7 Feb 2001 11:32:19 -0500

%% "Jose Maria Rodriguez Millan" <address@hidden> writes:

  jmrm> For example,if each lib directory has a src subdirectory
  jmrm> (a/src,b/src,c/src) ,i can get the list of prerrequisites with

  jmrm> $(subst .cc,.o,$(wildcard $(addsuffix /src/*.cc,$(@D))))

  jmrm> but this expression seems not to work if written as
  jmrm> prerrequisite (i suppose because $(@D) is defined only when
  jmrm> command execution begins.

Correct.

  jmrm> If it were so ,would not be interesting to have target-related
  jmrm> variables already defined when computing prerrequisites?))

There is a patch which will be integrated into the next version of GNU
make which does this, more or less.

  jmrm> $(PROJECTLIBS) : <calculate prerrequisites,based in current target path>
  jmrm>                     <commands>

  jmrm> Is this possible?Is there any other way to do the same thing?

The only way to do this is with recursion.  Have one instance of make
generate a makefile that contains the prerequisite definitions, then
recurse and include it.

GNU make has a feature where it automatically tries to generate its
included makefiles; you can use this to get what you want here.  Have a
rule that builds this makefile part, then include that makefile part.
Make will rebuild the makefile part automatically when it's deemed out
of date, then re-exec itself to read the new value.

-- 
-------------------------------------------------------------------------------
 Paul D. Smith <address@hidden>          Find some GNU make tips at:
 http://www.gnu.org                      http://www.paulandlesley.org/gmake/
 "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]