Refactor the build to try and get as much material as possible out of SConstruct.

This commit is contained in:
Russel Winder
2009-08-28 14:10:24 +01:00
parent c311cf72e6
commit 9e894274a3
10 changed files with 85 additions and 79 deletions

View File

@@ -21,26 +21,36 @@ import os.path
Import('environment')
e = environment.Clone()
e['CC'] = e['toolChains'][e['CPU']]['kernelCompiler']
e.Append(CPPPATH = ['#' + e['buildDirectory'], '#' + e['buildDirectory'] + '/l4', '#' + e['includeDirectory'], '#' + e['includeDirectory'] + '/l4'])
e.Append(LINKFLAGS = ['-T' + e['includeDirectory'] + '/l4/arch/' + e['ARCH'] + '/linker.lds'])
####
#### TODO: Why are these files forcibly included, why not just leave it up to the C code to include things?
####
e.Append(CPPFLAGS = ['-include', 'config.h', '-include', 'cml2Config.h', '-include', 'macros.h', '-include', 'types.h', '-D__KERNEL__'])
e.Append(LIBS = ['gcc'])
sources = \
Glob('api/*.[cS]') + \
Glob('generic/*.[cS]') + \
Glob('lib/*.[cS]') + \
Glob('arch/' + environment['ARCH'] + '/*.[cS]') + \
Glob('arch/' + environment['ARCH'] + '/' + environment['SUBARCH'] +'/*.[cS]') + \
Glob('glue/' + environment['ARCH'] + '/*.[cS]') + \
Glob('platform/' + environment['PLATFORM'] + '/*.[cS]')
Glob('arch/' + e['ARCH'] + '/*.[cS]') + \
Glob('arch/' + e['ARCH'] + '/' + e['SUBARCH'] +'/*.[cS]') + \
Glob('glue/' + e['ARCH'] + '/*.[cS]') + \
Glob('platform/' + e['PLATFORM'] + '/*.[cS]')
for item in environment['DRIVER'] :
for item in e['DRIVER'] :
path = 'drivers/' + item
if not os.path.isdir(path):
feature , device = item.split ( '/' )
raise ValueError, 'Driver ' + device + ' for ' + feature + ' not available.'
sources += Glob(path + '/*.[cS]')
objects = environment.Object(sources)
Depends(objects, environment['configFiles'])
objects = e.Object(sources)
Depends(objects, e['configFiles'])
startAxf = environment.Program('start.axf', objects)
Depends(startAxf, environment['configFiles'])
startAxf = e.Program('start.axf', objects)
Depends(startAxf, e['configFiles'])
Return('startAxf')