Makefiles -- .c and .h

Dan Bernstein brnstnd at kramden.acf.nyu.edu
Tue Nov 20 15:55:52 AEST 1990


In article <1990Nov18.204706.7044 at athena.mit.edu> jik at athena.mit.edu (Jonathan I. Kamens) writes:
>   How does the SunOs make figure out which files were included by each source
> file?  Does it do a "cc -E" on the source file, or something similar?

I don't know what it actually uses, but cc -M would be one solution.

> If so,
> isn't that (a) slow since it has to do it again each time the .c file changes,

It has to recompile every time the file changes. The extra time is
negligible.

> and (b) a problem with source files on which "cc -E" (or whatever command make
> uses) won't do the right thing?

If every transformation command accepted -M, it wouldn't be a problem.

One strategy to handle all cases would be to trace the executable and
keep track of what files were opened. Shared libraries could be
special-cased here. Under some tracing mechanisms this would even allow
the recursive make that some people want.

---Dan



More information about the Comp.unix.programmer mailing list