wscript 900 B

12345678910111213141516171819202122232425262728293031323334353637383940414243
  1. #! /usr/bin/env python
  2. # encoding: utf-8
  3. # Thomas Nagy, 2015 (ita)
  4. VERSION = '0.0.1'
  5. APPNAME = 'track_output_files'
  6. top = '.'
  7. import os
  8. from waflib import Logs, Options
  9. def options(opt):
  10. opt.load('compiler_c')
  11. opt.load('build_file_tracker')
  12. def configure(conf):
  13. conf.load('compiler_c')
  14. test_lib = False
  15. def play_test(ctx):
  16. if ctx.cmd != 'build':
  17. return
  18. global test_lib
  19. if not test_lib:
  20. # schedule one more build
  21. test_lib = True
  22. Options.commands.append('change_the_lib')
  23. Options.commands.append(ctx.cmd)
  24. def change_the_lib(ctx):
  25. lst = ctx.path.ant_glob('build/*stlib1.*')
  26. if lst:
  27. os.utime(lst[0].abspath(), None)
  28. Logs.pprint('YELLOW', '-> Touch %r' % lst[0].abspath())
  29. Logs.pprint('YELLOW', '-> Expect a rebuild of dependent files')
  30. def build(bld):
  31. bld.stlib(source='foo.c', target='stlib1')
  32. bld.program(source='main.c', target='app', use='stlib1')
  33. play_test(bld)