| 12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152 |
- from building import *
- import os
- src = Glob('*.c')
- src += Glob('klibc/*.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_mp.c', 'scheduler_mp.c'])
- else:
- SrcRemove(src, ['cpu_up.c', 'scheduler_up.c'])
- LOCAL_CFLAGS = ''
- LINKFLAGS = ''
- if rtconfig.PLATFORM in ['gcc']: # only for GCC
- LOCAL_CFLAGS += ' -Wunused' # unused warning
- LOCAL_CFLAGS += ' -Wformat -Wformat-security' # printf/scanf format warning
- LOCAL_CFLAGS += ' -Warray-bounds -Wuninitialized' # memory access warning
- LOCAL_CFLAGS += ' -Wreturn-type -Wcomment -Wswitch' # code style warning
- LOCAL_CFLAGS += ' -Wparentheses -Wlogical-op ' # operation warning
- LOCAL_CFLAGS += ' -Wmissing-declarations -Wmissing-prototypes -Wstrict-prototypes' # function declaration warning
- if 'mips' not in rtconfig.PREFIX: # mips toolchain does not support
- LOCAL_CFLAGS += ' -Wimplicit-fallthrough' # implicit fallthrough warning
- LOCAL_CFLAGS += ' -Wduplicated-cond -Wduplicated-branches' # duplicated condition warning
- if rtconfig.ARCH not in ['sim']:
- LINKFLAGS += ' -Wl,--gc-sections,--print-memory-usage' # remove unused sections and print memory usage
- group = DefineGroup('Kernel', src, depend=[''], CPPPATH=inc,
- LINKFLAGS=LINKFLAGS, LOCAL_CFLAGS=LOCAL_CFLAGS,
- CPPDEFINES=['__RTTHREAD__'], LOCAL_CPPDEFINES=['__RT_KERNEL_SOURCE__'])
- Return('group')
|