2011-06-02 12:42:57 +08:00
|
|
|
from building import *
|
2022-11-15 08:26:06 +08:00
|
|
|
import os
|
2011-06-02 12:42:57 +08:00
|
|
|
|
2012-09-20 11:17:26 +08:00
|
|
|
src = Glob('*.c')
|
2024-03-11 01:39:20 +08:00
|
|
|
src += Glob('klibc/*.c')
|
2022-11-15 08:26:06 +08:00
|
|
|
cwd = GetCurrentDir()
|
|
|
|
inc = [os.path.join(cwd, '..', 'include')]
|
2011-09-25 10:28:07 +08:00
|
|
|
|
2021-12-16 16:23:58 +08:00
|
|
|
if GetDepend('RT_USING_SMALL_MEM') == False:
|
2011-12-27 13:41:04 +08:00
|
|
|
SrcRemove(src, ['mem.c'])
|
|
|
|
|
2021-12-16 16:23:58 +08:00
|
|
|
if GetDepend('RT_USING_SLAB') == False:
|
2011-12-27 13:41:04 +08:00
|
|
|
SrcRemove(src, ['slab.c'])
|
2011-09-25 10:28:07 +08:00
|
|
|
|
2012-06-02 15:45:48 +08:00
|
|
|
if GetDepend('RT_USING_MEMPOOL') == False:
|
|
|
|
SrcRemove(src, ['mempool.c'])
|
|
|
|
|
|
|
|
if GetDepend('RT_USING_MEMHEAP') == False:
|
|
|
|
SrcRemove(src, ['memheap.c'])
|
2020-11-21 17:56:02 +08:00
|
|
|
|
2021-01-03 07:23:50 +08:00
|
|
|
if GetDepend('RT_USING_SIGNALS') == False:
|
|
|
|
SrcRemove(src, ['signal.c'])
|
|
|
|
|
2012-06-02 15:45:48 +08:00
|
|
|
if GetDepend('RT_USING_DEVICE') == False:
|
|
|
|
SrcRemove(src, ['device.c'])
|
|
|
|
|
2019-09-28 11:56:03 +08:00
|
|
|
if GetDepend('RT_USING_SMP') == False:
|
2023-10-17 13:07:59 +08:00
|
|
|
SrcRemove(src, ['cpu.c', 'scheduler_mp.c'])
|
2024-02-23 17:49:15 +08:00
|
|
|
else:
|
2023-03-29 19:04:26 +08:00
|
|
|
SrcRemove(src, ['scheduler_up.c'])
|
2019-09-28 11:56:03 +08:00
|
|
|
|
2024-02-20 03:51:05 +08:00
|
|
|
LOCAL_CFLAGS = ''
|
2024-03-30 04:28:39 +08:00
|
|
|
LINKFLAGS = ''
|
2024-02-20 03:51:05 +08:00
|
|
|
|
2024-03-03 12:18:34 +08:00
|
|
|
if rtconfig.PLATFORM in ['gcc']: # only for GCC
|
2024-02-20 03:51:05 +08:00
|
|
|
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
|
2024-02-21 11:45:04 +08:00
|
|
|
LOCAL_CFLAGS += ' -Wmissing-declarations -Wmissing-prototypes -Wstrict-prototypes' # function declaration warning
|
2024-02-20 03:51:05 +08:00
|
|
|
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
|
2024-03-30 04:28:39 +08:00
|
|
|
if rtconfig.ARCH not in ['sim']:
|
|
|
|
LINKFLAGS += ' -Wl,--gc-sections,--print-memory-usage' # remove unused sections and print memory usage
|
2024-02-20 03:51:05 +08:00
|
|
|
|
2024-03-30 04:28:39 +08:00
|
|
|
group = DefineGroup('Kernel', src, depend=[''], CPPPATH=inc,
|
|
|
|
LINKFLAGS=LINKFLAGS, LOCAL_CFLAGS=LOCAL_CFLAGS,
|
|
|
|
CPPDEFINES=['__RTTHREAD__'], LOCAL_CPPDEFINES=['__RT_KERNEL_SOURCE__'])
|
2011-06-02 12:42:57 +08:00
|
|
|
|
|
|
|
Return('group')
|