[project @ 2002-12-17 13:50:28 by simonmar]
authorsimonmar <unknown>
Tue, 17 Dec 2002 13:50:29 +0000 (13:50 +0000)
committersimonmar <unknown>
Tue, 17 Dec 2002 13:50:29 +0000 (13:50 +0000)
- add -no-link flag (omits link step, except in GHCi)
- tidy up some informmational messages

ghc/compiler/compMan/CompManager.lhs
ghc/compiler/main/DriverFlags.hs
ghc/compiler/main/DriverPipeline.hs
ghc/compiler/main/DriverState.hs
ghc/compiler/main/Main.hs

index 6dc4c6e..517b824 100644 (file)
@@ -490,7 +490,7 @@ cmDepAnal cmstate dflags rootnames
   = do showPass dflags "Chasing dependencies"
        when (verbosity dflags >= 1 && gmode cmstate == Batch) $
            hPutStrLn stderr (showSDoc (hcat [
-            text progName, text ": chasing modules from: ",
+            text "Chasing modules from: ",
             hcat (punctuate comma (map text rootnames))]))
        downsweep rootnames (mg cmstate)
 
index 9813c82..328dac3 100644 (file)
@@ -1,5 +1,5 @@
 -----------------------------------------------------------------------------
--- $Id: DriverFlags.hs,v 1.107 2002/12/12 17:36:18 simonmar Exp $
+-- $Id: DriverFlags.hs,v 1.108 2002/12/17 13:50:29 simonmar Exp $
 --
 -- Driver flags
 --
@@ -294,6 +294,7 @@ static_flags =
   ,  ( "optdll"                , HasArg (add v_Opt_dll) )
 
        ----- Linker --------------------------------------------------------
+  ,  ( "no-link"       , NoArg (writeIORef v_NoLink True) )
   ,  ( "static"        , NoArg (writeIORef v_Static True) )
   ,  ( "dynamic"        , NoArg (writeIORef v_Static False) )
   ,  ( "rdynamic"       , NoArg (return ()) ) -- ignored for compat w/ gcc
index a129357..0721c72 100644 (file)
@@ -301,8 +301,17 @@ link' Interactive dflags batch_attempt_linking linkables
 
 link' Batch dflags batch_attempt_linking linkables
    | batch_attempt_linking
-   = do when (verb >= 1) $
-             hPutStrLn stderr "ghc: linking ..."
+   = do 
+       -- check for the -no-link flag
+       omit_linking <- readIORef v_NoLink
+       if omit_linking 
+         then do when (verb >= 3) $
+                   hPutStrLn stderr "link(batch): linking omitted (-no-link flag given)."
+                 return Succeeded
+         else do
+
+       when (verb >= 1) $
+             hPutStrLn stderr "Linking ..."
 
        -- Don't showPass in Batch mode; doLink will do that for us.
         staticLink (concatMap getOfiles linkables)
index 5014174..fe5ff52 100644 (file)
@@ -1,5 +1,5 @@
 -----------------------------------------------------------------------------
--- $Id: DriverState.hs,v 1.86 2002/12/12 17:36:19 simonmar Exp $
+-- $Id: DriverState.hs,v 1.87 2002/12/17 13:50:29 simonmar Exp $
 --
 -- Settings for the driver
 --
@@ -96,6 +96,7 @@ GLOBAL_VAR(v_Keep_ilx_files,          False,          Bool)
 -- Misc
 GLOBAL_VAR(v_Scale_sizes_by,           1.0,            Double)
 GLOBAL_VAR(v_Static,                   True,           Bool)
+GLOBAL_VAR(v_NoLink,                   False,          Bool)
 GLOBAL_VAR(v_NoHsMain,                         False,          Bool)
 GLOBAL_VAR(v_Recomp,                   True,           Bool)
 GLOBAL_VAR(v_Collect_ghc_timing,       False,          Bool)
index 298107c..1fcaf02 100644 (file)
@@ -1,7 +1,7 @@
 {-# OPTIONS -fno-warn-incomplete-patterns -optc-DNON_POSIX_SOURCE #-}
 
 -----------------------------------------------------------------------------
--- $Id: Main.hs,v 1.114 2002/10/25 16:54:59 simonpj Exp $
+-- $Id: Main.hs,v 1.115 2002/12/17 13:50:29 simonmar Exp $
 --
 -- GHC Driver program
 --
@@ -37,7 +37,7 @@ import DriverState    ( buildCoreToDo, buildStgToDo,
                          v_GhcMode, v_GhcModeFlag, GhcMode(..),
                          v_Keep_tmp_files, v_Ld_inputs, v_Ways, 
                          v_OptLevel, v_Output_file, v_Output_hi, 
-                         readPackageConf, verifyOutputFiles
+                         readPackageConf, verifyOutputFiles, v_NoLink
                        )
 import DriverFlags     ( buildStaticHscOpts,
                          dynamic_flags, processArgs, static_flags)
@@ -304,8 +304,10 @@ main =
 
    o_files <- mapM compileFile srcs
 
+   omit_linking <- readIORef v_NoLink
+
    when (mode == DoMkDependHS) endMkDependHS
-   when (mode == DoLink) (staticLink o_files)
+   when (mode == DoLink && not omit_linking) (staticLink o_files)
    when (mode == DoMkDLL) (doMkDLL o_files)