|
Lines 146-154
def customize_compiler(compiler):
|
Link Here
|
|---|
|
varies across Unices and is stored in Python's Makefile. | varies across Unices and is stored in Python's Makefile. |
""" | """ |
if compiler.compiler_type == "unix": | if compiler.compiler_type == "unix": |
(cc, cxx, opt, cflags, ccshared, ldshared, so_ext) = \ |
(cc, cxx, opt, cflags, ccshared, ldshared, so_ext, cxxflags) = ( |
get_config_vars('CC', 'CXX', 'OPT', 'CFLAGS', |
get_config_vars('CC', 'CXX', 'OPT', 'CFLAGS', 'CCSHARED', |
'CCSHARED', 'LDSHARED', 'SO') |
'LDSHARED', 'SO', 'CXXFLAGS')) |
| |
if os.environ.has_key('CC'): | if os.environ.has_key('CC'): |
cc = os.environ['CC'] | cc = os.environ['CC'] |
|
Lines 169-181
def customize_compiler(compiler):
|
Link Here
|
|---|
|
cpp = cpp + ' ' + os.environ['CPPFLAGS'] | cpp = cpp + ' ' + os.environ['CPPFLAGS'] |
cflags = cflags + ' ' + os.environ['CPPFLAGS'] | cflags = cflags + ' ' + os.environ['CPPFLAGS'] |
ldshared = ldshared + ' ' + os.environ['CPPFLAGS'] | ldshared = ldshared + ' ' + os.environ['CPPFLAGS'] |
|
if os.environ.has_key('CXXFLAGS'): |
|
cxxflags = opt + ' ' + os.environ['CXXFLAGS'] |
| |
cc_cmd = cc + ' ' + cflags | cc_cmd = cc + ' ' + cflags |
|
cxx_cmd = cxx + ' ' + cxxflags |
compiler.set_executables( | compiler.set_executables( |
preprocessor=cpp, | preprocessor=cpp, |
compiler=cc_cmd, | compiler=cc_cmd, |
compiler_so=cc_cmd + ' ' + ccshared, | compiler_so=cc_cmd + ' ' + ccshared, |
compiler_cxx=cxx, |
compiler_cxx=cxx_cmd, |
|
compiler_cxx_so=cxx_cmd + ' ' + ccshared, |
linker_so=ldshared, | linker_so=ldshared, |
linker_exe=cc) | linker_exe=cc) |
| |
|
Lines 512-517
def get_config_vars(*args):
|
Link Here
|
|---|
|
for key in ('LDFLAGS', 'BASECFLAGS', | for key in ('LDFLAGS', 'BASECFLAGS', |
# a number of derived variables. These need to be | # a number of derived variables. These need to be |
# patched up as well. | # patched up as well. |
|
'CXXFLAGS', |
'CFLAGS', 'PY_CFLAGS', 'BLDSHARED'): | 'CFLAGS', 'PY_CFLAGS', 'BLDSHARED'): |
| |
flags = _config_vars[key] | flags = _config_vars[key] |
|
Lines 114-119
class UnixCCompiler(CCompiler):
|
Link Here
|
|---|
|
'compiler' : ["cc"], | 'compiler' : ["cc"], |
'compiler_so' : ["cc"], | 'compiler_so' : ["cc"], |
'compiler_cxx' : ["cc"], | 'compiler_cxx' : ["cc"], |
|
'compiler_cxx_so' : ["cc"], |
'linker_so' : ["cc", "-shared"], | 'linker_so' : ["cc", "-shared"], |
'linker_exe' : ["cc"], | 'linker_exe' : ["cc"], |
'archiver' : ["ar", "-cr"], | 'archiver' : ["ar", "-cr"], |
|
Lines 167-176
class UnixCCompiler(CCompiler):
|
Link Here
|
|---|
|
| |
def _compile(self, obj, src, ext, cc_args, extra_postargs, pp_opts): | def _compile(self, obj, src, ext, cc_args, extra_postargs, pp_opts): |
compiler_so = self.compiler_so | compiler_so = self.compiler_so |
|
compiler_cxx_so = self.compiler_cxx_so |
if sys.platform == 'darwin': | if sys.platform == 'darwin': |
compiler_so = _darwin_compiler_fixup(compiler_so, cc_args + extra_postargs) | compiler_so = _darwin_compiler_fixup(compiler_so, cc_args + extra_postargs) |
try: | try: |
self.spawn(compiler_so + cc_args + [src, '-o', obj] + |
if ext == '.c' or ext == '.m': |
|
cc = compiler_so + cc_args |
|
else: |
|
cc = compiler_cxx_so + cc_args |
|
self.spawn(cc + cc_args + [src, '-o', obj] + |
extra_postargs) | extra_postargs) |
except DistutilsExecError, msg: | except DistutilsExecError, msg: |
raise CompileError, msg | raise CompileError, msg |