|Makefile questions Stanya@aol.com (2001-07-03)|
|Re: Makefile questions email@example.com (Matthew J. Lockner) (2001-07-06)|
|Re: Makefile questions firstname.lastname@example.org (Wim Yedema) (2001-07-06)|
|Re: Makefile questions email@example.com (Marc Britten) (2001-07-06)|
|Re: Makefile questions firstname.lastname@example.org (walter) (2001-07-06)|
|Re: Makefile questions email@example.com (Lex Spoon) (2001-07-17)|
|From:||"Matthew J. Lockner" <firstname.lastname@example.org>|
|Date:||6 Jul 2001 16:27:14 -0400|
|Organization:||University of Northern Iowa|
|Posted-Date:||06 Jul 2001 16:27:14 EDT|
> I'm working on a project that has to do with the make command in UNIX
> to build projects. There are makefiles involved - in fact, a makefile
It sounds like you want to be able to reconstruct the entire dependency
graph and then be able to query on given file names for dependencies; is
this an accurate summary?
Since you didn't include the makefiles (and I very much doubt that would be
appropriate anyway on Usenet), I'll simply offer a few hopefully helpful
This first part you probably already know...
The basic theory behind make is to create a directed acyclic graph, whose
nodes are file names, and whose directed edges are the concept of
dependency. A file (node) depends on another file (node) if there is a
directed edge going into it.
A makefile is basically a textual representation (adjacency lists) of that
graph, which the make program can use to reconstruct the graph and then do
its magic, traversing the graph as necessary to recompile dependent files
for any given target.
End of review.
Now, Perl is a fine language for the text processing necessary for your
project, and you can construct as much of the graph as make can. Herein
lies one problem in trying to build a solution to the problem you gave: you
cannot construct a complete DAG, which is what I believe you are shooting
for (the key words 'whole build' are what I am concluding from). For a
discussion of why not, you may wish to read "Recursive Make Considered
Harmful" found at
<http://www.pcug.org.au/~millerp/rmch/recu-make-cons-harm.html>. You might
want to give it a read anyway; it discusses a lot of the hacks necessary to
make recursive make work, some of which you may well find in your Makefiles.
Recursive make can break the DAG up into many pieces, and your Perl will
have to be prepared for this. Pay attention to those actions that impose
an order upon the subordinate makes (loops, etc.)
> HP-UX, but I use ClearCase which, in turn, provides clearmake - their
Do you know what each of -w, -d, and -n do (i.e. individually)? I worked
with a bit of ClearCase once myself; I wouldn't be surprised if there were
some combination of options that will do at least part of this work for you.
I suspect what you describe is possible; good luck in your pursuits.
Return to the
Search the comp.compilers archives again.