You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

32 lines
919 B

#! /usr/bin/env python
# encoding: utf-8
"Ragel: '.rl' files are converted into .c files using 'ragel': {.rl -> .c -> .o}"
import TaskGen, Task, Runner
def rageltaskfun(task):
env = task.env
ragelbin = env.get_flat('RAGEL')
if ragelbin:
cmd = '%s -o %s %s' % (ragelbin, task.outputs[0].bldpath(env), task.inputs[0].srcpath(env))
src = task.inputs[0].srcpath(env)
src = src[:src.rfind('.')] + '.c'
cmd = 'cp %s %s' % (src, task.outputs[0].bldpath(env))
return Runner.exec_command(cmd)
rageltask = Task.task_type_from_func('ragel', rageltaskfun, vars = ['RAGEL'], color = 'BLUE', ext_in = '.rl', ext_out = '.c', before = 'c')
def ragel(self, node):
out = node.change_ext('.c')
tsk = self.create_task('ragel')
def detect(conf):
dang = conf.find_program('ragel', var='RAGEL')