aboutsummaryrefslogtreecommitdiff
path: root/src/Build.hs
diff options
context:
space:
mode:
authorBrad Richardson <brichardson@structint.com>2020-03-03 19:59:19 -0800
committerBrad Richardson <brichardson@structint.com>2020-03-03 19:59:19 -0800
commita145a9fc1e7dffbacbb7151fa543267a86e90cde (patch)
treec035acf8a4d71e9201dc7394a43bc0dcef28ac83 /src/Build.hs
parent92923f59d36726a99f9bb8435805a41ac5ba1388 (diff)
downloadfpm-a145a9fc1e7dffbacbb7151fa543267a86e90cde.tar.gz
fpm-a145a9fc1e7dffbacbb7151fa543267a86e90cde.zip
Fix building executables on windows
Diffstat (limited to 'src/Build.hs')
-rw-r--r--src/Build.hs26
1 files changed, 16 insertions, 10 deletions
diff --git a/src/Build.hs b/src/Build.hs
index d4432bb..2febb87 100644
--- a/src/Build.hs
+++ b/src/Build.hs
@@ -88,11 +88,11 @@ buildPrograms programDirectory libraryDirectories sourceExtensions buildDirector
}
$ do
buildDirectory </> "*" <.> "o" %> \objectFile -> do
- let realObjectFile = foldl (</>) "" $ splitDirectories objectFile
+ let realObjectFile =
+ foldl (</>) "" $ splitDirectories objectFile
let sourceFile = fromMaybe
undefined
- (Map.lookup realObjectFile sourceFileLookupMap
- )
+ (Map.lookup realObjectFile sourceFileLookupMap)
need [sourceFile]
modulesUsed <- liftIO $ getModulesUsed sourceFile
let
@@ -105,11 +105,14 @@ buildPrograms programDirectory libraryDirectories sourceExtensions buildDirector
includeFlags
flags
["-o", objectFile, sourceFile]
- (`elem` executables) ?> \exe -> do
- let objectFile = map toLower exe -<.> "o"
- need [objectFile]
- need archives
- cmd compiler objectFile archives ["-o", exe] flags
+ (\file ->
+ foldl (</>) "" (splitDirectories file) `elem` executables
+ )
+ ?> \exe -> do
+ let objectFile = map toLower exe -<.> "o"
+ need [objectFile]
+ need archives
+ cmd compiler objectFile archives ["-o", exe] flags
want executables
buildLibrary
@@ -140,10 +143,13 @@ buildLibrary libraryDirectory sourceExtensions buildDirectory compiler flags lib
$ do
map (\ext -> buildDirectory </> "*" <.> ext) ["o", "mod"]
&%> \[objectFile, moduleFile] -> do
- let realObjectFile = foldl (</>) "" $ splitDirectories objectFile
+ let
+ realObjectFile = foldl (</>) ""
+ $ splitDirectories objectFile
let sourceFile = fromMaybe
undefined
- (Map.lookup realObjectFile sourceFileLookupMap
+ (Map.lookup realObjectFile
+ sourceFileLookupMap
)
need [sourceFile]
modulesUsed <- liftIO $ getModulesUsed sourceFile