[project @ 2002-06-12 22:04:25 by wolfgang]
[ghc-hetmet.git] / ghc / compiler / main / DriverFlags.hs
index bfb3c00..e0196f2 100644 (file)
@@ -1,7 +1,5 @@
-{-# OPTIONS -#include "hschooks.h" #-}
-
 -----------------------------------------------------------------------------
--- $Id: DriverFlags.hs,v 1.86 2002/02/11 08:20:41 chak Exp $
+-- $Id: DriverFlags.hs,v 1.97 2002/06/12 22:04:26 wolfgang Exp $
 --
 -- Driver flags
 --
@@ -19,6 +17,7 @@ module DriverFlags (
 #include "HsVersions.h"
 #include "../includes/config.h"
 
+import MkIface         ( showIface )
 import DriverState
 import DriverPhases
 import DriverUtil
@@ -137,8 +136,8 @@ findArg spec arg
 arg_ok (NoArg _)            rest arg = null rest
 arg_ok (HasArg _)           rest arg = True
 arg_ok (SepArg _)           rest arg = null rest
-arg_ok (Prefix _)          rest arg = not (null rest)
-arg_ok (PrefixPred p _)     rest arg = not (null rest) && p rest
+arg_ok (Prefix _)          rest arg = notNull rest
+arg_ok (PrefixPred p _)     rest arg = notNull rest && p rest
 arg_ok (OptPrefix _)       rest arg = True
 arg_ok (PassFlag _)         rest arg = null rest 
 arg_ok (AnySuffix _)        rest arg = True
@@ -163,6 +162,10 @@ static_flags =
   ,  ( "-numeric-version", NoArg (do putStrLn cProjectVersion
                                     exitWith ExitSuccess))
 
+      ------- interfaces ----------------------------------------------------
+  ,  ( "-show-iface"     , HasArg (\f -> do showIface f
+                                           exitWith ExitSuccess))
+
       ------- verbosity ----------------------------------------------------
   ,  ( "n"              , NoArg setDryRun )
 
@@ -260,6 +263,12 @@ static_flags =
   ,  ( "L"             , Prefix (addToDirList v_Library_paths) )
   ,  ( "l"             , Prefix (add v_Cmdline_libraries) )
 
+#ifdef darwin_TARGET_OS
+       ------- Frameworks --------------------------------------------------
+        -- -framework-path should really be -F ...
+  ,  ( "framework-path" , HasArg (addToDirList v_Framework_paths) )
+  ,  ( "framework"     , HasArg (add v_Cmdline_frameworks) )
+#endif
         ------- Packages ----------------------------------------------------
   ,  ( "package-name"   , HasArg (\s -> add v_Opt_C ("-inpackage="++s)) )
 
@@ -268,7 +277,17 @@ static_flags =
   ,  ( "syslib"         , HasArg (addPackage) )        -- for compatibility w/ old vsns
 
         ------- Specific phases  --------------------------------------------
-  ,  ( "pgm"           , HasArg setPgm )
+  ,  ( "pgmP"           , HasArg setPgmP )
+  ,  ( "pgmF"           , HasArg setPgmF )
+  ,  ( "pgmc"           , HasArg setPgmc )
+  ,  ( "pgmm"           , HasArg setPgmm )
+  ,  ( "pgms"           , HasArg setPgms )
+  ,  ( "pgma"           , HasArg setPgma )
+  ,  ( "pgml"           , HasArg setPgml )
+#ifdef ILX
+  ,  ( "pgmI"           , HasArg setPgmI )
+  ,  ( "pgmi"           , HasArg setPgmi )
+#endif
 
   ,  ( "optdep"                , HasArg (add v_Opt_dep) )
   ,  ( "optl"          , HasArg (add v_Opt_l) )
@@ -307,9 +326,6 @@ static_flags =
        -- -fno-* pattern below doesn't work.  We therefore allow
        -- certain optimisation passes to be turned off explicitly:
   ,  ( "fno-strictness"           , NoArg (writeIORef v_Strictness False) )
-#ifdef DEBUG
-  ,  ( "fno-cpr"          , NoArg (writeIORef v_CPR False) )
-#endif
   ,  ( "fno-cse"          , NoArg (writeIORef v_CSE False) )
 
        -- All other "-fno-<blah>" options cancel out "-f<blah>" on the hsc cmdline
@@ -346,7 +362,7 @@ dynamic_flags = [
        -- on all other systems, quoting is necessary, to avoid interpretation
        -- of shell metacharacters in the arguments (e.g. green-card's
        -- -DBEGIN_GHC_ONLY='}-' trick).
-#ifndef mingw32_TARGET_OS
+#ifndef mingw32_HOST_OS
   ,  ( "D",            Prefix (\s -> addOpt_P ("-D'"++s++"'") ) )
   ,  ( "U",            Prefix (\s -> addOpt_P ("-U'"++s++"'") ) )
 #else
@@ -417,6 +433,7 @@ dynamic_flags = [
   ,  ( "fvia-c",       NoArg (setLang HscC) )
   ,  ( "fvia-C",       NoArg (setLang HscC) )
   ,  ( "filx",         NoArg (setLang HscILX) )
+  ,  ( "fcore",                NoArg (setLang HscCore) )
 
        -- "active negatives"
   ,  ( "fno-implicit-prelude",  NoArg (setDynFlag Opt_NoImplicitPrelude) )
@@ -446,6 +463,9 @@ fFlags = [
   ( "warn-unused-matches",             Opt_WarnUnusedMatches ),
   ( "warn-deprecations",               Opt_WarnDeprecations ),
   ( "glasgow-exts",                    Opt_GlasgowExts ),
+  ( "fi",                              Opt_FFI ),  -- support `-ffi'...
+  ( "ffi",                             Opt_FFI ),  -- ...and also `-fffi'
+  ( "with",                            Opt_With ), -- with keyword
   ( "parr",                            Opt_PArr ),
   ( "allow-overlapping-instances",     Opt_AllowOverlappingInstances ),
   ( "allow-undecidable-instances",     Opt_AllowUndecidableInstances ),
@@ -551,6 +571,9 @@ machdepCCOpts
                        "-DSTOLEN_X86_REGS="++show n_regs ]
                    )
 
+   | prefixMatch "ia64"    cTARGETPLATFORM  
+       = return ( [], ["-fomit-frame-pointer", "-G0"] )
+
    | prefixMatch "mips"    cTARGETPLATFORM
        = return ( ["-static"], [] )