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 341 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
352 # Get an environment for nacl-gcc when in PNaCl mode. | 352 # Get an environment for nacl-gcc when in PNaCl mode. |
353 def PNaClGetNNaClEnv(env): | 353 def PNaClGetNNaClEnv(env): |
354 assert(env.Bit('bitcode')) | 354 assert(env.Bit('bitcode')) |
355 assert(not env.Bit('target_arm')) | 355 assert(not env.Bit('target_arm')) |
356 | 356 |
357 # This is kind of a hack. We clone the environment, | 357 # This is kind of a hack. We clone the environment, |
358 # clear the bitcode bit, and then reload naclsdk.py | 358 # clear the bitcode bit, and then reload naclsdk.py |
359 native_env = env.Clone() | 359 native_env = env.Clone() |
360 native_env.ClearBits('bitcode') | 360 native_env.ClearBits('bitcode') |
361 native_env = native_env.Clone(tools = ['naclsdk']) | 361 native_env = native_env.Clone(tools = ['naclsdk']) |
| 362 # These are unfortunately clobbered by running Tool. |
| 363 native_env.Replace(EXTRA_CFLAGS=env['EXTRA_CFLAGS'], |
| 364 EXTRA_CXXFLAGS=env['EXTRA_CXXFLAGS'], |
| 365 CCFLAGS=env['CCFLAGS'], |
| 366 CFLAGS=env['CFLAGS'], |
| 367 CXXFLAGS=env['CXXFLAGS']) |
362 return native_env | 368 return native_env |
363 | 369 |
364 | 370 |
365 # This adds architecture specific defines for the target architecture. | 371 # This adds architecture specific defines for the target architecture. |
366 # These are normally omitted by PNaCl. | 372 # These are normally omitted by PNaCl. |
367 # For example: __i686__, __arm__, __x86_64__ | 373 # For example: __i686__, __arm__, __x86_64__ |
368 def AddBiasForPNaCl(env): | 374 def AddBiasForPNaCl(env): |
369 assert(env.Bit('bitcode')) | 375 assert(env.Bit('bitcode')) |
370 | 376 |
371 if env.Bit('target_arm'): | 377 if env.Bit('target_arm'): |
(...skipping 183 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
555 # Dependency files it produces are to be found in ${LIBPATH}. | 561 # Dependency files it produces are to be found in ${LIBPATH}. |
556 # It is applied recursively to those dependencies in case | 562 # It is applied recursively to those dependencies in case |
557 # some of them are linker scripts too. | 563 # some of them are linker scripts too. |
558 ldscript_scanner = SCons.Scanner.Base( | 564 ldscript_scanner = SCons.Scanner.Base( |
559 function=ScanLinkerScript, | 565 function=ScanLinkerScript, |
560 skeys=['.a', '.so', '.pso'], | 566 skeys=['.a', '.so', '.pso'], |
561 path_function=SCons.Scanner.FindPathDirs('LIBPATH'), | 567 path_function=SCons.Scanner.FindPathDirs('LIBPATH'), |
562 recursive=True | 568 recursive=True |
563 ) | 569 ) |
564 env.Append(SCANNERS=ldscript_scanner) | 570 env.Append(SCANNERS=ldscript_scanner) |
OLD | NEW |