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.

60 lines
1.4KB

  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'].insert(0, 'fc_nag')
  10. @conf
  11. def find_nag(conf):
  12. """Find the NAG Fortran Compiler (will look in the environment variable 'FC')"""
  13. fc = conf.find_program(['nagfor'], var='FC')
  14. conf.get_nag_version(fc)
  15. conf.env.FC_NAME = 'NAG'
  16. conf.env.FC_MOD_CAPITALIZATION = 'lower'
  17. @conf
  18. def nag_flags(conf):
  19. v = conf.env
  20. v['FCFLAGS_DEBUG'] = ['-C=all']
  21. @conf
  22. def nag_modifier_platform(conf):
  23. dest_os = conf.env['DEST_OS'] or Utils.unversioned_sys_platform()
  24. nag_modifier_func = getattr(conf, 'nag_modifier_' + dest_os, None)
  25. if nag_modifier_func:
  26. nag_modifier_func()
  27. @conf
  28. def get_nag_version(conf, fc):
  29. """Get the NAG compiler version"""
  30. version_re = re.compile(r"^NAG Fortran Compiler *Release *(?P<major>\d*)\.(?P<minor>\d*)", re.M).search
  31. cmd = fc + ['-v']
  32. out, err = fc_config.getoutput(conf,cmd,stdin=False)
  33. if out:
  34. match = version_re(out)
  35. if not match:
  36. match = version_re(err)
  37. else: match = version_re(err)
  38. if not match:
  39. conf.fatal('Could not determine the NAG version.')
  40. k = match.groupdict()
  41. conf.env['FC_VERSION'] = (k['major'], k['minor'])
  42. def configure(conf):
  43. conf.find_nag()
  44. conf.find_ar()
  45. conf.fc_flags()
  46. conf.fc_add_flags()
  47. conf.nag_flags()
  48. conf.nag_modifier_platform()