SConstruct (2637:18e4273315cd) | SConstruct (2638:b419cc6a4419) |
---|---|
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 --- 94 unchanged lines hidden (view full) --- 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 build roots and configs that the 109# collected targets reference. 110build_paths = [] | 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 --- 94 unchanged lines hidden (view full) --- 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 build roots and configs that the 109# collected targets reference. 110build_paths = [] |
111build_roots = [] | 111build_root = None |
112for t in abs_targets: 113 path_dirs = t.split('/') 114 try: 115 build_top = rfind(path_dirs, 'build', -2) 116 except: 117 print "Error: no non-leaf 'build' dir found on target path", t 118 Exit(1) | 112for t in abs_targets: 113 path_dirs = t.split('/') 114 try: 115 build_top = rfind(path_dirs, 'build', -2) 116 except: 117 print "Error: no non-leaf 'build' dir found on target path", t 118 Exit(1) |
119 build_root = os.path.join('/',*path_dirs[:build_top+1]) 120 if build_root not in build_roots: 121 build_roots.append(build_root) | 119 this_build_root = os.path.join('/',*path_dirs[:build_top+1]) 120 if not build_root: 121 build_root = this_build_root 122 else: 123 if this_build_root != build_root: 124 print "Error: build targets not under same build root\n"\ 125 " %s\n %s" % (build_root, this_build_root) 126 Exit(1) |
122 build_path = os.path.join('/',*path_dirs[:build_top+2]) 123 if build_path not in build_paths: 124 build_paths.append(build_path) 125 126################################################### 127# 128# Set up the default build environment. This environment is copied 129# and modified according to each selected configuration. --- 22 unchanged lines hidden (view full) --- 152if sys.platform == 'cygwin': 153 # cygwin has some header file issues... 154 env.Append(CCFLAGS=Split("-Wno-uninitialized")) 155env.Append(CPPPATH=[Dir('ext/dnet')]) 156 157# Default libraries 158env.Append(LIBS=['z']) 159 | 127 build_path = os.path.join('/',*path_dirs[:build_top+2]) 128 if build_path not in build_paths: 129 build_paths.append(build_path) 130 131################################################### 132# 133# Set up the default build environment. This environment is copied 134# and modified according to each selected configuration. --- 22 unchanged lines hidden (view full) --- 157if sys.platform == 'cygwin': 158 # cygwin has some header file issues... 159 env.Append(CCFLAGS=Split("-Wno-uninitialized")) 160env.Append(CPPPATH=[Dir('ext/dnet')]) 161 162# Default libraries 163env.Append(LIBS=['z']) 164 |
160# Platform-specific configuration 161conf = Configure(env) | 165# Platform-specific configuration. Note again that we assume that all 166# builds under a given build root run on the same host platform. 167conf = Configure(env, 168 conf_dir = os.path.join(build_root, '.scons_config'), 169 log_file = os.path.join(build_root, 'scons_config.log')) |
162 163# Check for <fenv.h> (C99 FP environment control) 164have_fenv = conf.CheckHeader('fenv.h', '<>') 165if not have_fenv: 166 print "Warning: Header file <fenv.h> not found." 167 print " This host has no IEEE FP rounding mode control." 168 169# Check for mysql. --- 123 unchanged lines hidden (view full) --- 293env.Append(BUILDERS = { 'ConfigFile' : config_builder }) 294 295# base help text 296help_text = ''' 297Usage: scons [scons options] [build options] [target(s)] 298 299''' 300 | 170 171# Check for <fenv.h> (C99 FP environment control) 172have_fenv = conf.CheckHeader('fenv.h', '<>') 173if not have_fenv: 174 print "Warning: Header file <fenv.h> not found." 175 print " This host has no IEEE FP rounding mode control." 176 177# Check for mysql. --- 123 unchanged lines hidden (view full) --- 301env.Append(BUILDERS = { 'ConfigFile' : config_builder }) 302 303# base help text 304help_text = ''' 305Usage: scons [scons options] [build options] [target(s)] 306 307''' 308 |
309# libelf build is shared across all configs in the build root. 310env.SConscript('ext/libelf/SConscript', 311 build_dir = os.path.join(build_root, 'libelf'), 312 exports = 'env') 313 |
|
301################################################### 302# 303# Define build environments for selected configurations. 304# 305################################################### 306 307# rename base env 308base_env = env 309 | 314################################################### 315# 316# Define build environments for selected configurations. 317# 318################################################### 319 320# rename base env 321base_env = env 322 |
310# Spme things (just libelf currently) are shared across all configs in 311# a "build root". Need to define how to build these just once for 312# each referenced root. 313build_root_env = {} 314for build_root in build_roots: 315 env = base_env.Copy() 316 env.SConscript('ext/libelf/SConscript', 317 build_dir = os.path.join(build_root, 'libelf'), 318 exports = 'env') 319 build_root_env[build_root] = env 320 | |
321for build_path in build_paths: 322 print "Building in", build_path 323 # build_dir is the tail component of build path, and is used to 324 # determine the build parameters (e.g., 'ALPHA_SE') 325 (build_root, build_dir) = os.path.split(build_path) 326 # Make a copy of the build-root environment to use for this config. | 323for build_path in build_paths: 324 print "Building in", build_path 325 # build_dir is the tail component of build path, and is used to 326 # determine the build parameters (e.g., 'ALPHA_SE') 327 (build_root, build_dir) = os.path.split(build_path) 328 # Make a copy of the build-root environment to use for this config. |
327 env = build_root_env[build_root].Copy() | 329 env = base_env.Copy() |
328 329 # Set env options according to the build directory config. 330 sticky_opts.files = [] 331 # Options for $BUILD_ROOT/$BUILD_DIR are stored in 332 # $BUILD_ROOT/options/$BUILD_DIR so you can nuke 333 # $BUILD_ROOT/$BUILD_DIR without losing your options settings. 334 current_opts_file = os.path.join(build_root, 'options', build_dir) 335 if os.path.isfile(current_opts_file): --- 90 unchanged lines hidden --- | 330 331 # Set env options according to the build directory config. 332 sticky_opts.files = [] 333 # Options for $BUILD_ROOT/$BUILD_DIR are stored in 334 # $BUILD_ROOT/options/$BUILD_DIR so you can nuke 335 # $BUILD_ROOT/$BUILD_DIR without losing your options settings. 336 current_opts_file = os.path.join(build_root, 'options', build_dir) 337 if os.path.isfile(current_opts_file): --- 90 unchanged lines hidden --- |