From: krasimir Date: Sun, 30 Oct 2005 19:12:31 +0000 (+0000) Subject: [project @ 2005-10-30 19:12:31 by krasimir] X-Git-Tag: Initial_conversion_from_CVS_complete~98 X-Git-Url: http://git.megacz.com/?p=ghc-hetmet.git;a=commitdiff_plain;h=6e64c691b64f700def0d1582d2c028b653ccd414 [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. --- 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