| OLD | NEW |
| 1 #!/usr/bin/python2.4 | 1 #!/usr/bin/python2.4 |
| 2 # Copyright 2008, Google Inc. | 2 # Copyright 2008, 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 52 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 63 # Need to force the target and source to be lists of nodes | 63 # Need to force the target and source to be lists of nodes |
| 64 return SCons.Node.FS.LinkFunc([env.Entry(target)], [env.Entry(source)], env) | 64 return SCons.Node.FS.LinkFunc([env.Entry(target)], [env.Entry(source)], env) |
| 65 | 65 |
| 66 | 66 |
| 67 def PreEvaluateVariables(env): | 67 def PreEvaluateVariables(env): |
| 68 """Deferred function to pre-evaluate SCons varables for each build mode. | 68 """Deferred function to pre-evaluate SCons varables for each build mode. |
| 69 | 69 |
| 70 Args: | 70 Args: |
| 71 env: Environment for the current build mode. | 71 env: Environment for the current build mode. |
| 72 """ | 72 """ |
| 73 # Convert directory variables to strings | 73 # Convert directory variables to strings. Must use .abspath not str(), since |
| 74 # otherwise $OBJ_ROOT is converted to a relative path, which evaluates |
| 75 # improperly in SConscripts not in $MAIN_DIR. |
| 74 for var in env.SubstList2('$PRE_EVALUATE_DIRS'): | 76 for var in env.SubstList2('$PRE_EVALUATE_DIRS'): |
| 75 env[var] = str(env.Dir('$' + var)) | 77 env[var] = env.Dir('$' + var).abspath |
| 76 | 78 |
| 77 | 79 |
| 78 #------------------------------------------------------------------------------ | 80 #------------------------------------------------------------------------------ |
| 79 | 81 |
| 80 | 82 |
| 81 def generate(env): | 83 def generate(env): |
| 82 # NOTE: SCons requires the use of this name, which fails gpylint. | 84 # NOTE: SCons requires the use of this name, which fails gpylint. |
| 83 """SCons entry point for this tool.""" | 85 """SCons entry point for this tool.""" |
| 84 | 86 |
| 85 # Use MD5 to tell when files differ, if the timestamps differ. This is | 87 # Use MD5 to tell when files differ, if the timestamps differ. This is |
| (...skipping 102 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 188 # Build all by default | 190 # Build all by default |
| 189 # TODO(rspangler): This would be more nicely done by creating an 'all' | 191 # TODO(rspangler): This would be more nicely done by creating an 'all' |
| 190 # alias and mapping that to $DESTINATION_ROOT (or the accumulation of all | 192 # alias and mapping that to $DESTINATION_ROOT (or the accumulation of all |
| 191 # $TARGET_ROOT's for the environments which apply to the current host | 193 # $TARGET_ROOT's for the environments which apply to the current host |
| 192 # platform). Ideally, that would be done in site_init.py and not here. But | 194 # platform). Ideally, that would be done in site_init.py and not here. But |
| 193 # since we can't do that, just set the default to be DESTINATION_ROOT here. | 195 # since we can't do that, just set the default to be DESTINATION_ROOT here. |
| 194 # Note that this currently forces projects which want to override the | 196 # Note that this currently forces projects which want to override the |
| 195 # default to do so after including the component_setup tool. | 197 # default to do so after including the component_setup tool. |
| 196 env.Default('$DESTINATION_ROOT') | 198 env.Default('$DESTINATION_ROOT') |
| 197 | 199 |
| 200 # Use brief command line strings if necessary |
| 201 SCons.Script.Help("""\ |
| 202 --verbose Print verbose output while building, including |
| 203 the full command lines for all commands. |
| 204 --brief Print brief output while building (the default). |
| 205 This and --verbose are opposites. Use --silent |
| 206 to turn off all output. |
| 207 """) |
| 208 SCons.Script.AddOption( |
| 209 '--brief', |
| 210 dest='brief_comstr', |
| 211 default=True, |
| 212 action='store_true', |
| 213 help='brief command line output') |
| 214 SCons.Script.AddOption( |
| 215 '--verbose', |
| 216 dest='brief_comstr', |
| 217 default=True, |
| 218 action='store_false', |
| 219 help='verbose command line output') |
| 220 if env.GetOption('brief_comstr'): |
| 221 env.SetDefault( |
| 222 ARCOMSTR='________Creating library $TARGET', |
| 223 ASCOMSTR='________Assembling $TARGET', |
| 224 CCCOMSTR='________Compiling $TARGET', |
| 225 CONCAT_SOURCE_COMSTR='________ConcatSource $TARGET', |
| 226 CXXCOMSTR='________Compiling $TARGET', |
| 227 LDMODULECOMSTR='________Building loadable module $TARGET', |
| 228 LINKCOMSTR='________Linking $TARGET', |
| 229 MANIFEST_COMSTR='________Updating manifest for $TARGET', |
| 230 MIDLCOMSTR='________Compiling IDL $TARGET', |
| 231 PCHCOMSTR='________Precompiling $TARGET', |
| 232 RANLIBCOMSTR='________Indexing $TARGET', |
| 233 RCCOMSTR='________Compiling resource $TARGET', |
| 234 SHCCCOMSTR='________Compiling $TARGET', |
| 235 SHCXXCOMSTR='________Compiling $TARGET', |
| 236 SHLINKCOMSTR='________Linking $TARGET', |
| 237 SHMANIFEST_COMSTR='________Updating manifest for $TARGET', |
| 238 ) |
| 239 |
| 198 # Add other default tools from our toolkit | 240 # Add other default tools from our toolkit |
| 199 # TODO(rspangler): Currently this needs to be before SOURCE_ROOT in case a | 241 # TODO(rspangler): Currently this needs to be before SOURCE_ROOT in case a |
| 200 # tool needs to redefine it. Need a better way to handle order-dependency | 242 # tool needs to redefine it. Need a better way to handle order-dependency |
| 201 # in tool setup. | 243 # in tool setup. |
| 202 for t in component_setup_tools: | 244 for t in component_setup_tools: |
| 203 env.Tool(t) | 245 env.Tool(t) |
| 204 | 246 |
| 205 # The following environment replacements use env.Dir() to force immediate | 247 # The following environment replacements use env.Dir() to force immediate |
| 206 # evaluation/substitution of SCons variables. They can't be part of the | 248 # evaluation/substitution of SCons variables. They can't be part of the |
| 207 # preceding env.Replace() since they they may rely indirectly on variables | 249 # preceding env.Replace() since they they may rely indirectly on variables |
| (...skipping 11 matching lines...) Expand all Loading... |
| 219 # have a common location for tools outside of the current clientspec. Need | 261 # have a common location for tools outside of the current clientspec. Need |
| 220 # to check if it's defined already, so it can be set prior to this tool | 262 # to check if it's defined already, so it can be set prior to this tool |
| 221 # being included. | 263 # being included. |
| 222 tool_root = env.get('TOOL_ROOT', '$SOURCE_ROOT') | 264 tool_root = env.get('TOOL_ROOT', '$SOURCE_ROOT') |
| 223 env['TOOL_ROOT'] = env.Dir(tool_root).abspath | 265 env['TOOL_ROOT'] = env.Dir(tool_root).abspath |
| 224 | 266 |
| 225 # Defer pre-evaluating some environment variables, but do before building | 267 # Defer pre-evaluating some environment variables, but do before building |
| 226 # SConscripts. | 268 # SConscripts. |
| 227 env.Defer(PreEvaluateVariables) | 269 env.Defer(PreEvaluateVariables) |
| 228 env.Defer('BuildEnvironmentSConscripts', after=PreEvaluateVariables) | 270 env.Defer('BuildEnvironmentSConscripts', after=PreEvaluateVariables) |
| OLD | NEW |