mirror of https://gitlab.com/ita1024/waf.git
Improve the definition of static link tasks
This commit is contained in:
parent
260f6065b9
commit
b41b1741d1
|
@ -224,14 +224,24 @@ class link_task(Task.Task):
|
||||||
class stlink_task(link_task):
|
class stlink_task(link_task):
|
||||||
"""
|
"""
|
||||||
Base for static link tasks, which use *ar* most of the time.
|
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
|
chmod = Utils.O644
|
||||||
"""Default installation mode for the static libraries"""
|
"""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):
|
def rm_tgt(cls):
|
||||||
|
# TODO obsolete code, remove in waf 2.2
|
||||||
old = cls.run
|
old = cls.run
|
||||||
def wrap(self):
|
def wrap(self):
|
||||||
try:
|
try:
|
||||||
|
@ -240,7 +250,6 @@ def rm_tgt(cls):
|
||||||
pass
|
pass
|
||||||
return old(self)
|
return old(self)
|
||||||
setattr(cls, 'run', wrap)
|
setattr(cls, 'run', wrap)
|
||||||
rm_tgt(stlink_task)
|
|
||||||
|
|
||||||
@feature('skip_stlib_link_deps')
|
@feature('skip_stlib_link_deps')
|
||||||
@before_method('process_use')
|
@before_method('process_use')
|
||||||
|
|
Loading…
Reference in New Issue