2011-09-10 11:13:51 +02:00
|
|
|
#! /usr/bin/env python
|
|
|
|
# encoding: utf-8
|
|
|
|
|
|
|
|
def options(opt):
|
|
|
|
opt.load('compiler_c')
|
|
|
|
|
|
|
|
def configure(conf):
|
|
|
|
conf.load('compiler_c')
|
|
|
|
|
|
|
|
def build(bld):
|
|
|
|
|
|
|
|
# the file precious.c is updated in the source directory
|
|
|
|
# the actual application is produced in the build directory
|
|
|
|
|
|
|
|
node = bld.path.find_resource('precious.c')
|
|
|
|
|
|
|
|
def fun(task):
|
|
|
|
import random
|
|
|
|
val = random.randint(0, 222111000)
|
|
|
|
task.outputs[0].write('#include <stdio.h>\nint main(){ printf("%%d", %d); return 0;}' % val)
|
|
|
|
|
|
|
|
bld(
|
|
|
|
#rule = '''echo -e "#include <stdio.h>\\nint main(){ printf(\\"%%d\\", $$RANDOM); return 0;}" > ${TGT}''',
|
|
|
|
rule = fun,
|
|
|
|
target = node,
|
2016-06-25 22:48:47 +02:00
|
|
|
always = True)
|
2011-09-10 11:13:51 +02:00
|
|
|
|
|
|
|
bld.program(
|
|
|
|
source = 'precious.c',
|
|
|
|
target = 'app')
|
|
|
|
|