wscript 773 B

12345678910111213141516171819202122232425262728293031323334353637
  1. #! /usr/bin/env python
  2. # encoding: utf-8
  3. # Thomas Nagy, 2009 (ita)
  4. VERSION='0.0.1'
  5. APPNAME='cc_test'
  6. top = '.'
  7. out = 'build'
  8. def configure(conf):
  9. conf.load('gcc')
  10. def build(bld):
  11. bld.program(
  12. source = 'main.c',
  13. target = 'test',
  14. ldscript = 'myscript.ld',
  15. linkflags = ['-nostdlib'],
  16. )
  17. from waflib import Utils
  18. from waflib.TaskGen import after, feature
  19. @after('apply_link')
  20. @feature('cprogram', 'cshlib')
  21. def process_ldscript(self):
  22. if not getattr(self, 'ldscript', None) or self.env.CC_NAME != 'gcc':
  23. return
  24. node = self.path.find_resource(self.ldscript)
  25. if not node:
  26. raise Utils.WafError('could not find %r' % self.ldscript)
  27. self.link_task.env.append_value('LINKFLAGS', '-Wl,-T,%s' % node.abspath())
  28. self.link_task.dep_nodes.append(node)