%% Bram <[EMAIL PROTECTED]> writes:

  b> I was wondering how to use the target of a pattern rule to generate
  b> a prerequisite using a function.

You can't.

  b> Something like this:

  b> %.cc: $(dir $@)
  b>     echo "Pre:" $^

  b> %.cc: $(dir %.cc)
  b>     echo "Pre:" $^

Variables (and functions) in targets and prerequisites are expanded as
the makefile is read in, long before either automatic variables like $@
exist or patterns like %.cc have been matched.

In general it's not a good idea (IMO) to depend on a directory anyway:
it will cause your code to rebuild in many situations where it's not
necessary.  The GNU make manual has an alternate suggestion on how to
get directories created by the build system.

-- 
-------------------------------------------------------------------------------
 Paul D. Smith <[EMAIL PROTECTED]>          Find some GNU make tips at:
 http://www.gnu.org                      http://make.paulandlesley.org
 "Please remain calm...I may be mad, but I am a professional." --Mad Scientist


_______________________________________________
Help-make mailing list
[EMAIL PROTECTED]
http://lists.gnu.org/mailman/listinfo/help-make

Reply via email to