Hi,
I'd like to change where Yhc puts generated files. I propose:
Every module gets assigned a "root" directory:
* foo/Main.hs has a root of "foo".
* foo/System/Cmd.hs, module System.Cmd, has a root of "foo".
* foo/System/Cmd.hs, module Cmd, has a root of "foo/System".
(Note that this is already done when searching for imports)
Every file with <ext> (where ext is one of hi, hbc,ycr,yca) will be created in:
* foo/Main.hs leads to foo/<dir-ext>/Main.<ext>
* foo/System/Cmd.hs, module System.Cmd, leads to foo/<dir-ext>/System.Cmd.<ext>
By default, <dir-ext> is "obj" for all extensions. The flag objdir
will allow the default <dir-ext> to be changed. The flag <ext>dir will
allow the location of <ext> files to be changed. For example
--hidir=hi would put all the hi files in foo/hi/Main.hi. --objdir=bar
will put all generated files in foo/bar/*.*.
There is exactly one exception to this rule:
foo/Foo.hs, module Main, creates foo/Foo.hbc, in all circumstances.
Comments? If the argument you use relies on some other compiler
(GCC/GHC) doing something different, please say _why_ that compilers
behaviour is preferable.
The reason for this change is that I have written a low-level Make
library, and therefore want to port Yhc to use this. I could
re-implement the existing behaviour, but once you sit down and take a
close look at the existing behaviour, it starts to look more and more
silly. The existing make facilities are around ~22Kb of source, the
new one will have a separate well defined library of ~7Kb, and a Yhc
specific part of ~3Kb. For free we will get minimal compilation, cycle
detection (and breaking using hand written .hi files), minimal file
tests etc.
As part of this move to a new make architecture, I want Yhc to be able
to compile the base library by simply invoking yhc *.hs, I want
linking of .yca files to work better, and I want world peace.
I also hope that once the Make library has been tested in the context
of Yhc, it can be shoved in the direction of the Cabal people.
Thanks
Neil