diff options
author | Brad Richardson <everythingfunctional@protonmail.com> | 2020-10-21 10:36:58 -0500 |
---|---|---|
committer | Brad Richardson <everythingfunctional@protonmail.com> | 2020-10-21 10:36:58 -0500 |
commit | 911aec5a28ccc4dbdcdbc2c56a2114c163a92442 (patch) | |
tree | 2c1826e31b9cc1ba19ad779df431cd46af5c3f24 /bootstrap | |
parent | 6ce08448d8e2376076f42841088687a01930b51b (diff) | |
download | fpm-911aec5a28ccc4dbdcdbc2c56a2114c163a92442.tar.gz fpm-911aec5a28ccc4dbdcdbc2c56a2114c163a92442.zip |
convert file path back to native in fileMatcher
Diffstat (limited to 'bootstrap')
-rw-r--r-- | bootstrap/src/Build.hs | 71 |
1 files changed, 35 insertions, 36 deletions
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 |