dcc.py 1.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172
  1. #!/usr/bin/env python
  2. # encoding: utf-8
  3. # Jérôme Carretero, 2011 (zougloub)
  4. from waflib import Options
  5. from waflib.Tools import ccroot
  6. from waflib.Configure import conf
  7. @conf
  8. def find_dcc(conf):
  9. conf.find_program(['dcc'], var='CC', path_list=getattr(Options.options, 'diabbindir', ""))
  10. conf.env.CC_NAME = 'dcc'
  11. @conf
  12. def find_dld(conf):
  13. conf.find_program(['dld'], var='LINK_CC', path_list=getattr(Options.options, 'diabbindir', ""))
  14. conf.env.LINK_CC_NAME = 'dld'
  15. @conf
  16. def find_dar(conf):
  17. conf.find_program(['dar'], var='AR', path_list=getattr(Options.options, 'diabbindir', ""))
  18. conf.env.AR_NAME = 'dar'
  19. conf.env.ARFLAGS = 'rcs'
  20. @conf
  21. def find_ddump(conf):
  22. conf.find_program(['ddump'], var='DDUMP', path_list=getattr(Options.options, 'diabbindir', ""))
  23. @conf
  24. def dcc_common_flags(conf):
  25. v = conf.env
  26. v['CC_SRC_F'] = []
  27. v['CC_TGT_F'] = ['-c', '-o']
  28. # linker
  29. if not v['LINK_CC']:
  30. v['LINK_CC'] = v['CC']
  31. v['CCLNK_SRC_F'] = []
  32. v['CCLNK_TGT_F'] = ['-o']
  33. v['CPPPATH_ST'] = '-I%s'
  34. v['DEFINES_ST'] = '-D%s'
  35. v['LIB_ST'] = '-l:%s' # template for adding libs
  36. v['LIBPATH_ST'] = '-L%s' # template for adding libpaths
  37. v['STLIB_ST'] = '-l:%s'
  38. v['STLIBPATH_ST'] = '-L%s'
  39. v['RPATH_ST'] = '-Wl,-rpath,%s'
  40. #v['STLIB_MARKER'] = '-Wl,-Bstatic'
  41. # program
  42. v['cprogram_PATTERN'] = '%s.elf'
  43. # static lib
  44. v['LINKFLAGS_cstlib'] = ['-Wl,-Bstatic']
  45. v['cstlib_PATTERN'] = 'lib%s.a'
  46. def configure(conf):
  47. conf.find_dcc()
  48. conf.find_dar()
  49. conf.find_dld()
  50. conf.find_ddump()
  51. conf.dcc_common_flags()
  52. conf.cc_load_tools()
  53. conf.cc_add_flags()
  54. conf.link_add_flags()
  55. def options(opt):
  56. """
  57. Add the ``--with-diab-bindir`` command-line options.
  58. """
  59. opt.add_option('--with-diab-bindir', type='string', dest='diabbindir', help = 'Specify alternate diab bin folder', default="")