Beispiel #1
0
def generate(env):
    '''
    CheckAbi(target, source)
    env.CheckAbi(target, source)

    CheckAbis source to target
    '''
    bldr = Builder(action=CommandGeneratorAction(
        generator=checkabi_generator, kw={'strfunction': checkabi_print}))
    env.Append(BUILDERS={'CheckAbi': bldr})
Beispiel #2
0
def generate(env):
    '''
    Strip(target, source)
    env.Strip(target, source)

    Strips source to target
    '''
    bldr = Builder(action=CommandGeneratorAction(
        generator=strip_generator, kw={'strfunction': strip_print}))
    env.Append(BUILDERS={'Strip': bldr})
def generate(env):
    '''
    Symbols(asm_source, symbols_file)
    env.Symbols(asm_source, symbols_file)

    Generates %.symbols.s file from %.symbols
    '''
    bldr = Builder(action=CommandGeneratorAction(
        generator=symbols_generator, kw={'strfunction': symbols_print}),
                   suffix='.symbols.s',
                   src_suffixes='.symbols')
    env.Append(BUILDERS={'Symbols': bldr})
Beispiel #4
0
def generate(env):
    '''
    BinaryObj(binary_source, binary_file)
    env.BinaryObj(binary_source, binary_file)

    Generates %.binary.s file from %.binary
    '''
    bldr = Builder(action = CommandGeneratorAction(generator = binary_generator,
                                                   kw = {'strfunction': binary_print}),
                   prefix = 'binary_',
                   suffix = '.o')
    env.Append(BUILDERS = {'BinaryObj' : bldr})
Beispiel #5
0
def generate(env):
    '''
    AbiSo(abi_so, symbols_obj)
    env.AbiSo(abi_so, symbols_obj)

    Generates %.abi.so file from %.symbols.o
    '''
    bldr = Builder(action=CommandGeneratorAction(
        generator=abi_so_generator, kw={'strfunction': abi_so_print}),
                   emitter=abi_so_emitter,
                   suffix='.symbols.s',
                   src_suffixes='.symbols')
    env.Append(BUILDERS={'LibAbiSo': bldr})
Beispiel #6
0
def CBuilder(action="yasha -MD $SOURCE -o $TARGET"):
    """
    Yasha SCons builder for C
    """
    def target_scan(node, env, path):
        """No used. Most likely will be removed."""
        try:  # Resolve template dependencies from the generated .d file
            with open(str(node) + ".d") as f:
                # IMPORTANT! Don't duplicate template dependency, thus [2:]
                deps = f.readline().split()[2:]
                return env.File(deps)
        except:
            return []

    def source_scan(node, env, path):
        """
        TODO: Doesn't take custom parses into account.
        """
        deps = []
        file, extension = os.path.splitext(str(node))
        while extension:
            for suffix in [".toml", ".yml", ".yaml", ".j2ext", ".jinja-ext"]:
                dep = file + suffix
                if os.path.isfile(dep):
                    deps.append(dep)
            file, extension = os.path.splitext(file)
        return env.File(deps)

    def emit(target, source, env):
        env.Clean(target[0], str(target[0]) + ".d")
        return target, source

    def gtor(source, target, env, for_signature):
        cmd = ""
        if is_c_file(target[0]):
            cmd = action.replace("$SOURCE", str(source[0]))
            cmd = cmd.replace("$TARGET", str(target[0]))
        return cmd

    return CBuilderBase(
        action=CommandGeneratorAction(gtor, {}),
        #action = Action(action),
        emitter=emit,
        #target_scanner = Scanner(function=target_scan),
        #source_scanner = Scanner(function=source_scan),
        single_source=True)