SConscript 1.9 KB

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