Commit 3ceca899 authored by Andrey Mokhov's avatar Andrey Mokhov
Browse files

Add buildProgram rule.

parent 3cd6a3b7
......@@ -7,6 +7,7 @@ import Rules.Dependencies
import Rules.Documentation
import Rules.Generate
import Rules.Library
import Rules.Program
import Rules.Resources
import Target
......@@ -17,4 +18,5 @@ buildPackage = mconcat
, generatePackageCode
, compilePackage
, buildPackageLibrary
, buildPackageDocumentation ]
, buildPackageDocumentation
, buildProgram ]
module Rules.Program (buildProgram) where
import Expression hiding (splitPath)
import Oracles
import Rules.Actions
import Rules.Library
import Rules.Resources
import Settings
buildProgram :: Resources -> PartialTarget -> Rules ()
buildProgram _ target @ (PartialTarget stage pkg) = do
let path = targetPath stage pkg
buildPath = path -/- "build"
program = programPath stage pkg
(\f -> program == Just f) ?> \bin -> do
cSrcs <- cSources target -- TODO: remove code duplication (Library.hs)
hSrcs <- hSources target
let cObjs = [ buildPath -/- src -<.> osuf vanilla | src <- cSrcs ]
hObjs = [ buildPath -/- src <.> osuf vanilla | src <- hSrcs ]
objs = cObjs ++ hObjs
need objs
build $ fullTargetWithWay target (Ghc stage) vanilla objs [bin]
synopsis <- interpretPartial target $ getPkgData Synopsis
putSuccess $ "/--------\n| Successfully built program '"
++ pkgName pkg ++ "' (stage " ++ show stage ++ ")."
putSuccess $ "| Executable: " ++ bin
putSuccess $ "| Package synopsis: "
++ dropWhileEnd isPunctuation synopsis ++ "." ++ "\n\\--------"
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