aboutsummaryrefslogtreecommitdiff
path: root/bootstrap/src/Fpm.hs
diff options
context:
space:
mode:
authorBrad Richardson <everythingfunctional@protonmail.com>2020-12-09 14:10:50 -0600
committerBrad Richardson <everythingfunctional@protonmail.com>2020-12-09 14:10:50 -0600
commite27befb0031c5743e2ed30ec713a365e754c485d (patch)
tree63765c0f2dfb0a2c3907078c8d2d1d067ed8052f /bootstrap/src/Fpm.hs
parenta062554e80c3718881c1be8edb0e7220e37fbd23 (diff)
downloadfpm-e27befb0031c5743e2ed30ec713a365e754c485d.tar.gz
fpm-e27befb0031c5743e2ed30ec713a365e754c485d.zip
feat(bootstrap): Add support for same compilers as Fortran version
Diffstat (limited to 'bootstrap/src/Fpm.hs')
-rw-r--r--bootstrap/src/Fpm.hs181
1 files changed, 181 insertions, 0 deletions
diff --git a/bootstrap/src/Fpm.hs b/bootstrap/src/Fpm.hs
index 9fc1c91..294c77d 100644
--- a/bootstrap/src/Fpm.hs
+++ b/bootstrap/src/Fpm.hs
@@ -690,6 +690,187 @@ defineCompilerSettings specifiedFlags compiler release
, compilerSettingsModuleFlag = "-J"
, compilerSettingsIncludeFlag = "-I"
}
+ | "f95" `isInfixOf` compiler
+ = let flags = case specifiedFlags of
+ [] -> if release
+ then
+ [ "-O3"
+ , "-Wimplicit-interface"
+ , "-fPIC"
+ , "-fmax-errors=1"
+ , "-ffast-math"
+ , "-funroll-loops"
+ ]
+ else
+ [ "-Wall"
+ , "-Wextra"
+ , "-Wimplicit-interface"
+ , "-fPIC"
+ , "-fmax-errors=1"
+ , "-g"
+ , "-fbounds-check"
+ , "-fcheck-array-temporaries"
+ , "-Wno-maybe-uninitialized"
+ , "-Wno-uninitialized"
+ , "-fbacktrace"
+ ]
+ fs -> fs
+ in return $ CompilerSettings { compilerSettingsCompiler = compiler
+ , compilerSettingsFlags = flags
+ , compilerSettingsModuleFlag = "-J"
+ , compilerSettingsIncludeFlag = "-I"
+ }
+ | "nvfortran" `isInfixOf` compiler
+ = let flags = case specifiedFlags of
+ [] -> if release
+ then
+ [ "-Mbackslash"
+ ]
+ else
+ [ "-Minform=inform"
+ , "-Mbackslash"
+ , "-g"
+ , "-Mbounds"
+ , "-Mchkptr"
+ , "-Mchkstk"
+ , "-traceback"
+ ]
+ fs -> fs
+ in return $ CompilerSettings { compilerSettingsCompiler = compiler
+ , compilerSettingsFlags = flags
+ , compilerSettingsModuleFlag = "-module"
+ , compilerSettingsIncludeFlag = "-I"
+ }
+ | "ifort" `isInfixOf` compiler
+ = let flags = case specifiedFlags of
+ [] -> if release
+ then
+ [ "-fp-model precise"
+ , "-pc 64"
+ , "-align all"
+ , "-coarray"
+ , "-error-limit 1"
+ , "-reentrancy threaded"
+ , "-nogen-interfaces"
+ , "-assume byterecl"
+ , "-assume nounderscore"
+ ]
+ else
+ [ "-warn all"
+ , "-check:all:noarg_temp_created"
+ , "-coarray"
+ , "-error-limit 1"
+ , "-O0"
+ , "-g"
+ , "-assume byterecl"
+ , "-traceback"
+ ]
+ fs -> fs
+ in return $ CompilerSettings { compilerSettingsCompiler = compiler
+ , compilerSettingsFlags = flags
+ , compilerSettingsModuleFlag = "-module"
+ , compilerSettingsIncludeFlag = "-I"
+ }
+ | "ifx" `isInfixOf` compiler
+ = let flags = case specifiedFlags of
+ [] -> if release
+ then
+ []
+ else
+ []
+ fs -> fs
+ in return $ CompilerSettings { compilerSettingsCompiler = compiler
+ , compilerSettingsFlags = flags
+ , compilerSettingsModuleFlag = "-module"
+ , compilerSettingsIncludeFlag = "-I"
+ }
+ | "pgfortran" `isInfixOf` compiler || "pgf90" `isInfixOf` compiler || "pgf95" `isInfixOf` compiler
+ = let flags = case specifiedFlags of
+ [] -> if release
+ then
+ []
+ else
+ []
+ fs -> fs
+ in return $ CompilerSettings { compilerSettingsCompiler = compiler
+ , compilerSettingsFlags = flags
+ , compilerSettingsModuleFlag = "-module"
+ , compilerSettingsIncludeFlag = "-I"
+ }
+ | "flang" `isInfixOf` compiler
+ = let flags = case specifiedFlags of
+ [] -> if release
+ then
+ []
+ else
+ []
+ fs -> fs
+ in return $ CompilerSettings { compilerSettingsCompiler = compiler
+ , compilerSettingsFlags = flags
+ , compilerSettingsModuleFlag = "-module"
+ , compilerSettingsIncludeFlag = "-I"
+ }
+ | "lfc" `isInfixOf` compiler
+ = let flags = case specifiedFlags of
+ [] -> if release
+ then
+ []
+ else
+ []
+ fs -> fs
+ in return $ CompilerSettings { compilerSettingsCompiler = compiler
+ , compilerSettingsFlags = flags
+ , compilerSettingsModuleFlag = "-M"
+ , compilerSettingsIncludeFlag = "-I"
+ }
+ | "nagfor" `isInfixOf` compiler
+ = let flags = case specifiedFlags of
+ [] -> if release
+ then
+ [ "-O4"
+ , "-coarray=single"
+ , "-PIC"
+ ]
+ else
+ [ "-g"
+ , "-C=all"
+ , "-O0"
+ , "-gline"
+ , "-coarray=single"
+ , "-PIC"
+ ]
+ fs -> fs
+ in return $ CompilerSettings { compilerSettingsCompiler = compiler
+ , compilerSettingsFlags = flags
+ , compilerSettingsModuleFlag = "-mdir"
+ , compilerSettingsIncludeFlag = "-I"
+ }
+ | "crayftn" `isInfixOf` compiler
+ = let flags = case specifiedFlags of
+ [] -> if release
+ then
+ []
+ else
+ []
+ fs -> fs
+ in return $ CompilerSettings { compilerSettingsCompiler = compiler
+ , compilerSettingsFlags = flags
+ , compilerSettingsModuleFlag = "-J"
+ , compilerSettingsIncludeFlag = "-I"
+ }
+ | "xlf90" `isInfixOf` compiler
+ = let flags = case specifiedFlags of
+ [] -> if release
+ then
+ []
+ else
+ []
+ fs -> fs
+ in return $ CompilerSettings { compilerSettingsCompiler = compiler
+ , compilerSettingsFlags = flags
+ , compilerSettingsModuleFlag = "-qmoddir"
+ , compilerSettingsIncludeFlag = "-I"
+ }
| otherwise
= do
putStrLn $ "Sorry, compiler is currently unsupported: " ++ compiler