summaryrefslogtreecommitdiff
path: root/components/lwp/SConscript
blob: 19da1baf1f681e626d35e003bc087ca7979c1a53 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
Import('rtconfig')
from building import *
import os

cwd     = GetCurrentDir()
src     = []
CPPPATH = [cwd]

support_arch  = {"arm": ["cortex-m3", "cortex-m4", "cortex-m7", "arm926", "cortex-a"],
                 "aarch64":["cortex-a"],
                 "risc-v": ["rv64"],
                 "x86": ["i386"]}
platform_file = {'armcc': 'rvds.S', 'gcc': 'gcc.S', 'iar': 'iar.S'}

platform = rtconfig.PLATFORM
arch     = rtconfig.ARCH
cpu      = rtconfig.CPU

# fix the cpu for risc-v
if arch == 'risc-v':
    if GetDepend('ARCH_CPU_64BIT'):
        cpu = 'rv64'

if platform in platform_file.keys(): # support platforms
    if arch in support_arch.keys() and cpu in support_arch[arch]:
        asm_path = 'arch/' + arch + '/' + cpu + '/*_' + platform_file[platform]
        arch_common = 'arch/' + arch + '/' + 'common/*.c'
        common = 'arch/common/*.c'
        common_excluded = []
        if not GetDepend('RT_USING_VDSO'):
            common_excluded.append('vdso_kernel.c')
            src += Glob(arch_common)
            src += [f for f in Glob(common) if os.path.basename(str(f)) not in common_excluded]
        else:
            CPPPATH += [cwd + '/vdso', cwd + '/vdso/kernel']
            src += Glob(arch_common)
            src += Glob(common)
        if not GetDepend('ARCH_MM_MMU'):
            excluded_files = ['ioremap.c', 'lwp_futex.c', 'lwp_mm_area.c', 'lwp_pmutex.c', 'lwp_shm.c', 'lwp_user_mm.c']
            src += [f for f in Glob('*.c') if os.path.basename(str(f)) not in excluded_files] + Glob(asm_path)
        else:
            src += Glob('*.c') + Glob(asm_path)
        src += Glob('arch/' + arch + '/' + cpu + '/*.c')
        CPPPATH = [cwd]
        CPPPATH += [cwd + '/arch/' + arch + '/' + cpu]

# Terminal I/O Subsystem
# terminal/*.c resolve their own headers via quoted-include directory lookup;
# keep the internal path out of the global CPPPATH
termios_path = ['./terminal/', './terminal/freebsd/']
for item in termios_path:
    src += Glob(item + '*.c')

# Remove optional sources
if not GetDepend(['LWP_USING_RUNTIME']):
    SrcRemove(src, 'lwp_runtime.c')

group = DefineGroup('lwProcess', src, depend = ['RT_USING_SMART'], CPPPATH = CPPPATH)

group = group + SConscript(os.path.join('vdso', 'SConscript'))
group = group + SConscript(os.path.join('utest', 'SConscript'))
Return('group')