From 7968190992cc1a148524360967afba8e29edf1f0 Mon Sep 17 00:00:00 2001 From: Simon Marlow Date: Fri, 11 Jul 2008 15:11:46 +0000 Subject: [PATCH] FIX #2248 Unconditionally add .exe to the output executable name when using --make on Windows, and no -o option was given. --- compiler/main/GHC.hs | 15 ++++++++++++--- 1 file changed, 12 insertions(+), 3 deletions(-) diff --git a/compiler/main/GHC.hs b/compiler/main/GHC.hs index 5626d24..39cb9b5 100644 --- a/compiler/main/GHC.hs +++ b/compiler/main/GHC.hs @@ -390,16 +390,25 @@ guessOutputFile :: Session -> IO () guessOutputFile s = modifySession s $ \env -> let dflags = hsc_dflags env mod_graph = hsc_mod_graph env - mainModuleSrcPath, guessedName :: Maybe String + mainModuleSrcPath :: Maybe String mainModuleSrcPath = do let isMain = (== mainModIs dflags) . ms_mod [ms] <- return (filter isMain mod_graph) ml_hs_file (ms_location ms) - guessedName = fmap dropExtension mainModuleSrcPath + name = fmap dropExtension mainModuleSrcPath + +#if defined(mingw32_HOST_OS) + -- we must add the .exe extention unconditionally here, otherwise + -- when name has an extension of its own, the .exe extension will + -- not be added by DriverPipeline.exeFileName. See #2248 + name_exe = name <.> "exe" +#else + name_exe = name +#endif in case outputFile dflags of Just _ -> env - Nothing -> env { hsc_dflags = dflags { outputFile = guessedName } } + Nothing -> env { hsc_dflags = dflags { outputFile = name_exe } } -- ----------------------------------------------------------------------------- -- Targets -- 1.7.10.4