Re: [patch/rfc] Generate makefile dependencies

Daniel Jacobowitz
2004-03-08T17:29:27Z

On Mon, Mar 08, 2004 at 11:24:20AM -0500, Andrew Cagney wrote:
> >>Date: Sun, 07 Mar 2004 19:35:34 -0500
> >>>From: Andrew Cagney <cagney@gnu.org>
> >>>
> >>>The attached, er, hack, modifies configure.in so that all the Makefile
> >>>dependencies are generated during configure time:
> >>>
> >>> defs_h = ...
> >>> foo.o: foo.c $(defs_h)
> >>>
> >>>It exploits the fact that GDB's code base is very consistent in its use
> >>>of "foo.h" vs <foo.h> -- the former is assumed to be local, the latter
> >>>in a system library.
> >
> >
> >Won't it be better to use "gcc -MM" when we compile with GCC?
>
> It would, except we can't assume GCC :-(. Better to always use the sed
> script as that way we'll know it always (hopefully :-) works.
>
> It needs comments (and a doco update).

So what about using the output of gcc -MM (or one of the other -M
options?) to generate dependencies in the source directory, like BFD
does?

BTW, your comment about running automake to update deps in BFD is
actually incorrect. You run 'make dep-am', which IIRC seds Makefile.am
and maye regenerates Makefile.in; the dependencies aren't managed by
automake. Recent versions of automake do have top-notch dependency
support though.

--
Daniel Jacobowitz
MontaVista Software Debian GNU/Linux Developer