aboutsummaryrefslogtreecommitdiff
path: root/app
diff options
context:
space:
mode:
authorBrad Richardson <brichardson@structint.com>2020-02-27 10:22:38 -0800
committerBrad Richardson <brichardson@structint.com>2020-02-27 10:22:38 -0800
commit775841b8437adf4f400a21fa939156dc6ef48cc2 (patch)
treeae10c44cef4e60bf118c59f9b32161d411a5a42a /app
parent2573315e014303cda41682003bafa7e0a6f00167 (diff)
downloadfpm-775841b8437adf4f400a21fa939156dc6ef48cc2.tar.gz
fpm-775841b8437adf4f400a21fa939156dc6ef48cc2.zip
Enable building a library
Diffstat (limited to 'app')
-rw-r--r--app/Main.hs29
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