Re: Makefile questions

"Matthew J. Lockner" <lockner@chaos.cns.uni.edu>
6 Jul 2001 16:27:14 -0400

          From comp.compilers

Related articles
Makefile questions Stanya@aol.com (2001-07-03)
Re: Makefile questions lockner@chaos.cns.uni.edu (Matthew J. Lockner) (2001-07-06)
Re: Makefile questions yedema@natlab.research.philips.com (Wim Yedema) (2001-07-06)
Re: Makefile questions yugami@monochromatic.com (Marc Britten) (2001-07-06)
Re: Makefile questions walter@digitalmars.com (walter) (2001-07-06)
Re: Makefile questions lex@cc.gatech.edu (Lex Spoon) (2001-07-17)
| List of all articles for this month |

From: "Matthew J. Lockner" <lockner@chaos.cns.uni.edu>
Newsgroups: comp.compilers
Followup-To: comp.compilers
Date: 6 Jul 2001 16:27:14 -0400
Organization: University of Northern Iowa
References: 01-07-031
Keywords: tools
Posted-Date: 06 Jul 2001 16:27:14 EDT

Stan wrote:


> 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
hints.


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.




Sincerely,
M. Lockner


Post a followup to this message

Return to the comp.compilers page.
Search the comp.compilers archives again.