OLD | NEW |
1 #!/usr/bin/python | 1 #!/usr/bin/python |
2 # Copyright (c) 2011 The Native Client Authors. All rights reserved. | 2 # Copyright (c) 2011 The Native Client Authors. All rights reserved. |
3 # Use of this source code is governed by a BSD-style license that can be | 3 # Use of this source code is governed by a BSD-style license that can be |
4 # found in the LICENSE file. | 4 # found in the LICENSE file. |
5 | 5 |
6 """Nacl SDK tool SCons.""" | 6 """Nacl SDK tool SCons.""" |
7 | 7 |
8 import __builtin__ | 8 import __builtin__ |
9 import re | 9 import re |
10 import os | 10 import os |
(...skipping 197 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
208 env.AppendUnique(SHCCFLAGS=['-fPIC'], | 208 env.AppendUnique(SHCCFLAGS=['-fPIC'], |
209 ) | 209 ) |
210 | 210 |
211 def _SetEnvForPnacl(env, root): | 211 def _SetEnvForPnacl(env, root): |
212 arch = env['TARGET_FULLARCH'] | 212 arch = env['TARGET_FULLARCH'] |
213 assert arch in ['arm', 'x86-32', 'x86-64'] | 213 assert arch in ['arm', 'x86-32', 'x86-64'] |
214 | 214 |
215 arch_flag = ' -arch %s' % arch | 215 arch_flag = ' -arch %s' % arch |
216 | 216 |
217 binprefix = os.path.join(root, 'bin', 'pnacl-') | 217 binprefix = os.path.join(root, 'bin', 'pnacl-') |
| 218 binext = '' |
| 219 if env.Bit('host_windows'): |
| 220 binext = '.bat' |
218 | 221 |
219 pnacl_lib = os.path.join(root, 'lib') | 222 pnacl_lib = os.path.join(root, 'lib') |
220 pnacl_lib_arch = os.path.join(root, 'lib-%s' % arch) | 223 pnacl_lib_arch = os.path.join(root, 'lib-%s' % arch) |
221 | 224 |
222 #TODO(robertm): remove NACL_SDK_INCLUDE ASAP | 225 #TODO(robertm): remove NACL_SDK_INCLUDE ASAP |
223 pnacl_include = os.path.join(root, 'sysroot', 'include') | 226 pnacl_include = os.path.join(root, 'sysroot', 'include') |
224 pnacl_ar = binprefix + 'ar' | 227 pnacl_ar = binprefix + 'ar' + binext |
225 pnacl_nm = binprefix + 'nm' | 228 pnacl_nm = binprefix + 'nm' + binext |
226 pnacl_ranlib = binprefix + 'ranlib' | 229 pnacl_ranlib = binprefix + 'ranlib' + binext |
227 | 230 |
228 pnacl_cc = binprefix + 'gcc' | 231 pnacl_cc = binprefix + 'gcc' + binext |
229 pnacl_cxx = binprefix + 'g++' | 232 pnacl_cxx = binprefix + 'g++' + binext |
230 pnacl_ld = binprefix + 'ld' | 233 pnacl_ld = binprefix + 'ld' + binext |
231 pnacl_disass = binprefix + 'dis' | 234 pnacl_disass = binprefix + 'dis' + binext |
232 pnacl_strip = binprefix + 'strip' | 235 pnacl_strip = binprefix + 'strip' + binext |
233 | 236 |
234 # NOTE: XXX_flags start with space for easy concatenation | 237 # NOTE: XXX_flags start with space for easy concatenation |
235 # The flags generated here get baked into the commands (CC, CXX, LINK) | 238 # The flags generated here get baked into the commands (CC, CXX, LINK) |
236 # instead of CFLAGS etc to keep them from getting blown away by some | 239 # instead of CFLAGS etc to keep them from getting blown away by some |
237 # tests. Don't add flags here unless they always need to be preserved. | 240 # tests. Don't add flags here unless they always need to be preserved. |
238 pnacl_cxx_flags = '' | 241 pnacl_cxx_flags = '' |
239 pnacl_cc_flags = ' -std=gnu99' | 242 pnacl_cc_flags = ' -std=gnu99' |
240 pnacl_cc_native_flags = ' -std=gnu99' + arch_flag | 243 pnacl_cc_native_flags = ' -std=gnu99' + arch_flag |
241 pnacl_ld_flags = ' ' + ' '.join(env['PNACL_BCLDFLAGS']) | 244 pnacl_ld_flags = ' ' + ' '.join(env['PNACL_BCLDFLAGS']) |
242 | 245 |
(...skipping 244 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
487 # Dependency files it produces are to be found in ${LIBPATH}. | 490 # Dependency files it produces are to be found in ${LIBPATH}. |
488 # It is applied recursively to those dependencies in case | 491 # It is applied recursively to those dependencies in case |
489 # some of them are linker scripts too. | 492 # some of them are linker scripts too. |
490 ldscript_scanner = SCons.Scanner.Base( | 493 ldscript_scanner = SCons.Scanner.Base( |
491 function=ScanLinkerScript, | 494 function=ScanLinkerScript, |
492 skeys=['.a', '.so'], | 495 skeys=['.a', '.so'], |
493 path_function=SCons.Scanner.FindPathDirs('LIBPATH'), | 496 path_function=SCons.Scanner.FindPathDirs('LIBPATH'), |
494 recursive=True | 497 recursive=True |
495 ) | 498 ) |
496 env.Append(SCANNERS=ldscript_scanner) | 499 env.Append(SCANNERS=ldscript_scanner) |
OLD | NEW |