SConscript 995 B

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