SConscript 2.0 KB

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