David Tweed writes:
> > $ gcc -M main.c >>Makefile
> > $ ghc -M Main.hs >>Makefile
> > $ hmake -M MyProg >>Makefile
>
> Since several people have pointed out the -M option for gcc I'd better
> explain that, for reasons of no interest to Haskell users, when tackling
> _C++_ it produces dependencies which are much, much worse than they could
> be (at least for me).
>
> Purely personally, I'd find it easier to have a tool that was independent
> of the compiler to customise, which could also be extended to other
> things, eg, latex, that don't have a -M option.
Well, compiler-independent is possible (e.g. hmake extracts
dependencies from any Haskell sources, regardless of compiler.)
However, language-independent is much more difficult. How could one
tool deal with all of C, C++, Haskell, and LaTeX? Since each language
has different lexical/parsing rules, not to mention different semantic
notions of imports or inclusions, it seems to me that the only
component of such a tool that would be common to all languages is the
core dependency-graph analyser.
Regards,
Malcolm