[lug] OT: Makefile oddity

Tom Tromey tromey at redhat.com
Sat Apr 20 17:43:31 MDT 2002


>>>>> ">" == D Stimits <stimits at idcomm.com> writes:

Tom> However, there's a bug here.  It is the classic recursive make
Tom> bug: you only have a dependency on the .cpp file.  So if you
Tom> `touch config.h', nothing will be rebuilt -- which is wrong.

>> I don't really consider this a bug, just a limitation of the
>> technology.  makedepend would almost work, except it is designed
>> for C instead of C++, and fails to deal properly with .cpp or .cxx
>> extensions.

I recommend against ever using makedepend.  Instead there is a much
better way to compute dependencies.  Read this:

    http://sources.redhat.com/automake/dependencies.html

This approach is pretty easy to implement if you can assume GNU make
and gcc.  If you need to do it portably, then more effort is required.

Tom



More information about the LUG mailing list