[project @ 2001-05-09 09:38:18 by simonmar]
authorsimonmar <unknown>
Wed, 9 May 2001 09:38:18 +0000 (09:38 +0000)
committersimonmar <unknown>
Wed, 9 May 2001 09:38:18 +0000 (09:38 +0000)
Add a new option: -hcsuf <suffix> which renames the .hc suffix to
<suffix> for this compilation, in the same way as -osuf and -hisuf.

To even things up, remove partial support for '-ohi -', which
allegedly dumped the .hi file to stdout but in reality never worked.
It's a strange thing to want to do anyway, but in any case you could
always say '-ohi /dev/stdout', or even 'ghc Foo.hs && cat Foo.hi'.

ghc/compiler/main/DriverFlags.hs
ghc/compiler/main/DriverPipeline.hs
ghc/compiler/main/DriverState.hs

index ce02488..a22668e 100644 (file)
@@ -1,7 +1,7 @@
 {-# OPTIONS -#include "hschooks.h" #-}
 
 -----------------------------------------------------------------------------
--- $Id: DriverFlags.hs,v 1.52 2001/03/29 18:40:09 rrt Exp $
+-- $Id: DriverFlags.hs,v 1.53 2001/05/09 09:38:18 simonmar Exp $
 --
 -- Driver flags
 --
@@ -206,11 +206,10 @@ static_flags =
   ,  ( "odir"          , HasArg (writeIORef v_Output_dir  . Just) )
   ,  ( "o"             , SepArg (writeIORef v_Output_file . Just) )
   ,  ( "osuf"          , HasArg (writeIORef v_Object_suf  . Just) )
+  ,  ( "hcsuf"         , HasArg (writeIORef v_HC_suf      . Just) )
   ,  ( "hisuf"         , HasArg (writeIORef v_Hi_suf) )
   ,  ( "tmpdir"                , HasArg (writeIORef v_TmpDir . (++ "/")) )
-  ,  ( "ohi"           , HasArg (\s -> case s of 
-                                         "-" -> writeIORef v_Hi_on_stdout True
-                                         _   -> writeIORef v_Output_hi (Just s)) )
+  ,  ( "ohi"           , HasArg (writeIORef v_Output_hi   . Just) )
        -- -odump?
 
   ,  ( "keep-hc-file"   , AnySuffix (\_ -> writeIORef v_Keep_hc_files True) )
index 2668c64..6e32929 100644 (file)
@@ -1,5 +1,5 @@
 -----------------------------------------------------------------------------
--- $Id: DriverPipeline.hs,v 1.67 2001/05/08 11:07:30 simonmar Exp $
+-- $Id: DriverPipeline.hs,v 1.68 2001/05/09 09:38:18 simonmar Exp $
 --
 -- GHC Driver
 --
@@ -152,6 +152,7 @@ genPipeline todo stop_flag persistent_output lang filename
    writeIORef v_Object_suf (Just "ilx")
 #endif
    osuf       <- readIORef v_Object_suf
+   hcsuf      <- readIORef v_HC_suf
 
    let
    ----------- -----  ----   ---   --   --  -  -  -
@@ -209,10 +210,10 @@ genPipeline todo stop_flag persistent_output lang filename
        else do
 
    let
-   ----------- -----  ----   ---   --   --  -  -  -
-      myPhaseInputExt Ln = case osuf of Nothing -> phaseInputExt Ln
-                                       Just s  -> s
-      myPhaseInputExt other = phaseInputExt other
+       -- .o and .hc suffixes can be overriden by command-line options:
+      myPhaseInputExt Ln  | Just s <- osuf  = s
+      myPhaseInputExt HCc | Just s <- hcsuf = s
+      myPhaseInputExt other                 = phaseInputExt other
 
       annotatePipeline
         :: [Phase]             -- raw pipeline
index 522330e..8591f8a 100644 (file)
@@ -1,5 +1,5 @@
 -----------------------------------------------------------------------------
--- $Id: DriverState.hs,v 1.37 2001/03/28 11:01:19 simonmar Exp $
+-- $Id: DriverState.hs,v 1.38 2001/05/09 09:38:18 simonmar Exp $
 --
 -- Settings for the driver
 --
@@ -92,10 +92,13 @@ defaultHscLang
   | otherwise                                  =  HscC
 
 GLOBAL_VAR(v_Output_dir,  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)
 
+GLOBAL_VAR(v_Object_suf,  Nothing, Maybe String)
+GLOBAL_VAR(v_HC_suf,     Nothing, Maybe String)
+GLOBAL_VAR(v_Hi_suf,      "hi",           String)
+
 GLOBAL_VAR(v_Ld_inputs,        [],      [String])
 
 odir_ify :: String -> IO String
@@ -113,12 +116,6 @@ osuf_ify f = do
        Just s  -> return (newsuf s f)
 
 -----------------------------------------------------------------------------
--- Hi Files
-
-GLOBAL_VAR(v_Hi_on_stdout,     False,  Bool)
-GLOBAL_VAR(v_Hi_suf,           "hi",   String)
-
------------------------------------------------------------------------------
 -- Compiler optimisation options
 
 GLOBAL_VAR(v_OptLevel, 0, Int)