On Tue, 2011-05-03 at 17:39 +0200, Akim Demaille wrote:
> Le 2 mai 2011 à 16:07, Paul Smith a écrit :
> 
> Hi Paul!
> 
> > So, the circular dependency issue is because of this:
> > 
> >> %.eps: %.pdf
> >> 
> >> %.eps %.pdf: %.dat
> > 
> > In the second rule you say that BOTH %.eps and %.pdf can be built from
> > %.dat, and in the first rule you say that %.eps can be built from %.pdf.
> > So make has two different ways to build %.eps, and one of them lists as
> > a prerequisite a co-target in the other rule.  Make is rightly confused
> > here.
> 
> I'm confused in understanding why it's rightly confused :/  But maybe
> my confusion is, as Edward pointed out, because I am misled by the
> term "circular dependency", as really, I can't see any here.

Maybe circular is not the best term; as Edward says maybe a better term
in this case is ambiguous.  However the same code checking is used for
circular dependencies so that's the output you get.

In order to understand make's dilemma I need to be sure you understand
what the "%.eps %.pdf: %.dat" syntax means; some people think it means
the same thing as:

        %.eps: %.dat
                command
        %.pdf: %.dat
                command

But that's not what it means (if these was an explicit rule, instead of
a pattern rule, it would mean that).  What it means instead is that one
invocation of <command> will create BOTH %.eps and %.pdf.  That is, make
has no way of building %.pdf, except for a rule that ALSO builds %.eps.

So, you ask to build accel.eps.  Make finds the first rule, "%.eps :
%.pdf".  Now make wants to know how to build accel.pdf.  Looking around
make sees that it can be build by the rule "%.eps %.pdf: %.dat".  This
rule works because there is an accel.dat.

But wait!  When make builds accel.pdf using that pattern rule, it will
ALSO build accel.eps... but make already has a different rule to build
accel.eps.

Now make has two different rules that both will build the same target
file, so it gives up with an error.

-- 
-------------------------------------------------------------------------------
 Paul D. Smith <psm...@gnu.org>          Find some GNU make tips at:
 http://www.gnu.org                      http://make.mad-scientist.net
 "Please remain calm...I may be mad, but I am a professional." --Mad Scientist


_______________________________________________
Bug-make mailing list
Bug-make@gnu.org
https://lists.gnu.org/mailman/listinfo/bug-make

Reply via email to