4 # Thomas Nagy 2016-2018 (ita)
7 from waflib
import Utils
8 from waflib
.Tools
import fc
, fc_config
, fc_scan
, ar
9 from waflib
.Configure
import conf
13 fc
= conf
.find_program('g95', var
='FC')
14 conf
.get_g95_version(fc
)
15 conf
.env
.FC_NAME
= 'G95'
20 v
.FCFLAGS_fcshlib
= ['-fPIC']
21 v
.FORTRANMODFLAG
= ['-fmod=', ''] # template for module path
22 v
.FCFLAGS_DEBUG
= ['-Werror'] # why not
25 def g95_modifier_win32(conf
):
26 fc_config
.fortran_modifier_win32(conf
)
29 def g95_modifier_cygwin(conf
):
30 fc_config
.fortran_modifier_cygwin(conf
)
33 def g95_modifier_darwin(conf
):
34 fc_config
.fortran_modifier_darwin(conf
)
37 def g95_modifier_platform(conf
):
38 dest_os
= conf
.env
.DEST_OS
or Utils
.unversioned_sys_platform()
39 g95_modifier_func
= getattr(conf
, 'g95_modifier_' + dest_os
, None)
44 def get_g95_version(conf
, fc
):
45 """get the compiler version"""
47 version_re
= re
.compile(r
"g95\s*(?P<major>\d*)\.(?P<minor>\d*)").search
48 cmd
= fc
+ ['--version']
49 out
, err
= fc_config
.getoutput(conf
, cmd
, stdin
=False)
51 match
= version_re(out
)
53 match
= version_re(err
)
55 conf
.fatal('cannot determine g95 version')
57 conf
.env
.FC_VERSION
= (k
['major'], k
['minor'])
65 conf
.g95_modifier_platform()