[pypy-svn] r18751 - pypy/dist/pypy/translator/tool

pedronis at codespeak.net pedronis at codespeak.net
Wed Oct 19 14:49:36 CEST 2005


Author: pedronis
Date: Wed Oct 19 14:49:34 2005
New Revision: 18751

Modified:
   pypy/dist/pypy/translator/tool/cbuild.py
Log:
specify -O2 for standalone on darwin too



Modified: pypy/dist/pypy/translator/tool/cbuild.py
==============================================================================
--- pypy/dist/pypy/translator/tool/cbuild.py	(original)
+++ pypy/dist/pypy/translator/tool/cbuild.py	Wed Oct 19 14:49:34 2005
@@ -258,17 +258,22 @@
                      libraries=[], library_dirs=None):
     from distutils.ccompiler import new_compiler 
     ext = ''
-    extra_preargs = None
+    compile_extra = []
+    link_extra = []
+
     if not include_dirs:
         include_dirs = []
     if not library_dirs:
         library_dirs = []
-    if not sys.platform in ('win32', 'darwin'): 
+    if not sys.platform in ('win32', 'darwin'): # xxx
         libraries.append('m')
         libraries.append('pthread')
-        extra_preargs = ['-O2', '-pthread']   # XXX 2 x hackish
+        compile_extra += ['-O2', '-pthread']
+        link_extra += ['-pthread']
     if sys.platform == 'darwin':
         include_dirs.append('/sw/include')
+        compile_extra += ['-O2']
+        
     if outputfilename is None:
         outputfilename = py.path.local(cfilenames[0]).new(ext=ext)
     else: 
@@ -286,7 +291,7 @@
         try: 
             res = compiler.compile([cfile.basename], 
                                    include_dirs=include_dirs,
-                                   extra_preargs=extra_preargs)
+                                   extra_preargs=compile_extra)
             assert len(res) == 1
             cobjfile = py.path.local(res[0]) 
             assert cobjfile.check()
@@ -295,8 +300,8 @@
             old.chdir() 
     compiler.link_executable(objects, str(outputfilename),
                              libraries=libraries,
-                             extra_preargs=extra_preargs,
-                            library_dirs=library_dirs)
+                             extra_preargs=link_extra,
+                             library_dirs=library_dirs)
     return str(outputfilename)
 
 def check_boehm_presence():



More information about the Pypy-commit mailing list