From a145a9fc1e7dffbacbb7151fa543267a86e90cde Mon Sep 17 00:00:00 2001 From: Brad Richardson Date: Tue, 3 Mar 2020 19:59:19 -0800 Subject: Fix building executables on windows --- src/Build.hs | 26 ++++++++++++++++---------- 1 file changed, 16 insertions(+), 10 deletions(-) (limited to 'src/Build.hs') diff --git a/src/Build.hs b/src/Build.hs index d4432bb..2febb87 100644 --- a/src/Build.hs +++ b/src/Build.hs @@ -88,11 +88,11 @@ buildPrograms programDirectory libraryDirectories sourceExtensions buildDirector } $ do buildDirectory "*" <.> "o" %> \objectFile -> do - let realObjectFile = foldl () "" $ splitDirectories objectFile + let realObjectFile = + foldl () "" $ splitDirectories objectFile let sourceFile = fromMaybe undefined - (Map.lookup realObjectFile sourceFileLookupMap - ) + (Map.lookup realObjectFile sourceFileLookupMap) need [sourceFile] modulesUsed <- liftIO $ getModulesUsed sourceFile let @@ -105,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,10 +143,13 @@ buildLibrary libraryDirectory sourceExtensions buildDirectory compiler flags lib $ do map (\ext -> buildDirectory "*" <.> ext) ["o", "mod"] &%> \[objectFile, moduleFile] -> do - let realObjectFile = foldl () "" $ splitDirectories objectFile + let + realObjectFile = foldl () "" + $ splitDirectories objectFile let sourceFile = fromMaybe undefined - (Map.lookup realObjectFile sourceFileLookupMap + (Map.lookup realObjectFile + sourceFileLookupMap ) need [sourceFile] modulesUsed <- liftIO $ getModulesUsed sourceFile -- cgit v1.2.3