make depend
Wayne Throop
throopw at rtp47.UUCP
Mon Mar 25 07:49:19 AEST 1985
> > ...
> > People don't keep their dependency lists up to date, things
> > ...
> > Guy Harris
>
> I agree entirely with Guy concerning the importance of automated
> dependeny generators.
> ...
> The solution is to use ONLY source files as a basis for
> dependency generation.
> ...
> Kim Walden
Kim's solution seems quite good given the way make works. If you are
willing to change make's model of the world, another solution becomes
available. In particular, if a make-like tool allowed dependencies to
be specified dynamically, the problem of intermediate files being needed
before make is invoked (to allow dependencies to be discovered) becomes
a non-problem.
There are many ways for make to be modified to allow for dynamic inputs,
but suppose a syntax something like
foo.o: foo.c (foo.c; find_includes foo.c)
cc -c foo.c
foo.c: foo.x
make_c_from_x foo.x
The parenthesized text specifies a list of inputs to the "command"
at the end of the list. The output of the command will be a list of
include files, and the effect is as though that list of files had been
supplied instead of the parenthesized text. What make would do for
this makefile fragment would be to invoke make_c_from_x, then invoke
find_includes (discovering any include file dependencies of foo.c),
and then cc foo.c, producing foo.o.
This is essentially an "incremental make-file generator". It has problems,
such as what to do about include files that include other files, and so
on, but these problems can be overcome. Note also that make would then need
a database of already-run dynamic input lists, for efficency (otherwise
it would need to re-run find_includes every time make runs, not just when
foo.c changes).
More information about the Comp.unix
mailing list