Makefiles -- .c and .h

David Ellis 15-Nov-1990 0915 ellis at ultra.dec.com
Fri Nov 16 01:43:00 AEST 1990


Consider a Makefile for an executable built from a large number of .o files, 
each separately compiled from a .c file.

If we use a single .c.o rule for compiling all the source files, then it 
seems that a change in a .h file that is #include'd in a .c file will
not be picked up by Make to automatically force recompilation of the .c file.

One workaround is to replace the single .c.o rule with a collection of rules, 
one for each .o file, listing the dependencies on the .h files #include'd in
the corresponding .c file.  But this is a lot of writing, and if we change
the "#include" lines in any .c file, we have to update the Makefile with the
corresponding change.

Is there a simpler way?

----
David  J  Ellis
Digital Equipment Corporation, Secure Systems Group 
Mailstop LTN1-1/D07
295 Foster Street, Littleton MA 01460
(508) 486-6157
Usenet:   {ucbvax,allegra,decvax}!decwrl!ultra.enet!ellis
Internet: ellis at ultra.enet.dec.com



More information about the Comp.unix.programmer mailing list