waf

FORK: waf with some random patches
git clone https://git.neptards.moe/neptards/waf.git
Log | Files | Refs | README

fc_fujitsu.py (1316B)


      1 #! /usr/bin/env python
      2 # encoding: utf-8
      3 # Detection of the Fujitsu Fortran compiler for ARM64FX
      4 
      5 import re
      6 from waflib.Tools import fc,fc_config,fc_scan
      7 from waflib.Configure import conf
      8 from waflib.Tools.compiler_fc import fc_compiler
      9 fc_compiler['linux'].append('fc_fujitsu')
     10 
     11 @conf
     12 def find_fujitsu(conf):
     13 	fc=conf.find_program(['frtpx'],var='FC')
     14 	conf.get_fujitsu_version(fc)
     15 	conf.env.FC_NAME='FUJITSU'
     16 	conf.env.FC_MOD_CAPITALIZATION='lower'
     17 
     18 @conf
     19 def fujitsu_flags(conf):
     20 	v=conf.env
     21 	v['_FCMODOUTFLAGS']=[]
     22 	v['FCFLAGS_DEBUG']=[]
     23 	v['FCFLAGS_fcshlib']=[]
     24 	v['LINKFLAGS_fcshlib']=[]
     25 	v['FCSTLIB_MARKER']=''
     26 	v['FCSHLIB_MARKER']=''
     27 
     28 @conf
     29 def get_fujitsu_version(conf,fc):
     30 	version_re=re.compile(r"frtpx\s*\(FRT\)\s*(?P<major>\d+)\.(?P<minor>\d+)\.",re.I).search
     31 	cmd=fc+['--version']
     32 	out,err=fc_config.getoutput(conf,cmd,stdin=False)
     33 	if out:
     34 		match=version_re(out)
     35 	else:
     36 		match=version_re(err)
     37 	if not match:
     38 		return(False)
     39 		conf.fatal('Could not determine the Fujitsu FRT Fortran compiler version.')
     40 	else:
     41 		k=match.groupdict()
     42 		conf.env['FC_VERSION']=(k['major'],k['minor'])
     43 
     44 def configure(conf):
     45 	conf.find_fujitsu()
     46 	conf.find_program('ar',var='AR')
     47 	conf.add_os_flags('ARFLAGS')
     48 	if not conf.env.ARFLAGS:
     49 		conf.env.ARFLAGS=['rcs']
     50 	conf.fc_flags()
     51 	conf.fc_add_flags()
     52 	conf.fujitsu_flags()