mirror of
https://github.com/drasko/codezero.git
synced 2026-01-13 03:13:15 +01:00
Refactor the build to try and get as much material as possible out of SConstruct.
This commit is contained in:
@@ -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')
|
||||
|
||||
Reference in New Issue
Block a user