Compiling using gmake

Simon Marlow marlowsd at gmail.com
Tue Nov 8 16:34:24 CET 2011


On 05/11/2011 23:41, Christian Brolin wrote:

> I try to set-up a gnu makefile for compiling Haskell programs with GHC.
> I want to generate dependencies automatically and I want to put my
> object (.o) files in a binary specifc directories to be able to compile
> for different architechtures. The problem is when GHC derives the
> dependencies it names the object file for the Main module to Main.o and
> not filename.o as it does if I don't specifiy an odir. This gives me two
> problems, first I cannot have more than one Main module in the same
> directory as I often need, e.g. for different test programs. The second
> problem is that it doesn't match my compile command which always names
> the object files after the the source files by just changing extensions
> from .hs to .o. So gmake does not recognize dependencies from my Main
> modules to other modules.
>
> I am stuck here. Any ideas?

In GHC's build system we use explicit -o options, as well as -odir and 
-hidir.

Cheers,
	Simon




More information about the Glasgow-haskell-users mailing list