help-make
[Top][All Lists]
Advanced

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

Re: Rule-specific variables


From: Paul Smith
Subject: Re: Rule-specific variables
Date: Mon, 10 Mar 2008 17:27:01 -0400

On Mon, 2008-03-10 at 21:14 +0000, Brendan Heading wrote:
> I was alluding to this part of the manual : 
> 
> "Be aware that a given prerequisite will only be built once per
> invocation of make, at most. If the same file is a prerequisite of
> multiple targets, and each of those targets has a different value for
> the same target-specific variable, then the first target to be built
> will cause that prerequisite to be built and the prerequisite will
> inherit the target-specific value from the first target." 
> 
> I tried this and I appeared to hit this problem, the C++ rule was
> being used to compile the C file. It's possible that I was seeing some
> other snafu ..

I'd have to see exactly what you did to understand what went wrong.  In
general this paragraph should not apply to you, since although you COULD
create foo.o from either foo.c or foo.cc, in fact you will only ever
have rules to create it from one or the other, not both.

So, make will never try to create the target foo.o multiple times thus
you never have "the same file is a prerequisite of multiple targets".


Maybe you tried to use pattern-specific variables?  But that can't work
because you can't define a pattern that says ".o's built from .c's" vs.
a pattern that says ".o's built from .cc's".  All you can say is "a
pattern that matches all .o's".

-- 
-----------------------------------------------------------------------------
 Paul D. Smith <address@hidden>                 http://make.mad-scientist.us
 "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]