Exemplo n.º 1
0
def build_module(module, required):
    import os.path
    tools.mkdir_safe('product/modules/%s' % module)
    out = 'product/modules/%s/%s.o' % (module, module)
    srcs = []

    metafile = 'modules/%s/%s.meta' % (module, module)
    if os.path.exists(metafile):
        tools.copy_file('product/modules/%s/%s.meta' % (module, module), metafile)
        srcs.append(metafile)
    meta = tools.load_meta(metafile)
    extra_objs = ''
    if 'objs' in meta:
        extra_objs = meta['objs']
    src = 'modules/%s/%s.rip' % (module, module)
    if tools.depends(out, module_deps + [src]):
        tools.pprint('MOD', src, out)
        args = ['product/ripe', conf["RFLAGS"], '-n', module,
                '-c', srcs, src, extra_objs, '-o', out]
        # Required (default) packages have already been typed, and are
        # loaded by default.  Hence, they do not need to be typed.
        if required:
          args.append('--omit-typing')
        if conf["VERBOSITY"] > 1:
            args.append('-v')
        if required:
            tools.call(args)
        else:
            if not tools.try_call(args):
                failed_modules.append(module)
Exemplo n.º 2
0
def cons_flex(target, src, depends):
    tdepends = [src] + depends

    # Check timestamps
    if tools.depends(target, tdepends):
        tools.pprint("LEX", src, target)
        tools.call(['flex', src])
Exemplo n.º 3
0
def build_module(module, required):
    import os.path
    tools.mkdir_safe('product/modules/%s' % module)
    out = 'product/modules/%s/%s.o' % (module, module)
    srcs = []

    metafile = 'modules/%s/%s.meta' % (module, module)
    if os.path.exists(metafile):
        tools.copy_file('product/modules/%s/%s.meta' % (module, module),
                        metafile)
        srcs.append(metafile)
    meta = tools.load_meta(metafile)
    extra_objs = ''
    if 'objs' in meta:
        extra_objs = meta['objs']
    src = 'modules/%s/%s.rip' % (module, module)
    if tools.depends(out, module_deps + [src]):
        tools.pprint('MOD', src, out)
        args = [
            'product/ripe', conf["RFLAGS"], '-n', module, '-c', srcs, src,
            extra_objs, '-o', out
        ]
        # Required (default) packages have already been typed, and are
        # loaded by default.  Hence, they do not need to be typed.
        if required:
            args.append('--omit-typing')
        if conf["VERBOSITY"] > 1:
            args.append('-v')
        if required:
            tools.call(args)
        else:
            if not tools.try_call(args):
                failed_modules.append(module)
Exemplo n.º 4
0
def cons_yacc(target, src, depends):
    tdepends = [src] + depends

    # Check timestamps
    if tools.depends(target, tdepends):
        tools.pprint("YAC", src, target)
        tools.call(['bison', src])
Exemplo n.º 5
0
def type_module(module):
    path = 'modules/%s/%s.rip' % (module, module)
    out = 'product/modules/%s/%s.typ' % (module, module)
    if tools.depends(out, type_deps + [path]):
        sys.stdout.write(tools.color_src + module + tools.color_reset + " ")
        tools.mkdir_safe('product/modules/%s' % module)
        tools.call(['product/ripe', '-t', path, '>', out])
    return out
Exemplo n.º 6
0
def type_module(module):
    path = 'modules/%s/%s.rip' % (module, module)
    out = 'product/modules/%s/%s.typ' % (module, module)
    if tools.depends(out, type_deps + [path]):
        sys.stdout.write(tools.color_src + module + tools.color_reset + " ")
        tools.mkdir_safe('product/modules/%s' % module)
        tools.call(['product/ripe', '-t', path, '>', out])
    return out
Exemplo n.º 7
0
def cons_obj(target, src, depends):
    tdepends = [src] + depends

    # Check timestamps
    if tools.depends(target, tdepends):
        # Build object
        tools.pprint('CC', src, target)
        tools.call([CC, CFLAGS, '-c', src, '-o', target])
Exemplo n.º 8
0
def cons_module(src, dest, module, extra_CFLAGS=''):
    if tools.depends(dest, module_deps + [src]):
        tools.pprint('MOD', src, dest)
        args = ['product/ripe', '-n', module, '-c', src, '-o', dest,
                        '-f', '"%s"' % extra_CFLAGS]
        if tools.is_verbose():
            args.append('-v')
        tools.call(args)
Exemplo n.º 9
0
def bootstrap(newripe, oldripe, depends):
    if tools.depends(newripe, [oldripe] + depends):
        tools.pprint('RIP', 'riperipe/*.rip', newripe)
        args = [conf["VALGRIND"], oldripe,
                   '-s', '-o', newripe, bootstrap_srcs]
        tools.call(args)
Exemplo n.º 10
0
def bootstrap(newripe, oldripe, depends):
    if tools.depends(newripe, [oldripe] + depends):
        tools.pprint('RIP', 'riperipe/*.rip', newripe)
        args = [conf["VALGRIND"], oldripe, '-s', '-o', newripe, bootstrap_srcs]
        tools.call(args)
Exemplo n.º 11
0
def copy_file(dest, src):
    import shutil
    if tools.depends(dest, [src]):
        tools.pprint('CP', src, dest)
        shutil.copy(src, dest)
Exemplo n.º 12
0
def cons_gen(gen_program, target, t):
    if tools.depends(target, [gen_program]):
        tools.pprint('GEN', gen_program, target)
        tools.call([gen_program, t, '>', target])
Exemplo n.º 13
0
def cons_bin(target, objs, depends):
    tdepends = objs + depends
    if tools.depends(target, tdepends):
        tools.pprint('BIN', target)
        tools.call([CC, CFLAGS, LFLAGS, objs, '-o', target])
Exemplo n.º 14
0
def link_objs(objs, output):
    # Link objects into the output program
    if tools.depends(output, objs):
        arr = tools.flatten([LD, '-r', objs, '-o', output])
        tools.pprint('LD', output)
        tools.call(arr)