From b2db559eac2efe9e13f67da3214dfc0721ca1015 Mon Sep 17 00:00:00 2001 From: Neil Mitchell Date: Mon, 21 Aug 2006 14:30:21 +0000 Subject: [PATCH] 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. --- Distribution/Simple/GHC.hs | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/Distribution/Simple/GHC.hs b/Distribution/Simple/GHC.hs index 57f0c40be7f..67ba298aa85 100644 --- a/Distribution/Simple/GHC.hs +++ b/Distribution/Simple/GHC.hs @@ -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]