-hidir separation of search/output paths

Andre Pang ozone@algorithm.com.au
Tue, 10 Dec 2002 22:39:10 +1100

On Tue, Dec 10, 2002 at 10:15:58PM +1100, Andre Pang wrote:

> Is it possible to modify the behaviour so that if --make
> -no-hs-main is specified, GHC won't perform the link if it finds
> a main function?

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

Being able to build outside of the source directory (e.g. if you
make a 'build' directory in the source tree, and do ../configure
from there) is fairly common, and is also required for passing
a 'make distcheck' if you use automake.

Currently, if you use "-hidir ." to put interface files in the
current directory, GHC will only search the current directory for
hi files, so it keeps building stuff unnecessarily if you
specify imports outside the current directory with
"-i$src/SomeLibrary", since they get built to $build/SomeLibrary
instead of the directory you're currently in.

Another way of achieving the same thing without adding a new
option would be to search the directories specified with -i for
interface files as well as .hs files; that way, you could do

    "-i$src/SomeLibrary -i$build/SomeLibrary -hidir ."

to perform the same thing as the above.

(I hope that wasn't too confusing!)

#ozone/algorithm <ozone@algorithm.com.au>          - trust.in.love.to.save