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