@echo "cProjectVersionInt = \"$(ProjectVersionInt)\"" >> $(CONFIG_HS)
@echo "cProjectPatchLevel = \"$(ProjectPatchLevel)\"" >> $(CONFIG_HS)
@echo "cBooterVersion = \"$(GhcVersion)\"" >> $(CONFIG_HS)
+ @echo "cStage = STAGE" >> $(CONFIG_HS)
@echo "cHscIfaceFileVersion = \"$(HscIfaceFileVersion)\"" >> $(CONFIG_HS)
@echo "cGhcWithNativeCodeGen = \"$(GhcWithNativeCodeGen)\"" >> $(CONFIG_HS)
@echo "cGhcUnregisterised = \"$(GhcUnregisterised)\"" >> $(CONFIG_HS)
include $(TOP)/mk/target.mk
+$(odir)/main/Config.$(way_)o: SRC_HC_OPTS+=-DSTAGE='"$(stage)"'
+
# -----------------------------------------------------------------------------
# Explicit dependencies
-- (c) The GHC Team 2005-2006
--
-----------------------------------------------------------------------------
-module InteractiveUI (
- interactiveUI,
- ghciWelcomeMsg,
- ghciShortWelcomeMsg
- ) where
+module InteractiveUI ( interactiveUI ) where
#include "HsVersions.h"
newStablePtr stdout
newStablePtr stderr
- -- Initialise buffering for the *interpreted* I/O system
+ -- Initialise buffering for the *interpreted* I/O system
initInterpBuffering session
when (isNothing maybe_expr) $ do
- -- Only for GHCi (not runghc and ghc -e):
- -- Turn buffering off for the compiled program's stdout/stderr
- turnOffBuffering
- -- Turn buffering off for GHCi's stdout
- hFlush stdout
- hSetBuffering stdout NoBuffering
- -- We don't want the cmd line to buffer any input that might be
- -- intended for the program, so unbuffer stdin.
- hSetBuffering stdin NoBuffering
-
- -- initial context is just the Prelude
+ -- Only for GHCi (not runghc and ghc -e):
+
+ -- Turn buffering off for the compiled program's stdout/stderr
+ turnOffBuffering
+ -- Turn buffering off for GHCi's stdout
+ hFlush stdout
+ hSetBuffering stdout NoBuffering
+ -- We don't want the cmd line to buffer any input that might be
+ -- intended for the program, so unbuffer stdin.
+ hSetBuffering stdin NoBuffering
+
+ -- initial context is just the Prelude
prel_mod <- GHC.findModule session prel_name (Just basePackageId)
GHC.setContext session [] [prel_mod]
let show_prompt = verbosity dflags > 0 || is_tty
case maybe_expr of
- Nothing ->
+ Nothing ->
do
#if defined(mingw32_HOST_OS)
- -- The win32 Console API mutates the first character of
+ -- The win32 Console API mutates the first character of
-- type-ahead when reading from it in a non-buffered manner. Work
-- around this by flushing the input buffer of type-ahead characters,
-- but only if stdin is available.
flushed <- io (IO.try (GHC.ConsoleHandler.flushConsole stdin))
- case flushed of
- Left err | isDoesNotExistError err -> return ()
- | otherwise -> io (ioError err)
- Right () -> return ()
+ case flushed of
+ Left err | isDoesNotExistError err -> return ()
+ | otherwise -> io (ioError err)
+ Right () -> return ()
#endif
- -- initialise the console if necessary
- io setUpConsole
-
- -- enter the interactive loop
- interactiveLoop is_tty show_prompt
- Just expr -> do
- -- just evaluate the expression we were given
- runCommandEval expr
- return ()
+ -- initialise the console if necessary
+ io setUpConsole
+
+ let msg = if dopt Opt_ShortGhciBanner dflags
+ then ghciShortWelcomeMsg
+ else ghciWelcomeMsg
+ when (verbosity dflags >= 1) $ io $ putStrLn msg
+
+ -- enter the interactive loop
+ interactiveLoop is_tty show_prompt
+ Just expr -> do
+ -- just evaluate the expression we were given
+ runCommandEval expr
+ return ()
-- and finally, exit
io $ do when (verbosity dflags > 0) $ putStrLn "Leaving GHCi."
| Opt_RewriteRules
-- misc opts
+ | Opt_ShortGhciBanner
| Opt_Cpp
| Opt_Pp
| Opt_ForceRecomp
, ( "F" , NoArg (setDynFlag Opt_Pp))
, ( "#include" , HasArg (addCmdlineHCInclude) )
, ( "v" , OptIntSuffix setVerbosity )
+ , ( "short-ghci-banner", NoArg (setDynFlag Opt_ShortGhciBanner) )
+ , ( "long-ghci-banner" , NoArg (unSetDynFlag Opt_ShortGhciBanner) )
------- Specific phases --------------------------------------------
, ( "pgmL" , HasArg (upd . setPgmL) )
import DriverPipeline ( oneShot, compileFile )
import DriverMkDepend ( doMkDependHS )
#ifdef GHCI
-import InteractiveUI ( ghciWelcomeMsg, ghciShortWelcomeMsg, interactiveUI )
+import InteractiveUI ( interactiveUI )
#endif
-- Various other random stuff that we need
-import Config ( cProjectVersion, cBooterVersion, cProjectName )
+import Config
import Packages ( dumpPackages )
import DriverPhases ( Phase(..), isSourceFilename, anyHsc,
startPhase, isHaskellSrcFilename )
-- make sure we clean up after ourselves
GHC.defaultCleanupHandler dflags $ do
- -- Display banner
showBanner cli_mode dflags
-- we've finished manipulating the DynFlags, update the session
showBanner :: CmdLineMode -> DynFlags -> IO ()
showBanner cli_mode dflags = do
let verb = verbosity dflags
- -- Show the GHCi banner
-# ifdef GHCI
- let msg = if opt_ShortGhciBanner
- then ghciShortWelcomeMsg
- else ghciWelcomeMsg
- when (isInteractiveMode cli_mode && verb >= 1) $ hPutStrLn stdout msg
-# endif
-
- -- Display details of the configuration in verbose mode
- when (not (isInteractiveMode cli_mode) && verb >= 2) $
- do hPutStr stderr "Glasgow Haskell Compiler, Version "
- hPutStr stderr cProjectVersion
- hPutStr stderr ", for Haskell 98, compiled by GHC version "
-#ifdef GHCI
- -- GHCI is only set when we are bootstrapping...
- hPutStrLn stderr cProjectVersion
-#else
- hPutStrLn stderr cBooterVersion
-#endif
+
+ -- Display details of the configuration in verbose mode
+ when (verb >= 2) $
+ do hPutStr stderr "Glasgow Haskell Compiler, Version "
+ hPutStr stderr cProjectVersion
+ hPutStr stderr ", for Haskell 98, stage "
+ hPutStr stderr cStage
+ hPutStr stderr " booted by GHC version "
+ hPutStrLn stderr cBooterVersion
showVersion :: IO ()
showVersion = do
-- misc opts
opt_IgnoreDotGhci,
- opt_ShortGhciBanner,
opt_ErrorSpans,
opt_GranMacros,
opt_HiVersion,
------- GHCi -------------------------------------------------------
( "ignore-dot-ghci", PassFlag addOpt )
, ( "read-dot-ghci" , NoArg (removeOpt "-ignore-dot-ghci") )
- , ( "short-ghci-banner", PassFlag addOpt )
- , ( "long-ghci-banner" , NoArg (removeOpt "-short-ghci-banner") )
------- ways --------------------------------------------------------
, ( "prof" , NoArg (addWay WayProf) )
opt_IgnoreDotGhci = lookUp FSLIT("-ignore-dot-ghci")
-opt_ShortGhciBanner = lookUp FSLIT("-short-ghci-banner")
-- debugging opts
opt_PprStyle_Debug = lookUp FSLIT("-dppr-debug")
<row>
<entry><option>-short-ghci-banner</option></entry>
<entry>Display a one-line banner at GHCi startup</entry>
- <entry>static</entry>
+ <entry>dynamic</entry>
<entry>-</entry>
</row>
<row>
<entry><option>-long-ghci-banner</option></entry>
<entry>Display a full banner at GHCi startup</entry>
- <entry>static</entry>
+ <entry>dynamic</entry>
<entry>-</entry>
</row>
<row>