1from building import * 2import os 3 4src = Glob('*.c') 5cwd = GetCurrentDir() 6inc = [os.path.join(cwd, '..', 'include')] 7 8if GetDepend('RT_USING_SMALL_MEM') == False: 9 SrcRemove(src, ['mem.c']) 10 11if GetDepend('RT_USING_SLAB') == False: 12 SrcRemove(src, ['slab.c']) 13 14if GetDepend('RT_USING_MEMPOOL') == False: 15 SrcRemove(src, ['mempool.c']) 16 17if GetDepend('RT_USING_MEMHEAP') == False: 18 SrcRemove(src, ['memheap.c']) 19 20if GetDepend('RT_USING_SIGNALS') == False: 21 SrcRemove(src, ['signal.c']) 22 23if GetDepend('RT_USING_DEVICE') == False: 24 SrcRemove(src, ['device.c']) 25 26if GetDepend('RT_USING_SMP') == False: 27 SrcRemove(src, ['cpu_mp.c', 'scheduler_mp.c']) 28else: 29 SrcRemove(src, ['cpu_up.c', 'scheduler_up.c']) 30 31LOCAL_CFLAGS = '' 32LINKFLAGS = '' 33 34if rtconfig.PLATFORM in ['gcc']: # only for GCC 35 LOCAL_CFLAGS += ' -Wunused' # unused warning 36 LOCAL_CFLAGS += ' -Wformat -Wformat-security' # printf/scanf format warning 37 LOCAL_CFLAGS += ' -Warray-bounds -Wuninitialized' # memory access warning 38 LOCAL_CFLAGS += ' -Wreturn-type -Wcomment -Wswitch' # code style warning 39 LOCAL_CFLAGS += ' -Wparentheses -Wlogical-op ' # operation warning 40 LOCAL_CFLAGS += ' -Wmissing-declarations -Wmissing-prototypes -Wstrict-prototypes' # function declaration warning 41 if 'mips' not in rtconfig.PREFIX: # mips toolchain does not support 42 LOCAL_CFLAGS += ' -Wimplicit-fallthrough' # implicit fallthrough warning 43 LOCAL_CFLAGS += ' -Wduplicated-cond -Wduplicated-branches' # duplicated condition warning 44 if rtconfig.ARCH not in ['sim']: 45 LINKFLAGS += ' -Wl,--gc-sections,--print-memory-usage' # remove unused sections and print memory usage 46 47if GetDepend('RT_USING_HOOKLIST') == True: 48 if rtconfig.PLATFORM in ['gcc', 'armclang']: 49 LOCAL_CFLAGS += ' -std=gnu99' 50 elif rtconfig.PLATFORM in ['armcc']: 51 LOCAL_CFLAGS += ' --c99 --gnu' 52 53if rtconfig.CROSS_TOOL == 'msvc': 54 group = DefineGroup('Kernel', src, depend=[''], CPPPATH=inc, 55 LINKFLAGS=LINKFLAGS, LOCAL_CFLAGS=LOCAL_CFLAGS, 56 CPPDEFINES=['__RTTHREAD__', '__RT_KERNEL_SOURCE__']) 57else: 58 group = DefineGroup('Kernel', src, depend=[''], CPPPATH=inc, 59 LINKFLAGS=LINKFLAGS, LOCAL_CFLAGS=LOCAL_CFLAGS, 60 CPPDEFINES=['__RTTHREAD__'], LOCAL_CPPDEFINES=['__RT_KERNEL_SOURCE__']) 61 62list = os.listdir(cwd) 63for item in list: 64 if os.path.isfile(os.path.join(cwd, item, 'SConscript')): 65 group = group + SConscript(os.path.join(item, 'SConscript')) 66 67Return('group') 68