-hidir separation of search/output paths

Simon Marlow simonmar@microsoft.com
Wed, 11 Dec 2002 12:02:15 -0000

> Oops, one more request which I almost forgot: -hidir currently
> specifies both where to search for .hi files, and where to output
> hi files.  It would be good to split up the two operations into
> two distinct options; e.g. use -hidir to search for interface
> files, and a new option such as -ohidir to specify where to
> output new interface files.
> This is very useful if you're trying to build stuff (with --make)
> outside of the source tree: you could write
>     "-i$src/SomeLibrary" to tell GHC to find the .hs files in
> 			 a directory named $src/SomeLibrary,
>     "-hidir$build/SomeLibrary" to find the .hi files in
> 			       a directory named
>                                $build/SomeLibrary, and
>     "-ohidir ." to tell GHC to output any .hi files to the
> 		current directory

Urk!  I'm really not sure that we need yet another option that further
complicates the behaviour.

You don't say whether you're using --make/GHCi or "one-shot" (ghc -c)
mode.  This makes a difference to the search behaviour: the former
searches for source files, whereas the latter searches for interface
files along the search path.  One-shot mode tends to be more flexible
with respect to the naming of files, so if you want to separate your
source files from your interface files or give the source files
non-standard names, then one-shot is usually the way to go.

If you have pre-built libraries that you don't want to recompile, the
proper way is to make it into a package.  GHC maintains recompilation
information within a package only, and assumes that all packages except
the "home" package are fully up to date.


I think I should try to write down a precise description of GHC's file
searching behaviour so we can discuss changes more easily...