diff --git a/waflib/Tools/ccroot.py b/waflib/Tools/ccroot.py index f4e1c841..0e11e095 100644 --- a/waflib/Tools/ccroot.py +++ b/waflib/Tools/ccroot.py @@ -224,14 +224,24 @@ class link_task(Task.Task): class stlink_task(link_task): """ Base for static link tasks, which use *ar* most of the time. - The target is always removed before being written. """ - run_str = '${AR} ${ARFLAGS} ${AR_TGT_F}${TGT} ${AR_SRC_F}${SRC}' + run_str = [ + lambda task: task.remove_before_build(), + '${AR} ${ARFLAGS} ${AR_TGT_F}${TGT} ${AR_SRC_F}${SRC}' + ] chmod = Utils.O644 """Default installation mode for the static libraries""" + def remove_before_build(self): + "Remove the library before building it" + try: + os.remove(self.outputs[0].abspath()) + except OSError: + pass + def rm_tgt(cls): + # TODO obsolete code, remove in waf 2.2 old = cls.run def wrap(self): try: @@ -240,7 +250,6 @@ def rm_tgt(cls): pass return old(self) setattr(cls, 'run', wrap) -rm_tgt(stlink_task) @feature('skip_stlib_link_deps') @before_method('process_use')