[project @ 2005-10-30 19:12:31 by krasimir]
authorkrasimir <unknown>
Sun, 30 Oct 2005 19:12:31 +0000 (19:12 +0000)
committerkrasimir <unknown>
Sun, 30 Oct 2005 19:12:31 +0000 (19:12 +0000)
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
ghc/compiler/main/GHC.hs

index d045f0a..bdc0546 100644 (file)
@@ -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"
index fec3dfc..2ff5229 100644 (file)
@@ -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