import tempfile xlf_cfg = '/etc/opt/ibmcmp/xlf/%s/xlf.cfg' % version new_cfg = tempfile.mktemp() + '_xlf.cfg' log.info('Creating ' + new_cfg) fi = open(xlf_cfg, 'r') fo = open(new_cfg, 'w') crt1_match = re.compile( r'\s*crt\s*[=]\s*(?P<path>.*)/crt1.o').match for line in fi.readlines(): m = crt1_match(line) if m: fo.write('crt = %s/bundle1.o\n' % (m.group('path'))) else: fo.write(line) fi.close() fo.close() opt.append('-F' + new_cfg) return opt def get_flags_opt(self): return ['-O5'] if __name__ == '__main__': from distutils import log log.set_verbosity(2) from fcompiler import new_fcompiler compiler = new_fcompiler(compiler='ibm') compiler.customize() print compiler.get_version()
'linker_so': ["f95"], 'archiver': ["ar", "-cr"], 'ranlib': ["ranlib"] } def get_flags_linker_so(self): if sys.platform == 'darwin': return [ '-unsharedf95', '-Wl,-bundle,-flat_namespace,-undefined,suppress' ] return ["-Wl,shared"] def get_flags_opt(self): return ['-O4'] def get_flags_arch(self): return ['-target=native'] def get_flags_debug(self): return ['-g', '-gline', '-g90', '-nan', '-C'] if __name__ == '__main__': from distutils import log log.set_verbosity(2) from fcompiler import new_fcompiler compiler = new_fcompiler(compiler='nag') compiler.customize() print compiler.get_version()
module_dir_switch = None #XXX Fix me module_include_switch = None #XXX Fix me def get_flags_opt(self): return ['-O'] def get_flags_debug(self): return ['-g', '--chk', '--chkglobal'] def get_library_dirs(self): opt = [] d = os.environ.get('LAHEY') if d: opt.append(os.path.join(d, 'lib')) return opt def get_libraries(self): opt = [] opt.extend(['fj9f6', 'fj9i6', 'fj9ipp', 'fj9e6']) return opt if __name__ == '__main__': from distutils import log log.set_verbosity(2) from fcompiler import new_fcompiler compiler = new_fcompiler(compiler='lahey') compiler.customize() print compiler.get_version()
'linker_so': ['DF'], 'archiver': [ar_exe, "/OUT:"], 'ranlib': None } def get_flags(self): return [ '/nologo', '/MD', '/WX', '/iface=(cref,nomixed_str_len_arg)', '/names:lowercase', '/assume:underscore' ] def get_flags_opt(self): return [ '/Ox', '/fast', '/optimize:5', '/unroll:0', '/math_library:fast' ] def get_flags_arch(self): return ['/threads'] def get_flags_debug(self): return ['/debug'] if __name__ == '__main__': from distutils import log log.set_verbosity(2) from fcompiler import new_fcompiler compiler = new_fcompiler(compiler='compaq') compiler.customize() print compiler.get_version()
opt = [] for a in '19 20 21 22_4k 22_5k 24 25 26 27 28 30 32_5k 32_10k'.split(): if getattr(cpu, 'is_IP%s' % a)(): opt.append('-TARG:platform=IP%s' % a) break return opt def get_flags_arch_f77(self): r = None if cpu.is_r10000(): r = 10000 elif cpu.is_r12000(): r = 12000 elif cpu.is_r8000(): r = 8000 elif cpu.is_r5000(): r = 5000 elif cpu.is_r4000(): r = 4000 if r is not None: return ['r%s' % (r)] return [] def get_flags_arch_f90(self): r = self.get_flags_arch_f77() if r: r[0] = '-' + r[0] return r if __name__ == '__main__': from fcompiler import new_fcompiler compiler = new_fcompiler(compiler='mips') compiler.customize() print compiler.get_version()
opt.extend([ "-YCFRL=1", "-YCOM_NAMES=LCS", "-YCOM_PFX", "-YEXT_PFX", "-YCOM_SFX=_", "-YEXT_SFX=_", "-YEXT_NAMES=LCS" ]) if self.get_version(): if self.get_version() > '4.6': opt.extend(["-YDEALLOC=ALL"]) return opt def get_flags_fix(self): opt = FCompiler.get_flags_fix(self) opt.extend([ "-YCFRL=1", "-YCOM_NAMES=LCS", "-YCOM_PFX", "-YEXT_PFX", "-YCOM_SFX=_", "-YEXT_SFX=_", "-YEXT_NAMES=LCS" ]) opt.extend(["-f", "fixed"]) return opt def get_flags_opt(self): opt = ['-O'] return opt if __name__ == '__main__': from distutils import log log.set_verbosity(2) from fcompiler import new_fcompiler compiler = new_fcompiler(compiler='absoft') compiler.customize() print compiler.get_version()
'version_cmd': ["pgf77", "-V 2>/dev/null"], 'compiler_f77': ["pgf77"], 'compiler_fix': ["pgf90", "-Mfixed"], 'compiler_f90': ["pgf90"], 'linker_so': ["pgf90", "-shared", "-fpic"], 'archiver': ["ar", "-cr"], 'ranlib': ["ranlib"] } pic_flags = ['-fpic'] module_dir_switch = '-module ' module_include_switch = '-I' def get_flags(self): opt = ['-Minform=inform', '-Mnosecond_underscore'] return self.pic_flags + opt def get_flags_opt(self): return ['-fast'] def get_flags_debug(self): return ['-g'] if __name__ == '__main__': from distutils import log log.set_verbosity(2) from fcompiler import new_fcompiler compiler = new_fcompiler(compiler='pg') compiler.customize() print compiler.get_version()
class IntelItaniumVisualFCompiler(IntelVisualFCompiler): compiler_type = 'intelev' version_pattern = r'Intel\(R\) Fortran 90 Compiler Itanium\(TM\) Compiler'\ ' for the Itanium\(TM\)-based applications,'\ ' Version (?P<version>[^\s*]*)' fc_exe = 'efl' # XXX this is a wild guess ar_exe = IntelVisualFCompiler.ar_exe executables = { 'version_cmd' : [fc_exe, "-FI -V -c %(fname)s.f -o %(fname)s.o" \ % {'fname':dummy_fortran_file()}], 'compiler_f77' : [fc_exe,"-FI","-w90","-w95"], 'compiler_fix' : [fc_exe,"-FI","-4L72","-w"], 'compiler_f90' : [fc_exe], 'linker_so' : [fc_exe,"-shared"], 'archiver' : [ar_exe, "/verbose", "/OUT:"], 'ranlib' : None } if __name__ == '__main__': from distutils import log log.set_verbosity(2) from fcompiler import new_fcompiler compiler = new_fcompiler(compiler='intel') compiler.customize() print compiler.get_version()
executables = { 'version_cmd' : ["f90", "+version"], 'compiler_f77' : ["f90"], 'compiler_fix' : ["f90"], 'compiler_f90' : ["f90"], 'linker_so' : None, 'archiver' : ["ar", "-cr"], 'ranlib' : ["ranlib"] } module_dir_switch = None #XXX: fix me module_include_switch = None #XXX: fix me pic_flags = ['+pic=long'] def get_flags(self): return self.pic_flags + ['+ppu'] def get_flags_opt(self): return ['-O3'] def get_libraries(self): return ['m'] def get_version(self, force=0, ok_status=[256,0]): # XXX status==256 may indicate 'unrecognized option' or # 'no input file'. So, version_cmd needs more work. return FCompiler.get_version(self,force,ok_status) if __name__ == '__main__': from distutils import log log.set_verbosity(10) from fcompiler import new_fcompiler compiler = new_fcompiler(compiler='hpux') compiler.customize() print compiler.get_version()
'archiver' : ["ar", "-cr"], 'ranlib' : ["ranlib"] } module_dir_switch = '-moddir=' module_include_switch = '-M' pic_flags = ['-xcode=pic32'] def get_flags_f77(self): ret = ["-ftrap=%none"] if (self.get_version() or '') >= '7': ret.append("-f77") else: ret.append("-fixed") return ret def get_opt(self): return ['-fast','-dalign'] def get_arch(self): return ['-xtarget=generic'] def get_libraries(self): opt = [] opt.extend(['fsu','sunmath','mvec','f77compat']) return opt if __name__ == '__main__': from scipy_distutils import log log.set_verbosity(2) from fcompiler import new_fcompiler compiler = new_fcompiler(compiler='sun') compiler.customize() print compiler.get_version()