[project @ 2000-10-11 16:06:38 by simonmar]
[ghc-hetmet.git] / ghc / driver / Main.hs
index b468e7a..2e235bf 100644 (file)
@@ -1,6 +1,6 @@
 {-# OPTIONS -W -fno-warn-incomplete-patterns #-}
 -----------------------------------------------------------------------------
--- $Id: Main.hs,v 1.62 2000/10/03 16:51:57 sewardj Exp $
+-- $Id: Main.hs,v 1.68 2000/10/11 16:06:38 simonmar Exp $
 --
 -- GHC Driver program
 --
@@ -396,6 +396,7 @@ minusWallOpts         = minusWOpts ++
                    [ "-fwarn-type-defaults"
                    , "-fwarn-name-shadowing"
                    , "-fwarn-missing-signatures"
+                   , "-fwarn-hi-shadowing"
                    ]
 
 data WarningState = W_default | W_ | W_all | W_not
@@ -865,16 +866,14 @@ way_details =
         [ ]),
 
     (WayPar, Way  "mp" "Parallel" 
-       [ "-fstack-check"
-       , "-fparallel"
+       [ "-fparallel"
        , "-D__PARALLEL_HASKELL__"
        , "-optc-DPAR"
        , "-package concurrent"
        , "-fvia-C" ]),
 
     (WayGran, Way  "mg" "Gransim" 
-       [ "-fstack-check"
-       , "-fgransim"
+       [ "-fgransim"
        , "-D__GRANSIM__"
        , "-optc-DGRAN"
        , "-package concurrent"
@@ -1130,8 +1129,10 @@ main =
    argv'  <- setTopDir argv
 
        -- check whether TMPDIR is set in the environment
+#ifndef mingw32_TARGET_OS
    IO.try (do dir <- getEnv "TMPDIR" -- fails if not set
              writeIORef tmpdir dir)
+#endif
 
        -- read the package configuration
    conf_file <- readIORef package_config
@@ -1222,10 +1223,10 @@ getToDo flags
 -- what the suffix of the intermediate files should be, etc.
 
 -- The following compilation pipeline algorithm is fairly hacky.  A
--- better way to do this would be to express the whole comilation as a
+-- better way to do this would be to express the whole compilation as a
 -- data flow DAG, where the nodes are the intermediate files and the
 -- edges are the compilation phases.  This framework would also work
--- nicely if a haskell dependency generator was included in the
+-- nicely if a Haskell dependency generator were included in the
 -- driver.
 
 -- It would also deal much more cleanly with compilation phases that
@@ -1239,7 +1240,7 @@ getToDo flags
 -- the host machine.  For example, when compiling two Haskell files
 -- where one depends on the other, the data flow graph would determine
 -- that the C compiler from the first comilation can be overlapped
--- with the hsc comilation for the second file.
+-- with the hsc compilation for the second file.
 
 data IntermediateFileType
   = Temporary
@@ -1753,13 +1754,6 @@ run_phase Hsc    basename suff input_fn output_fn
   -- build the hsc command line
        hsc_opts <- build_hsc_opts
        
-       doing_hi <- readIORef produceHi
-       tmp_hi_file <- if doing_hi      
-                         then do fn <- newTempName "hi"
-                                 add files_to_clean fn
-                                 return fn
-                         else return ""
-       
   -- deal with -Rghc-timing
        timing <- readIORef collect_ghc_timing
         stat_file <- newTempName "stat"
@@ -1791,11 +1785,11 @@ run_phase Hsc   basename suff input_fn output_fn
   -- date wrt M.hs (or M.o doesn't exist) so we must recompile regardless.
        do_recomp <- readIORef recomp
        todo <- readIORef v_todo
+        o_file <- odir_ify (basename ++ '.':phase_input_ext Ln)
        source_unchanged <- 
           if not (do_recomp && ( todo == DoLink || todo == StopBefore Ln ))
             then return ""
             else do t1 <- getModificationTime (basename ++ '.':suff)
-                    o_file <- odir_ify (basename ++ '.':phase_input_ext Ln)
                     o_file_exists <- doesFileExist o_file
                     if not o_file_exists
                        then return ""  -- Need to recompile
@@ -1821,7 +1815,9 @@ run_phase Hsc     basename suff input_fn output_fn
   -- check whether compilation was performed, bail out if not
        b <- doesFileExist output_fn
        if not b && not (null source_unchanged) -- sanity
-               then return False
+               then do run_something "Touching object file"
+                           ("touch " ++ o_file)
+                       return False
                else do -- carry on...
 
   -- Generate -Rghc-timing info