aboutsummaryrefslogtreecommitdiff
path: root/src/Build.hs
diff options
context:
space:
mode:
authorBrad Richardson <brichardson@structint.com>2020-05-29 19:58:34 -0700
committerBrad Richardson <brichardson@structint.com>2020-05-29 19:58:34 -0700
commit6297e11e84f609c08384a83f9bd1e61d51de740a (patch)
tree3a383bf379f0d536af26a887c24f043b76d1a96c /src/Build.hs
parentc2d5c656affd4e0a7c97e8ca469fb6cfba00dc4d (diff)
downloadfpm-6297e11e84f609c08384a83f9bd1e61d51de740a.tar.gz
fpm-6297e11e84f609c08384a83f9bd1e61d51de740a.zip
Impelement test/executable specific dependencies
- with the possibility of them being "circular", meaning if one of them depends on the current library, it will still work
Diffstat (limited to 'src/Build.hs')
-rw-r--r--src/Build.hs7
1 files changed, 4 insertions, 3 deletions
diff --git a/src/Build.hs b/src/Build.hs
index 2e471ec..913e754 100644
--- a/src/Build.hs
+++ b/src/Build.hs
@@ -69,8 +69,9 @@ buildProgram
-> [String]
-> String
-> FilePath
+ -> [FilePath]
-> IO ()
-buildProgram programDirectory libraryDirectories sourceExtensions buildDirectory compiler flags programName programSource
+buildProgram programDirectory libraryDirectories sourceExtensions buildDirectory compiler flags programName programSource archives
= do
sourceFiles <- getDirectoriesFiles [programDirectory] sourceExtensions
canonicalProgramSource <- makeAbsolute $ programDirectory </> programSource
@@ -93,7 +94,6 @@ buildProgram programDirectory libraryDirectories sourceExtensions buildDirectory
let allModuleMaps =
moduleLookupMap `Map.union` foldl Map.union Map.empty otherModuleMaps
let includeFlags = map ("-I" ++) libraryDirectories
- archives <- getDirectoriesFiles libraryDirectories [".a"]
shake shakeOptions { shakeFiles = buildDirectory
, shakeChange = ChangeModtimeAndDigest
, shakeColor = True
@@ -151,7 +151,7 @@ buildLibrary
-> [String]
-> String
-> [FilePath]
- -> IO ()
+ -> IO (FilePath)
buildLibrary libraryDirectory sourceExtensions buildDirectory compiler flags libraryName otherLibraryDirectories
= do
sourceFiles <- getDirectoriesFiles [libraryDirectory] sourceExtensions
@@ -193,6 +193,7 @@ buildLibrary libraryDirectory sourceExtensions buildDirectory compiler flags lib
need objectFiles
cmd "ar" ["rs"] a objectFiles
want [archiveFile]
+ return archiveFile
-- A little wrapper around getDirectoryFiles so we can get files from multiple directories
getDirectoriesFiles :: [FilePath] -> [FilePattern] -> IO [FilePath]