[commit: ghc] wip/nfs-locking: Add new builder HsCpp. (45d41a5)
git at git.haskell.org
git at git.haskell.org
Thu Oct 26 23:22:06 UTC 2017
Repository : ssh://git@git.haskell.org/ghc
On branch : wip/nfs-locking
Link : http://ghc.haskell.org/trac/ghc/changeset/45d41a568b324f37d992fdcd616726959d4c439d/ghc
>---------------------------------------------------------------
commit 45d41a568b324f37d992fdcd616726959d4c439d
Author: Andrey Mokhov <andrey.mokhov at gmail.com>
Date: Thu Sep 24 12:44:38 2015 +0100
Add new builder HsCpp.
>---------------------------------------------------------------
45d41a568b324f37d992fdcd616726959d4c439d
cfg/system.config.in | 2 ++
src/Builder.hs | 2 ++
src/Rules/Actions.hs | 5 +++++
src/Settings/Args.hs | 2 ++
src/Settings/Builders/GhcCabal.hs | 2 +-
src/Settings/Builders/HsCpp.hs | 17 +++++++++++++++++
src/Settings/Builders/Hsc2Hs.hs | 2 +-
7 files changed, 30 insertions(+), 2 deletions(-)
diff --git a/cfg/system.config.in b/cfg/system.config.in
index 87d2b93..e85788b 100644
--- a/cfg/system.config.in
+++ b/cfg/system.config.in
@@ -23,6 +23,8 @@ hsc2hs = @hardtop@/inplace/bin/hsc2hs
genprimopcode = @hardtop@/inplace/bin/genprimopcode
+hs-cpp = @HaskellCPPCmd@ @HaskellCPPArgs@
+
unlit = @hardtop@/inplace/lib/unlit
ghc-split = @hardtop@/inplace/lib/ghc-split
diff --git a/src/Builder.hs b/src/Builder.hs
index a6521a1..e1c69be 100644
--- a/src/Builder.hs
+++ b/src/Builder.hs
@@ -30,6 +30,7 @@ data Builder = Alex
| Haddock
| Happy
| HsColour
+ | HsCpp
| Hsc2Hs
| Ld
| Unlit
@@ -58,6 +59,7 @@ builderKey builder = case builder of
Haddock -> "haddock"
HsColour -> "hscolour"
Hsc2Hs -> "hsc2hs"
+ HsCpp -> "hs-cpp"
Ld -> "ld"
Unlit -> "unlit"
diff --git a/src/Rules/Actions.hs b/src/Rules/Actions.hs
index 1e0472a..8214112 100644
--- a/src/Rules/Actions.hs
+++ b/src/Rules/Actions.hs
@@ -32,6 +32,11 @@ buildWithResources rs target = do
forM_ (chunksOfSize maxChunk remainingArgs) $ \argsChunk ->
unit . cmd [path] $ persistentArgs ++ argsChunk
+ HsCpp -> do
+ let file = head $ Target.files target -- TODO: ugly
+ Stdout output <- cmd [path] argList
+ writeFileChanged file output
+
GenPrimopCode -> do
let src = head $ Target.sources target -- TODO: ugly
file = head $ Target.files target
diff --git a/src/Settings/Args.hs b/src/Settings/Args.hs
index 349668a..231f5ed 100644
--- a/src/Settings/Args.hs
+++ b/src/Settings/Args.hs
@@ -11,6 +11,7 @@ import Settings.Builders.GhcPkg
import Settings.Builders.Haddock
import Settings.Builders.Happy
import Settings.Builders.Hsc2Hs
+import Settings.Builders.HsCpp
import Settings.Builders.Ld
import Settings.User
@@ -41,4 +42,5 @@ defaultArgs = mconcat
, haddockArgs
, happyArgs
, hsc2HsArgs
+ , hsCppArgs
, ldArgs ]
diff --git a/src/Settings/Builders/GhcCabal.hs b/src/Settings/Builders/GhcCabal.hs
index 54452d8..b68da27 100644
--- a/src/Settings/Builders/GhcCabal.hs
+++ b/src/Settings/Builders/GhcCabal.hs
@@ -1,6 +1,6 @@
module Settings.Builders.GhcCabal (
cabalArgs, ghcCabalHsColourArgs, bootPackageDbArgs, customPackageArgs,
- ccArgs, ccWarnings, argStagedSettingList
+ ccArgs, cppArgs, ccWarnings, argStagedSettingList
) where
import Expression
diff --git a/src/Settings/Builders/HsCpp.hs b/src/Settings/Builders/HsCpp.hs
new file mode 100644
index 0000000..da104cc
--- /dev/null
+++ b/src/Settings/Builders/HsCpp.hs
@@ -0,0 +1,17 @@
+module Settings.Builders.HsCpp (hsCppArgs) where
+
+import Expression
+import Predicates (builder)
+import Settings.Builders.GhcCabal
+
+-- TODO: why process the result with grep -v '^#pragma GCC'? No such lines!
+hsCppArgs :: Args
+hsCppArgs = builder HsCpp ? do
+ stage <- getStage
+ src <- getSource
+ mconcat [ arg "-P"
+ , cppArgs
+ , arg $ "-Icompiler/stage" ++ show stage
+ , arg "-x"
+ , arg "c"
+ , arg src ]
diff --git a/src/Settings/Builders/Hsc2Hs.hs b/src/Settings/Builders/Hsc2Hs.hs
index 7dfe286..dcf44fc 100644
--- a/src/Settings/Builders/Hsc2Hs.hs
+++ b/src/Settings/Builders/Hsc2Hs.hs
@@ -4,7 +4,7 @@ import Expression
import Oracles
import Predicates (builder, stage0, notStage0)
import Settings
-import Settings.Builders.GhcCabal
+import Settings.Builders.GhcCabal hiding (cppArgs)
hsc2HsArgs :: Args
hsc2HsArgs = builder Hsc2Hs ? do
More information about the ghc-commits
mailing list