Generalize the configuration processing so that the top-level SConstruct only processes the ARCH symbol and prepares the PLATFORM and SUBARCH entries so as to write the config.h. Everything is now entered in the environment so the SConscript files can be responsible fo rthe processing.

This commit is contained in:
Russel Winder
2009-08-28 10:39:19 +01:00
parent f6707e3ca7
commit 03205855cc
2 changed files with 10 additions and 5 deletions

View File

@@ -100,11 +100,16 @@ else :
for key, value in configData.items():
if value:
items = key.split('_')
if items[0] == 'ARCH': continue
if items[0] == configuration.env['ARCH'].upper():
configuration.env[items[1]] = items[2].lower()
elif items[0] == 'DRIVER':
# Add data to the environment about which driver paths to include in the build.
configuration.env.Append(driverList = [items[1].lower() + '/' + items[2].lower()])
else:
path = items[1].lower() + '/' + items[2].lower()
try:
configuration.env[items[0]]
except KeyError:
configuration.env[items[0]] = []
configuration.env[items[0]].append(path)
configuration.Define('__ARCH__', configuration.env['ARCH'])
configuration.Define('__PLATFORM__', configuration.env['PLATFORM'])
configuration.Define('__SUBARCH__', configuration.env['SUBARCH'])

View File

@@ -30,12 +30,12 @@ sources = \
Glob('glue/' + environment['ARCH'] + '/*.[cS]') + \
Glob('platform/' + environment['PLATFORM'] + '/*.[cS]')
for item in environment['driverList'] :
for item in environment['DRIVER'] :
path = 'drivers/' + item
if not os.path.isdir(path):
feature , device = item.split ( '/' )
raise ValueError, 'Driver ' + device + ' for ' + feature + ' not available.'
sources += Glob('drivers/' + item + '/*.[cS]')
sources += Glob(path + '/*.[cS]')
objects = environment.Object(sources)
Depends(objects, environment['configFiles'])