from building import *
import os

src = Glob('*.c')
cwd = GetCurrentDir()

inc = [os.path.join(cwd, '..', 'include')]

if GetDepend('RT_USING_SMALL_MEM') == False:
    SrcRemove(src, ['mem.c'])

if GetDepend('RT_USING_SLAB') == False:
    SrcRemove(src, ['slab.c'])

if GetDepend('RT_USING_MEMPOOL') == False:
    SrcRemove(src, ['mempool.c'])

if GetDepend('RT_USING_MEMHEAP') == False:
    SrcRemove(src, ['memheap.c'])

if GetDepend('RT_USING_SIGNALS') == False:
    SrcRemove(src, ['signal.c'])

if GetDepend('RT_USING_DEVICE') == False:
    SrcRemove(src, ['device.c'])

if GetDepend('RT_USING_SMP') == False:
    SrcRemove(src, ['cpu.c','scheduler_mp.c'])

if GetDepend('RT_USING_SMP') == True:
    SrcRemove(src, ['scheduler_up.c'])

if GetDepend('RT_USING_DM') == False:
    SrcRemove(src, ['driver.c'])

group = DefineGroup('Kernel', src, depend = [''], CPPPATH = inc, CPPDEFINES = ['__RTTHREAD__'])

Return('group')
