"Simon Marlow" <[EMAIL PROTECTED]> writes:
> > The nub of the bug is that ghc --make now names the object file for any
> > module Main as Main.o, disregarding the actual filename of the source.
> > (Previously, the .o was named to correspond to the .hs source file.)
>
> This is intentional, and is part of a cleaning up of GHC's filename
> handling policies that we did recently.
It may be conceptually cleaner, but in practice it seems to make things
worse rather than better. I'm sure I can't be the only person to
store more than one Main module source file in a single directory?
With the current scheme, I'm seeing more errors than previously,
not fewer.
> Previously, the .o file followed the filename, but the .hi file followed
> the module name. Under this scheme, you would also run into trouble
> with having several Main modules in the same directory,
Wouldn't the simpler solution be to follow hbc and nhc98's practice
of naming both the .hi and the .o file for the original filename,
rather than for Main? This seems to work well.
> Of course, you can always circumvent the default behaviour by passing
> the appropriate command-line flags.
I can see what flags to pass to plain one-pass ghc to fix this, but
what are the appropriate command-line flags to the --make variant to
ensure that the names of the .hi and .o files follow the filename and
not the module name? (The best option I could find was -no-recomp,
which despite its name appears to /force/ recompilation, but that
rather defeats the object of using ghc --make, doesn't it?)
At the moment, the only good solution seems to be to abandon ghc
--make and revert to hmake to issue a series of one-shot ghc commands,
because at least it doesn't miss dependencies, even if it sometimes
comes up with too many.
(On a slight tangent related to the latter point, it often appears
that ghc updates the timestamp of a .hi file even if nothing in the
interface has actually changed. Is there a good reason for this?
The manual section 4.9.5 isn't very clear on the subject.)
> > ghc --make believes that the second Main module has already been
> > compiled, and so links a /different/ program's Main.o with the modules
> > imported by this program.
>
> It would certainly be nice to provide some error checking to catch cases
> like this - we could store the source filename in the .hi file, for
> example. This is one for the ToDo list.
If you decide to keep the current output file naming scheme, I would
say that the absence of such a check is a pretty serious bug, not a
mere wishlist item.
Regards,
Malcolm
_______________________________________________
Cvs-ghc mailing list
[EMAIL PROTECTED]
http://www.haskell.org/mailman/listinfo/cvs-ghc