From 911aec5a28ccc4dbdcdbc2c56a2114c163a92442 Mon Sep 17 00:00:00 2001 From: Brad Richardson Date: Wed, 21 Oct 2020 10:36:58 -0500 Subject: convert file path back to native in fileMatcher --- bootstrap/src/Build.hs | 71 +++++++++++++++++++++++++------------------------- 1 file changed, 35 insertions(+), 36 deletions(-) (limited to 'bootstrap/src') diff --git a/bootstrap/src/Build.hs b/bootstrap/src/Build.hs index bee5bba..0e6a7c7 100644 --- a/bootstrap/src/Build.hs +++ b/bootstrap/src/Build.hs @@ -38,6 +38,7 @@ import Development.Shake ( FilePattern , (&?>) ) import Development.Shake.FilePath ( exe + , splitDirectories , () , (<.>) ) @@ -81,24 +82,23 @@ buildProgram programDirectory libraryDirectories sourceExtensions buildDirectory , shakeProgress = progressSimple } $ do - let - infoToRule cti = - let - obj = compileTimeInfoObjectFileProduced cti - other = compileTimeInfoOtherFilesProduced cti - directDependencies = compileTimeInfoDirectDependencies cti - sourceFile = compileTimeInfoSourceFileName cti - fileMatcher f = if f == obj || f `elem` other - then Just (obj : other) - else Nothing - in - fileMatcher &?> \(objectFile : _) -> do - need (sourceFile : directDependencies) - cmd compiler - ["-c", "-J" ++ buildDirectory] - includeFlags - flags - ["-o", objectFile, sourceFile] + let infoToRule cti = + let obj = compileTimeInfoObjectFileProduced cti + other = compileTimeInfoOtherFilesProduced cti + directDependencies = compileTimeInfoDirectDependencies cti + sourceFile = compileTimeInfoSourceFileName cti + fileMatcher f = + let realf = foldl1 () (splitDirectories f) + in if realf == obj || realf `elem` other + then Just (obj : other) + else Nothing + in fileMatcher &?> \(objectFile : _) -> do + need (sourceFile : directDependencies) + cmd compiler + ["-c", "-J" ++ buildDirectory] + includeFlags + flags + ["-o", objectFile, sourceFile] want [buildDirectory programName <.> exe] buildDirectory programName <.> exe %> \executable -> do liftIO $ print objectFiles @@ -134,24 +134,23 @@ buildLibrary libraryDirectory sourceExtensions buildDirectory compiler flags lib , shakeProgress = progressSimple } $ do - let - infoToRule cti = - let - obj = compileTimeInfoObjectFileProduced cti - other = compileTimeInfoOtherFilesProduced cti - directDependencies = compileTimeInfoDirectDependencies cti - sourceFile = compileTimeInfoSourceFileName cti - fileMatcher f = if f == obj || f `elem` other - then Just (obj : other) - else Nothing - in - fileMatcher &?> \(objectFile : _) -> do - need (sourceFile : directDependencies) - cmd compiler - ["-c", "-J" ++ buildDirectory] - includeFlags - flags - ["-o", objectFile, sourceFile] + let infoToRule cti = + let obj = compileTimeInfoObjectFileProduced cti + other = compileTimeInfoOtherFilesProduced cti + directDependencies = compileTimeInfoDirectDependencies cti + sourceFile = compileTimeInfoSourceFileName cti + fileMatcher f = + let realf = foldl1 () (splitDirectories f) + in if realf == obj || realf `elem` other + then Just (obj : other) + else Nothing + in fileMatcher &?> \(objectFile : _) -> do + need (sourceFile : directDependencies) + cmd compiler + ["-c", "-J" ++ buildDirectory] + includeFlags + flags + ["-o", objectFile, sourceFile] want [archiveFile] archiveFile %> \a -> do need objectFiles -- cgit v1.2.3