SConstruct (3717:d4eacb8998d2) | SConstruct (3718:9d40568cfaeb) |
---|---|
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 --- 92 unchanged lines hidden (view full) --- 101# Figure out which configurations to set up based on the path(s) of 102# the target(s). 103# 104################################################### 105 106# Find default configuration & binary. 107Default(os.environ.get('M5_DEFAULT_BINARY', 'build/ALPHA_SE/m5.debug')) 108 | 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 --- 92 unchanged lines hidden (view full) --- 101# Figure out which configurations to set up based on the path(s) of 102# the target(s). 103# 104################################################### 105 106# Find default configuration & binary. 107Default(os.environ.get('M5_DEFAULT_BINARY', 'build/ALPHA_SE/m5.debug')) 108 |
109# Ask SCons which directory it was invoked from. 110launch_dir = GetLaunchDir() 111 112# Make targets relative to invocation directory 113abs_targets = map(lambda x: os.path.normpath(joinpath(launch_dir, str(x))), 114 BUILD_TARGETS) 115 | |
116# helper function: find last occurrence of element in list 117def rfind(l, elt, offs = -1): 118 for i in range(len(l)+offs, 0, -1): 119 if l[i] == elt: 120 return i 121 raise ValueError, "element not found" 122 123# helper function: compare dotted version numbers. --- 13 unchanged lines hidden (view full) --- 137 return 0 138 139# Each target must have 'build' in the interior of the path; the 140# directory below this will determine the build parameters. For 141# example, for target 'foo/bar/build/ALPHA_SE/arch/alpha/blah.do' we 142# recognize that ALPHA_SE specifies the configuration because it 143# follow 'build' in the bulid path. 144 | 109# helper function: find last occurrence of element in list 110def rfind(l, elt, offs = -1): 111 for i in range(len(l)+offs, 0, -1): 112 if l[i] == elt: 113 return i 114 raise ValueError, "element not found" 115 116# helper function: compare dotted version numbers. --- 13 unchanged lines hidden (view full) --- 130 return 0 131 132# Each target must have 'build' in the interior of the path; the 133# directory below this will determine the build parameters. For 134# example, for target 'foo/bar/build/ALPHA_SE/arch/alpha/blah.do' we 135# recognize that ALPHA_SE specifies the configuration because it 136# follow 'build' in the bulid path. 137 |
138# Generate absolute paths to targets so we can see where the build dir is 139if COMMAND_LINE_TARGETS: 140 # Ask SCons which directory it was invoked from 141 launch_dir = GetLaunchDir() 142 # Make targets relative to invocation directory 143 abs_targets = map(lambda x: os.path.normpath(joinpath(launch_dir, str(x))), 144 COMMAND_LINE_TARGETS) 145else: 146 # Default targets are relative to root of tree 147 abs_targets = map(lambda x: os.path.normpath(joinpath(ROOT, str(x))), 148 DEFAULT_TARGETS) 149 150 |
|
145# Generate a list of the unique build roots and configs that the 146# collected targets reference. 147build_paths = [] 148build_root = None 149for t in abs_targets: 150 path_dirs = t.split('/') 151 try: 152 build_top = rfind(path_dirs, 'build', -2) --- 475 unchanged lines hidden --- | 151# Generate a list of the unique build roots and configs that the 152# collected targets reference. 153build_paths = [] 154build_root = None 155for t in abs_targets: 156 path_dirs = t.split('/') 157 try: 158 build_top = rfind(path_dirs, 'build', -2) --- 475 unchanged lines hidden --- |