Hierarchical modules and compilation output redirection
15 Oct 2002 17:49:44 +0200
tis 2002-10-15 klockan 17.18 skrev Simon Marlow:
> > 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.
> Perhaps -odir should append the full module name as a directory (i.e. the default behaviour would be a special case where -odir is ".").
At least it should be made to work with hierarchical modules with the
same last name. Perhaps -odir should be made relative to the location of
the source file (unless an absolute path is specified, then you have to
do something else).
Or have -opre and be able to specify a directory there. (i.e -opre
> It sounds like what you want is a way to specify a general mapping function from module names to object file names, perhaps in Haskell. Something like
> $ ghc -omap "\m -> $ARCHITECTURE ++ \
> map (\x -> if x == '.' then '/' else x) m ++ \
> I'm only kidding, but we could implement this if we wanted :-)
> How about having a make rule which just moves the object file to the required place after compilation?
Well, that's a possibility, but then I can't use --make and reuse the
already-compiled object files when using the modules for another
project. No biggie of course.
All this is of course due to using the --make feature of ghc instead of
using a proper Makefile with dependancies.
I've found that using --make speeds the compilation up by a great deal,
so it would be nice to be able to continue using that.
-omap is maybe a bit to generic, but it would be fun.