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 331 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
342 # Get an environment for nacl-gcc when in PNaCl mode. | 342 # Get an environment for nacl-gcc when in PNaCl mode. |
343 def PNaClGetNNaClEnv(env): | 343 def PNaClGetNNaClEnv(env): |
344 assert(env.Bit('bitcode')) | 344 assert(env.Bit('bitcode')) |
345 assert(not env.Bit('target_arm')) | 345 assert(not env.Bit('target_arm')) |
346 | 346 |
347 # This is kind of a hack. We clone the environment, | 347 # This is kind of a hack. We clone the environment, |
348 # clear the bitcode bit, and then reload naclsdk.py | 348 # clear the bitcode bit, and then reload naclsdk.py |
349 native_env = env.Clone() | 349 native_env = env.Clone() |
350 native_env.ClearBits('bitcode') | 350 native_env.ClearBits('bitcode') |
351 native_env = native_env.Clone(tools = ['naclsdk']) | 351 native_env = native_env.Clone(tools = ['naclsdk']) |
| 352 # These are unfortunately clobbered by running Tool. |
| 353 native_env.Replace(EXTRA_CFLAGS=env['EXTRA_CFLAGS'], |
| 354 EXTRA_CXXFLAGS=env['EXTRA_CXXFLAGS'], |
| 355 CCFLAGS=env['CCFLAGS'], |
| 356 CFLAGS=env['CFLAGS'], |
| 357 CXXFLAGS=env['CXXFLAGS']) |
352 return native_env | 358 return native_env |
353 | 359 |
354 | 360 |
355 # This adds architecture specific defines for the target architecture. | 361 # This adds architecture specific defines for the target architecture. |
356 # These are normally omitted by PNaCl. | 362 # These are normally omitted by PNaCl. |
357 # For example: __i686__, __arm__, __x86_64__ | 363 # For example: __i686__, __arm__, __x86_64__ |
358 def AddBiasForPNaCl(env): | 364 def AddBiasForPNaCl(env): |
359 assert(env.Bit('bitcode')) | 365 assert(env.Bit('bitcode')) |
360 | 366 |
361 if env.Bit('target_arm'): | 367 if env.Bit('target_arm'): |
(...skipping 182 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
544 # Dependency files it produces are to be found in ${LIBPATH}. | 550 # Dependency files it produces are to be found in ${LIBPATH}. |
545 # It is applied recursively to those dependencies in case | 551 # It is applied recursively to those dependencies in case |
546 # some of them are linker scripts too. | 552 # some of them are linker scripts too. |
547 ldscript_scanner = SCons.Scanner.Base( | 553 ldscript_scanner = SCons.Scanner.Base( |
548 function=ScanLinkerScript, | 554 function=ScanLinkerScript, |
549 skeys=['.a', '.so', '.pso'], | 555 skeys=['.a', '.so', '.pso'], |
550 path_function=SCons.Scanner.FindPathDirs('LIBPATH'), | 556 path_function=SCons.Scanner.FindPathDirs('LIBPATH'), |
551 recursive=True | 557 recursive=True |
552 ) | 558 ) |
553 env.Append(SCANNERS=ldscript_scanner) | 559 env.Append(SCANNERS=ldscript_scanner) |
OLD | NEW |