| OLD | NEW |
| 1 #!/usr/bin/python2.4 | 1 #!/usr/bin/python2.4 |
| 2 # Copyright 2009, Google Inc. | 2 # Copyright 2009, Google Inc. |
| 3 # All rights reserved. | 3 # All rights reserved. |
| 4 # | 4 # |
| 5 # Redistribution and use in source and binary forms, with or without | 5 # Redistribution and use in source and binary forms, with or without |
| 6 # modification, are permitted provided that the following conditions are | 6 # modification, are permitted provided that the following conditions are |
| 7 # met: | 7 # met: |
| 8 # | 8 # |
| 9 # * Redistributions of source code must retain the above copyright | 9 # * Redistributions of source code must retain the above copyright |
| 10 # notice, this list of conditions and the following disclaimer. | 10 # notice, this list of conditions and the following disclaimer. |
| (...skipping 115 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 126 | 126 |
| 127 # This supports a NaCl convention that was previously supported with a | 127 # This supports a NaCl convention that was previously supported with a |
| 128 # modification to SCons. Previously, EXTRA_LIBS was interpolated into LIBS | 128 # modification to SCons. Previously, EXTRA_LIBS was interpolated into LIBS |
| 129 # using the ${EXTRA_LIBS} syntax. It appears, however, that SCons naturally | 129 # using the ${EXTRA_LIBS} syntax. It appears, however, that SCons naturally |
| 130 # computes library dependencies before interpolation, so EXTRA_LIBS will not | 130 # computes library dependencies before interpolation, so EXTRA_LIBS will not |
| 131 # be correctly depended upon if interpolated. In the past, SCons was modified | 131 # be correctly depended upon if interpolated. In the past, SCons was modified |
| 132 # to force interpolation before library dependencies were computed. This new | 132 # to force interpolation before library dependencies were computed. This new |
| 133 # approach allows us to use an unmodified version of SCons. | 133 # approach allows us to use an unmodified version of SCons. |
| 134 # In general, the use of EXTRA_LIBS is discouraged. | 134 # In general, the use of EXTRA_LIBS is discouraged. |
| 135 if 'EXTRA_LIBS' in env: | 135 if 'EXTRA_LIBS' in env: |
| 136 env['LIBS'] = env['EXTRA_LIBS'] + env['LIBS'] | 136 # The SubstList2 method expands and flattens so that scons will |
| 137 # correctly know about the library dependencies in cases like |
| 138 # EXTRA_LIBS=['${FOO_LIBS}', 'bar']. |
| 139 env['LIBS'] = env.SubstList2('${EXTRA_LIBS}', '${LIBS}') |
| 137 | 140 |
| 138 # Call platform-specific component setup function, if any | 141 # Call platform-specific component setup function, if any |
| 139 if env.get('COMPONENT_PLATFORM_SETUP'): | 142 if env.get('COMPONENT_PLATFORM_SETUP'): |
| 140 env['COMPONENT_PLATFORM_SETUP'](env, builder_name) | 143 env['COMPONENT_PLATFORM_SETUP'](env, builder_name) |
| 141 | 144 |
| 142 # Return the modified environment | 145 # Return the modified environment |
| 143 return env | 146 return env |
| 144 | 147 |
| 145 #------------------------------------------------------------------------------ | 148 #------------------------------------------------------------------------------ |
| 146 | 149 |
| (...skipping 322 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 469 # raise Exception("Program name shouldn't have a suffix") | 472 # raise Exception("Program name shouldn't have a suffix") |
| 470 prog_name = env.subst(prog_name) | 473 prog_name = env.subst(prog_name) |
| 471 prog_name = prog_name[:-len(env['PROGSUFFIX'])] | 474 prog_name = prog_name[:-len(env['PROGSUFFIX'])] |
| 472 | 475 |
| 473 # Call env.Program() | 476 # Call env.Program() |
| 474 out_nodes = env.Program(prog_name, *args, **kwargs) | 477 out_nodes = env.Program(prog_name, *args, **kwargs) |
| 475 | 478 |
| 476 # Add dependencies on includes | 479 # Add dependencies on includes |
| 477 env.Depends(out_nodes, env['INCLUDES']) | 480 env.Depends(out_nodes, env['INCLUDES']) |
| 478 | 481 |
| 482 # Add dependencies on libraries marked as implicitly included in the link. |
| 483 # These are libraries that are not passed on the command line, but are |
| 484 # always linked in by the toolchain, i.e. startup files and -lc and such. |
| 485 if 'IMPLICIT_LIBS' in env: |
| 486 env.Depends(out_nodes, env['IMPLICIT_LIBS']) |
| 487 |
| 479 # Publish output | 488 # Publish output |
| 480 env.Publish(prog_name, 'run', out_nodes[0]) | 489 env.Publish(prog_name, 'run', out_nodes[0]) |
| 481 env.Publish(prog_name, 'debug', out_nodes[1:]) | 490 env.Publish(prog_name, 'debug', out_nodes[1:]) |
| 482 | 491 |
| 483 # Add an alias to build the program to the right groups | 492 # Add an alias to build the program to the right groups |
| 484 a = env.Alias(prog_name, out_nodes) | 493 a = env.Alias(prog_name, out_nodes) |
| 485 for group in env['COMPONENT_PROGRAM_GROUPS']: | 494 for group in env['COMPONENT_PROGRAM_GROUPS']: |
| 486 SCons.Script.Alias(group, a) | 495 SCons.Script.Alias(group, a) |
| 487 | 496 |
| 488 # Store list of components for this program | 497 # Store list of components for this program |
| (...skipping 139 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 628 # Add our target groups | 637 # Add our target groups |
| 629 AddTargetGroup('all_libraries', 'libraries can be built') | 638 AddTargetGroup('all_libraries', 'libraries can be built') |
| 630 AddTargetGroup('all_programs', 'programs can be built') | 639 AddTargetGroup('all_programs', 'programs can be built') |
| 631 AddTargetGroup('all_test_programs', 'tests can be built') | 640 AddTargetGroup('all_test_programs', 'tests can be built') |
| 632 AddTargetGroup('all_packages', 'packages can be built') | 641 AddTargetGroup('all_packages', 'packages can be built') |
| 633 AddTargetGroup('run_all_tests', 'tests can be run') | 642 AddTargetGroup('run_all_tests', 'tests can be run') |
| 634 AddTargetGroup('run_disabled_tests', 'tests are disabled') | 643 AddTargetGroup('run_disabled_tests', 'tests are disabled') |
| 635 AddTargetGroup('run_small_tests', 'small tests can be run') | 644 AddTargetGroup('run_small_tests', 'small tests can be run') |
| 636 AddTargetGroup('run_medium_tests', 'medium tests can be run') | 645 AddTargetGroup('run_medium_tests', 'medium tests can be run') |
| 637 AddTargetGroup('run_large_tests', 'large tests can be run') | 646 AddTargetGroup('run_large_tests', 'large tests can be run') |
| 638 | |
| OLD | NEW |