Deleted Added
sdiff udiff text old ( 2632:1bb2f91485ea ) new ( 2634:db0b1133abd5 )
full compact
1# -*- mode:python -*-
2
3# Copyright (c) 2004-2005 The Regents of The University of Michigan
4# All rights reserved.
5#
6# Redistribution and use in source and binary forms, with or without
7# modification, are permitted provided that the following conditions are
8# met: redistributions of source code must retain the above copyright

--- 91 unchanged lines hidden (view full) ---

100 raise ValueError, "element not found"
101
102# Each target must have 'build' in the interior of the path; the
103# directory below this will determine the build parameters. For
104# example, for target 'foo/bar/build/ALPHA_SE/arch/alpha/blah.do' we
105# recognize that ALPHA_SE specifies the configuration because it
106# follow 'build' in the bulid path.
107
108# Generate a list of the unique configs that the collected targets
109# reference.
110build_paths = []
111for t in abs_targets:
112 path_dirs = t.split('/')
113 try:
114 build_top = rfind(path_dirs, 'build', -2)
115 except:
116 print "Error: no non-leaf 'build' dir found on target path", t
117 Exit(1)
118 config_dir = os.path.join('/',*path_dirs[:build_top+2])
119 if config_dir not in build_paths:
120 build_paths.append(config_dir)
121
122###################################################
123#
124# Set up the default build environment. This environment is copied
125# and modified according to each selected configuration.
126#
127###################################################
128

--- 112 unchanged lines hidden (view full) ---

241 'STATS_BINNING']
242
243# Define a handy 'no-op' action
244def no_action(target, source, env):
245 return 0
246
247env.NoAction = Action(no_action, None)
248
249# libelf build is described in its own SConscript file.
250# SConscript-global is the build in build/libelf shared among all
251# configs.
252env.SConscript('src/libelf/SConscript-global', exports = 'env')
253
254###################################################
255#
256# Define a SCons builder for configuration flag headers.
257#
258###################################################
259
260# This function generates a config header file that #defines the
261# option symbol to the current option setting (0 or 1). The source

--- 25 unchanged lines hidden (view full) ---

287 val = int(eval(str(env[option])))
288 # Sources are option name & value (packaged in SCons Value nodes)
289 return ([target], [Value(option), Value(val)])
290
291config_builder = Builder(emitter = config_emitter, action = config_action)
292
293env.Append(BUILDERS = { 'ConfigFile' : config_builder })
294
295###################################################
296#
297# Define build environments for selected configurations.
298#
299###################################################
300
301# rename base env
302base_env = env
303
304help_text = '''
305Usage: scons [scons options] [build options] [target(s)]
306
307'''
308
309for build_path in build_paths:
310 print "Building in", build_path
311 # build_dir is the tail component of build path, and is used to
312 # determine the build parameters (e.g., 'ALPHA_SE')
313 (build_root, build_dir) = os.path.split(build_path)
314 # Make a copy of the default environment to use for this config.
315 env = base_env.Copy()
316
317 # Set env options according to the build directory config.
318 sticky_opts.files = []
319 # Options for $BUILD_ROOT/$BUILD_DIR are stored in
320 # $BUILD_ROOT/options/$BUILD_DIR so you can nuke
321 # $BUILD_ROOT/$BUILD_DIR without losing your options settings.
322 current_opts_file = os.path.join(build_root, 'options', build_dir)
323 if os.path.isfile(current_opts_file):

--- 90 unchanged lines hidden ---