Commit 5bb1d7e2 authored by Andrey Mokhov's avatar Andrey Mokhov
Browse files

Drop need from build. Add appropriate needs to build rules.

parent b397bb36
......@@ -21,7 +21,7 @@ buildWithResources rs target = do
let builder = Target.builder target
deps = Target.dependencies target
needBuilder builder
need deps
-- need deps -- TODO: think if needs could be done here
path <- builderPath builder
argList <- interpret target getArgs
-- The line below forces the rule to be rerun if the args hash has changed
......
......@@ -35,6 +35,11 @@ compilePackage _ target = do
when (null cDeps && null hDeps) $
putError $ "Cannot determine sources for '" ++ obj ++ "'."
when (not (null cDeps) && not (null hDeps)) $
putError $ "Both .c and .hs sources found for '" ++ obj ++ "'."
need $ hDeps ++ cDeps
if null cDeps
then build $ fullTargetWithWay target hSrcDeps (Ghc stage) way [obj]
else build $ fullTarget target cDeps (Gcc stage) [obj]
......@@ -45,6 +45,7 @@ buildPackageData (Resources ghcCabal ghcPkg) target = do
depPkgs = intersectOrd cmp (sort pkgs) deps
need [ targetPath stage p -/- "package-data.mk" | p <- depPkgs ]
need [cabal]
buildWithResources [(ghcCabal, 1)] $
fullTarget target [cabal] GhcCabal files
......
......@@ -22,15 +22,17 @@ buildPackageDependencies _ target =
in do
(buildPath <//> "*.c.deps") %> \depFile -> do
let srcFile = dropBuild . dropExtension $ depFile
need [srcFile]
build $ fullTarget target [srcFile] (GccM stage) [depFile]
(buildPath -/- "c.deps") %> \file -> do
srcs <- pkgDataList $ CSrcs path
let depFiles = [ buildPath -/- src <.> "deps" | src <- srcs ]
need depFiles -- increase parallelism by needing all at once
need depFiles
deps <- mapM readFile' depFiles
writeFileChanged file (concat deps)
(buildPath -/- "haskell.deps") %> \file -> do
srcs <- interpret target getHsSources
need srcs
build $ fullTarget target srcs (GhcM stage) [file]
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