diff options
Diffstat (limited to 'app')
-rw-r--r-- | app/Main.hs | 29 |
1 files changed, 25 insertions, 4 deletions
diff --git a/app/Main.hs b/app/Main.hs index 68cef7c..e1451af 100644 --- a/app/Main.hs +++ b/app/Main.hs @@ -1,5 +1,10 @@ module Main where +import Build ( buildLibrary ) +import Development.Shake ( FilePattern + , (<//>) + , getDirectoryFilesIO + ) import Options.Applicative ( Parser , (<**>) , command @@ -19,13 +24,23 @@ data Command = Run | Test | Build main :: IO () main = do args <- getArguments - run args + app args -run :: Arguments -> IO () -run args = case command' args of +app :: Arguments -> IO () +app args = case command' args of Run -> putStrLn "Run" Test -> putStrLn "Test" - Build -> putStrLn "Build" + Build -> build + +build :: IO () +build = do + putStrLn "Building" + buildLibrary "src" + [".f90", ".f", ".F", ".F90", ".f95", ".f03"] + "build" + "gfortran" + ["-g", "-Wall", "-Wextra", "-Werror", "-pedantic"] + "library" getArguments :: IO Arguments getArguments = execParser @@ -51,3 +66,9 @@ testArguments = pure $ Arguments Test buildArguments :: Parser Arguments buildArguments = pure $ Arguments Build + +getDirectoriesFiles :: [FilePath] -> [FilePattern] -> IO [FilePath] +getDirectoriesFiles dirs exts = getDirectoryFilesIO "" newPatterns + where + newPatterns = concatMap appendExts dirs + appendExts dir = map ((dir <//> "*") ++) exts |