Commit 96dec149 authored by Andrey Mokhov's avatar Andrey Mokhov
Browse files

Rename Gcc(M) to Cc(M).

See #222, #223.
parent e23dab7c
......@@ -7,7 +7,7 @@
alex = @AlexCmd@
ar = @ArCmd@
gcc = @WhatGccIsCalled@
cc = @WhatGccIsCalled@
happy = @HappyCmd@
hs-cpp = @HaskellCPPCmd@
hscolour = @HSCOLOUR@
......@@ -16,7 +16,7 @@ make = @MakeCmd@
nm = @NmCmd@
objdump = @ObjdumpCmd@
ranlib = @REAL_RANLIB_CMD@
system-gcc = @CC_STAGE0@
system-cc = @CC_STAGE0@
system-ghc = @WithGhc@
system-ghc-pkg = @GhcPkgCmd@
tar = @TarCmd@
......
......@@ -71,8 +71,8 @@ executable ghc-shake
, Settings.Builders.Alex
, Settings.Builders.Ar
, Settings.Builders.Common
, Settings.Builders.Cc
, Settings.Builders.DeriveConstants
, Settings.Builders.Gcc
, Settings.Builders.GenApply
, Settings.Builders.GenPrimopCode
, Settings.Builders.Ghc
......
......@@ -21,14 +21,14 @@ import Stage
-- @GhcPkg Stage0@ is the bootstrapping @GhcPkg@
-- @GhcPkg StageN@, N > 0, is the one built in Stage0 (TODO: need only Stage1?)
-- TODO: Do we really need HsCpp builder? Can't we use a generic Cpp
-- builder instead? It would also be used instead of GccM.
-- TODO: rename Gcc to CCompiler? We sometimes use gcc and sometimes clang.
-- TODO: why are Gcc/GccM staged?
-- builder instead? It would also be used instead of CcM.
-- TODO: why are Cc/CcM staged?
-- TODO: use Cc CcMode, where CcMode = Compile | FindDeps instead of Cc & CcM.
data Builder = Alex
| Ar
| DeriveConstants
| Gcc Stage
| GccM Stage -- synonym for 'Gcc -MM'
| Cc Stage
| CcM Stage -- synonym for 'Cc -MM'
| GenApply
| GenPrimopCode
| Ghc Stage
......@@ -79,12 +79,12 @@ isInternal = isJust . builderProvenance
isStaged :: Builder -> Bool
isStaged = \case
(Gcc _) -> True
(GccM _) -> True
(Ghc _) -> True
(GhcM _) -> True
(GhcPkg _) -> True
_ -> False
(Cc _) -> True
(CcM _) -> True
(Ghc _) -> True
(GhcM _) -> True
(GhcPkg _) -> True
_ -> False
-- TODO: Some builders are required only on certain platforms. For example,
-- Objdump is only required on OpenBSD and AIX, as mentioned in #211. Add
......@@ -103,26 +103,26 @@ builderPath builder = case builderProvenance builder of
Just context -> return . fromJust $ programPath context
Nothing -> do
let builderKey = case builder of
Alex -> "alex"
Ar -> "ar"
Gcc Stage0 -> "system-gcc"
Gcc _ -> "gcc"
GccM Stage0 -> "system-gcc"
GccM _ -> "gcc"
Ghc Stage0 -> "system-ghc"
GhcM Stage0 -> "system-ghc"
GhcPkg Stage0 -> "system-ghc-pkg"
Happy -> "happy"
HsColour -> "hscolour"
HsCpp -> "hs-cpp"
Ld -> "ld"
Make -> "make"
Nm -> "nm"
Objdump -> "objdump"
Patch -> "patch"
Perl -> "perl"
Ranlib -> "ranlib"
Tar -> "tar"
Alex -> "alex"
Ar -> "ar"
Cc Stage0 -> "system-cc"
Cc _ -> "cc"
CcM Stage0 -> "system-cc"
CcM _ -> "cc"
Ghc Stage0 -> "system-ghc"
GhcM Stage0 -> "system-ghc"
GhcPkg Stage0 -> "system-ghc-pkg"
Happy -> "happy"
HsColour -> "hscolour"
HsCpp -> "hs-cpp"
Ld -> "ld"
Make -> "make"
Nm -> "nm"
Objdump -> "objdump"
Patch -> "patch"
Perl -> "perl"
Ranlib -> "ranlib"
Tar -> "tar"
_ -> error $ "Cannot determine builderKey for " ++ show builder
path <- askConfigWithDefault builderKey . putError $
"\nCannot find path to '" ++ builderKey
......
-- | Convenient predicates
module Predicates (
stage, package, builder, stagedBuilder, builderGcc, builderGhc, file, way,
stage, package, builder, stagedBuilder, builderCc, builderGhc, file, way,
stage0, stage1, stage2, notStage0, notPackage
) where
......@@ -24,8 +24,8 @@ stagedBuilder :: (Stage -> Builder) -> Predicate
stagedBuilder stageBuilder = builder . stageBuilder =<< getStage
-- | Are we building with GCC?
builderGcc :: Predicate
builderGcc = stagedBuilder Gcc ||^ stagedBuilder GccM
builderCc :: Predicate
builderCc = stagedBuilder Cc ||^ stagedBuilder CcM
-- | Are we building with GHC?
builderGhc :: Predicate
......
......@@ -34,7 +34,7 @@ compilePackage rs context@Context {..} = do
if ("//*.c" ?== src)
then do
need $ src : deps
build $ Target context (Gcc stage) [src] [obj]
build $ Target context (Cc stage) [src] [obj]
else do
if compileInterfaceFilesSeparately && "//*.hs" ?== src
then need $ (obj -<.> hisuf way) : src : deps
......
......@@ -20,7 +20,7 @@ buildPackageDependencies rs context@Context {..} =
[ "//*.c.deps", "//*.cmm.deps", "//*.S.deps" ] |%> \out -> do
let src = dep2src context out
need [src]
build $ Target context (GccM stage) [src] [out]
build $ Target context (CcM stage) [src] [out]
hDepFile %> \out -> do
srcs <- haskellSources context
......
......@@ -37,7 +37,7 @@ gmpPatches = (gmpBase -/-) <$> ["gmpsrc.patch", "tarball/gmp-5.0.4.patch"]
-- TODO: See Libffi.hs about removing code duplication.
configureEnvironment :: Action [CmdOption]
configureEnvironment = do
sequence [ builderEnv "CC" $ Gcc Stage1
sequence [ builderEnv "CC" $ Cc Stage1
, builderEnv "AR" Ar
, builderEnv "NM" Nm ]
where
......
......@@ -43,8 +43,8 @@ configureEnvironment = do
[ cArgs
, argStagedSettingList ConfCcArgs ]
ldFlags <- interpretInContext libffiContext $ fromDiffExpr ldArgs
sequence [ builderEnv "CC" $ Gcc Stage0
, builderEnv "CXX" $ Gcc Stage0
sequence [ builderEnv "CC" $ Cc Stage0
, builderEnv "CXX" $ Cc Stage0
, builderEnv "LD" Ld
, builderEnv "AR" Ar
, builderEnv "NM" Nm
......
......@@ -5,7 +5,7 @@ import Expression
import Settings.Builders.Alex
import Settings.Builders.Ar
import Settings.Builders.DeriveConstants
import Settings.Builders.Gcc
import Settings.Builders.Cc
import Settings.Builders.GenApply
import Settings.Builders.GenPrimopCode
import Settings.Builders.Ghc
......@@ -50,9 +50,9 @@ defaultBuilderArgs :: Args
defaultBuilderArgs = mconcat
[ alexBuilderArgs
, arBuilderArgs
, ccBuilderArgs
, ccMBuilderArgs
, deriveConstantsBuilderArgs
, gccBuilderArgs
, gccMBuilderArgs
, genApplyBuilderArgs
, genPrimopCodeBuilderArgs
, ghcBuilderArgs
......
module Settings.Builders.Gcc (gccBuilderArgs, gccMBuilderArgs) where
module Settings.Builders.Cc (ccBuilderArgs, ccMBuilderArgs) where
import Development.Shake.FilePath
import Expression
......@@ -8,19 +8,19 @@ import Predicates (stagedBuilder)
import Settings
import Settings.Builders.Common (cIncludeArgs)
gccBuilderArgs :: Args
gccBuilderArgs = stagedBuilder Gcc ?
mconcat [ commonGccArgs
ccBuilderArgs :: Args
ccBuilderArgs = stagedBuilder Cc ?
mconcat [ commonCcArgs
, arg "-c", arg =<< getInput
, arg "-o", arg =<< getOutput ]
-- TODO: handle custom $1_$2_MKDEPENDC_OPTS and
gccMBuilderArgs :: Args
gccMBuilderArgs = stagedBuilder GccM ? do
ccMBuilderArgs :: Args
ccMBuilderArgs = stagedBuilder CcM ? do
output <- getOutput
mconcat [ arg "-E"
, arg "-MM"
, commonGccArgs
, commonCcArgs
, arg "-MF"
, arg output
, arg "-MT"
......@@ -29,7 +29,7 @@ gccMBuilderArgs = stagedBuilder GccM ? do
, arg "c"
, arg =<< getInput ]
commonGccArgs :: Args
commonGccArgs = mconcat [ append =<< getPkgDataList CcArgs
, append =<< getSettingList . ConfCcArgs =<< getStage
, cIncludeArgs ]
commonCcArgs :: Args
commonCcArgs = mconcat [ append =<< getPkgDataList CcArgs
, append =<< getSettingList . ConfCcArgs =<< getStage
, cIncludeArgs ]
......@@ -20,7 +20,7 @@ deriveConstantsBuilderArgs = builder DeriveConstants ? do
, file "//GHCConstantsHaskellExports.hs" ? arg "--gen-haskell-exports"
, arg "-o", arg output
, arg "--tmpdir", arg tempDir
, arg "--gcc-program", arg =<< getBuilderPath (Gcc Stage1)
, arg "--gcc-program", arg =<< getBuilderPath (Cc Stage1)
, append . concat $ map (\a -> ["--gcc-flag", a]) cFlags
, arg "--nm-program", arg =<< getBuilderPath Nm
, specified Objdump ? mconcat [ arg "--objdump-program"
......
......@@ -32,7 +32,7 @@ ghcCabalBuilderArgs = builder GhcCabal ? do
, with HsColour
, configureArgs
, packageConstraints
, withStaged Gcc
, withStaged Cc
, notStage0 ? with Ld
, with Ar
, with Alex
......@@ -85,7 +85,7 @@ configureArgs = do
, conf "--with-gmp-includes" $ argSetting GmpIncludeDir
, conf "--with-gmp-libraries" $ argSetting GmpLibDir
, crossCompiling ? (conf "--host" $ argSetting TargetPlatformFull)
, conf "--with-cc" $ argStagedBuilderPath Gcc ]
, conf "--with-cc" $ argStagedBuilderPath Cc ]
newtype PackageDbKey = PackageDbKey Stage
deriving (Show, Typeable, Eq, Hashable, Binary, NFData)
......@@ -114,7 +114,7 @@ withBuilderKey :: Builder -> String
withBuilderKey b = case b of
Ar -> "--with-ar="
Ld -> "--with-ld="
Gcc _ -> "--with-gcc="
Cc _ -> "--with-gcc="
Ghc _ -> "--with-ghc="
Alex -> "--with-alex="
Happy -> "--with-happy="
......@@ -122,7 +122,7 @@ withBuilderKey b = case b of
HsColour -> "--with-hscolour="
_ -> error "withBuilderKey: not supported builder"
-- Expression 'with Gcc' appends "--with-gcc=/path/to/gcc" and needs Gcc.
-- Expression 'with Alex' appends "--with-alex=/path/to/alex" and needs Alex.
with :: Builder -> Args
with b = specified b ? do
top <- getTopDirectory
......
......@@ -18,7 +18,7 @@ templateHsc = "inplace/lib/template-hsc.h"
hsc2hsBuilderArgs :: Args
hsc2hsBuilderArgs = builder Hsc2Hs ? do
stage <- getStage
ccPath <- lift . builderPath $ Gcc stage
ccPath <- getBuilderPath $ Cc stage
gmpDir <- getSetting GmpIncludeDir
cFlags <- getCFlags
lFlags <- getLFlags
......
......@@ -10,4 +10,4 @@ import Predicates (stagedBuilder, package)
-- only file which requires special treatment when using GCC.
directoryPackageArgs :: Args
directoryPackageArgs = package directory ?
stagedBuilder Gcc ? arg "-D__GLASGOW_HASKELL__"
stagedBuilder Cc ? arg "-D__GLASGOW_HASKELL__"
......@@ -3,7 +3,7 @@ module Settings.Packages.IntegerGmp (integerGmpPackageArgs, gmpBuildPath) where
import Base
import Expression
import GHC (integerGmp)
import Predicates (builder, builderGcc, package)
import Predicates (builder, builderCc, package)
import Settings.Paths
import Oracles.Config.Setting
......@@ -24,4 +24,4 @@ integerGmpPackageArgs = package integerGmp ? do
, appendSub "--configure-option=CFLAGS" [includeGmp]
, appendSub "--gcc-options" [includeGmp] ]
, builderGcc ? arg includeGmp ]
, builderCc ? arg includeGmp ]
......@@ -7,7 +7,7 @@ import Expression
import GHC (rts, rtsContext)
import Oracles.Config.Flag
import Oracles.Config.Setting
import Predicates (builder, builderGcc, builderGhc, package, file)
import Predicates (builder, builderCc, builderGhc, package, file)
import Settings
import Settings.Builders.Common
......@@ -52,7 +52,7 @@ rtsPackageArgs = package rts ? do
ffiIncludeDir <- getSetting FfiIncludeDir
ffiLibraryDir <- getSetting FfiLibDir
mconcat
[ builderGcc ? mconcat
[ builderCc ? mconcat
[ arg "-Irts"
, arg $ "-I" ++ path
, arg $ "-DRtsWay=\"rts_" ++ show way ++ "\""
......
Markdown is supported
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