2
0
mirror of https://gitlab.com/ita1024/waf.git synced 2024-11-22 01:46:15 +01:00

Issue 1162

This commit is contained in:
ita 2012-05-04 09:25:48 +02:00
parent e4b22a3317
commit 2c4d772e3d
2 changed files with 22 additions and 7 deletions

View File

@ -14,5 +14,9 @@ def r1(self):
import time
time.sleep(1)
self.outputs[0].write(' ')
bld(rule=r1, target='foo.h') # when in doubt, add before=['c', 'cxx']
bld(rule=r1, target='foo.h', before=['c'])
# the default scanner may enforce the build order on generated headers, but it is just
# better and faster to set before=['c', 'cxx'] explicitly
# the dependency processing for 'gccdeps' also requires it

View File

@ -16,20 +16,22 @@ lock = threading.Lock()
preprocessor_flag = '-MD'
@feature('cc')
@before_method('apply_core')
@feature('c')
@before_method('process_source')
def add_mmd_cc(self):
if self.env.get_flat('CFLAGS').find(preprocessor_flag) < 0:
if self.env.CC_NAME in ('gcc', 'icc') and self.env.get_flat('CFLAGS').find(preprocessor_flag) < 0:
self.env.append_value('CFLAGS', [preprocessor_flag])
@feature('cxx')
@before_method('apply_core')
@before_method('process_source')
def add_mmd_cxx(self):
if self.env.get_flat('CXXFLAGS').find(preprocessor_flag) < 0:
if self.env.CC_NAME in ('gcc', 'icc') and self.env.get_flat('CXXFLAGS').find(preprocessor_flag) < 0:
self.env.append_value('CXXFLAGS', [preprocessor_flag])
def scan(self):
"the scanner does not do anything initially"
if self.env.CC_NAME not in ('gcc', 'icc'):
return self.no_gccdeps_scan()
nodes = self.generator.bld.node_deps.get(self.uid(), [])
names = []
return (nodes, names)
@ -38,6 +40,9 @@ re_o = re.compile("\.o$")
def post_run(self):
# The following code is executed by threads, it is not safe, so a lock is needed...
if self.env.CC_NAME not in ('gcc', 'icc'):
return self.no_gccdeps_post_run()
if getattr(self, 'cached', None):
return Task.Task.post_run(self)
@ -106,17 +111,23 @@ def post_run(self):
Task.Task.post_run(self)
def sig_implicit_deps(self):
if self.env.CC_NAME not in ('gcc', 'icc'):
return self.no_gccdeps_sig_implicit_deps()
try:
return Task.Task.sig_implicit_deps(self)
except Errors.WafError:
return Utils.SIG_NIL
for name in 'cc cxx'.split():
for name in 'c cxx'.split():
try:
cls = Task.classes[name]
except KeyError:
pass
else:
cls.no_gccdeps_post_run = cls.post_run
cls.no_gccdeps_scan = cls.scan
cls.no_gccdeps_sig_implicit_deps = cls.sig_implicit_deps
cls.post_run = post_run
cls.scan = scan
cls.sig_implicit_deps = sig_implicit_deps