C + Make

Dan Bernstein brnstnd at kramden.acf.nyu.edu
Wed Sep 19 02:48:59 AEST 1990


In article <0955 at sheol.UUCP> throopw at sheol.UUCP (Wayne Throop) writes:
> Now, "ideally" the construction steps (eg: compilers) and make should
> talk to each other about dependencies.

Exactly. This can be done rather cleanly: cc has a -F flag to output a
list of all files it'll open. Every output file has a dependency list,
consisting of just the commands needed to create that file. make zooms
through the commands, giving each one a -F to find out what files it'll
use. It continues recursively, then invokes real compiles as necessary.
A file is always re-made if its dependency list has changed.

For efficiency, make can cache the -F output in another spot, knowing
that it must reinvoke cc -F whenever any of those files are touched.

If all constructors (including make itself) have a -F flag, this scheme
becomes quite reliable and modular.

---Dan



More information about the Comp.lang.c mailing list