jack2 codebase
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

58 lines
1.6KB

  1. #! /usr/bin/env python
  2. # encoding: utf-8
  3. # harald at klimachs.de
  4. import re
  5. from waflib import Utils
  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_nec')
  10. @conf
  11. def find_sxfc(conf):
  12. """Find the NEC fortran compiler (will look in the environment variable 'FC')"""
  13. fc = conf.find_program(['sxf90','sxf03'], var='FC')
  14. conf.get_sxfc_version(fc)
  15. conf.env.FC_NAME = 'NEC'
  16. conf.env.FC_MOD_CAPITALIZATION = 'lower'
  17. @conf
  18. def sxfc_flags(conf):
  19. v = conf.env
  20. v['_FCMODOUTFLAGS'] = [] # enable module files and put them in the current directoy
  21. v['FCFLAGS_DEBUG'] = [] # more verbose compiler warnings
  22. v['FCFLAGS_fcshlib'] = []
  23. v['LINKFLAGS_fcshlib'] = []
  24. v['FCSTLIB_MARKER'] = ''
  25. v['FCSHLIB_MARKER'] = ''
  26. @conf
  27. def get_sxfc_version(conf, fc):
  28. version_re = re.compile(r"FORTRAN90/SX\s*Version\s*(?P<major>\d*)\.(?P<minor>\d*)", re.I).search
  29. cmd = fc + ['-V']
  30. out,err = fc_config.getoutput(conf, cmd, stdin=False)
  31. if out: match = version_re(out)
  32. else: match = version_re(err)
  33. if not match:
  34. version_re=re.compile(r"NEC Fortran 2003 Compiler for\s*(?P<major>\S*)\s*\(c\)\s*(?P<minor>\d*)",re.I).search
  35. if out: match = version_re(out)
  36. else: match = version_re(err)
  37. if not match:
  38. conf.fatal('Could not determine the NEC Fortran compiler version.')
  39. k = match.groupdict()
  40. conf.env['FC_VERSION'] = (k['major'], k['minor'])
  41. def configure(conf):
  42. conf.find_sxfc()
  43. conf.find_program('sxar',var='AR')
  44. conf.add_os_flags('ARFLAGS')
  45. if not conf.env.ARFLAGS:
  46. conf.env.ARFLAGS=['rcs']
  47. conf.fc_flags()
  48. conf.fc_add_flags()
  49. conf.sxfc_flags()