Commit b2db559e authored by Neil Mitchell's avatar Neil Mitchell
Browse files

Make -o use the filename as GHC will, i.e. with .exe on the end for Windows....

Make -o use the filename as GHC will, i.e. with .exe on the end for Windows. This fixes a GHC 6.4.2 bug with relinking every time.
parent 90b5471e
......@@ -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
......@@ -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
......@@ -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]
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment