From 1553cb2dd6f4051ee4394acd1211a370fa41ec52 Mon Sep 17 00:00:00 2001 From: Jerome Carretero Date: Tue, 7 Feb 2012 23:48:15 -0500 Subject: [PATCH] ccroot: implement bld.read_object("pouet.o") and aux. feature I could use this ! --- waflib/Tools/ccroot.py | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) diff --git a/waflib/Tools/ccroot.py b/waflib/Tools/ccroot.py index d7e9e122..bf7c3278 100644 --- a/waflib/Tools/ccroot.py +++ b/waflib/Tools/ccroot.py @@ -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) +