3 # WARNING! Do not edit! https://waf.io/book/index.html#_obtaining_the_waf_file
7 # harald at klimachs.de
10 from waflib.Tools import fc, fc_config, fc_scan
11 from waflib.Configure import conf
13 from waflib.Tools.compiler_fc import fc_compiler
14 fc_compiler['linux'].append('fc_cray')
17 def find_crayftn(conf):
18 """Find the Cray fortran compiler (will look in the environment variable 'FC')"""
19 fc = conf.find_program(['crayftn'], var='FC')
20 conf.get_crayftn_version(fc)
21 conf.env.FC_NAME = 'CRAY'
22 conf.env.FC_MOD_CAPITALIZATION = 'UPPER.mod'
25 def crayftn_flags(conf):
27 v['_FCMODOUTFLAGS'] = ['-em', '-J.'] # enable module files and put them in the current directoy
28 v['FCFLAGS_DEBUG'] = ['-m1'] # more verbose compiler warnings
29 v['FCFLAGS_fcshlib'] = ['-h pic']
30 v['LINKFLAGS_fcshlib'] = ['-h shared']
32 v['FCSTLIB_MARKER'] = '-h static'
33 v['FCSHLIB_MARKER'] = '-h dynamic'
36 def get_crayftn_version(conf, fc):
37 version_re = re.compile(r"Cray Fortran\s*:\s*Version\s*(?P<major>\d*)\.(?P<minor>\d*)", re.I).search
39 out,err = fc_config.getoutput(conf, cmd, stdin=False)
41 match = version_re(out)
43 match = version_re(err)
45 conf.fatal('Could not determine the Cray Fortran compiler version.')
47 conf.env['FC_VERSION'] = (k['major'], k['minor'])