aboutsummaryrefslogtreecommitdiff
path: root/src/Build.hs
diff options
context:
space:
mode:
authorBrad Richardson <brichardson@structint.com>2020-04-13 21:01:55 -0500
committerBrad Richardson <brichardson@structint.com>2020-04-29 19:08:05 -0700
commit196d9bf3b07a50d4ded4ce8fcc50c79687c4964f (patch)
treed35d2c6e94357edd8e28027262753c6c2615c556 /src/Build.hs
parent7a371d11e9bc18825b5352b90dd7c88e8efbe491 (diff)
downloadfpm-196d9bf3b07a50d4ded4ce8fcc50c79687c4964f.tar.gz
fpm-196d9bf3b07a50d4ded4ce8fcc50c79687c4964f.zip
Fix filtering out program source
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