The Shoes of the Fisherman's Wife Are Some Jive-Ass Slippers

tpot (at) frungy . org

rss

2007
Months
May

Tue, 08 May 2007

SCons Builder for Ragel

Here's a SCons builder for the Ragel State Machine Compiler, based on the one for SWIG included in the SCons distribution.

#            tastes like -*- python -*-

"""Tool-specific initialisation for ragel."""

import SCons.Util
import SCons.Tool
import SCons.Action

def generate(env):

    c_file, cxx_file = SCons.Tool.createCFileBuilders(env)
    c_file.suffix['.rl'] = '.c'

    c_file.add_action('.rl', SCons.Action.Action('$RAGELCOM', '$RAGELCOMSTR'))

    env['RAGEL'] = 'ragel'
    env['RAGELFLAGS'] = SCons.Util.CLVar('')

    env['RLCODEGEN'] = 'rlcodegen'
    env['RLCODEGENFLAGS'] = SCons.Util.CLVar('')

    env['RAGELCOM'] = \
        '$RAGEL $RAGELFLAGS $SOURCE | $RLCODEGEN $RLCODEGENFLAGS -o $TARGET'

def exists(env):
    return env.Detect(['ragel', 'rlcodegen'])

posted at: 22:59 | path: /software/scons | permanent link to this entry