[project @ 2001-09-04 18:29:20 by ken]
[ghc-hetmet.git] / ghc / compiler / main / DriverFlags.hs
index 0f8e551..435e50a 100644 (file)
@@ -1,7 +1,7 @@
 {-# OPTIONS -#include "hschooks.h" #-}
 
 -----------------------------------------------------------------------------
--- $Id: DriverFlags.hs,v 1.60 2001/06/26 16:32:03 rrt Exp $
+-- $Id: DriverFlags.hs,v 1.68 2001/09/04 18:29:20 ken Exp $
 --
 -- Driver flags
 --
@@ -167,6 +167,10 @@ static_flags =
       ------- verbosity ----------------------------------------------------
   ,  ( "n"              , NoArg setDryRun )
 
+       ------- GHCi -------------------------------------------------------
+  ,  ( "ignore-dot-ghci", NoArg (writeIORef v_Read_DotGHCi False) )
+  ,  ( "read-dot-ghci"  , NoArg (writeIORef v_Read_DotGHCi True) )
+
        ------- recompilation checker --------------------------------------
   ,  ( "recomp"                , NoArg (writeIORef v_Recomp True) )
   ,  ( "no-recomp"     , NoArg (writeIORef v_Recomp False) )
@@ -239,6 +243,7 @@ static_flags =
         ------- Packages ----------------------------------------------------
   ,  ( "package-name"   , HasArg (\s -> add v_Opt_C ("-inpackage="++s)) )
 
+  ,  ( "package-conf"   , HasArg (readPackageConf) )
   ,  ( "package"        , HasArg (addPackage) )
   ,  ( "syslib"         , HasArg (addPackage) )        -- for compatibility w/ old vsns
 
@@ -300,15 +305,25 @@ dynamic_flags = [
   ,  ( "optc",         HasArg (addOpt_c) )
   ,  ( "optm",         HasArg (addOpt_m) )
   ,  ( "opta",         HasArg (addOpt_a) )
+#ifdef ILX
+  ,  ( "optI",         HasArg (addOpt_I) )
+  ,  ( "opti",         HasArg (addOpt_i) )
+#endif
 
        ------ HsCpp opts ---------------------------------------------------
-       -- These options used to put ticks around their arguments for unknown
-       -- reasons. These quotes are stripped by the shell executing system()
-       -- on Unix, but not on Windows, where it therefore goes on to disturb
-       -- gcc. Hence they are now gone; if they need to be replaced later on
-       -- Unix, there will need to be #ifdefery.
+       -- With a C compiler whose system() doesn't use a UNIX shell (i.e.
+       -- mingwin gcc), -D and -U args must *not* be quoted, as the quotes
+       -- will be interpreted as part of the arguments, and not stripped;
+       -- 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
+  ,  ( "D",            Prefix (\s -> addOpt_P ("-D'"++s++"'") ) )
+  ,  ( "U",            Prefix (\s -> addOpt_P ("-U'"++s++"'") ) )
+#else
   ,  ( "D",            Prefix (\s -> addOpt_P ("-D"++s) ) )
   ,  ( "U",            Prefix (\s -> addOpt_P ("-U"++s) ) )
+#endif
 
        ------ Debugging ----------------------------------------------------
   ,  ( "dstg-stats",   NoArg (writeIORef v_StgStats True) )
@@ -372,6 +387,7 @@ dynamic_flags = [
   ,  ( "fvia-c",       NoArg (setLang HscC) )
   ,  ( "fvia-C",       NoArg (setLang HscC) )
   ,  ( "filx",         NoArg (setLang HscILX) )
+  ,  ( "fno-code",      NoArg (setLang HscNothing) )
 
        -- "active negatives"
   ,  ( "fno-implicit-prelude",  NoArg (setDynFlag Opt_NoImplicitPrelude) )
@@ -466,7 +482,10 @@ buildStaticHscOpts = do
 
 machdepCCOpts 
    | prefixMatch "alpha"   cTARGETPLATFORM  
-       = return ( ["-static"], [] )
+       = return ( ["-static"], ["-w"] )
+       -- For now, to suppress the gcc warning "call-clobbered
+       -- register used for global register variable", we simply
+       -- disable all warnings altogether using the -w flag. Oh well.
 
    | prefixMatch "hppa"    cTARGETPLATFORM  
         -- ___HPUX_SOURCE, not _HPUX_SOURCE, is #defined if -ansi!
@@ -499,21 +518,31 @@ machdepCCOpts
                    )
 
    | prefixMatch "mips"    cTARGETPLATFORM
-       = return ( ["static"], [] )
+       = return ( ["-static"], [] )
+
+   | prefixMatch "sparc"    cTARGETPLATFORM
+       = return ( [], ["-w"] )
+       -- For now, to suppress the gcc warning "call-clobbered
+       -- register used for global register variable", we simply
+       -- disable all warnings altogether using the -w flag. Oh well.
 
    | prefixMatch "powerpc" cTARGETPLATFORM || prefixMatch "rs6000" cTARGETPLATFORM
-       = return ( ["static"], ["-finhibit-size-directive"] )
+       = return ( ["-static"], ["-finhibit-size-directive"] )
 
    | otherwise
        = return ( [], [] )
 
 
 
-addOpt_L a = updDynFlags (\s -> s{opt_L =  a : opt_L s})
-addOpt_P a = updDynFlags (\s -> s{opt_P =  a : opt_P s})
-addOpt_c a = updDynFlags (\s -> s{opt_c =  a : opt_c s})
-addOpt_a a = updDynFlags (\s -> s{opt_a =  a : opt_a s})
-addOpt_m a = updDynFlags (\s -> s{opt_m =  a : opt_m s})
+addOpt_L a = updDynFlags (\s -> s{opt_L = a : opt_L s})
+addOpt_P a = updDynFlags (\s -> s{opt_P = a : opt_P s})
+addOpt_c a = updDynFlags (\s -> s{opt_c = a : opt_c s})
+addOpt_a a = updDynFlags (\s -> s{opt_a = a : opt_a s})
+addOpt_m a = updDynFlags (\s -> s{opt_m = a : opt_m s})
+#ifdef ILX
+addOpt_I a = updDynFlags (\s -> s{opt_I = a : opt_I s})
+addOpt_i a = updDynFlags (\s -> s{opt_i = a : opt_i s})
+#endif
 
 addCmdlineHCInclude a = updDynFlags (\s -> s{cmdlineHcIncludes =  a : cmdlineHcIncludes s})
 
@@ -522,8 +551,7 @@ getOpts :: (DynFlags -> [a]) -> IO [a]
 getOpts opts = dynFlag opts >>= return . reverse
 
 -- we can only change HscC to HscAsm and vice-versa with dynamic flags 
--- (-fvia-C and -fasm).
--- NB: we can also set the new lang to ILX, via -filx.  I hope this is right
+-- (-fvia-C and -fasm). We can also set the new lang to ILX, via -filx.
 setLang l = updDynFlags (\ dfs -> case hscLang dfs of
                                        HscC   -> dfs{ hscLang = l }
                                        HscAsm -> dfs{ hscLang = l }