From 6e64c691b64f700def0d1582d2c028b653ccd414 Mon Sep 17 00:00:00 2001 From: krasimir Date: Sun, 30 Oct 2005 19:12:31 +0000 Subject: [PATCH] [project @ 2005-10-30 19:12:31 by krasimir] Change the way in which the .exe suffix to the output file is added. The reason is that "-o main" will generate main.exe on Windows while the doesFileExists "main" in DriverPipeline.link will return False. --- ghc/compiler/main/DriverPipeline.hs | 9 ++++++++- ghc/compiler/main/GHC.hs | 4 ---- 2 files changed, 8 insertions(+), 5 deletions(-) diff --git a/ghc/compiler/main/DriverPipeline.hs b/ghc/compiler/main/DriverPipeline.hs index d045f0a..bdc0546 100644 --- a/ghc/compiler/main/DriverPipeline.hs +++ b/ghc/compiler/main/DriverPipeline.hs @@ -1205,7 +1205,14 @@ staticLink dflags o_files dep_packages = do exeFileName :: DynFlags -> FilePath exeFileName dflags - | Just s <- outputFile dflags = s + | Just s <- outputFile dflags = +#if defined(mingw32_HOST_OS) + if null (suffixOf s) + then s `joinFileExt` "exe" + else s +#else + s +#endif | otherwise = #if defined(mingw32_HOST_OS) "main.exe" diff --git a/ghc/compiler/main/GHC.hs b/ghc/compiler/main/GHC.hs index fec3dfc..2ff5229 100644 --- a/ghc/compiler/main/GHC.hs +++ b/ghc/compiler/main/GHC.hs @@ -365,11 +365,7 @@ guessOutputFile s = modifySession s $ \env -> let isMain = (== mainModIs dflags) . ms_mod [ms] <- return (filter isMain mod_graph) ml_hs_file (ms_location ms) -#if defined(mingw32_HOST_OS) - guessedName = fmap (\fname -> basenameOf fname `joinFileExt` "exe") mainModuleSrcPath -#else guessedName = fmap basenameOf mainModuleSrcPath -#endif in case outputFile dflags of Just _ -> env -- 1.7.10.4