Commit d8e15453 authored by Ian Lynagh's avatar Ian Lynagh
Browse files

Implement --info, and change how can_split is defined

We now get the value of can_split from the SplitObjs setting in the
build system, rather than working out whether it should be possible
based on the platform.
parent 6e4c802a
......@@ -215,6 +215,7 @@ $(CONFIG_HS) : $(FPTOOLS_TOP)/mk/config.mk
@echo "cBooterVersion = \"$(GhcVersion)\"" >> $(CONFIG_HS)
@echo "cStage = STAGE" >> $(CONFIG_HS)
@echo "cHscIfaceFileVersion = \"$(HscIfaceFileVersion)\"" >> $(CONFIG_HS)
@echo "cSplitObjs = \"$(SplitObjs)\"" >> $(CONFIG_HS)
@echo "cGhcWithNativeCodeGen = \"$(GhcWithNativeCodeGen)\"" >> $(CONFIG_HS)
@echo "cGhcUnregisterised = \"$(GhcUnregisterised)\"" >> $(CONFIG_HS)
@echo "cGhcEnableTablesNextToCode = \"$(GhcEnableTablesNextToCode)\"" >> $(CONFIG_HS)
......
......@@ -49,6 +49,7 @@ module DynFlags (
-- misc stuff
machdepCCOpts, picCCOpts,
supportedLanguages,
compilerInfo,
) where
#include "HsVersions.h"
......@@ -1634,18 +1635,21 @@ picCCOpts dflags
-- Splitting
can_split :: Bool
can_split =
#if defined(i386_TARGET_ARCH) \
|| defined(x86_64_TARGET_ARCH) \
|| defined(alpha_TARGET_ARCH) \
|| defined(hppa_TARGET_ARCH) \
|| defined(m68k_TARGET_ARCH) \
|| defined(mips_TARGET_ARCH) \
|| defined(powerpc_TARGET_ARCH) \
|| defined(rs6000_TARGET_ARCH) \
|| defined(sparc_TARGET_ARCH)
True
#else
False
#endif
can_split = cSplitObjs == "YES"
-- -----------------------------------------------------------------------------
-- Compiler Info
compilerInfo :: [(String, String)]
compilerInfo = [("Project name", cProjectName),
("Project version", cProjectVersion),
("Booter version", cBooterVersion),
("Stage", cStage),
("Interface file version", cHscIfaceFileVersion),
("Object splitting", cSplitObjs),
("Have native code generator", cGhcWithNativeCodeGen),
("Unregisterised", cGhcUnregisterised),
("Tables next to code", cGhcEnableTablesNextToCode),
("Win32 DLLs", cEnableWin32DLLs),
("Leading underscore", cLeadingUnderscore)]
......@@ -85,6 +85,8 @@ main =
-- to find out what version of GHC it's using before package.conf
-- exists, so starting the session fails.
case cli_mode of
ShowInfo -> do showInfo
exitWith ExitSuccess
ShowSupportedLanguages -> do showSupportedLanguages
exitWith ExitSuccess
ShowVersion -> do showVersion
......@@ -296,6 +298,7 @@ verifyOutputFiles dflags = do
data CmdLineMode
= ShowUsage -- ghc -?
| PrintLibdir -- ghc --print-libdir
| ShowInfo -- ghc --info
| ShowSupportedLanguages -- ghc --supported-languages
| ShowVersion -- ghc -V/--version
| ShowNumVersion -- ghc --numeric-version
......@@ -360,6 +363,7 @@ mode_flags =
, ( "V" , PassFlag (setMode ShowVersion))
, ( "-version" , PassFlag (setMode ShowVersion))
, ( "-numeric-version", PassFlag (setMode ShowNumVersion))
, ( "-info", PassFlag (setMode ShowInfo))
, ( "-supported-languages", PassFlag (setMode ShowSupportedLanguages))
------- interfaces ----------------------------------------------------
......@@ -449,6 +453,14 @@ showBanner cli_mode dflags = do
hPutStr stderr " booted by GHC version "
hPutStrLn stderr cBooterVersion
-- We print out a Read-friendly string, but a prettier one than the
-- Show instance gives us
showInfo :: IO ()
showInfo = do
let sq x = " [" ++ x ++ "\n ]"
putStrLn $ sq $ concat $ intersperse "\n ," $ map show compilerInfo
exitWith ExitSuccess
showSupportedLanguages :: IO ()
showSupportedLanguages = do mapM_ putStrLn supportedLanguages
exitWith ExitSuccess
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment