[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Automake and dependency generation for Haskell

From: scrambles
Subject: Automake and dependency generation for Haskell
Date: Fri, 28 Jan 2005 18:32:22 +1100


For a while now I've been using autoconf and automake to configure and build a
program I'm writing in Haskell.

The Haskell compiler I'm using is GHC:

One problem I've encountered is with dependency generation.

Haskell modules (each in a seperate file) must be compiled in dependency order.
That is, if module A imports module B, then we must compile B before A.

I would like it very much if I could get this kind of order dependent
with automake, perhaps using the depcomp wrapper, but of course I don't know
how to do it.

GHC has a -M flag which will generate dependency information which it normally
appends to the end of Makefile, though you can ask it to write the information
to another place also.

Any ideas on whether there is any hope to support a Haskell compiler in 
depcomp? And if so how to go about it? Or another solution altogether?

You might wonder how am I using automake at the moment? Well I use a
very nasty hack. GHC also supports a --make flag. For example if you issue the
   ghc --make Foo.hs
(Haskell filenames end in ".hs".)
GHC will compile Foo.hs to Foo.o, but it will first compile anything that Foo.hs
depends on. Normally it tries to link the whole thing into an executable, but
you can stop it from doing this with another flag.

My hack is to compile all the files in whatever order they appear in,
giving GHC the --make flag so that it can cope with the dependency issues.
The downside of this is that it causes GHC to re-read many files during the
whole compilation, most of the time it realises that it has already compiled
the file previously and avoids re-compilation, however there is still
a considerable
slow down. 


reply via email to

[Prev in Thread] Current Thread [Next in Thread]