| OLD | NEW |
| 1 #!/usr/bin/python | 1 #!/usr/bin/python |
| 2 # Copyright (c) 2011 The Native Client Authors. All rights reserved. | 2 # Copyright (c) 2012 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 |
| 11 import shutil | 11 import shutil |
| 12 import sys | 12 import sys |
| (...skipping 234 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 247 pnacl_cc = binprefix + 'dgcc' + binext | 247 pnacl_cc = binprefix + 'dgcc' + binext |
| 248 pnacl_cxx = binprefix + 'dg++' + binext | 248 pnacl_cxx = binprefix + 'dg++' + binext |
| 249 else: | 249 else: |
| 250 print "Unknown frontend" | 250 print "Unknown frontend" |
| 251 sys.exit(-1) | 251 sys.exit(-1) |
| 252 | 252 |
| 253 pnacl_ld = binprefix + 'ld' + binext | 253 pnacl_ld = binprefix + 'ld' + binext |
| 254 pnacl_nativeld = binprefix + 'nativeld' + binext | 254 pnacl_nativeld = binprefix + 'nativeld' + binext |
| 255 pnacl_disass = binprefix + 'dis' + binext | 255 pnacl_disass = binprefix + 'dis' + binext |
| 256 pnacl_strip = binprefix + 'strip' + binext | 256 pnacl_strip = binprefix + 'strip' + binext |
| 257 pnacl_readmeta = binprefix + 'meta' + binext |
| 257 | 258 |
| 258 # NOTE: XXX_flags start with space for easy concatenation | 259 # NOTE: XXX_flags start with space for easy concatenation |
| 259 # The flags generated here get baked into the commands (CC, CXX, LINK) | 260 # The flags generated here get baked into the commands (CC, CXX, LINK) |
| 260 # instead of CFLAGS etc to keep them from getting blown away by some | 261 # instead of CFLAGS etc to keep them from getting blown away by some |
| 261 # tests. Don't add flags here unless they always need to be preserved. | 262 # tests. Don't add flags here unless they always need to be preserved. |
| 262 pnacl_cxx_flags = '' | 263 pnacl_cxx_flags = '' |
| 263 pnacl_cc_flags = ' -std=gnu99' | 264 pnacl_cc_flags = ' -std=gnu99' |
| 264 pnacl_cc_native_flags = ' -std=gnu99' + arch_flag | 265 pnacl_cc_native_flags = ' -std=gnu99' + arch_flag |
| 265 pnacl_ld_flags = ' ' + ' '.join(env['PNACL_BCLDFLAGS']) | 266 pnacl_ld_flags = ' ' + ' '.join(env['PNACL_BCLDFLAGS']) |
| 266 | 267 |
| (...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 298 # with shared libraries except use them with the toolchain. | 299 # with shared libraries except use them with the toolchain. |
| 299 SHLINK=pnacl_cxx + arch_flag + pnacl_ld_flags, | 300 SHLINK=pnacl_cxx + arch_flag + pnacl_ld_flags, |
| 300 LD=pnacl_ld, | 301 LD=pnacl_ld, |
| 301 NATIVELD=pnacl_nativeld, | 302 NATIVELD=pnacl_nativeld, |
| 302 AR=pnacl_ar, | 303 AR=pnacl_ar, |
| 303 AS=pnacl_as + arch_flag, | 304 AS=pnacl_as + arch_flag, |
| 304 RANLIB=pnacl_ranlib, | 305 RANLIB=pnacl_ranlib, |
| 305 DISASS=pnacl_disass, | 306 DISASS=pnacl_disass, |
| 306 OBJDUMP=pnacl_disass, | 307 OBJDUMP=pnacl_disass, |
| 307 STRIP=pnacl_strip, | 308 STRIP=pnacl_strip, |
| 309 READMETA=pnacl_readmeta, |
| 308 ) | 310 ) |
| 309 | 311 |
| 310 | 312 |
| 311 def _SetEnvForSdkManually(env): | 313 def _SetEnvForSdkManually(env): |
| 312 def GetEnvOrDummy(v): | 314 def GetEnvOrDummy(v): |
| 313 return os.getenv('NACL_SDK_' + v, 'MISSING_SDK_' + v) | 315 return os.getenv('NACL_SDK_' + v, 'MISSING_SDK_' + v) |
| 314 | 316 |
| 315 env.Replace(# Replace header and lib paths. | 317 env.Replace(# Replace header and lib paths. |
| 316 NACL_SDK_INCLUDE=GetEnvOrDummy('INCLUDE'), | 318 NACL_SDK_INCLUDE=GetEnvOrDummy('INCLUDE'), |
| 317 NACL_SDK_LIB=GetEnvOrDummy('LIB'), | 319 NACL_SDK_LIB=GetEnvOrDummy('LIB'), |
| (...skipping 244 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 562 # Dependency files it produces are to be found in ${LIBPATH}. | 564 # Dependency files it produces are to be found in ${LIBPATH}. |
| 563 # It is applied recursively to those dependencies in case | 565 # It is applied recursively to those dependencies in case |
| 564 # some of them are linker scripts too. | 566 # some of them are linker scripts too. |
| 565 ldscript_scanner = SCons.Scanner.Base( | 567 ldscript_scanner = SCons.Scanner.Base( |
| 566 function=ScanLinkerScript, | 568 function=ScanLinkerScript, |
| 567 skeys=['.a', '.so', '.pso'], | 569 skeys=['.a', '.so', '.pso'], |
| 568 path_function=SCons.Scanner.FindPathDirs('LIBPATH'), | 570 path_function=SCons.Scanner.FindPathDirs('LIBPATH'), |
| 569 recursive=True | 571 recursive=True |
| 570 ) | 572 ) |
| 571 env.Append(SCANNERS=ldscript_scanner) | 573 env.Append(SCANNERS=ldscript_scanner) |
| OLD | NEW |