jack2 codebase
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

76 lines
1.7KB

  1. #!/usr/bin/env python
  2. # encoding: utf-8
  3. # Thomas Nagy, 2008-2010 (ita)
  4. """
  5. Assembly support, used by tools such as gas and nasm
  6. To declare targets using assembly::
  7. def configure(conf):
  8. conf.load('gcc gas')
  9. def build(bld):
  10. bld(
  11. features='c cstlib asm',
  12. source = 'test.S',
  13. target = 'asmtest')
  14. bld(
  15. features='asm asmprogram',
  16. source = 'test.S',
  17. target = 'asmtest')
  18. Support for pure asm programs and libraries should also work::
  19. def configure(conf):
  20. conf.load('nasm')
  21. conf.find_program('ld', 'ASLINK')
  22. def build(bld):
  23. bld(
  24. features='asm asmprogram',
  25. source = 'test.S',
  26. target = 'asmtest')
  27. """
  28. import os, sys
  29. from waflib import Task, Utils
  30. import waflib.Task
  31. from waflib.Tools.ccroot import link_task, stlink_task
  32. from waflib.TaskGen import extension, feature
  33. class asm(Task.Task):
  34. """
  35. Compile asm files by gas/nasm/yasm/...
  36. """
  37. color = 'BLUE'
  38. run_str = '${AS} ${ASFLAGS} ${ASMPATH_ST:INCPATHS} ${DEFINES_ST:DEFINES} ${AS_SRC_F}${SRC} ${AS_TGT_F}${TGT}'
  39. @extension('.s', '.S', '.asm', '.ASM', '.spp', '.SPP')
  40. def asm_hook(self, node):
  41. """
  42. Bind the asm extension to the asm task
  43. :param node: input file
  44. :type node: :py:class:`waflib.Node.Node`
  45. """
  46. return self.create_compiled_task('asm', node)
  47. class asmprogram(link_task):
  48. "Link object files into a c program"
  49. run_str = '${ASLINK} ${ASLINKFLAGS} ${ASLNK_TGT_F}${TGT} ${ASLNK_SRC_F}${SRC}'
  50. ext_out = ['.bin']
  51. inst_to = '${BINDIR}'
  52. class asmshlib(asmprogram):
  53. "Link object files into a c shared library"
  54. inst_to = '${LIBDIR}'
  55. class asmstlib(stlink_task):
  56. "Link object files into a c static library"
  57. pass # do not remove
  58. def configure(conf):
  59. conf.env['ASMPATH_ST'] = '-I%s'