3 # WARNING! Do not edit! https://waf.io/book/index.html#_obtaining_the_waf_file
8 # Thomas Nagy 2016-2018 (ita)
11 from waflib import Utils
12 from waflib.Tools import fc, fc_config, fc_scan, ar
13 from waflib.Configure import conf
17 fc = conf.find_program('g95', var='FC')
18 conf.get_g95_version(fc)
19 conf.env.FC_NAME = 'G95'
24 v.FCFLAGS_fcshlib = ['-fPIC']
25 v.FORTRANMODFLAG = ['-fmod=', ''] # template for module path
26 v.FCFLAGS_DEBUG = ['-Werror'] # why not
29 def g95_modifier_win32(conf):
30 fc_config.fortran_modifier_win32(conf)
33 def g95_modifier_cygwin(conf):
34 fc_config.fortran_modifier_cygwin(conf)
37 def g95_modifier_darwin(conf):
38 fc_config.fortran_modifier_darwin(conf)
41 def g95_modifier_platform(conf):
42 dest_os = conf.env.DEST_OS or Utils.unversioned_sys_platform()
43 g95_modifier_func = getattr(conf, 'g95_modifier_' + dest_os, None)
48 def get_g95_version(conf, fc):
49 """get the compiler version"""
51 version_re = re.compile(r"g95\s*(?P<major>\d*)\.(?P<minor>\d*)").search
52 cmd = fc + ['--version']
53 out, err = fc_config.getoutput(conf, cmd, stdin=False)
55 match = version_re(out)
57 match = version_re(err)
59 conf.fatal('cannot determine g95 version')
61 conf.env.FC_VERSION = (k['major'], k['minor'])
69 conf.g95_modifier_platform()