SConscript 1.6 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546
  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.c', 'scheduler_mp.c'])
  20. else:
  21. SrcRemove(src, ['scheduler_up.c'])
  22. LOCAL_CFLAGS = ''
  23. if rtconfig.PLATFORM in ['gcc']: # only for GCC
  24. LOCAL_CFLAGS += ' -Wunused' # unused warning
  25. LOCAL_CFLAGS += ' -Wformat -Wformat-security' # printf/scanf format warning
  26. LOCAL_CFLAGS += ' -Warray-bounds -Wuninitialized' # memory access warning
  27. LOCAL_CFLAGS += ' -Wreturn-type -Wcomment -Wswitch' # code style warning
  28. LOCAL_CFLAGS += ' -Wparentheses -Wlogical-op ' # operation warning
  29. LOCAL_CFLAGS += ' -Wmissing-declarations -Wmissing-prototypes -Wstrict-prototypes' # function declaration warning
  30. if 'mips' not in rtconfig.PREFIX: # mips toolchain does not support
  31. LOCAL_CFLAGS += ' -Wimplicit-fallthrough' # implicit fallthrough warning
  32. LOCAL_CFLAGS += ' -Wduplicated-cond -Wduplicated-branches' # duplicated condition warning
  33. group = DefineGroup('Kernel', src, depend=[''], CPPPATH=inc, CPPDEFINES=['__RTTHREAD__'], LOCAL_CFLAGS=LOCAL_CFLAGS, LOCAL_CPPDEFINES=['__RT_KERNEL_SOURCE__'])
  34. Return('group')