wscript 913 B

12345678910111213141516171819202122232425262728293031323334353637383940414243444546
  1. #! /usr/bin/env python
  2. # encoding: utf-8
  3. # Thomas Nagy, 2011 (ita)
  4. """
  5. One test for headers
  6. Just call 'waf clean test'
  7. """
  8. VERSION='0.0.1'
  9. APPNAME='cc_test'
  10. top = '.'
  11. def options(opt):
  12. opt.load('compiler_c')
  13. def configure(conf):
  14. conf.load('compiler_c ')
  15. def build(bld):
  16. bld.program(source='main.c', includes='. uhu', target='bar')
  17. # ---------------------------------------------------------
  18. import shutil
  19. from waflib import Options
  20. def test(ctx):
  21. Options.commands += ['test1', 'build', 'test2', 'build']
  22. def test1(ctx):
  23. d = ctx.path.make_node('uhu')
  24. d.mkdir()
  25. bar = d.make_node('bar.h')
  26. bar.write('int k = 32;\n')
  27. main = ctx.path.make_node('main.c')
  28. main.write('#include "bar.h"\nint main() { return 0; }\n')
  29. def test2(ctx):
  30. d = ctx.path.find_node('uhu')
  31. if d:
  32. shutil.rmtree(d.abspath())
  33. main = ctx.path.make_node('main.c')
  34. main.write('//#include "bar.h"\nint main() { return 0; }\n')