help-make
[Top][All Lists]
Advanced

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

Re: Finding Circular Dependencies


From: Paul Smith
Subject: Re: Finding Circular Dependencies
Date: Tue, 12 Feb 2008 09:46:34 -0500

On Mon, 2008-02-11 at 22:44 +0200, Eli Zaretskii wrote:
> > From: "Dave Korn" <address@hidden>
> > - when to dump the data ?  (I'm thinking maybe sometime just after all the
> > makefiles have been remade?)
> 
> I think it's before the second call to update_goal_chain in main.c.

Alternatively you could have it dumped as part of the -p output, maybe.

> > - what's the name of the struct that holds the dependency data and where's 
> > the
> > head?
> 
> I think the variable `goals' (static struct dep variable in main.c) is
> it, possibly together with struct file members of each goal.  Each
> struct file's `deps' member points to a chain of struct dep objects,
> chained through their `next' member.  I think you can generate the
> dependency graph by chasing these.  See remake.c, dep.h, and filedef.h
> for more details (and perhaps wait for Paul to correct what I messed
> up ;-).

That's about right.  The thing to remember is that GNU make's dependency
graph is not a single-rooted tree.  It's a set of directed acyclic
graphs.  There isn't really any one starting point inherent in the
graph.  GNU make starts either (a) where the user asks via command line
goals, or (b) the first target it finds in the makefiles.

The question is, do you want to construct a graph of the entire set of
targets that are defined in the makefile?  Because it's quite common for
there to be a number of completely disjoint graphs.  Or do you want to
construct a graph for the targets that will actually be checked during a
given invocation of make?

-- 
-------------------------------------------------------------------------------
 Paul D. Smith <address@hidden>          Find some GNU make tips at:
 http://www.gnu.org                      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]