Commit 036328f0 authored by Andrey Mokhov's avatar Andrey Mokhov
Browse files

Clean up.

parent 5bb1d7e2
...@@ -29,34 +29,36 @@ buildPackageLibrary _ target = do ...@@ -29,34 +29,36 @@ buildPackageLibrary _ target = do
cSrcs <- interpret target $ getPkgDataList CSrcs cSrcs <- interpret target $ getPkgDataList CSrcs
modules <- interpret target $ getPkgDataList Modules modules <- interpret target $ getPkgDataList Modules
let way = fromJust . detectWay $ a -- fromJust is safe let way = fromJust . detectWay $ a -- fromJust is safe
hsSrcs = map (replaceEq '.' '/') modules hSrcs = map (replaceEq '.' '/') modules
cObjs = [ buildPath -/- src -<.> osuf way | src <- cSrcs ] cObjs = [ buildPath -/- src -<.> osuf way | src <- cSrcs ]
hsObjs = [ buildPath -/- src <.> osuf way | src <- hsSrcs ] hObjs = [ buildPath -/- src <.> osuf way | src <- hSrcs ]
need $ cObjs ++ hsObjs -- this will create split objects if required need $ cObjs ++ hObjs -- this will create split objects if required
split <- interpret target splitObjects split <- interpret target splitObjects
splitObjs <- if split splitObjs <- if split
then fmap concat $ forM hsSrcs $ \src -> do then fmap concat $ forM hSrcs $ \src -> do
let files = buildPath -/- src ++ "_" ++ osuf way ++ "_split/*" let files = buildPath -/- src ++ "_" ++ osuf way ++ "_split/*"
getDirectoryFiles "" [files] fmap (map unifyPath) $ getDirectoryFiles "" [files]
else return [] else return []
build $ fullTarget target (cObjs ++ hsObjs ++ splitObjs) Ar [a] build $ fullTarget target (cObjs ++ hObjs ++ splitObjs) Ar [a]
synopsis <- interpret target $ getPkgData Synopsis synopsis <- interpret target $ getPkgData Synopsis
putSuccess $ "/--------\n| Successfully built package '" putSuccess $ "/--------\n| Successfully built package library '"
++ pkgName pkg ++ "' (stage " ++ show stage ++ ")." ++ pkgName pkg
++ "' (stage " ++ show stage ++ ", way "++ show way ++ ")."
putSuccess $ "| Package synopsis: " putSuccess $ "| Package synopsis: "
++ dropWhileEnd isPunctuation synopsis ++ "." ++ "\n\\--------" ++ dropWhileEnd isPunctuation synopsis ++ "." ++ "\n\\--------"
-- TODO: this looks fragile as haskell objects can match this rule if their -- TODO: this looks fragile as haskell objects can match this rule if their
-- names start with "HS" and they are on top of the module hierarchy. -- names start with "HS" and they are on top of the module hierarchy.
(buildPath -/- "HS*.o") %> \o -> do priority 2 $ (buildPath -/- "HS*.o") %> \o -> do
cSrcs <- interpret target $ getPkgDataList CSrcs cSrcs <- interpret target $ getPkgDataList CSrcs
modules <- interpret target $ getPkgDataList Modules modules <- interpret target $ getPkgDataList Modules
let hsSrcs = map (replaceEq '.' '/') modules let hSrcs = map (replaceEq '.' '/') modules
cObjs = [ buildPath -/- src -<.> "o" | src <- cSrcs ] cObjs = [ buildPath -/- src -<.> "o" | src <- cSrcs ]
hsObjs = [ buildPath -/- src <.> "o" | src <- hsSrcs ] hObjs = [ buildPath -/- src <.> "o" | src <- hSrcs ]
build $ fullTarget target (cObjs ++ hsObjs) Ld [o] need $ cObjs ++ hObjs
build $ fullTarget target (cObjs ++ hObjs) Ld [o]
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