ccroot: implement bld.read_object("pouet.o") and aux. feature

I could use this !
This commit is contained in:
Jerome Carretero 2012-02-07 23:48:15 -05:00
parent 5c3f6c680b
commit 1553cb2dd6
1 changed files with 21 additions and 0 deletions

View File

@ -618,3 +618,24 @@ def add_those_o_files(self, node):
except AttributeError:
self.compiled_tasks = [tsk]
@feature('fake_obj')
@before_method('process_source')
def process_objs(self):
"""
Puts object files in the task generator outputs
"""
for node in self.to_nodes(self.source):
self.add_those_o_files(node)
self.source = []
@conf
def read_object(self, obj):
"""
Read an object file, enabling injection in libs/programs. Will trigger a rebuild if the file changes.
:param obj: object file path, as string or Node
"""
if not isinstance(obj, self.path.__class__):
obj = self.path.find_resource(obj)
return self(features='fake_obj', source=obj, name=obj.name)