1# RT-Thread building script for component
2
3from building import *
4
5Import('rtconfig')
6
7cwd     = GetCurrentDir()
8src     = Glob('*.c') + Glob('*.cpp') + Glob('*.S')
9CPPPATH = [cwd, cwd + '/include']
10
11if GetDepend('RT_USING_SMP'):
12    core_model = 'mp'
13else:
14    core_model = 'up'
15
16src += Glob(core_model + '/*.S')
17
18if GetDepend('RT_USING_OFW') == False:
19    SrcRemove(src, ['setup.c', 'cpu_psci.c', 'psci.c'])
20
21if GetDepend('RT_USING_PIC') == True:
22    SrcRemove(src, ['gicv3.c', 'gic.c', 'gtimer.c', 'interrupt.c'])
23
24if GetDepend('RT_HWTIMER_ARM_ARCH') == True:
25    SrcRemove(src, ['gtimer.c'])
26
27group = DefineGroup('libcpu', src, depend = [''], CPPPATH = CPPPATH)
28
29# build for sub-directory
30list = os.listdir(cwd)
31objs = []
32
33for d in list:
34    path = os.path.join(cwd, d)
35    if os.path.isfile(os.path.join(path, 'SConscript')):
36        objs = objs + SConscript(os.path.join(d, 'SConscript'))
37group = group + objs
38
39
40Return('group')
41