wscript 702 B

12345678910111213141516171819202122232425262728293031
  1. #! /usr/bin/env python
  2. # encoding: utf-8
  3. def options(opt):
  4. opt.load('compiler_c')
  5. def configure(conf):
  6. conf.load('compiler_c')
  7. def build(bld):
  8. # the file precious.c is updated in the source directory
  9. # the actual application is produced in the build directory
  10. node = bld.path.find_resource('precious.c')
  11. def fun(task):
  12. import random
  13. val = random.randint(0, 222111000)
  14. task.outputs[0].write('#include <stdio.h>\nint main(){ printf("%%d", %d); return 0;}' % val)
  15. bld(
  16. #rule = '''echo -e "#include <stdio.h>\\nint main(){ printf(\\"%%d\\", $$RANDOM); return 0;}" > ${TGT}''',
  17. rule = fun,
  18. target = node,
  19. always = True)
  20. bld.program(
  21. source = 'precious.c',
  22. target = 'app')