makefile makers

Richard Harter rh at smds.UUCP
Wed Jan 23 14:21:54 AEST 1991


In article <1991Jan22.002523.19803 at inel.gov>, whg at INEL.GOV (Bill Gray) writes:
> In article <1898 at gold.gvg.tek.com> bobb at gold.gvg.tek.com (Bob Bateman) writes:
> >I'm looking for any form of makefile-generating scripts ...

> Uhhh ... make (?).  Couldn't make make other make files?  I dunno;  just a thought.

It's a non-trivial problem -- it's really an AI type problem because you
need some knowledge about what kinds of things you are making.  Our
(proprietary) software management system does handle writing makefile
writing for classical third generation executables.  Briefly, this is
the scenario.

You are given a set of source files (in one or more directories) and
a set of files containing entry points for executables to be built (mains).
You need to be able to determine for each main the list of additional
object files that will be needed to build the executable.  For each object
file you need to determine the source file and include files that it will
depend upon (the relatively easy part).  To determine the list of object
files needed you have two choices.  One route is to compile each file and
fish around in the object file for all of the referenced externals.  The
other is to scan the source code with language specific scanners that dig
out the referenced and declared entry points.  In either case, given the
cross reference information for the source file set you derive the
entry point closure for each main and, from that, the object file set
needed for each executable.  Given this information, the make file writing
is simply an exercise.

However life is not that simple.  First of all there are external libraries
to deal with (this can be finessed).  Secondly you may be packaging your
own object code into libraries -- this changes the whole dependency 
analysis problem because on one hand you don't need to derive minimum
closures but on the other hand you now have to generate library dependency
code for the makefile.  Thirdly the above scenario really doesn't deal
with intermediate preprocessors, e.g. lex, yacc, and friends.  Fourthly
there can be data file dependencies that have to be factored in.  And,
of course, the build may be parameterized by compiler and preprocessor
options and parameters.
-- 
Richard Harter, Software Maintenance and Development Systems, Inc.
Net address: jjmhome!smds!rh Phone: 508-369-7398 
US Mail: SMDS Inc., PO Box 555, Concord MA 01742
This sentence no verb.  This sentence short.  This signature done.



More information about the Comp.unix.questions mailing list