Makefiles -- .c and .h

0257014-Robert White140 rwhite at nusdecs.uucp
Sat Nov 17 07:20:48 AEST 1990


In article <9011151442.AA02010 at decpa.pa.dec.com> ellis at ultra.dec.com (David Ellis 15-Nov-1990 0915) writes:
>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

The simplest thing to do is to take the line

someobj.o:	someobj.c

and turn it into:

someobj.o:	someobj.c someheader.h

When the header is older than the .o then everything is as it should be
but when the header is changed the object is out of date wrt the source(s)
and it is recompiled.

An automatic way to generate this sort of dependancy list is to get make
cc output the included file list instead of compiling an object.  Take
that output and massage it into a dependancy list.

Rob.



More information about the Comp.unix.programmer mailing list