Compiling using gmake

Christian Brolin cbrolin at
Sun Nov 6 00:41:25 CET 2011


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?

More information about the Glasgow-haskell-users mailing list