2
0
mirror of https://gitlab.com/ita1024/waf.git synced 2024-12-01 22:40:46 +01:00
waf/playground/codegen/wscript
2011-09-10 11:13:51 +02:00

36 lines
877 B
Python

#! /usr/bin/env python
# coding: utf-8
def options(opt):
opt.load('compiler_c')
def configure(cnf):
cnf.load('compiler_c')
def build(bld):
from waflib import Build
bld.post_mode = Build.POST_LAZY
def create_files(tsk):
out = tsk.generator.path.make_node('generated')
from waflib import Utils
for x in out.ant_glob('*.c'):
x.delete()
import random
for x in range(2):
num = random.randint(0, 2**31)
k = out.make_node('test%d.c' % num)
k.write('int k%d = %d;' % (num, num))
bld(rule=create_files, source='wscript', name='codegen')
bld.add_group()
bld.program(features='find_them', source=['main.c'], target='app')
from waflib.TaskGen import feature, before
from waflib import Utils
@feature('find_them')
@before('process_source')
def list_the_source_files(self):
self.source = Utils.to_list(self.source) + self.path.ant_glob('generated/*.c')