Commit 6ce7cd3a authored by Andrey Mokhov's avatar Andrey Mokhov
Browse files

Use multiple output rules for *.o and *.hi files.

parent 7ad0b09d
......@@ -11,16 +11,16 @@ import Development.Shake.Util
-ilibraries/deepseq/dist-install/build/autogen
-Ilibraries/deepseq/dist-install/build
-Ilibraries/deepseq/dist-install/build/autogen
-Ilibraries/deepseq/.
-Ilibraries/deepseq/.
-optP-include -optPlibraries/deepseq/dist-install/build/autogen/cabal_macros.h
-package-key array_3w0nMK0JfaFJPpLFn2yWAJ
-package-key base_469rOtLAqwTGFEOGWxSUiQ
-package-key ghcpr_FgrV6cgh2JHBlbcx1OSlwt
-Wall -XHaskell2010 -O2 -no-user-package-db -rtsopts
-Wall -XHaskell2010 -O2 -no-user-package-db -rtsopts
-odir libraries/deepseq/dist-install/build
-hidir libraries/deepseq/dist-install/build
-stubdir libraries/deepseq/dist-install/build
-split-objs
-split-objs
-c libraries/deepseq/./Control/DeepSeq.hs
-o libraries/deepseq/dist-install/build/Control/DeepSeq.o -}
......@@ -29,13 +29,13 @@ suffixArgs way = arg ["-hisuf", hisuf way]
<> arg [ "-osuf", osuf way]
<> arg ["-hcsuf", hcsuf way]
oRule :: Package -> TodoItem -> Rules ()
oRule (Package name path _) (stage, dist, settings) =
buildPackageCompile :: Package -> TodoItem -> Rules ()
buildPackageCompile (Package name path _) (stage, dist, settings) =
let buildDir = toStandard $ path </> dist </> "build"
pkgData = path </> dist </> "package-data.mk"
depFile = buildDir </> name <.> "m"
depFile = buildDir </> takeBaseName name <.> "m"
in
(buildDir <//> "*o") %> \out -> do
[buildDir <//> "*o", buildDir <//> "*hi"] &%> \[out, _] -> do
let way = detectWay $ tail $ takeExtension out
need ["shake/src/Package/Compile.hs"]
need [depFile]
......@@ -48,24 +48,12 @@ oRule (Package name path _) (stage, dist, settings) =
<> arg SrcHcOpts
<> packageArgs stage pkgData
<> includeArgs path dist
<> concatArgs ["-optP"] (CppOpts pkgData)
-- TODO: use HC_OPTS from pkgData
<> concatArgs ["-optP"] (CppOpts pkgData)
<> arg (HsOpts pkgData)
-- TODO: now we have both -O and -O2
<> arg ["-Wall", "-XHaskell2010", "-O2"]
-- <> arg ["-O2"]
<> productArgs ["-odir", "-hidir", "-stubdir"] buildDir
<> when (splitObjects stage) (arg "-split-objs")
<> arg ("-c":srcs)
<> arg ["-o", toStandard out]
-- TODO: This rule looks hacky... combine it with the above?
hiRule :: Package -> TodoItem -> Rules ()
hiRule (Package name path _) (stage, dist, settings) =
let buildDir = path </> dist </> "build"
in
(buildDir <//> "*hi") %> \out -> do
let way = detectWay $ tail $ takeExtension out
oFile = out -<.> osuf way
need [oFile]
buildPackageCompile :: Package -> TodoItem -> Rules ()
buildPackageCompile = oRule <> hiRule
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