2
0
mirror of https://gitlab.com/ita1024/waf.git synced 2024-11-22 09:57:15 +01:00
waf/demos/c/program/wscript_build
2011-09-10 11:13:51 +02:00

37 lines
925 B
Python

#! /usr/bin/env python
def write_header(tsk):
tsk.outputs[0].write('int abc = 423;')
bld(rule=write_header, target='b.h', ext_out=['.h'])
bld.program(
features = 'aaa',
source = 'main.c',
includes = '. ..',
cflags = ['-O3'],
defines = ['foo=bar'],
target = 'myprogram',
use = 'M')
# make main.c depend on wscript_build, just for the fun of it
bld.add_manual_dependency('main.c', bld.path.find_resource('wscript_build'))
# ----------------------------------------
from waflib import TaskGen
@TaskGen.feature('aaa')
@TaskGen.before('apply_link')
def add_one_task(self):
"""this is a task generator method, it is bound to the feature 'aaa' """
tsk = self.create_task('foo')
tsk.outputs = [self.bld.path.find_or_declare('abc.h')]
import waflib.Task
class foo(waflib.Task.Task):
"""this is a task class"""
before = ['c']
color = 'BLUE'
def run(self):
self.outputs[0].write('int kik = 343;\n')