using ghc with make
john at repetae.net
Mon Apr 17 19:25:35 EDT 2006
On Mon, Apr 17, 2006 at 10:57:32PM +0100, Frederik Eaton wrote:
> I have two examples of projects that use Makefiles, darcs and jhc, but
> they both appear to hand-code the list of dependencies for
> executables. The "-M" option to ghc should let us do this
> automatically, but either because of a deficiency in GHC or in GNU
> Make, that looks to be impossible or difficult. Does anyone have
> experience with this?
FWIW ginsu and DrIFT both use make and don't use ghcs --make feature. I
find this can be faster once your projects grow beyond a certain size as
it takes ghc a while to figure out which files need to be rebuilt with
--make, especially when a preprocessor is used. The main reason I have
found to use --make is it makes concurrent profiling and non-profiling
builds a lot easier.
both require an explicit 'make depend' whenever you change the import
it would be nice if ghc could spit out the dependencies to a file as a
side effect whenever using '--make' since it collects that info anyway.
ginsu is particularly tricky in order to get hierarchical modules to
play nice with 'automake' and 'autoconf'. it has to create symbolic
links from internal files to top level ones. If better solutions exist,
I'd love to hear of them.
> The compile / fix compiler errors cycle is an important part of the
> development process for me, and so I want recompilation to go as
> quickly as possible. By the way, the GHC user manual claims that using
> --make is much faster than using a Makefile, but in a test on a small
> program, the difference was not significant (16 seconds vs. 18
> seconds). Furthermore, some build systems are able to combine targets,
> e.g. running "ghc -c Bar.hs -c Foo.hs" instead of "ghc -c Bar.hs; ghc
> -c Foo.hs", which should eliminate the already small difference.
indeed, for a project the size of jhc (~150 modules) 'make' is
quite signifigantly faster than '--make'.
John Meacham - ⑆repetae.net⑆john⑈
More information about the Glasgow-haskell-users