@@ -38,6 +38,7 @@ import Development.Shake ( FilePattern
38
38
, (&?>)
39
39
)
40
40
import Development.Shake.FilePath ( exe
41
+ , splitDirectories
41
42
, (</>)
42
43
, (<.>)
43
44
)
@@ -81,24 +82,23 @@ buildProgram programDirectory libraryDirectories sourceExtensions buildDirectory
81
82
, shakeProgress = progressSimple
82
83
}
83
84
$ do
84
- let
85
- infoToRule cti =
86
- let
87
- obj = compileTimeInfoObjectFileProduced cti
88
- other = compileTimeInfoOtherFilesProduced cti
89
- directDependencies = compileTimeInfoDirectDependencies cti
90
- sourceFile = compileTimeInfoSourceFileName cti
91
- fileMatcher f = if f == obj || f `elem` other
92
- then Just (obj : other)
93
- else Nothing
94
- in
95
- fileMatcher &?> \ (objectFile : _) -> do
96
- need (sourceFile : directDependencies)
97
- cmd compiler
98
- [" -c" , " -J" ++ buildDirectory]
99
- includeFlags
100
- flags
101
- [" -o" , objectFile, sourceFile]
85
+ let infoToRule cti =
86
+ let obj = compileTimeInfoObjectFileProduced cti
87
+ other = compileTimeInfoOtherFilesProduced cti
88
+ directDependencies = compileTimeInfoDirectDependencies cti
89
+ sourceFile = compileTimeInfoSourceFileName cti
90
+ fileMatcher f =
91
+ let realf = foldl1 (</>) (splitDirectories f)
92
+ in if realf == obj || realf `elem` other
93
+ then Just (obj : other)
94
+ else Nothing
95
+ in fileMatcher &?> \ (objectFile : _) -> do
96
+ need (sourceFile : directDependencies)
97
+ cmd compiler
98
+ [" -c" , " -J" ++ buildDirectory]
99
+ includeFlags
100
+ flags
101
+ [" -o" , objectFile, sourceFile]
102
102
want [buildDirectory </> programName <.> exe]
103
103
buildDirectory </> programName <.> exe %> \ executable -> do
104
104
liftIO $ print objectFiles
@@ -134,24 +134,23 @@ buildLibrary libraryDirectory sourceExtensions buildDirectory compiler flags lib
134
134
, shakeProgress = progressSimple
135
135
}
136
136
$ do
137
- let
138
- infoToRule cti =
139
- let
140
- obj = compileTimeInfoObjectFileProduced cti
141
- other = compileTimeInfoOtherFilesProduced cti
142
- directDependencies = compileTimeInfoDirectDependencies cti
143
- sourceFile = compileTimeInfoSourceFileName cti
144
- fileMatcher f = if f == obj || f `elem` other
145
- then Just (obj : other)
146
- else Nothing
147
- in
148
- fileMatcher &?> \ (objectFile : _) -> do
149
- need (sourceFile : directDependencies)
150
- cmd compiler
151
- [" -c" , " -J" ++ buildDirectory]
152
- includeFlags
153
- flags
154
- [" -o" , objectFile, sourceFile]
137
+ let infoToRule cti =
138
+ let obj = compileTimeInfoObjectFileProduced cti
139
+ other = compileTimeInfoOtherFilesProduced cti
140
+ directDependencies = compileTimeInfoDirectDependencies cti
141
+ sourceFile = compileTimeInfoSourceFileName cti
142
+ fileMatcher f =
143
+ let realf = foldl1 (</>) (splitDirectories f)
144
+ in if realf == obj || realf `elem` other
145
+ then Just (obj : other)
146
+ else Nothing
147
+ in fileMatcher &?> \ (objectFile : _) -> do
148
+ need (sourceFile : directDependencies)
149
+ cmd compiler
150
+ [" -c" , " -J" ++ buildDirectory]
151
+ includeFlags
152
+ flags
153
+ [" -o" , objectFile, sourceFile]
155
154
want [archiveFile]
156
155
archiveFile %> \ a -> do
157
156
need objectFiles
0 commit comments