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