[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Using the target of a pattern rule as a prerequisite
From: |
Paul D. Smith |
Subject: |
Re: Using the target of a pattern rule as a prerequisite |
Date: |
Thu, 3 Jun 2004 11:25:54 -0400 |
%% Bram <address@hidden> 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 <address@hidden> 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
- Using the target of a pattern rule as a prerequisite, Bram, 2004/06/03
- Re: Using the target of a pattern rule as a prerequisite,
Paul D. Smith <=
- Re: Using the target of a pattern rule as a prerequisite, Noel Yap, 2004/06/03
- Re: Using the target of a pattern rule as a prerequisite, Boris Kolpackov, 2004/06/03
- Re: Using the target of a pattern rule as a prerequisite, Paul D. Smith, 2004/06/04
- Re: Using the target of a pattern rule as a prerequisite, Noel Yap, 2004/06/04
- Re: Using the target of a pattern rule as a prerequisite, David Boyce, 2004/06/04
- Re: Using the target of a pattern rule as a prerequisite, Paul D. Smith, 2004/06/04
- Re: Using the target of a pattern rule as a prerequisite, Noel Yap, 2004/06/04
- Re: Using the target of a pattern rule as a prerequisite, David Boyce, 2004/06/04
- Re: Using the target of a pattern rule as a prerequisite, Noel Yap, 2004/06/04
- Re: Using the target of a pattern rule as a prerequisite, Paul D. Smith, 2004/06/04