first commit for chrg
This commit is contained in:
@@ -0,0 +1,67 @@
|
||||
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_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
|
||||
|
||||
if GetDepend('RT_USING_HOOKLIST') == True:
|
||||
if rtconfig.PLATFORM in ['gcc', 'armclang']:
|
||||
LOCAL_CFLAGS += ' -std=gnu99'
|
||||
elif rtconfig.PLATFORM in ['armcc']:
|
||||
LOCAL_CFLAGS += ' --c99 --gnu'
|
||||
|
||||
if rtconfig.CROSS_TOOL == 'msvc':
|
||||
group = DefineGroup('Kernel', src, depend=[''], CPPPATH=inc,
|
||||
LINKFLAGS=LINKFLAGS, LOCAL_CFLAGS=LOCAL_CFLAGS,
|
||||
CPPDEFINES=['__RTTHREAD__', '__RT_KERNEL_SOURCE__'])
|
||||
else:
|
||||
group = DefineGroup('Kernel', src, depend=[''], CPPPATH=inc,
|
||||
LINKFLAGS=LINKFLAGS, LOCAL_CFLAGS=LOCAL_CFLAGS,
|
||||
CPPDEFINES=['__RTTHREAD__'], LOCAL_CPPDEFINES=['__RT_KERNEL_SOURCE__'])
|
||||
|
||||
list = os.listdir(cwd)
|
||||
for item in list:
|
||||
if os.path.isfile(os.path.join(cwd, item, 'SConscript')):
|
||||
group = group + SConscript(os.path.join(item, 'SConscript'))
|
||||
|
||||
Return('group')
|
||||
Reference in New Issue
Block a user