ghc -M
Mon, 09 Dec 2002 12:27:58 -0500

Hi Peter,

> Now, since ghc -M does such a great job at gobbling up the
> dependencies, I wonder if it was not possible to extend its
> functionality a little bit so that it also determines the .o files
> that are required to link a Main program. I could imagine something
> like an -optdep-Main and then the program name.

Could come in handy sometimes, perhaps, but maybe there are other ways?

If it is the size of the resulting executables that prevents you from
linking each main.o file with all the other .o files (except the main ones),
couldn't you just put all the non-main .o files into an archive and then let
the linker figure out what to link against what for you? Make has pretty
much all rules for building archives in a good way built in, so this is
easy to do.

If it's mainly a matter of avoiding clashes between the different Main
modules, it should, with a little bit of care, not be too hard to structure
the makefile to deal with that.



Henrik Nilsson
Yale University
Department of Computer Science