Hierarchical modules and compilation output redirection

Malcolm Wallace Malcolm.Wallace@cs.york.ac.uk
Tue, 15 Oct 2002 16:14:06 +0100


Martin Norbäck <d95mback@dtek.chalmers.se> writes:

> So I want to redirect the output with -odir OUTPUT_DIR
> 
> However it won't work since ghc wll put the compilation output of both
> modules in OUTPUT_DIR/Module.o and subsequently fail to link.

You could use a recent version of hmake, with the -d OUTPUT_DIR
option.  This will place .o files in directories corresponding to
their hierarchical names.

e.g.
    hmake -ghc Main -i. -d OUTPUT_DIR
generates
    OUTPUT_DIR/Main.o
    OUTPUT_DIR/Bar/Module.o
    OUTPUT_DIR/Foo/Module.o
and links them to a final executable ./Main.

Regards,
    Malcolm