SConscript 985 B

1234567891011121314151617181920212223242526272829303132333435
  1. # RT-Thread building script for bridge
  2. import os
  3. from building import *
  4. Import('rtconfig')
  5. cwd = GetCurrentDir()
  6. group = []
  7. list = os.listdir(cwd)
  8. bsp_path = Dir('#').abspath
  9. if not os.path.exists(bsp_path + "/link.lds"):
  10. Env['LINKFLAGS'] = Env['LINKFLAGS'].replace('link.lds', cwd + "/link.lds")
  11. Preprocessing("link.lds.S", ".lds", CPPPATH=[bsp_path])
  12. # fix the linker with crtx.o
  13. Env['LINKFLAGS'] += ' -nostartfiles'
  14. # add common code files
  15. group = group + SConscript(os.path.join('common', 'SConscript'))
  16. # cpu porting code files
  17. if rtconfig.CPU != 'common':
  18. group = group + SConscript(os.path.join(rtconfig.CPU, 'SConscript'))
  19. def del_gnu99():
  20. for g in Projects:
  21. if g["name"] == "Kernel":
  22. flags = re.sub(r'\s+', ' ', re.sub(r'\s*-std=gnu99\s*', ' ', g["LOCAL_CFLAGS"])).strip()
  23. flags = re.sub(r'(?<!\s)(-Wunused)', r' \1', flags)
  24. g["LOCAL_CFLAGS"] = flags
  25. RegisterPreBuildingAction(del_gnu99)
  26. Return('group')