aboutsummaryrefslogtreecommitdiff
path: root/src/Build.hs
diff options
context:
space:
mode:
authorOndřej Čertík <ondrej@certik.us>2020-03-03 20:40:34 -0800
committerGitHub <noreply@github.com>2020-03-03 20:40:34 -0800
commit8e6fd427508e10999349c7e08c53a3d34bcea143 (patch)
treec035acf8a4d71e9201dc7394a43bc0dcef28ac83 /src/Build.hs
parent45cc57a901594eaa94535659e2aafe9971a24c00 (diff)
parenta145a9fc1e7dffbacbb7151fa543267a86e90cde (diff)
downloadfpm-8e6fd427508e10999349c7e08c53a3d34bcea143.tar.gz
fpm-8e6fd427508e10999349c7e08c53a3d34bcea143.zip
Merge pull request #41 from certik/call
Test calling GFortran from Haskell
Diffstat (limited to 'src/Build.hs')
-rw-r--r--src/Build.hs27
1 files changed, 17 insertions, 10 deletions
diff --git a/src/Build.hs b/src/Build.hs
index 813c10e..2febb87 100644
--- a/src/Build.hs
+++ b/src/Build.hs
@@ -88,10 +88,11 @@ buildPrograms programDirectory libraryDirectories sourceExtensions buildDirector
}
$ do
buildDirectory </> "*" <.> "o" %> \objectFile -> do
- let
- sourceFile = fromMaybe
+ let realObjectFile =
+ foldl (</>) "" $ splitDirectories objectFile
+ let sourceFile = fromMaybe
undefined
- (Map.lookup objectFile sourceFileLookupMap)
+ (Map.lookup realObjectFile sourceFileLookupMap)
need [sourceFile]
modulesUsed <- liftIO $ getModulesUsed sourceFile
let
@@ -104,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,9 +144,12 @@ buildLibrary libraryDirectory sourceExtensions buildDirectory compiler flags lib
map (\ext -> buildDirectory </> "*" <.> ext) ["o", "mod"]
&%> \[objectFile, moduleFile] -> do
let
- sourceFile = fromMaybe
+ realObjectFile = foldl (</>) ""
+ $ splitDirectories objectFile
+ let sourceFile = fromMaybe
undefined
- (Map.lookup objectFile sourceFileLookupMap
+ (Map.lookup realObjectFile
+ sourceFileLookupMap
)
need [sourceFile]
modulesUsed <- liftIO $ getModulesUsed sourceFile