SConstruct 1.5 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647
  1. import os
  2. import sys
  3. import rtconfig
  4. if os.getenv('RTT_ROOT'):
  5. RTT_ROOT = os.getenv('RTT_ROOT')
  6. else:
  7. RTT_ROOT = os.path.normpath(os.getcwd() + '/../..')
  8. sys.path = sys.path + [os.path.join(RTT_ROOT, 'tools')]
  9. from building import *
  10. TARGET = 'rtthread-mini2440.' + rtconfig.TARGET_EXT
  11. env = Environment(tools = ['mingw'],
  12. AS = rtconfig.AS, ASFLAGS = rtconfig.AFLAGS,
  13. CC = rtconfig.CC, CCFLAGS = rtconfig.CFLAGS,
  14. CXX = rtconfig.CXX,
  15. AR = rtconfig.AR, ARFLAGS = '-rc',
  16. LINK = rtconfig.LINK, LINKFLAGS = rtconfig.LFLAGS)
  17. env.PrependENVPath('PATH', rtconfig.EXEC_PATH)
  18. Export('RTT_ROOT')
  19. Export('rtconfig')
  20. if rtconfig.PLATFORM == 'gcc':
  21. start_obj = 'build/libcpu/' + rtconfig.ARCH + '/' + rtconfig.CPU + '/start_gcc.o',
  22. elif rtconfig.PLATFORM == 'armcc':
  23. start_obj = 'build/libcpu/' + rtconfig.ARCH + '/' + rtconfig.CPU + '/start_rvds.o',
  24. # prepare building environment
  25. libs = PrepareBuilding(env, RTT_ROOT)
  26. if GetDepend('RT_USING_RTGUI'):
  27. libs = objs + SConscript(RTT_ROOT + '/examples/gui/SConscript', variant_dir='build/examples/gui', duplicate=0)
  28. # libc testsuite
  29. # libs = libs + SConscript(RTT_ROOT + '/examples/libc/SConscript', variant_dir='build/examples/libc', duplicate=0)
  30. # build program
  31. if GetDepend('RT_USING_NEWLIB'):
  32. env.Program(target = TARGET, source = [start_obj, 'build/components/libc/newlib/syscalls.o', 'build/components/libc/newlib/libc.o'], LIBS = libs)
  33. else:
  34. env.Program(target = TARGET, source = start_obj, LIBS = libs)
  35. # end building
  36. EndBuilding(TARGET)