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_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) |
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) |
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 |
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')) |
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 |
314################################################### 315# 316# Define build environments for selected configurations. 317# 318################################################### 319 320# rename base env 321base_env = env 322 |
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. |
329 env = base_env.Copy() |
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 --- |