[project @ 2003-09-04 11:08:46 by simonmar]
[ghc-hetmet.git] / ghc / compiler / main / DriverFlags.hs
index 378265e..1189f10 100644 (file)
@@ -1,5 +1,5 @@
 -----------------------------------------------------------------------------
--- $Id: DriverFlags.hs,v 1.116 2003/06/23 10:35:17 simonpj Exp $
+-- $Id: DriverFlags.hs,v 1.123 2003/09/04 11:08:47 simonmar Exp $
 --
 -- Driver flags
 --
@@ -127,7 +127,7 @@ findArg :: [(String,OptKind)] -> String -> Maybe (String,OptKind)
 findArg spec arg
   = case [ (remove_spaces rest, k) 
         | (pat,k)   <- spec, 
-          Just rest <- [my_prefix_match pat arg],
+          Just rest <- [maybePrefixMatch pat arg],
           arg_ok k rest arg ] 
     of
        []      -> Nothing
@@ -156,9 +156,8 @@ static_flags =
   ,  ( "-help"          , NoArg showGhcUsage)
   ,  ( "-print-libdir"   , NoArg (do getTopDir >>= putStrLn
                                     exitWith ExitSuccess))  
-  ,  ( "-version"       , NoArg (do putStrLn (cProjectName
-                                     ++ ", version " ++ cProjectVersion)
-                                    exitWith ExitSuccess))
+  ,  ( "V"              , NoArg showVersion)
+  ,  ( "-version"       , NoArg showVersion)
   ,  ( "-numeric-version", NoArg (do putStrLn cProjectVersion
                                     exitWith ExitSuccess))
 
@@ -179,6 +178,7 @@ static_flags =
   ,  ( "-make"         , PassFlag (setMode DoMake))
   ,  ( "-interactive"  , PassFlag (setMode DoInteractive))
   ,  ( "-mk-dll"       , PassFlag (setMode DoMkDLL))
+  ,  ( "e"              , HasArg   (\s -> setMode (DoEval s) "-e"))
 
        -- -fno-code says to stop after Hsc but don't generate any code.
   ,  ( "fno-code"      , PassFlag (\f -> do setMode (StopBefore HCc) f
@@ -252,7 +252,7 @@ static_flags =
                                    then do writeIORef v_Split_object_files True
                                            add v_Opt_C "-fglobalise-toplev-names"
                                    else hPutStrLn stderr
-                                           "warning: don't know how to  split \
+                                           "warning: don't know how to  split \ 
                                            \object files on this architecture"
                                ) )
 
@@ -455,6 +455,7 @@ fFlags = [
   ( "fi",                              Opt_FFI ),  -- support `-ffi'...
   ( "ffi",                             Opt_FFI ),  -- ...and also `-fffi'
   ( "with",                            Opt_With ), -- with keyword
+  ( "arrows",                          Opt_Arrows ), -- arrow syntax
   ( "parr",                            Opt_PArr ),
   ( "allow-overlapping-instances",     Opt_AllowOverlappingInstances ),
   ( "allow-undecidable-instances",     Opt_AllowUndecidableInstances ),
@@ -600,6 +601,9 @@ machdepCCOpts
    | prefixMatch "ia64"    cTARGETPLATFORM  
        = return ( [], ["-fomit-frame-pointer", "-G0"] )
 
+   | prefixMatch "x86_64"  cTARGETPLATFORM
+       = return ( [], ["-fomit-frame-pointer"] )
+
    | prefixMatch "mips"    cTARGETPLATFORM
        = return ( ["-static"], [] )
 
@@ -646,3 +650,8 @@ setVerbosity n
   | otherwise     = throwDyn (UsageError "can't parse verbosity flag (-v<n>)")
 
 addCmdlineHCInclude a = updDynFlags (\s -> s{cmdlineHcIncludes =  a : cmdlineHcIncludes s})
+
+showVersion :: IO ()
+showVersion = do
+  putStrLn (cProjectName ++ ", version " ++ cProjectVersion)
+  exitWith ExitSuccess