Commit 4b70d6e8 authored by Andrey Mokhov's avatar Andrey Mokhov
Browse files

Add GenApply builder, #22.

parent 77655b7c
......@@ -22,6 +22,7 @@ haddock = inplace/bin/haddock
hsc2hs = inplace/bin/hsc2hs
genprimopcode = inplace/bin/genprimopcode
genapply = inplace/bin/genapply
derive-constants = inplace/bin/deriveConstants
hs-cpp = @HaskellCPPCmd@
......
......@@ -38,6 +38,7 @@ executable ghc-shake
, Rules.Cabal
, Rules.Compile
, Rules.Config
, Rules.Copy
, Rules.Data
, Rules.Dependencies
, Rules.Documentation
......@@ -48,7 +49,6 @@ executable ghc-shake
, Rules.Generators.GhcPlatformH
, Rules.Generators.GhcVersionH
, Rules.Generators.VersionHs
, Rules.Install
, Rules.Library
, Rules.Oracles
, Rules.Package
......@@ -63,6 +63,7 @@ executable ghc-shake
, Settings.Builders.Common
, Settings.Builders.DeriveConstants
, Settings.Builders.Gcc
, Settings.Builders.GenApply
, Settings.Builders.GenPrimopCode
, Settings.Builders.Ghc
, Settings.Builders.GhcCabal
......@@ -82,6 +83,7 @@ executable ghc-shake
, Settings.Packages.Haddock
, Settings.Packages.Hp2ps
, Settings.Packages.IntegerGmp
, Settings.Packages.Rts
, Settings.Packages.RunGhc
, Settings.TargetDirectory
, Settings.User
......
......@@ -25,6 +25,7 @@ data Builder = Alex
| DeriveConstants
| Gcc Stage
| GccM Stage
| GenApply
| GenPrimopCode
| Ghc Stage
| GhcCabal
......@@ -60,6 +61,7 @@ builderKey builder = case builder of
Gcc Stage0 -> "system-gcc"
Gcc _ -> "gcc"
GccM stage -> builderKey $ Gcc stage -- synonym for 'Gcc -MM'
GenApply -> "genapply"
GenPrimopCode -> "genprimopcode"
Ghc Stage0 -> "system-ghc"
Ghc Stage1 -> "ghc-stage1"
......
......@@ -27,14 +27,12 @@ buildWithResources rs target = do
quietlyUnlessVerbose $ case builder of
Ar -> arCmd path argList
HsCpp -> do
let file = head $ Target.outputs target -- TODO: ugly
Stdout output <- cmd [path] argList
writeFileChanged file output
HsCpp -> captureStdout target path argList
GenApply -> captureStdout target path argList
GenPrimopCode -> do
let src = head $ Target.inputs target -- TODO: ugly
file = head $ Target.outputs target
src <- interpret target getInput
file <- interpret target getOutput
input <- readFile' src
Stdout output <- cmd (Stdin input) [path] argList
writeFileChanged file output
......@@ -45,6 +43,12 @@ buildWithResources rs target = do
build :: Target -> Action ()
build = buildWithResources []
captureStdout :: Target -> FilePath -> [String] -> Action ()
captureStdout target path argList = do
file <- interpret target getOutput
Stdout output <- cmd [path] argList
writeFileChanged file output
-- Print out key information about the command being executed
putInfo :: Target.Target -> Action ()
putInfo (Target.Target {..}) = putBuild $ renderBox $
......
......@@ -7,6 +7,7 @@ import Settings.Builders.Alex
import Settings.Builders.Ar
import Settings.Builders.DeriveConstants
import Settings.Builders.Gcc
import Settings.Builders.GenApply
import Settings.Builders.GenPrimopCode
import Settings.Builders.Ghc
import Settings.Builders.GhcCabal
......@@ -25,6 +26,7 @@ import Settings.Packages.GhcPrim
import Settings.Packages.Haddock
import Settings.Packages.Hp2ps
import Settings.Packages.IntegerGmp
import Settings.Packages.Rts
import Settings.Packages.RunGhc
import Settings.User
......@@ -44,6 +46,7 @@ defaultBuilderArgs = mconcat
, deriveConstantsBuilderArgs
, gccBuilderArgs
, gccMBuilderArgs
, genApplyBuilderArgs
, genPrimopCodeBuilderArgs
, ghcBuilderArgs
, ghcCabalBuilderArgs
......@@ -67,4 +70,5 @@ defaultPackageArgs = mconcat
, haddockPackageArgs
, hp2psPackageArgs
, integerGmpPackageArgs
, rtsPackageArgs
, runGhcPackageArgs ]
module Settings.Builders.GenApply (genApplyBuilderArgs) where
import Expression
-- Stdin/stdout are handled in a special way. See Rules/Actions.hs.
-- TODO: Dead code? ifeq "$(GhcUnregisterised)" "YES" GENAPPLY_OPTS = -u
genApplyBuilderArgs :: Args
genApplyBuilderArgs = mempty
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