From 2573315e014303cda41682003bafa7e0a6f00167 Mon Sep 17 00:00:00 2001 From: Brad Richardson Date: Tue, 25 Feb 2020 14:27:08 -0800 Subject: Add explicit import --- app/Main.hs | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) (limited to 'app') diff --git a/app/Main.hs b/app/Main.hs index 9d9c5dc..68cef7c 100644 --- a/app/Main.hs +++ b/app/Main.hs @@ -1,6 +1,16 @@ module Main where -import Options.Applicative +import Options.Applicative ( Parser + , (<**>) + , command + , execParser + , fullDesc + , info + , header + , helper + , progDesc + , subparser + ) newtype Arguments = Arguments { command' :: Command } -- cgit v1.2.3 From 775841b8437adf4f400a21fa939156dc6ef48cc2 Mon Sep 17 00:00:00 2001 From: Brad Richardson Date: Thu, 27 Feb 2020 10:22:38 -0800 Subject: Enable building a library --- app/Main.hs | 29 +++++++++++++++++++++++++---- 1 file changed, 25 insertions(+), 4 deletions(-) (limited to 'app') 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 -- cgit v1.2.3 From d4c0aea26050b32bf394eabe91c95ab56113ce1a Mon Sep 17 00:00:00 2001 From: Brad Richardson Date: Thu, 27 Feb 2020 21:01:13 -0800 Subject: Enable building executables --- app/Main.hs | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) (limited to 'app') diff --git a/app/Main.hs b/app/Main.hs index e1451af..02d54d6 100644 --- a/app/Main.hs +++ b/app/Main.hs @@ -1,10 +1,13 @@ module Main where -import Build ( buildLibrary ) +import Build ( buildLibrary + , buildPrograms + ) import Development.Shake ( FilePattern , () , getDirectoryFilesIO ) +import Development.Shake.FilePath ( () ) import Options.Applicative ( Parser , (<**>) , command @@ -37,10 +40,16 @@ build = do putStrLn "Building" buildLibrary "src" [".f90", ".f", ".F", ".F90", ".f95", ".f03"] - "build" + ("build" "library") "gfortran" ["-g", "-Wall", "-Wextra", "-Werror", "-pedantic"] "library" + buildPrograms "app" + ["build" "library"] + [".f90", ".f", ".F", ".F90", ".f95", ".f03"] + ("build" "app") + "gfortran" + ["-g", "-Wall", "-Wextra", "-Werror", "-pedantic"] getArguments :: IO Arguments getArguments = execParser -- cgit v1.2.3