From 196d9bf3b07a50d4ded4ce8fcc50c79687c4964f Mon Sep 17 00:00:00 2001 From: Brad Richardson Date: Mon, 13 Apr 2020 21:01:55 -0500 Subject: Fix filtering out program source --- src/Build.hs | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) (limited to 'src') 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 -- cgit v1.2.3