@@ -18,6 +18,7 @@ import Control.Monad.Extra ( concatMapM
18
18
)
19
19
import Data.Hashable ( hash )
20
20
import Data.List ( intercalate
21
+ , isInfixOf
21
22
, isSuffixOf
22
23
, find
23
24
, nub
@@ -590,33 +591,7 @@ toml2AppSettings tomlSettings args = do
590
591
(tomlSettingsExecutables tomlSettings)
591
592
projectName
592
593
testSettings <- getTestSettings $ tomlSettingsTests tomlSettings
593
- let flags = if compiler == " gfortran"
594
- then case specifiedFlags of
595
- [] -> if release
596
- then
597
- [ " -Wall"
598
- , " -Wextra"
599
- , " -Wimplicit-interface"
600
- , " -fPIC"
601
- , " -fmax-errors=1"
602
- , " -O3"
603
- , " -march=native"
604
- , " -ffast-math"
605
- , " -funroll-loops"
606
- ]
607
- else
608
- [ " -Wall"
609
- , " -Wextra"
610
- , " -Wimplicit-interface"
611
- , " -fPIC"
612
- , " -fmax-errors=1"
613
- , " -g"
614
- , " -fbounds-check"
615
- , " -fcheck-array-temporaries"
616
- , " -fbacktrace"
617
- ]
618
- flags -> flags
619
- else specifiedFlags
594
+ flags <- defineFlags specifiedFlags compiler release
620
595
buildPrefix <- makeBuildPrefix compiler flags
621
596
let dependencies = tomlSettingsDependencies tomlSettings
622
597
let devDependencies = tomlSettingsDevDependencies tomlSettings
@@ -631,6 +606,15 @@ toml2AppSettings tomlSettings args = do
631
606
, appSettingsDevDependencies = devDependencies
632
607
}
633
608
609
+ defineFlags :: [String ] -> FilePath -> Bool -> IO [String ]
610
+ defineFlags [] compiler release
611
+ | " gfortran" `isInfixOf` compiler = return $ if release then [ " -Wall" , " -Wextra" , " -Wimplicit-interface" , " -fPIC" , " -fmax-errors=1" , " -O3" , " -march=native" , " -ffast-math" , " -funroll-loops" ] else [ " -Wall" , " -Wextra" , " -Wimplicit-interface" , " -fPIC" , " -fmax-errors=1" , " -g" , " -fbounds-check" , " -fcheck-array-temporaries" , " -fbacktrace" ]
612
+ | " caf" `isInfixOf` compiler = return $ if release then [ " -Wall" , " -Wextra" , " -Wimplicit-interface" , " -fPIC" , " -fmax-errors=1" , " -O3" , " -march=native" , " -ffast-math" , " -funroll-loops" ] else [ " -Wall" , " -Wextra" , " -Wimplicit-interface" , " -fPIC" , " -fmax-errors=1" , " -g" , " -fbounds-check" , " -fcheck-array-temporaries" , " -fbacktrace" ]
613
+ | otherwise = do
614
+ putStrLn $ " Sorry, compiler is currently unsupported: " ++ compiler
615
+ exitWith (ExitFailure 1 )
616
+ defineFlags specifiedFlags _ _ = return specifiedFlags
617
+
634
618
getLibrarySettings :: Maybe Library -> IO (Maybe Library )
635
619
getLibrarySettings maybeSettings = case maybeSettings of
636
620
Just settings -> return maybeSettings
0 commit comments