aboutsummaryrefslogtreecommitdiff
path: root/src/Build.hs
diff options
context:
space:
mode:
authorOndřej Čertík <ondrej@certik.us>2020-04-30 00:52:06 -0600
committerGitHub <noreply@github.com>2020-04-30 00:52:06 -0600
commitf071fcc750da95e008f622d96fb033a4b0f73039 (patch)
tree787ab0d77c9db8a6c2982cd1b994e7bf88731f5f /src/Build.hs
parenta8dabeea48210450e6b1088c95abf80358f40e3c (diff)
parentd6e5d3055946e58bd17dfc156bcffe88ef08b5dd (diff)
downloadfpm-f071fcc750da95e008f622d96fb033a4b0f73039.tar.gz
fpm-f071fcc750da95e008f622d96fb033a4b0f73039.zip
Merge pull request #54 from everythingfunctional/AdditionalTesting
Additional testing
Diffstat (limited to 'src/Build.hs')
-rw-r--r--src/Build.hs11
1 files changed, 9 insertions, 2 deletions
diff --git a/src/Build.hs b/src/Build.hs
index 0c692cb..12b6bcd 100644
--- a/src/Build.hs
+++ b/src/Build.hs
@@ -5,6 +5,7 @@ module Build
where
import Control.Applicative ( (<|>) )
+import Control.Monad ( filterM )
import Data.Char ( isAsciiLower
, isDigit
, toLower
@@ -41,6 +42,7 @@ import Development.Shake.FilePath ( dropExtension
, (<.>)
, (-<.>)
)
+import System.Directory ( makeAbsolute )
import System.FilePath ( splitDirectories )
import Text.ParserCombinators.ReadP ( ReadP
, char
@@ -71,8 +73,13 @@ buildProgram
buildProgram programDirectory libraryDirectories sourceExtensions buildDirectory compiler flags programName programSource
= do
sourceFiles <- getDirectoriesFiles [programDirectory] sourceExtensions
- let moduleSourceFiles =
- filter (/= programDirectory </> programSource) sourceFiles
+ canonicalProgramSource <- makeAbsolute $ programDirectory </> programSource
+ moduleSourceFiles <- filterM
+ (\source -> do
+ canonicalSource <- makeAbsolute source
+ return $ canonicalProgramSource /= canonicalSource
+ )
+ sourceFiles
let moduleObjectFiles = map
(sourceFileToObjectFile buildDirectory programDirectory)
moduleSourceFiles