Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in / Register
Toggle navigation
Menu
Open sidebar
Glasgow Haskell Compiler
GHC
Commits
3344cead
Commit
3344cead
authored
Jan 18, 2015
by
Andrey Mokhov
Browse files
Split compile rules for {hi, o}, clean up code.
parent
9e247b06
Changes
2
Hide whitespace changes
Inline
Side-by-side
src/Oracles.hs
View file @
3344cead
...
...
@@ -67,15 +67,17 @@ packageDataOracle = do
-- Oracle for 'path/dist/*.deps' files
dependencyOracle
::
Rules
()
dependencyOracle
=
do
deps
<-
newCache
$
\
depF
ile
->
do
need
[
depF
ile
]
putOracle
$
"Parsing "
++
toStandard
depF
ile
++
"..."
contents
<-
parseMakefile
<$>
(
liftIO
$
readFile
depF
ile
)
deps
<-
newCache
$
\
f
ile
->
do
need
[
f
ile
]
putOracle
$
"Parsing "
++
f
ile
++
"..."
contents
<-
parseMakefile
<$>
(
liftIO
$
readFile
f
ile
)
return
$
M
.
fromList
$
map
(
bimap
toStandard
(
map
toStandard
))
$
map
(
bimap
head
concat
.
unzip
)
$
groupBy
((
==
)
`
on
`
fst
)
$
sortBy
(
compare
`
on
`
fst
)
contents
addOracle
$
\
(
DependencyListKey
(
file
,
obj
))
->
M
.
lookup
obj
<$>
deps
file
addOracle
$
\
(
DependencyListKey
(
file
,
obj
))
->
M
.
lookup
(
toStandard
obj
)
<$>
deps
(
toStandard
file
)
return
()
oracleRules
::
Rules
()
...
...
src/Package/Compile.hs
View file @
3344cead
...
...
@@ -47,10 +47,14 @@ buildRule pkg @ (Package name path _) todo @ (stage, dist, _) =
forM_
allWays
$
\
way
->
do
-- TODO: optimise (too many ways in allWays)
let
oPattern
=
"*."
++
osuf
way
let
hiPattern
=
"*."
++
hisuf
way
[
buildDir
<//>
oPattern
,
buildDir
<//>
hiPattern
]
|%>
\
out
->
do
(
buildDir
<//>
hiPattern
)
%>
\
out
->
do
let
obj
=
out
-<.>
osuf
way
need
[
obj
]
(
buildDir
<//>
oPattern
)
%>
\
obj
->
do
need
[
argListPath
argListDir
pkg
stage
]
let
obj
=
toStandard
$
out
-<.>
osuf
way
vanillaObj
=
toStandard
$
out
-<.>
"o"
let
vanillaObj
=
obj
-<.>
"o"
-- TODO: keep only vanilla dependencies in hDepFile
hDeps
<-
args
$
DependencyList
hDepFile
obj
cDeps
<-
args
$
DependencyList
cDepFile
$
takeFileName
vanillaObj
...
...
@@ -59,10 +63,10 @@ buildRule pkg @ (Package name path _) todo @ (stage, dist, _) =
-- Report impossible cases
when
(
null
$
hSrcs
++
cSrcs
)
$
redError_
$
"No source files found for "
++
toStandard
o
ut
++
"."
++
toStandard
o
bj
++
"."
when
(
not
(
null
hSrcs
)
&&
not
(
null
cSrcs
))
$
redError_
$
"Both c and Haskell sources found for "
++
toStandard
o
ut
++
"."
++
toStandard
o
bj
++
"."
-- Build using appropriate compiler
need
$
hDeps
++
cDeps
when
(
not
$
null
hSrcs
)
...
...
@@ -70,6 +74,7 @@ buildRule pkg @ (Package name path _) todo @ (stage, dist, _) =
when
(
not
$
null
cSrcs
)
$
run
(
Gcc
stage
)
$
gccArgs
pkg
todo
cSrcs
obj
argListRule
::
Package
->
TodoItem
->
Rules
()
argListRule
pkg
todo
@
(
stage
,
_
,
settings
)
=
(
argListPath
argListDir
pkg
stage
)
%>
\
out
->
do
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment