[Top][All Lists]

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

Re: Make 3.82: weird "circular dependency" and missing $< expansion

From: Paul Smith
Subject: Re: Make 3.82: weird "circular dependency" and missing $< expansion
Date: Mon, 02 May 2011 10:07:05 -0400

On Mon, 2011-05-02 at 09:17 +0200, Akim Demaille wrote:
> Using the attached Makefile (I spent quite a while to strip it down from an 
> Automake generated file), Make 3.81 reports:
> $ make
> echo accel.dat >accel.dat
> echo "{accel.dat}"
> {accel.dat}
> test -n "accel.dat"
> echo accel.pdf >accel.eps
> Which is what I expect.  But Make 3.82 reports:
> $ LC_ALL=C gmake -rR
> gmake: Circular accel.pdf <- accel.pdf dependency dropped.
> echo "{}"
> {}
> test -n ""
> gmake: *** [accel.pdf] Error 1
> I would have understood that something be reported about accel.eps,
> but I don't understand what it means about accel.pdf.  It would be
> really nice to have more details about those "circular dependencies".
> And see how $< is expanding to nothing.
> Weirdly enough, if I comment the "document.pdf" dependency, which is
> not involved in plain "make all", it works.  If I move it, it works
> too.  If I compare the --print-db without-document.pdf ->
> with-document.pdf, I can see that things about accel.pdf differ (and
> $< is not defined), but it does not help me understand what's wrong:

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

When make wants to build foo.eps it finds the first rule and sees that
it can build foo.eps if it can build foo.pdf, so make looks for a rule
to build foo.pdf and finds that it can build it from foo.dat... but that
rule ALSO builds foo.eps.  Now make has two rules that can build foo.eps
and one of them is required to build its own prerequisite.  Circular.

It all depends on the order in which make searches the rules, which is
why changing things in the makefile matters.  If make finds the second
rule first then it sees it can build foo.eps and foo.pdf from foo.dat
and it's all good.  No circularity.

I'm not sure about the details, and I'm not sure about why $< is empty;
that does seem like a bug.

 Paul D. Smith <address@hidden>          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

reply via email to

[Prev in Thread] Current Thread [Next in Thread]