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.

51 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'].append('fc_cray')
  10. @conf
  11. def find_crayftn(conf):
  12. """Find the Cray fortran compiler (will look in the environment variable 'FC')"""
  13. fc = conf.find_program(['crayftn'], var='FC')
  14. conf.get_crayftn_version(fc)
  15. conf.env.FC_NAME = 'CRAY'
  16. conf.env.FC_MOD_CAPITALIZATION = 'UPPER.mod'
  17. @conf
  18. def crayftn_flags(conf):
  19. v = conf.env
  20. v['_FCMODOUTFLAGS'] = ['-em', '-J.'] # enable module files and put them in the current directoy
  21. v['FCFLAGS_DEBUG'] = ['-m1'] # more verbose compiler warnings
  22. v['FCFLAGS_fcshlib'] = ['-h pic']
  23. v['LINKFLAGS_fcshlib'] = ['-h shared']
  24. v['FCSTLIB_MARKER'] = '-h static'
  25. v['FCSHLIB_MARKER'] = '-h dynamic'
  26. @conf
  27. def get_crayftn_version(conf, fc):
  28. version_re = re.compile(r"Cray Fortran\s*:\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. conf.fatal('Could not determine the Cray Fortran compiler version.')
  35. k = match.groupdict()
  36. conf.env['FC_VERSION'] = (k['major'], k['minor'])
  37. def configure(conf):
  38. conf.find_crayftn()
  39. conf.find_ar()
  40. conf.fc_flags()
  41. conf.fc_add_flags()
  42. conf.crayftn_flags()