Skip to content

Commit

Permalink
Make -o use the filename as GHC will, i.e. with .exe on the end for W…
Browse files Browse the repository at this point in the history
…indows. This fixes a GHC 6.4.2 bug with relinking every time.
  • Loading branch information
Neil Mitchell committed Aug 21, 2006
1 parent 90b5471 commit b2db559
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions Distribution/Simple/GHC.hs
Expand Up @@ -67,7 +67,7 @@ import Distribution.Version ( Version(..) )
import Distribution.Compat.FilePath
( joinFileName, exeExtension, joinFileExt,
splitFilePath, objExtension, joinPaths,
isAbsolutePath )
isAbsolutePath, splitFileExt )
import Distribution.Compat.Directory
( createDirectoryIfMissing )
import qualified Distribution.Simple.GHCPackageConfig as GHC
Expand Down Expand Up @@ -236,6 +236,11 @@ build pkg_descr lbi verbose = do
withExe pkg_descr $ \ (Executable exeName' modPath exeBi) -> do
when (verbose > 3)
(putStrLn $ "Building executable: " ++ exeName' ++ "...")

-- exeNameReal, the name that GHC really uses (with .exe on Windows)
let exeNameReal = exeName' `joinFileExt`
(if null $ snd $ splitFileExt exeName' then exeExtension else "")

let targetDir = pref `joinFileName` exeName'
let exeDir = joinPaths targetDir (exeName' ++ "-tmp")
createDirectoryIfMissing True targetDir
Expand Down Expand Up @@ -267,7 +272,7 @@ build pkg_descr lbi verbose = do
pkg_conf
++ ["-I"++pref]
++ (if linkExe
then ["-o", targetDir `joinFileName` exeName']
then ["-o", targetDir `joinFileName` exeNameReal]
else ["-c"])
++ constructGHCCmdLine lbi exeBi exeDir verbose
++ [exeDir `joinFileName` x | x <- cObjs]
Expand Down

0 comments on commit b2db559

Please sign in to comment.