[project @ 2000-11-14 16:28:38 by simonmar]
[ghc-hetmet.git] / ghc / compiler / main / DriverState.hs
index f7092fd..d6ee6d0 100644 (file)
@@ -1,5 +1,5 @@
 -----------------------------------------------------------------------------
--- $Id: DriverState.hs,v 1.9 2000/10/27 14:56:00 sewardj Exp $
+-- $Id: DriverState.hs,v 1.13 2000/11/14 16:28:38 simonmar Exp $
 --
 -- Settings for the driver
 --
@@ -16,9 +16,12 @@ import CmdLineOpts
 import DriverUtil
 import Util
 import Config
-
 import Exception
 import IOExts
+#ifdef mingw32_TARGET_OS
+import TmpFiles        ( newTempName )
+import Directory ( removeFile )
+#endif
 
 import System
 import IO
@@ -125,6 +128,7 @@ GLOBAL_VAR(v_Static,                        True,           Bool)
 #else
 GLOBAL_VAR(v_Static,                   False,          Bool)
 #endif
+GLOBAL_VAR(v_NoHsMain,                         False,          Bool)
 GLOBAL_VAR(v_Recomp,                   True,           Bool)
 GLOBAL_VAR(v_Collect_ghc_timing,       False,          Bool)
 GLOBAL_VAR(v_Do_asm_mangling,          True,           Bool)
@@ -150,15 +154,14 @@ can_split =  prefixMatch "i386" cTARGETPLATFORM
 -----------------------------------------------------------------------------
 -- Compiler output options
 
-GLOBAL_VAR(v_Hsc_Lang, if cGhcWithNativeCodeGen == "YES" && 
-                        (prefixMatch "i386" cTARGETPLATFORM ||
-                         prefixMatch "sparc" cTARGETPLATFORM)
-                       then  HscAsm
-                       else  HscC, 
-          HscLang)
+defaultHscLang
+  | cGhcWithNativeCodeGen == "YES" && 
+       (prefixMatch "i386" cTARGETPLATFORM ||
+        prefixMatch "sparc" cTARGETPLATFORM)   =  HscAsm
+  | otherwise                                  =  HscC
 
 GLOBAL_VAR(v_Output_dir,  Nothing, Maybe String)
-GLOBAL_VAR(v_Output_suf,  Nothing, Maybe String)
+GLOBAL_VAR(v_Object_suf,  Nothing, Maybe String)
 GLOBAL_VAR(v_Output_file, Nothing, Maybe String)
 GLOBAL_VAR(v_Output_hi,   Nothing, Maybe String)
 
@@ -173,7 +176,7 @@ odir_ify f = do
 
 osuf_ify :: String -> IO String
 osuf_ify f = do
-  osuf_opt <- readIORef v_Output_suf
+  osuf_opt <- readIORef v_Object_suf
   case osuf_opt of
        Nothing -> return f
        Just s  -> return (newsuf s f)
@@ -228,23 +231,16 @@ GLOBAL_VAR(v_Warning_opt, W_default, WarningState)
 GLOBAL_VAR(v_OptLevel, 0, Int)
 
 setOptLevel :: String -> IO ()
-setOptLevel ""             = do { writeIORef v_OptLevel 1; go_via_C }
+setOptLevel ""             = do { writeIORef v_OptLevel 1 }
 setOptLevel "not"          = writeIORef v_OptLevel 0
 setOptLevel [c] | isDigit c = do
    let level = ord c - ord '0'
    writeIORef v_OptLevel level
-   when (level >= 1) go_via_C
 setOptLevel s = unknownFlagErr ("-O"++s)
 
-go_via_C = do
-   l <- readIORef v_Hsc_Lang
-   case l of { HscAsm -> writeIORef v_Hsc_Lang HscC; 
-              _other -> return () }
-
-GLOBAL_VAR(v_minus_o2_for_C, False, Bool)
-
-GLOBAL_VAR(v_MaxSimplifierIterations, 4,     Int)
-GLOBAL_VAR(v_StgStats,                False, Bool)
+GLOBAL_VAR(v_minus_o2_for_C,            False, Bool)
+GLOBAL_VAR(v_MaxSimplifierIterations,   4,     Int)
+GLOBAL_VAR(v_StgStats,                  False, Bool)
 GLOBAL_VAR(v_UsageSPInf,               False, Bool)  -- Off by default
 GLOBAL_VAR(v_Strictness,               True,  Bool)
 GLOBAL_VAR(v_CPR,                      True,  Bool)