SConscript (5273:69faa6c5e314) | SConscript (5341:4efeab4cc2a5) |
---|---|
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 --- 19 unchanged lines hidden (view full) --- 28# 29# Authors: Nathan Binkert 30 31import imp 32import os 33import sys 34 35from os.path import basename | 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 --- 19 unchanged lines hidden (view full) --- 28# 29# Authors: Nathan Binkert 30 31import imp 32import os 33import sys 34 35from os.path import basename |
36from os.path import join as joinpath | 36from os.path import isdir, join as joinpath |
37from os.path import exists 38from os.path import isdir 39from os.path import isfile 40 41import SCons 42 43# This file defines how to build a particular configuration of M5 44# based on variable settings in the 'env' build environment. --- 131 unchanged lines hidden (view full) --- 176# files. 177env.Append(CPPPATH=Dir('.')) 178 179# Add a flag defining what THE_ISA should be for all compilation 180env.Append(CPPDEFINES=[('THE_ISA','%s_ISA' % env['TARGET_ISA'].upper())]) 181 182######################################################################## 183# | 37from os.path import exists 38from os.path import isdir 39from os.path import isfile 40 41import SCons 42 43# This file defines how to build a particular configuration of M5 44# based on variable settings in the 'env' build environment. --- 131 unchanged lines hidden (view full) --- 176# files. 177env.Append(CPPPATH=Dir('.')) 178 179# Add a flag defining what THE_ISA should be for all compilation 180env.Append(CPPDEFINES=[('THE_ISA','%s_ISA' % env['TARGET_ISA'].upper())]) 181 182######################################################################## 183# |
184# Walk the tree and execute all SConscripts | 184# Walk the tree and execute all SConscripts in 'src' subdirectories |
185# | 185# |
186srcdir = env['SRCDIR'] 187for root, dirs, files in os.walk(srcdir, topdown=True): 188 if root == srcdir: 189 # we don't want to recurse back into this SConscript | 186 187for base_dir in base_dir_list: 188 src_dir = joinpath(base_dir, 'src') 189 if not isdir(src_dir): |
190 continue | 190 continue |
191 here = Dir('.').srcnode().abspath 192 for root, dirs, files in os.walk(src_dir, topdown=True): 193 if root == here: 194 # we don't want to recurse back into this SConscript 195 continue |
|
191 | 196 |
192 if 'SConscript' in files: 193 # strip off the srcdir part since scons will try to find the 194 # script in the build directory 195 base = root[len(srcdir) + 1:] 196 SConscript(joinpath(base, 'SConscript')) | 197 if 'SConscript' in files: 198 build_dir = joinpath(env['BUILDDIR'], root[len(src_dir) + 1:]) 199 SConscript(joinpath(root, 'SConscript'), build_dir=build_dir) |
197 | 200 |
198extra_string = env['EXTRAS'] 199if extra_string and extra_string != '' and not extra_string.isspace(): 200 for extra in extra_string.split(':'): 201 print 'Adding', extra, 'to source directory list' 202 env.Append(CPPPATH=[Dir(extra)]) 203 for root, dirs, files in os.walk(extra, topdown=True): 204 if 'SConscript' in files: 205 subdir = root[len(os.path.dirname(extra))+1:] 206 print ' Found SConscript in', subdir 207 build_dir = joinpath(env['BUILDDIR'], subdir) 208 SConscript(joinpath(root, 'SConscript'), build_dir=build_dir) 209 | |
210for opt in env.ExportOptions: 211 env.ConfigFile(opt) 212 213######################################################################## 214# 215# Prevent any SimObjects from being added after this point, they 216# should all have been added in the SConscripts above 217# --- 240 unchanged lines hidden --- | 201for opt in env.ExportOptions: 202 env.ConfigFile(opt) 203 204######################################################################## 205# 206# Prevent any SimObjects from being added after this point, they 207# should all have been added in the SConscripts above 208# --- 240 unchanged lines hidden --- |