akmhoque | fa8ee9b | 2014-03-14 09:06:24 -0500 | [diff] [blame^] | 1 | #! /usr/bin/env python |
| 2 | # encoding: utf-8 |
| 3 | # WARNING! Do not edit! http://waf.googlecode.com/git/docs/wafbook/single.html#_obtaining_the_waf_file |
| 4 | |
| 5 | import re |
| 6 | from waflib import Utils |
| 7 | from waflib.Tools import fc,fc_config,fc_scan,ar |
| 8 | from waflib.Configure import conf |
| 9 | @conf |
| 10 | def find_g95(conf): |
| 11 | fc=conf.find_program('g95',var='FC') |
| 12 | fc=conf.cmd_to_list(fc) |
| 13 | conf.get_g95_version(fc) |
| 14 | conf.env.FC_NAME='G95' |
| 15 | @conf |
| 16 | def g95_flags(conf): |
| 17 | v=conf.env |
| 18 | v['FCFLAGS_fcshlib']=['-fPIC'] |
| 19 | v['FORTRANMODFLAG']=['-fmod=',''] |
| 20 | v['FCFLAGS_DEBUG']=['-Werror'] |
| 21 | @conf |
| 22 | def g95_modifier_win32(conf): |
| 23 | fc_config.fortran_modifier_win32(conf) |
| 24 | @conf |
| 25 | def g95_modifier_cygwin(conf): |
| 26 | fc_config.fortran_modifier_cygwin(conf) |
| 27 | @conf |
| 28 | def g95_modifier_darwin(conf): |
| 29 | fc_config.fortran_modifier_darwin(conf) |
| 30 | @conf |
| 31 | def g95_modifier_platform(conf): |
| 32 | dest_os=conf.env['DEST_OS']or Utils.unversioned_sys_platform() |
| 33 | g95_modifier_func=getattr(conf,'g95_modifier_'+dest_os,None) |
| 34 | if g95_modifier_func: |
| 35 | g95_modifier_func() |
| 36 | @conf |
| 37 | def get_g95_version(conf,fc): |
| 38 | version_re=re.compile(r"g95\s*(?P<major>\d*)\.(?P<minor>\d*)").search |
| 39 | cmd=fc+['--version'] |
| 40 | out,err=fc_config.getoutput(conf,cmd,stdin=False) |
| 41 | if out: |
| 42 | match=version_re(out) |
| 43 | else: |
| 44 | match=version_re(err) |
| 45 | if not match: |
| 46 | conf.fatal('cannot determine g95 version') |
| 47 | k=match.groupdict() |
| 48 | conf.env['FC_VERSION']=(k['major'],k['minor']) |
| 49 | def configure(conf): |
| 50 | conf.find_g95() |
| 51 | conf.find_ar() |
| 52 | conf.fc_flags() |
| 53 | conf.fc_add_flags() |
| 54 | conf.g95_flags() |
| 55 | conf.g95_modifier_platform() |