Skip to content

-odir option changes .o and .hi names of main source file to Main.hi/o

One-liner illustrating problem:

    cd /tmp/ &&
    mkdir __tmp_ghc_test &&
    cd __tmp_ghc_test &&
    echo 'main = print 1' > foo.hs && ghc --make foo.hs -odir . &&
        rm -f * &&
    echo 'main = print 1' > foo.hs && ghc --make foo.hs

The output is:

[1 of 1] Compiling Main             ( foo.hs, Main.o )
Linking foo ...
[1 of 1] Compiling Main             ( foo.hs, foo.o )
Linking foo ...

In the first invocation we have got foo.hi/.o, but in the second Main.hi/.o.

It causes problems when user wants to write her custom Makefiles with predictable interface file names.

Or just wants to build two programs in one dir:

ghc --make foo.hs -odir .
ghc --make bar.hs -odir .

Which .o/.hi files will be used in the second case?

Thanks!

Trac metadata
Trac field Value
Version 7.6.1
Type Bug
TypeOfFailure OtherFailure
Priority normal
Resolution Unresolved
Component Compiler
Test case
Differential revisions
BlockedBy
Related
Blocking
CC
Operating system
Architecture
To upload designs, you'll need to enable LFS and have an admin enable hashed storage. More information