问题描述:

I need some extra files (p.ex. memory mapping) from the linker thus I've modified the flags accordingly: myenv.Append(LINKFLAGS=...)

How could I get these additional .map files cleaned up with scons -c?

I know there are Emitters to add targets. Is it possible to extend a buildin builder of myenv?

What is an appropriate way?

网友答案:

Ok, I found a way to do it. Scons provides a variable PROGEMITTER which is documented as 'TODO'.

def prog_emitter(target, source, env):
    # assume target is a list!
    # exchange extension of target file with .map
    target.append(os.path.splitext(target[0].get_path())[0] + '.map')
    return target, source

myenv.Append(PROGEMITTER=prog_emitter)

For other builders you could use add_emitter. You'll find all loaded builders in myenv['BUILDERS'].

网友答案:

If you know what the name of the file is going to be, then you list it as a side effect and set it to be cleaned.

myenv.Append(LINKFLAGS=...)
lib = myenv.SharedLibrary(source)
map = SideEffect('file.map', lib)
Clean(lib, map)
相关阅读:
Top