3 # WARNING! Do not edit! https://waf.io/book/index.html#_obtaining_the_waf_file
7 # harald at klimachs.de
10 from waflib import Utils
11 from waflib.Tools import fc,fc_config,fc_scan
12 from waflib.Configure import conf
14 from waflib.Tools.compiler_fc import fc_compiler
15 fc_compiler['linux'].insert(0, 'fc_nag')
19 """Find the NAG Fortran Compiler (will look in the environment variable 'FC')"""
21 fc = conf.find_program(['nagfor'], var='FC')
22 conf.get_nag_version(fc)
23 conf.env.FC_NAME = 'NAG'
24 conf.env.FC_MOD_CAPITALIZATION = 'lower'
29 v.FCFLAGS_DEBUG = ['-C=all']
30 v.FCLNK_TGT_F = ['-o', '']
31 v.FC_TGT_F = ['-c', '-o', '']
34 def nag_modifier_platform(conf):
35 dest_os = conf.env['DEST_OS'] or Utils.unversioned_sys_platform()
36 nag_modifier_func = getattr(conf, 'nag_modifier_' + dest_os, None)
41 def get_nag_version(conf, fc):
42 """Get the NAG compiler version"""
44 version_re = re.compile(r"^NAG Fortran Compiler *Release *(?P<major>\d*)\.(?P<minor>\d*)", re.M).search
47 out, err = fc_config.getoutput(conf,cmd,stdin=False)
49 match = version_re(out)
51 match = version_re(err)
52 else: match = version_re(err)
54 conf.fatal('Could not determine the NAG version.')
56 conf.env['FC_VERSION'] = (k['major'], k['minor'])
64 conf.nag_modifier_platform()